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

188 lines
8.8 KiB
C++

/*
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
*/
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
#include "StdH.h"
#include <EntitiesMP/Spinner.h>
#include <EntitiesMP/Spinner_tables.h>
CEntityEvent *ESpinnerInit::MakeCopy(void) { CEntityEvent *peeCopy = new ESpinnerInit(*this); return peeCopy;}
ESpinnerInit::ESpinnerInit() : CEntityEvent(EVENTCODE_ESpinnerInit) {;
ClearToDefault(penParent);
ClearToDefault(penTwister);
ClearToDefault(vRotationAngle);
ClearToDefault(tmSpinTime);
ClearToDefault(fUpSpeed);
ClearToDefault(bImpulse);
ClearToDefault(tmImpulseDuration);
};
void CSpinner::SetDefaultProperties(void) {
m_penParent = NULL;
m_aSpinRotation = FLOAT3D(0.0f , 0.0f , 0.0f);
m_vSpeed = FLOAT3D(0.0f , 0.0f , 0.0f);
m_tmExpire = 0.0f;
m_vLastSpeed = FLOAT3D(0.0f , 0.0f , 0.0f);
m_bImpulse = FALSE ;
m_tmWaitAfterImpulse = 0.0f;
m_tmSpawn = 0.0f;
m_vSpinSpeed = FLOAT3D(0.0f , 0.0f , 0.0f);
CRationalEntity::SetDefaultProperties();
}
BOOL CSpinner::
#line 41 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
Main(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CSpinner_Main
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_ESpinnerInit, "CSpinner::Main expects 'ESpinnerInit' as input!"); const ESpinnerInit &esi = (const ESpinnerInit &)__eeInput;
#line 44 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
if((! (esi . penParent -> GetPhysicsFlags () & EPF_MOVABLE )) ||
#line 45 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
(esi . penParent == NULL ) || (esi . penParent == NULL ))
#line 46 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
{
#line 47 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
Destroy ();
#line 48 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
Return(STATE_CURRENT,EVoid());
#line 48 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
return TRUE;
#line 49 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
}
#line 50 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
ASSERT (esi . penParent != NULL );
#line 51 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
ASSERT (esi . penTwister != NULL );
#line 54 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
CTwister & penTwister = (CTwister &) * esi . penTwister ;
#line 55 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
CMovableEntity & penParent = (CMovableEntity &) * esi . penParent ;
#line 56 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_penParent = esi . penParent ;
#line 57 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_aSpinRotation = esi . vRotationAngle ;
#line 58 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_bImpulse = esi . bImpulse ;
#line 59 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
if(m_bImpulse ){
#line 60 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_tmWaitAfterImpulse = esi . tmSpinTime - esi . tmImpulseDuration ;
#line 61 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
if(m_tmWaitAfterImpulse <= 0.0f){m_tmWaitAfterImpulse = 0.01f;}
#line 62 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
}
#line 64 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_vSpinSpeed = ((CMovableEntity &) * m_penParent ) . en_vCurrentTranslationAbsolute ;
#line 65 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_vSpinSpeed = FLOAT3D (0.0f , 0.0f , m_vSpinSpeed . Length ());
#line 68 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
InitAsVoid ();
#line 69 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
SetPhysicsFlags (EPF_MODEL_IMMATERIAL );
#line 70 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
SetCollisionFlags (ECF_IMMATERIAL );
#line 72 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
if(! m_bImpulse ){
#line 73 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_tmExpire = _pTimer -> CurrentTick () + esi . tmSpinTime ;
#line 74 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
}else {
#line 75 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_tmExpire = _pTimer -> CurrentTick () + esi . tmImpulseDuration ;
#line 76 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
}
#line 77 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_tmSpawn = _pTimer -> CurrentTick ();
#line 80 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_vSpeed = FLOAT3D (penTwister . en_mRotation (1 , 2) , penTwister . en_mRotation (2 , 2) , penTwister . en_mRotation (3 , 2)) * esi . fUpSpeed ;
#line 83 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
ANGLE3D aRnd ;
#line 84 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
FLOATmatrix3D m ;
#line 85 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
aRnd (1) = FRnd () * 360.0f;aRnd (2) = FRnd () * 30.0f;aRnd (3) = 0.0f;
#line 86 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
MakeRotationMatrixFast (m , aRnd );
#line 87 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_vSpeed = m_vSpeed * m ;
#line 90 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
Jump(STATE_CURRENT,0x015c0003, FALSE, EInternal());return TRUE;}BOOL CSpinner::H0x015c0003_Main_03(const CEntityEvent &__eeInput)
#line 91 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
{
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x015c0003
if(!(_pTimer -> CurrentTick () < m_tmExpire )){ Jump(STATE_CURRENT,0x015c0004, FALSE, EInternal());return TRUE;}
#line 93 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
if(m_penParent -> GetFlags () & ENF_DELETED ){
#line 94 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
Destroy ();
#line 95 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
Return(STATE_CURRENT,EVoid());
#line 95 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
return TRUE;
#line 96 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
}
#line 98 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
if(((CMovableEntity &) * m_penParent ) . en_vCurrentTranslationAbsolute != m_vLastSpeed ||
#line 99 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
((CMovableEntity &) * m_penParent ) . en_vCurrentTranslationAbsolute == FLOAT3D (0.0f , 0.0f , 0.0f)){
#line 101 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
((CMovableEntity &) * m_penParent ) . en_vCurrentTranslationAbsolute += m_vSpeed ;
#line 102 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
m_vLastSpeed = ((CMovableEntity &) * m_penParent ) . en_vCurrentTranslationAbsolute ;
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
}else {
#line 105 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
((CMovableEntity &) * m_penParent ) . SetDesiredTranslation (m_vSpinSpeed );
#line 106 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
}
#line 109 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
if(! m_bImpulse ){
#line 110 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
((CMovableEntity &) * m_penParent ) . en_aDesiredRotationRelative = m_aSpinRotation ;
#line 111 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
}
#line 112 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
SetTimerAfter(_pTimer -> TickQuantum );
Jump(STATE_CURRENT, 0x015c0001, FALSE, EBegin());return TRUE;}BOOL CSpinner::H0x015c0001_Main_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x015c0001
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: return TRUE;case EVENTCODE_ETimer: Jump(STATE_CURRENT,0x015c0002, FALSE, EInternal()); return TRUE;default: return FALSE; }}BOOL CSpinner::H0x015c0002_Main_02(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x015c0002
;Jump(STATE_CURRENT,0x015c0003, FALSE, EInternal());return TRUE;
#line 113 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
}BOOL CSpinner::H0x015c0004_Main_04(const CEntityEvent &__eeInput) {
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x015c0004
#line 115 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
((CMovableEntity &) * m_penParent ) . en_aDesiredRotationRelative = ANGLE3D (0.0f , 0.0f , 0.0f);
#line 118 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
if(!(m_bImpulse )){ Jump(STATE_CURRENT,0x015c0007, FALSE, EInternal());return TRUE;}
#line 119 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
((CMovableEntity &) * m_penParent ) . SetDesiredTranslation (FLOAT3D (0.0f , 0.0f , 0.0f));
#line 120 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
SetTimerAfter(m_tmWaitAfterImpulse );
Jump(STATE_CURRENT, 0x015c0005, FALSE, EBegin());return TRUE;}BOOL CSpinner::H0x015c0005_Main_05(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x015c0005
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: return TRUE;case EVENTCODE_ETimer: Jump(STATE_CURRENT,0x015c0006, FALSE, EInternal()); return TRUE;default: return FALSE; }}BOOL CSpinner::H0x015c0006_Main_06(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x015c0006
;Jump(STATE_CURRENT,0x015c0007, FALSE, EInternal());return TRUE;}BOOL CSpinner::H0x015c0007_Main_07(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x015c0007
#line 124 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
Destroy ();
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
Return(STATE_CURRENT,EVoid());
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/Spinner.es"
return TRUE; ASSERT(FALSE); return TRUE;};