mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-22 10:20:26 +01:00
163 lines
6.2 KiB
C++
163 lines
6.2 KiB
C++
/*
|
|
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
|
|
*/
|
|
|
|
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
|
|
#include "StdH.h"
|
|
|
|
#include <EntitiesMP/Pendulum.h>
|
|
#include <EntitiesMP/Pendulum_tables.h>
|
|
void CPendulum::SetDefaultProperties(void) {
|
|
m_strName = "Pendulum";
|
|
m_bDynamicShadows = FALSE ;
|
|
m_fMaxAngle = 60.0f;
|
|
m_fSpeed = 0.0f;
|
|
m_fDampFactor = 0.9f;
|
|
m_fPendulumFactor = 1.0f;
|
|
m_fImpulseFactor = 0.01f;
|
|
m_fTriggerImpulse = 10.0f;
|
|
m_bActive = TRUE ;
|
|
CMovableBrushEntity::SetDefaultProperties();
|
|
}
|
|
|
|
#line 27 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
void CPendulum::ReceiveDamage(CEntity * penInflictor,enum DamageType dmtType,
|
|
#line 28 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
FLOAT fDamageAmmount,const FLOAT3D & vHitPoint,const FLOAT3D & vDirection)
|
|
#line 29 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
{
|
|
#line 30 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
if(! m_bActive )
|
|
#line 31 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
{
|
|
#line 32 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
return ;
|
|
#line 33 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}
|
|
#line 35 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
FLOAT3D vOscilatingDirection ;
|
|
#line 36 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
GetHeadingDirection (- 90.0f , vOscilatingDirection );
|
|
#line 38 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
FLOAT fImpulse = vDirection % vOscilatingDirection ;
|
|
#line 40 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
fImpulse *= fDamageAmmount * m_fImpulseFactor ;
|
|
#line 42 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
m_fSpeed += fImpulse ;
|
|
#line 43 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
SetDesiredRotation (ANGLE3D (0 , 0 , m_fSpeed ));
|
|
#line 44 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}
|
|
|
|
#line 47 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
void CPendulum::PostMoving()
|
|
#line 48 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
{
|
|
#line 49 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
CMovableBrushEntity :: PostMoving ();
|
|
#line 50 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
ANGLE fCurrentBanking = GetPlacement () . pl_OrientationAngle (3);
|
|
#line 51 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
FLOAT fNewSpeed = m_fSpeed * m_fDampFactor - m_fPendulumFactor * fCurrentBanking ;
|
|
#line 54 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
if(Abs (fCurrentBanking ) > m_fMaxAngle && Sgn (fNewSpeed ) == Sgn (fCurrentBanking ))
|
|
#line 55 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
{
|
|
#line 56 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
fNewSpeed = 0.0f;
|
|
#line 57 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}
|
|
#line 59 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
m_fSpeed = fNewSpeed ;
|
|
#line 60 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
SetDesiredRotation (ANGLE3D (0 , 0 , fNewSpeed ));
|
|
#line 63 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
if(Abs (fCurrentBanking ) > 1.0f)
|
|
#line 64 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
{
|
|
#line 66 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
SetFlags (GetFlags () & ~ ENF_INRENDERING );
|
|
#line 67 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}
|
|
#line 68 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}
|
|
BOOL CPendulum::
|
|
#line 71 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
Main(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT STATE_CPendulum_Main
|
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CPendulum::Main expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
|
#line 73 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
InitAsBrush ();
|
|
#line 74 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
SetPhysicsFlags (EPF_BRUSH_MOVING );
|
|
#line 75 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
SetCollisionFlags (ECF_BRUSH );
|
|
#line 77 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
SetFlags (GetFlags () & ~ ENF_ZONING );
|
|
#line 80 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
if(m_bDynamicShadows ){
|
|
#line 81 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
SetFlags (GetFlags () | ENF_DYNAMICSHADOWS );
|
|
#line 82 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}else {
|
|
#line 83 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
SetFlags (GetFlags () & ~ ENF_DYNAMICSHADOWS );
|
|
#line 84 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}
|
|
#line 87 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
SetTimerAt(THINKTIME_NEVER);
|
|
Jump(STATE_CURRENT, 0x006a0000, FALSE, EBegin());return TRUE;}BOOL CPendulum::H0x006a0000_Main_01(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x006a0000
|
|
switch(__eeInput.ee_slEvent){case(EVENTCODE_EActivate):
|
|
#line 89 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
{const EActivate&e= (EActivate&)__eeInput;
|
|
|
|
#line 90 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
m_bActive = TRUE ;
|
|
#line 91 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
return TRUE;
|
|
#line 92 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}ASSERT(FALSE);break;case(EVENTCODE_EDeactivate):
|
|
#line 94 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
{const EDeactivate&e= (EDeactivate&)__eeInput;
|
|
|
|
#line 95 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
m_bActive = FALSE ;
|
|
#line 96 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
return TRUE;
|
|
#line 97 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}ASSERT(FALSE);break;case(EVENTCODE_ETrigger):
|
|
#line 99 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
{const ETrigger&e= (ETrigger&)__eeInput;
|
|
|
|
#line 100 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
if(m_bActive )
|
|
#line 101 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
{
|
|
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
m_fSpeed += m_fTriggerImpulse ;
|
|
#line 104 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
AddToMovers ();
|
|
#line 105 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}
|
|
#line 106 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
return TRUE;
|
|
#line 107 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}ASSERT(FALSE);break;default: return FALSE; break;
|
|
#line 108 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
}return TRUE;}BOOL CPendulum::H0x006a0001_Main_02(const CEntityEvent &__eeInput){
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x006a0001
|
|
|
|
#line 110 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
Destroy ();
|
|
#line 111 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
UnsetTimer();Jump(STATE_CURRENT,0x006a0001, FALSE, EInternal());return TRUE;
|
|
#line 112 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
Return(STATE_CURRENT,EVoid());
|
|
#line 112 "D:/SE1_GPL/Sources/EntitiesMP/Pendulum.es"
|
|
return TRUE; ASSERT(FALSE); return TRUE;}; |