Serious-Engine/Sources/EntitiesMP/MeteorShower.cpp
2016-03-11 15:57:17 +02:00

186 lines
8.9 KiB
C++

/*
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
*/
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
#include "StdH.h"
#include <EntitiesMP/MeteorShower.h>
#include <EntitiesMP/MeteorShower_tables.h>
void CMeteorShower::SetDefaultProperties(void) {
m_strName = "Meteor Shower";
m_aAngle = ANGLE3D(AngleDeg (0.0f) , AngleDeg (0.0f) , AngleDeg (0.0f));
m_iPerTickLaunchChance = 10;
m_fMinStretch = 1.0f;
m_fMaxStretch = 1.1f;
m_rSafeArea = 10.0f;
m_rArea = 50.0f;
m_fSpeed = 300.0f;
m_fLaunchDistance = 500.0f;
CRationalEntity::SetDefaultProperties();
}
#line 41 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
void CMeteorShower::Precache(void) {
#line 42 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
PrecacheClass (CLASS_PROJECTILE , PRT_METEOR );
#line 43 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
}
#line 46 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
void CMeteorShower::SpawnProjectile(const CPlacement3D & pl)
#line 47 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
{
#line 48 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
CEntityPointer pen = CreateEntity (pl , CLASS_PROJECTILE );
#line 51 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
ELaunchProjectile eLaunch ;
#line 52 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
eLaunch . penLauncher = this ;
#line 53 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
eLaunch . prtType = PRT_METEOR ;
#line 54 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
eLaunch . fStretch = Lerp (m_fMinStretch , m_fMaxStretch , FRnd ());
#line 55 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
eLaunch . fSpeed = m_fSpeed ;
#line 56 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
pen -> Initialize (eLaunch );
#line 57 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
}
#line 59 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
void CMeteorShower::MaybeShootMeteor(void)
#line 60 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
{
#line 61 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
INDEX iShoot = IRnd () % 100;
#line 63 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
if(iShoot <= m_iPerTickLaunchChance )
#line 64 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
{
#line 65 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
CPlacement3D plFall ;
#line 67 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
plFall . pl_PositionVector = GetPlacement () . pl_PositionVector ;
#line 68 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
FLOAT fR = Lerp (m_rSafeArea , m_rArea , FRnd ());
#line 69 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
FLOAT fA = FRnd () * 360.0f;
#line 70 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
plFall . pl_PositionVector += FLOAT3D (CosFast (fA ) * fR , 0.05f , SinFast (fA ) * fR );
#line 71 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
FLOAT3D vDir ;
#line 72 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
AnglesToDirectionVector (m_aAngle , vDir );
#line 73 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
vDir . Normalize ();
#line 74 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
CPlacement3D plLaunch = plFall ;
#line 75 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
plLaunch . pl_PositionVector = plFall . pl_PositionVector - vDir * m_fLaunchDistance ;
#line 76 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
plLaunch . pl_OrientationAngle = m_aAngle ;
#line 77 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
SpawnProjectile (plLaunch );
#line 78 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
}
#line 79 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
}
BOOL CMeteorShower::
#line 86 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
Active(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CMeteorShower_Active
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CMeteorShower::Active expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
#line 88 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
Jump(STATE_CURRENT,0x02670003, FALSE, EInternal());return TRUE;}BOOL CMeteorShower::H0x02670003_Active_03(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x02670003
if(!(TRUE )){ Jump(STATE_CURRENT,0x02670004, FALSE, EInternal());return TRUE;}
#line 90 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
SetTimerAfter(_pTimer -> TickQuantum );
Jump(STATE_CURRENT, 0x02670001, FALSE, EBegin());return TRUE;}BOOL CMeteorShower::H0x02670001_Active_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x02670001
switch(__eeInput.ee_slEvent){case(EVENTCODE_EBegin):{const EBegin&e= (EBegin&)__eeInput;
#line 92 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
return TRUE;
#line 93 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
}ASSERT(FALSE);break;case(EVENTCODE_EEnvironmentStop):{const EEnvironmentStop&e= (EEnvironmentStop&)__eeInput;
#line 95 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
Jump(STATE_CURRENT, STATE_CMeteorShower_Inactive, TRUE, EVoid());return TRUE;
#line 96 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
}ASSERT(FALSE);break;case(EVENTCODE_ETimer):{const ETimer&e= (ETimer&)__eeInput;
#line 98 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
MaybeShootMeteor ();
#line 99 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
UnsetTimer();Jump(STATE_CURRENT,0x02670002, FALSE, EInternal());return TRUE;
#line 100 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
}ASSERT(FALSE);break;default: return FALSE; break;
#line 101 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
}return TRUE;}BOOL CMeteorShower::H0x02670002_Active_02(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x02670002
Jump(STATE_CURRENT,0x02670003, FALSE, EInternal());return TRUE;
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
}BOOL CMeteorShower::H0x02670004_Active_04(const CEntityEvent &__eeInput) {
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x02670004
ASSERT(FALSE); return TRUE;};BOOL CMeteorShower::
#line 107 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
Inactive(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CMeteorShower_Inactive
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CMeteorShower::Inactive expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
#line 109 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
SetTimerAt(THINKTIME_NEVER);
Jump(STATE_CURRENT, 0x02670006, FALSE, EBegin());return TRUE;}BOOL CMeteorShower::H0x02670006_Inactive_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x02670006
switch(__eeInput.ee_slEvent){case(EVENTCODE_EBegin):{const EBegin&e= (EBegin&)__eeInput;
return TRUE;}ASSERT(FALSE);break;case(EVENTCODE_EEnvironmentStart):{const EEnvironmentStart&e= (EEnvironmentStart&)__eeInput;
Jump(STATE_CURRENT, STATE_CMeteorShower_Active, TRUE, EVoid());return TRUE;}ASSERT(FALSE);break;default: return FALSE; break;
#line 112 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
}return TRUE;}BOOL CMeteorShower::H0x02670007_Inactive_02(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x02670007
ASSERT(FALSE); return TRUE;};BOOL CMeteorShower::
#line 116 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
Main(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CMeteorShower_Main
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CMeteorShower::Main expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
#line 118 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
if(m_fMinStretch > m_fMaxStretch ){m_fMinStretch = m_fMaxStretch ;}
#line 119 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
if(m_rSafeArea > m_rArea ){m_rSafeArea = m_rArea ;}
#line 121 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
InitAsEditorModel ();
#line 122 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
SetPhysicsFlags (EPF_MODEL_IMMATERIAL );
#line 123 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
SetCollisionFlags (ECF_IMMATERIAL );
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
SetModel (MODEL_MARKER );
#line 127 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
SetModelMainTexture (TEXTURE_MARKER );
#line 129 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
SetTimerAfter(0.05f);
Jump(STATE_CURRENT, 0x02670008, FALSE, EBegin());return TRUE;}BOOL CMeteorShower::H0x02670008_Main_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x02670008
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: return TRUE;case EVENTCODE_ETimer: Jump(STATE_CURRENT,0x02670009, FALSE, EInternal()); return TRUE;default: return FALSE; }}BOOL CMeteorShower::H0x02670009_Main_02(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x02670009
;
#line 131 "D:/SE1_GPL/Sources/EntitiesMP/MeteorShower.es"
Jump(STATE_CURRENT, STATE_CMeteorShower_Inactive, TRUE, EVoid());return TRUE; ASSERT(FALSE); return TRUE;};