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

335 lines
15 KiB
C++

/*
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
*/
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
#include "StdH.h"
#include <EntitiesMP/DevilProjectile.h>
#include <EntitiesMP/DevilProjectile_tables.h>
CEntityEvent *EDevilProjectile::MakeCopy(void) { CEntityEvent *peeCopy = new EDevilProjectile(*this); return peeCopy;}
EDevilProjectile::EDevilProjectile() : CEntityEvent(EVENTCODE_EDevilProjectile) {;
ClearToDefault(penLauncher);
ClearToDefault(penTarget);
};
#line 18 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
#define FLY_TIME 15.0f
#define ROTATE_SPEED 200.0f
#define MOVING_SPEED 30.0f
#define MOVING_FREQUENCY 0.1f
void CDevilProjectile::SetDefaultProperties(void) {
m_penLauncher = NULL;
m_penTarget = NULL;
m_fIgnoreTime = 0.0f;
m_fStartTime = 0.0f;
m_vDesiredAngle = FLOAT3D(0 , 0 , 0);
m_bFly = FALSE ;
m_soEffect.SetOwner(this);
m_soEffect.Stop_internal();
CMovableModelEntity::SetDefaultProperties();
}
#line 56 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::Read_t(CTStream * istr)
#line 57 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
{
#line 58 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
CMovableModelEntity :: Read_t (istr );
#line 60 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
SetupLightSource ();
#line 61 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 64 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
CLightSource * CDevilProjectile::GetLightSource(void)
#line 65 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
{
#line 66 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
if(! IsPredictor ()){
#line 67 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
return & m_lsLightSource ;
#line 68 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}else {
#line 69 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
return NULL ;
#line 70 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 71 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 74 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::SetupLightSource(void)
#line 75 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
{
#line 77 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
CLightSource lsNew ;
#line 78 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
lsNew . ls_ulFlags = LSF_NONPERSISTENT | LSF_DYNAMIC ;
#line 79 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
lsNew . ls_rHotSpot = 0.0f;
#line 80 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
lsNew . ls_colColor = RGBToColor (0 , 128 , 128);
#line 81 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
lsNew . ls_rFallOff = 5.0f;
#line 82 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
lsNew . ls_plftLensFlare = NULL ;
#line 83 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
lsNew . ls_ubPolygonalMask = 0;
#line 84 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
lsNew . ls_paoLightAnimation = NULL ;
#line 86 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_lsLightSource . ls_penEntity = this ;
#line 87 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_lsLightSource . SetLightSource (lsNew );
#line 88 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 96 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::CalcHeadingRotation(ANGLE aWantedHeadingRelative,ANGLE & aRotation) {
#line 98 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
aWantedHeadingRelative = NormalizeAngle (aWantedHeadingRelative );
#line 101 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
if(aWantedHeadingRelative < - ROTATE_SPEED * MOVING_FREQUENCY ){
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
aRotation = - ROTATE_SPEED ;
#line 105 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}else if(aWantedHeadingRelative > ROTATE_SPEED * MOVING_FREQUENCY ){
#line 107 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
aRotation = + ROTATE_SPEED ;
#line 109 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}else {
#line 110 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
aRotation = aWantedHeadingRelative / MOVING_FREQUENCY ;
#line 111 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 112 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 115 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::CalcAngleFromPosition() {
#line 117 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
FLOAT3D vTarget ;
#line 120 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
vTarget = m_penTarget -> GetPlacement () . pl_PositionVector ;
#line 121 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
vTarget += FLOAT3D (m_penTarget -> en_mRotation (1 , 2) ,
#line 122 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_penTarget -> en_mRotation (2 , 2) ,
#line 123 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_penTarget -> en_mRotation (3 , 2)) * 2.0f;
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_vDesiredAngle = (vTarget - GetPlacement () . pl_PositionVector ) . Normalize ();
#line 127 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 130 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::RotateToAngle() {
#line 132 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
ANGLE aRotation ;
#line 133 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
CalcHeadingRotation (GetRelativeHeading (m_vDesiredAngle ) , aRotation );
#line 136 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
SetDesiredRotation (ANGLE3D (aRotation , 0 , 0));
#line 137 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 140 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::FlyInDirection() {
#line 141 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
RotateToAngle ();
#line 144 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
FLOAT3D vTarget ;
#line 147 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
vTarget = m_penTarget -> GetPlacement () . pl_PositionVector ;
#line 148 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
vTarget += FLOAT3D (m_penTarget -> en_mRotation (1 , 2) ,
#line 149 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_penTarget -> en_mRotation (2 , 2) ,
#line 150 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_penTarget -> en_mRotation (3 , 2)) * 2.0f;
#line 153 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
FLOAT3D vTranslation = (vTarget - GetPlacement () . pl_PositionVector ) * ! en_mRotation ;
#line 154 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
vTranslation (1) = 0.0f;
#line 155 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
vTranslation . Normalize ();
#line 156 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
vTranslation *= MOVING_SPEED ;
#line 159 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
SetDesiredTranslation (vTranslation );
#line 160 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 163 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::FlyToPosition() {
#line 164 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
CalcAngleFromPosition ();
#line 165 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
FlyInDirection ();
#line 166 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 169 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::RotateToPosition() {
#line 170 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
CalcAngleFromPosition ();
#line 171 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
RotateToAngle ();
#line 172 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 175 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::StopMoving() {
#line 176 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
StopRotating ();
#line 177 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
StopTranslating ();
#line 178 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 181 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::StopRotating() {
#line 182 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
SetDesiredRotation (ANGLE3D (0 , 0 , 0));
#line 183 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 186 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::StopTranslating() {
#line 187 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
SetDesiredTranslation (FLOAT3D (0.0f , 0.0f , 0.0f));
#line 188 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 195 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
void CDevilProjectile::ProjectileTouch(CEntityPointer penHit) {
#line 197 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
FLOAT3D vDirection ;
#line 198 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
AnglesToDirectionVector (GetPlacement () . pl_OrientationAngle , vDirection );
#line 199 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
InflictDirectDamage (penHit , m_penLauncher , DMT_PROJECTILE , 15.0f ,
#line 200 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
GetPlacement () . pl_PositionVector , vDirection );
#line 201 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
BOOL CDevilProjectile::
#line 209 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
Fly(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CDevilProjectile_Fly
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CDevilProjectile::Fly expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
#line 211 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_bFly = TRUE ;
#line 212 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
Jump(STATE_CURRENT,0x01ff0004, FALSE, EInternal());return TRUE;}BOOL CDevilProjectile::H0x01ff0004_Fly_03(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x01ff0004
if(!(m_bFly && m_fStartTime + FLY_TIME > _pTimer -> CurrentTick ())){ Jump(STATE_CURRENT,0x01ff0005, FALSE, EInternal());return TRUE;}
#line 213 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
SetTimerAfter(0.1f);
Jump(STATE_CURRENT, 0x01ff0002, FALSE, EBegin());return TRUE;}BOOL CDevilProjectile::H0x01ff0002_Fly_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x01ff0002
switch(__eeInput.ee_slEvent){case(EVENTCODE_EBegin):{const EBegin&e= (EBegin&)__eeInput;
#line 215 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
FlyToPosition ();
#line 216 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
return TRUE;
#line 217 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}ASSERT(FALSE);break;case(EVENTCODE_EPass):{const EPass&epass= (EPass&)__eeInput;
#line 219 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
BOOL bHit ;
#line 221 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
bHit = epass . penOther != m_penLauncher || _pTimer -> CurrentTick () > m_fIgnoreTime ;
#line 223 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
bHit &= ! IsOfClass (epass . penOther , "Twister");
#line 224 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
if(bHit ){
#line 225 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
ProjectileTouch (epass . penOther );
#line 226 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_bFly = FALSE ;
#line 227 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
UnsetTimer();Jump(STATE_CURRENT,0x01ff0003, FALSE, EInternal());return TRUE;
#line 228 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}
#line 229 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
return TRUE;
#line 230 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}ASSERT(FALSE);break;case(EVENTCODE_ETouch):{const ETouch&etouch= (ETouch&)__eeInput;
#line 233 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_fIgnoreTime = 0.0f;
#line 234 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
return TRUE;
#line 235 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}ASSERT(FALSE);break;case(EVENTCODE_ETimer):{const ETimer&e= (ETimer&)__eeInput;
UnsetTimer();Jump(STATE_CURRENT,0x01ff0003, FALSE, EInternal());return TRUE;}ASSERT(FALSE);break;default: return FALSE; break;
#line 237 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}return TRUE;}BOOL CDevilProjectile::H0x01ff0003_Fly_02(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x01ff0003
Jump(STATE_CURRENT,0x01ff0004, FALSE, EInternal());return TRUE;
#line 238 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
}BOOL CDevilProjectile::H0x01ff0005_Fly_04(const CEntityEvent &__eeInput) {
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x01ff0005
#line 239 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
Return(STATE_CURRENT,EEnd ());
#line 239 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
return TRUE; ASSERT(FALSE); return TRUE;};BOOL CDevilProjectile::
#line 243 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
Main(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CDevilProjectile_Main
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EDevilProjectile, "CDevilProjectile::Main expects 'EDevilProjectile' as input!"); const EDevilProjectile &eLaunch = (const EDevilProjectile &)__eeInput;
#line 245 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
ASSERT (eLaunch . penLauncher != NULL );
#line 246 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
ASSERT (eLaunch . penTarget != NULL );
#line 247 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_penLauncher = eLaunch . penLauncher ;
#line 248 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_penTarget = eLaunch . penTarget ;
#line 251 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
InitAsModel ();
#line 252 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
SetPhysicsFlags (EPF_PROJECTILE_FLYING );
#line 253 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
SetCollisionFlags (ECF_PROJECTILE_MAGIC );
#line 254 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
SetModel (MODEL_FLARE );
#line 255 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
SetModelMainTexture (TEXTURE_FLARE );
#line 258 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
SetupLightSource ();
#line 261 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_fIgnoreTime = _pTimer -> CurrentTick () + 1.0f;
#line 264 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
m_fStartTime = _pTimer -> CurrentTick ();
#line 265 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
STATE_CDevilProjectile_Fly, TRUE;
Jump(STATE_CURRENT, 0x01ff0006, FALSE, EBegin());return TRUE;}BOOL CDevilProjectile::H0x01ff0006_Main_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x01ff0006
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: Call(STATE_CURRENT, STATE_CDevilProjectile_Fly, TRUE, EVoid());return TRUE;case EVENTCODE_EEnd: Jump(STATE_CURRENT,0x01ff0007, FALSE, __eeInput); return TRUE;default: return FALSE; }}BOOL CDevilProjectile::H0x01ff0007_Main_02(const CEntityEvent &__eeInput){
#undef STATE_CURRENT
#define STATE_CURRENT 0x01ff0007
const EEnd&__e= (EEnd&)__eeInput;
;
#line 268 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
Destroy ();
#line 270 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
Return(STATE_CURRENT,EVoid());
#line 270 "D:/SE1_GPL/Sources/EntitiesMP/DevilProjectile.es"
return TRUE; ASSERT(FALSE); return TRUE;};