Serious-Engine/Sources/EntitiesMP/Light.cpp

649 lines
24 KiB
C++
Raw Normal View History

2016-03-11 14:57:17 +01:00
/*
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
*/
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
#include "StdH.h"
#include <EntitiesMP/Light.h>
#include <EntitiesMP/Light_tables.h>
#line 35 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
void CLight_OnInitClass(void)
{
// init lens flares effects
InitLensFlares();
}
void CLight_OnEndClass(void)
{
// close lens flares effects
CloseLensFlares();
}
void CLight::SetDefaultProperties(void) {
m_colColor = C_GRAY ;
m_colAmbient = C_BLACK ;
m_rFallOffRange = 8.0f;
m_rHotSpotRange = 0.0f;
m_itIllumination = 0;
m_ltType = LT_POINT ;
m_strDescription = "";
m_strName = "Light";
m_bDarkLight = FALSE ;
m_fNearClip = 0.1f;
m_fFarClip = 0.01f;
m_bSubstractSectorAmbient = FALSE ;
m_bRenderAsSmallLight = FALSE ;
m_lftLensFlare = LFT_NONE ;
m_bBackground = FALSE ;
m_bLensFlareOnly = FALSE ;
m_fnmLightAnimation = CTString("");
m_iLightAnimation = 0;
m_tmOffsetPhase = 0.0f;
m_aoLightAnimation.SetData(NULL);
m_bTargetable = FALSE ;
m_bDynamic = FALSE ;
m_bDiffusion = TRUE ;
m_fnmAmbientLightAnimation = CTString("");
m_iAmbientLightAnimation = 0;
m_aoAmbientLightAnimation.SetData(NULL);
CEntity::SetDefaultProperties();
}
#line 96 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
CAnimData * CLight::GetAnimData(SLONG slPropertyOffset)
#line 97 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 98 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(slPropertyOffset == offsetof (CLight , m_iLightAnimation ))
#line 99 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 100 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return m_aoLightAnimation . GetData ();
#line 101 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 102 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
else if(slPropertyOffset == offsetof (CLight , m_iAmbientLightAnimation ))
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 104 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return m_aoAmbientLightAnimation . GetData ();
#line 105 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 106 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
else
#line 107 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 108 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return CEntity :: GetAnimData (slPropertyOffset );
#line 109 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 110 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 112 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
BOOL CLight::IsTargetable(void)const
#line 113 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 114 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return m_bTargetable ;
#line 115 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 117 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
BOOL CLight::IsImportant(void)const
#line 118 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 119 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return (m_ltType == LT_DIRECTIONAL );
#line 120 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 123 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
BOOL CLight::HandleEvent(const CEntityEvent & ee)
#line 124 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(ee . ee_slEvent == EVENTCODE_ERangeModelDestruction )
#line 127 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 129 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_colColor = C_BLACK ;
#line 130 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_colAmbient = C_BLACK ;
#line 131 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
CLightSource lsNew ;
#line 132 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetupLightSource (lsNew );
#line 133 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_lsLightSource . SetLightSource (lsNew );
#line 134 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return TRUE ;
#line 136 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 137 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
else if(ee . ee_slEvent == EVENTCODE_EChangeAnim )
#line 138 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 139 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
EChangeAnim & eChange = (EChangeAnim &) ee ;
#line 142 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_iLightAnimation = eChange . iLightAnim ;
#line 143 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_aoLightAnimation . GetData () != NULL )
#line 144 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 145 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_aoLightAnimation . PlayAnim (m_iLightAnimation , eChange . bLightLoop ? AOF_LOOPING : 0);
#line 146 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 149 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_iAmbientLightAnimation = eChange . iAmbientLightAnim ;
#line 150 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_aoAmbientLightAnimation . GetData () != NULL )
#line 151 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 152 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_aoAmbientLightAnimation . PlayAnim (m_iAmbientLightAnimation , eChange . bAmbientLightLoop ? AOF_LOOPING : 0);
#line 153 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 156 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if((m_aoLightAnimation . GetData () == NULL ) && (m_aoAmbientLightAnimation . GetData () == NULL ))
#line 157 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 158 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_colColor = eChange . colDiffuse ;
#line 159 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_colAmbient = eChange . colAmbient ;
#line 160 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
CLightSource lsNew ;
#line 161 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetupLightSource (lsNew );
#line 162 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_lsLightSource . SetLightSource (lsNew );
#line 163 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return TRUE ;
#line 164 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 165 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 166 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return FALSE ;
#line 167 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 170 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
void CLight::MirrorAndStretch(FLOAT fStretch,BOOL bMirrorX)
#line 171 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 173 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_rFallOffRange *= fStretch ;
#line 174 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_rHotSpotRange *= fStretch ;
#line 175 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_fNearClip *= fStretch ;
#line 176 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_fFarClip *= fStretch ;
#line 178 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 181 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
CLightSource * CLight::GetLightSource(void)
#line 182 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 184 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(! m_bdfInitialized . bdf_bValue ){
#line 186 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
CLightSource lsNew ;
#line 187 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetupLightSource (lsNew );
#line 188 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_lsLightSource . SetLightSourceWithNoDiscarding (lsNew );
#line 189 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_bdfInitialized . bdf_bValue = TRUE ;
#line 190 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 191 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(! IsPredictor ()){
#line 192 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return & m_lsLightSource ;
#line 193 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}else {
#line 194 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return NULL ;
#line 195 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 196 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 199 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
void CLight::SetupLightSource(CLightSource & lsNew)
#line 200 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 201 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
switch(m_ltType ){
#line 202 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LT_POINT :
#line 203 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LT_STRONG_POINT :
#line 204 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_ulFlags = LSF_CASTSHADOWS ;
#line 205 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 206 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LT_DIRECTIONAL :
#line 207 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_ulFlags = LSF_DIRECTIONAL | LSF_CASTSHADOWS ;
#line 208 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 209 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LT_STRONG_AMBIENT :
#line 210 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LT_AMBIENT :
#line 211 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_ulFlags = 0;
#line 212 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 213 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 214 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_bSubstractSectorAmbient ){lsNew . ls_ulFlags |= LSF_SUBSTRACTSECTORAMBIENT ;}
#line 215 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_bLensFlareOnly ){lsNew . ls_ulFlags |= LSF_LENSFLAREONLY ;}
#line 216 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_bDynamic ){lsNew . ls_ulFlags |= LSF_DYNAMIC ;}
#line 218 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_bDarkLight ){
#line 219 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_ltType == LT_DIRECTIONAL ){
#line 220 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_ulFlags &= ~ LSF_DARKLIGHT ;
#line 221 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_bDarkLight = FALSE ;
#line 222 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}else {
#line 223 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_ulFlags |= LSF_DARKLIGHT ;
#line 224 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 225 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 227 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_bDiffusion ){
#line 228 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_bDynamic || m_ltType == LT_AMBIENT || m_ltType == LT_STRONG_AMBIENT ){
#line 229 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_ulFlags &= ~ LSF_DIFFUSION ;
#line 230 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_bDiffusion = FALSE ;
#line 231 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}else {
#line 232 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_ulFlags |= LSF_DIFFUSION ;
#line 233 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 234 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 236 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_rHotSpot = m_rHotSpotRange ;
#line 237 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_rFallOff = m_rFallOffRange ;
#line 238 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_fNearClipDistance = m_fNearClip ;
#line 239 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_fFarClipDistance = m_fFarClip ;
#line 241 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_ltType == LT_STRONG_AMBIENT || m_ltType == LT_STRONG_POINT ){
#line 242 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_rHotSpot = lsNew . ls_rFallOff * 0.9f;
#line 243 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 245 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_colColor = m_colColor ;
#line 246 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_colAmbient = C_BLACK ;
#line 247 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(lsNew . ls_ulFlags & LSF_DIRECTIONAL ){lsNew . ls_colAmbient = m_colAmbient ;}
#line 248 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_ubPolygonalMask = (UBYTE ) m_itIllumination ;
#line 250 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
switch(m_lftLensFlare )
#line 251 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 252 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_NONE :
#line 253 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = NULL ;
#line 254 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 255 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_STANDARD :
#line 256 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftStandard ;
#line 257 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 258 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_STANDARD_REFLECTIONS :
#line 259 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftStandardReflections ;
#line 260 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 261 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_YELLOW_STAR_RED_RING :
#line 262 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftYellowStarRedRing ;
#line 263 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 264 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_WHITE_GLOW_STAR_RED_RING :
#line 265 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftWhiteGlowStarRedRing ;
#line 266 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 267 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_WHITE_GLOW_STAR :
#line 268 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftWhiteGlowStar ;
#line 269 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 270 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_WHITE_STAR_RED_RING_STREAKS :
#line 271 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftWhiteStarRedRingStreaks ;
#line 272 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 273 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_WHITE_STAR_RED_REFLECTIONS :
#line 274 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftWhiteStarRedReflections ;
#line 275 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 276 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_BLUE_STAR_BLUE_REFLECTIONS :
#line 277 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftBlueStarBlueReflections ;
#line 278 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 279 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_PV_SPACE_SHIP_WINDOW_FLARE :
#line 280 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftPVSpaceShipWindowFlare ;
#line 281 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 282 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_WHITE_GLOW_STAR_RED_RING_FAR :
#line 283 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftYellowStarRedRingFar ;
#line 284 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 285 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_WHITE_GLOW_FAR :
#line 286 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftWhiteGlowFar ;
#line 287 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 288 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
case LFT_WHITE_GLOW_STAR_NG :
#line 289 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_plftLensFlare = & _lftWhiteGlowStarNG ;
#line 290 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
break ;
#line 291 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 295 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_paoLightAnimation = NULL ;
#line 296 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_aoLightAnimation . GetData () != NULL ){
#line 297 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_paoLightAnimation = & m_aoLightAnimation ;
#line 298 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 301 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_paoAmbientLightAnimation = NULL ;
#line 302 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_aoAmbientLightAnimation . GetData () != NULL ){
#line 303 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
lsNew . ls_paoAmbientLightAnimation = & m_aoAmbientLightAnimation ;
#line 304 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 305 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 309 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SLONG CLight::GetUsedMemory(void)
#line 310 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 312 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SLONG slUsedMemory = sizeof (CLight ) - sizeof (CEntity ) + CEntity :: GetUsedMemory ();
#line 314 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
slUsedMemory += m_strDescription . Length ();
#line 315 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
slUsedMemory += m_strName . Length ();
#line 316 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
slUsedMemory += m_fnmLightAnimation . Length ();
#line 317 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
slUsedMemory += m_fnmAmbientLightAnimation . Length ();
#line 318 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
slUsedMemory += 2 * sizeof (CAnimObject);
#line 319 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return slUsedMemory ;
#line 320 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
BOOL CLight::
#line 324 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
Main(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CLight_Main
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CLight::Main expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
#line 327 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_rFallOffRange < 0){
#line 328 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_rFallOffRange = 0.0f;
#line 329 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 330 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_rHotSpotRange < 0){
#line 331 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_rHotSpotRange = 0.0f;
#line 332 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 334 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_rHotSpotRange > m_rFallOffRange ){
#line 335 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_rHotSpotRange = m_rFallOffRange ;
#line 336 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 345 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_fNearClip <= 0.01f){
#line 346 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_fNearClip = 0.01f;
#line 347 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 349 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_fFarClip <= 0){
#line 350 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_fFarClip = 0.0f;
#line 351 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 354 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_ltType != LT_DIRECTIONAL ){
#line 355 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_colAmbient = C_BLACK ;
#line 356 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 358 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
InitAsEditorModel ();
#line 359 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetPhysicsFlags (EPF_MODEL_IMMATERIAL );
#line 360 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetCollisionFlags (ECF_IMMATERIAL );
#line 363 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_bRenderAsSmallLight )
#line 364 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 365 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
GetModelObject () -> mo_Stretch = FLOAT3D (0.25f , 0.25f , 0.25f);
#line 366 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 367 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
else
#line 368 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 370 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_ltType != LT_DIRECTIONAL ){
#line 371 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
const float LIGHT_MINSIZE = 0.5f;
#line 372 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
FLOAT fFactor = Log2 (m_rFallOffRange ) * LIGHT_MINSIZE ;
#line 373 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(fFactor < LIGHT_MINSIZE ){
#line 374 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
fFactor = LIGHT_MINSIZE ;
#line 375 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 376 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
GetModelObject () -> mo_Stretch = FLOAT3D (fFactor , fFactor , fFactor );
#line 377 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 378 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 380 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
CTString strType ;
#line 381 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_ltType == LT_POINT || m_ltType == LT_STRONG_POINT )
#line 382 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 383 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
strType = "point";
#line 385 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetModel (MODEL_LIGHT_SOURCE );
#line 387 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetModelMainTexture (TEXTURE_POINT_LIGHT );
#line 388 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 390 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
else if(m_ltType == LT_AMBIENT )
#line 391 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 392 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
strType = "ambient";
#line 394 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetModel (MODEL_LIGHT_SOURCE );
#line 396 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetModelMainTexture (TEXTURE_AMBIENT_LIGHT );
#line 397 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 399 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
else if(m_ltType == LT_STRONG_AMBIENT )
#line 400 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 401 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
strType = "ambient";
#line 403 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetModel (MODEL_LIGHT_SOURCE );
#line 405 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetModelMainTexture (TEXTURE_REAL_AMBIENT_LIGHT );
#line 406 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 408 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
else if(m_ltType == LT_DIRECTIONAL )
#line 409 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 410 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
strType = "directional";
#line 412 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetModel (MODEL_SPOT_LIGHT );
#line 414 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetModelMainTexture (TEXTURE_SPOT_LIGHT );
#line 415 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 417 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_bDarkLight )
#line 418 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
{
#line 419 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
strType = strType + ", dark";
#line 420 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 423 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
try {
#line 424 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_aoLightAnimation . SetData_t (m_fnmLightAnimation );
#line 425 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}catch (char * strError ){
#line 426 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
WarningMessage (TRANS ("Cannot load '%s': %s") , (CTString &) m_fnmLightAnimation , strError );
#line 427 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_fnmLightAnimation = "";
#line 428 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 429 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_aoLightAnimation . GetData () != NULL ){
#line 430 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_aoLightAnimation . PlayAnim (m_iLightAnimation , AOF_LOOPING );
#line 431 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_aoLightAnimation . OffsetPhase (m_tmOffsetPhase * m_aoLightAnimation . GetCurrentAnimLength ());
#line 432 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 435 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
try {
#line 436 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_aoAmbientLightAnimation . SetData_t (m_fnmAmbientLightAnimation );
#line 437 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}catch (char * strError ){
#line 438 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
WarningMessage (TRANS ("Cannot load '%s': %s") , (CTString &) m_fnmAmbientLightAnimation , strError );
#line 439 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_fnmAmbientLightAnimation = "";
#line 440 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 441 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_aoAmbientLightAnimation . GetData () != NULL ){
#line 442 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_aoAmbientLightAnimation . PlayAnim (m_iAmbientLightAnimation , AOF_LOOPING );
#line 443 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_aoAmbientLightAnimation . OffsetPhase (m_tmOffsetPhase * m_aoAmbientLightAnimation . GetCurrentAnimLength ());
#line 444 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 447 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
CLightSource lsNew ;
#line 448 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetupLightSource (lsNew );
#line 451 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(m_bBackground ){
#line 452 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetFlags (GetFlags () | ENF_BACKGROUND );
#line 453 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}else {
#line 454 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
SetFlags (GetFlags () & ~ ENF_BACKGROUND );
#line 455 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 458 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_lsLightSource . ls_penEntity = this ;
#line 459 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
if(! m_bdfInitialized . bdf_bValue ){
#line 460 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_lsLightSource . SetLightSourceWithNoDiscarding (lsNew );
#line 461 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_bdfInitialized . bdf_bValue = TRUE ;
#line 462 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}else {
#line 463 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_lsLightSource . SetLightSource (lsNew );
#line 464 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
}
#line 466 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
m_strDescription . PrintF ("%s:%g-%g" ,
#line 467 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
strType , m_rHotSpotRange , m_rFallOffRange );
#line 469 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
Return(STATE_CURRENT,EVoid());
#line 469 "D:/SE1_GPL/Sources/EntitiesMP/Light.es"
return TRUE; ASSERT(FALSE); return TRUE;};