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

848 lines
43 KiB
C++

/*
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
*/
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
#include "StdH.h"
#include "ModelsMP/Enemies/CannonRotating/Turret.h"
#include "ModelsMP/Enemies/CannonRotating/RotatingMechanism.h"
#include <EntitiesMP/CannonRotating.h>
#include <EntitiesMP/CannonRotating_tables.h>
#line 16 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
#define CANNONR_SIZE 2.0f
// info structure
static EntityInfo eiCannonRotating = {
EIBT_WOOD, 10000.0f,
0.0f, 1.5f*CANNONR_SIZE, 0.0f, // source (eyes)
0.0f, 0.5f*CANNONR_SIZE, 0.0f, // target (body)
};
#define FIRING_POSITION_MUZZLE FLOAT3D(0.0f, 0.0f, -1.0f)
#define MUZZLE_ROTATION_SPEED 45.0f //deg/sec
void CCannonRotating::SetDefaultProperties(void) {
m_fHealth = 100.0f;
m_fFiringRangeClose = 50.0f;
m_fFiringRangeFar = 150.0f;
m_fWaitAfterFire = 3.0f;
m_fSize = CANNONR_SIZE ;
m_fMaxPitch = 20.0f;
m_fViewAngle = 2.5f;
m_fScanAngle = 60.0f;
m_fRotationSpeed = 20.0f;
m_bActive = TRUE ;
m_fRotSpeedMuzzle = ANGLE3D(0.0f , 0.0f , 0.0f);
m_fRotSpeedRotator = ANGLE3D(0.0f , 0.0f , 0.0f);
m_fDistanceToPlayer = 0.0f;
m_fDesiredMuzzlePitch = 0.0f;
m_iMuzzleDir = 1.0f;
m_vFiringPos = FLOAT3D(0.0f , 0.0f , 0.0f);
m_vTarget = FLOAT3D(0.0f , 0.0f , 0.0f);
m_tmLastFireTime = -1000.0f;
m_aBeginMuzzleRotation = ANGLE3D(0.0f , 0.0f , 0.0f);
m_aEndMuzzleRotation = ANGLE3D(0.0f , 0.0f , 0.0f);
m_aBeginRotatorRotation = ANGLE3D(0.0f , 0.0f , 0.0f);
m_aEndRotatorRotation = ANGLE3D(0.0f , 0.0f , 0.0f);
CEnemyBase::SetDefaultProperties();
}
CTString CCannonRotating::GetPlayerKillDescription(const CTString & strPlayerName,const EDeath & eDeath)
#line 90 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
{
#line 91 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CTString str ;
#line 92 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
str . PrintF (TRANS ("A Cannon killed %s") , strPlayerName );
#line 93 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return str ;
#line 94 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 97 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
void * CCannonRotating::GetEntityInfo(void) {
#line 98 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return & eiCannonRotating ;
#line 99 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
const CTFileName & CCannonRotating::GetComputerMessageName(void)const {
#line 102 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
static DECLARE_CTFILENAME (fnmCannon , "DataMP\\Messages\\Enemies\\CannonRotating.txt");
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return fnmCannon ;
#line 104 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 106 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
void CCannonRotating::Precache(void) {
#line 107 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CEnemyBase :: Precache ();
#line 108 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
PrecacheModel (MODEL_DEBRIS_MUZZLE );
#line 109 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
PrecacheModel (MODEL_DEBRIS_ROTATOR );
#line 110 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
PrecacheModel (MODEL_DEBRIS_BASE );
#line 111 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
PrecacheModel (MODEL_BALL );
#line 113 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
PrecacheTexture (TEXTURE_BALL );
#line 115 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
PrecacheSound (SOUND_FIRE );
#line 117 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
PrecacheClass (CLASS_CANNONBALL );
#line 118 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 121 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
void CCannonRotating::ReceiveDamage(CEntity * penInflictor,enum DamageType dmtType,
#line 122 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT fDamageAmmount,const FLOAT3D & vHitPoint,const FLOAT3D & vDirection)
#line 123 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
{
#line 125 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(dmtType == DMT_BULLET && fDamageAmmount > 100.0f)
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
{
#line 127 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
fDamageAmmount *= 0.5f;
#line 128 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 130 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CEnemyBase :: ReceiveDamage (penInflictor , dmtType , fDamageAmmount ,
#line 131 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
vHitPoint , vDirection );
#line 132 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 135 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
INDEX CCannonRotating::AnimForDamage(FLOAT fDamage) {
#line 136 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return 0;
#line 137 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 140 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
INDEX CCannonRotating::AnimForDeath(void) {
#line 141 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return 0;
#line 142 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 145 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
BOOL CCannonRotating::IsVisible(CEntity * penEntity)
#line 146 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
{
#line 147 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
ASSERT (penEntity != NULL );
#line 149 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vSource , vTarget ;
#line 150 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
GetPositionCastRay (this , penEntity , vSource , vTarget );
#line 153 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CCastRay crRay (this , vSource , vTarget );
#line 154 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
crRay . cr_ttHitModels = CCastRay :: TT_NONE ;
#line 155 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
crRay . cr_bHitTranslucentPortals = FALSE ;
#line 156 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
en_pwoWorld -> CastRay (crRay );
#line 159 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return (crRay . cr_penHit == NULL );
#line 160 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 162 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
BOOL CCannonRotating::IsInTheLineOfFire(CEntity * penEntity,FLOAT fAngle)
#line 163 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
{
#line 164 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
ASSERT (penEntity != NULL );
#line 166 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT fCosAngle ;
#line 167 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vHeading ;
#line 168 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vToPlayer ;
#line 170 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vSide = FLOAT3D (1.0f , 0.0f , 0.0f) * GetRotationMatrix ();
#line 171 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vFront = FLOAT3D (0.0f , 0.0f , - 1.0f) * GetRotationMatrix ();
#line 172 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOATmatrix3D m ;
#line 173 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
MakeRotationMatrixFast (m , m_aBeginRotatorRotation );
#line 174 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
vSide = vSide * m ;
#line 175 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
vFront = vFront * m ;
#line 177 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
vToPlayer = penEntity -> GetPlacement () . pl_PositionVector - GetPlacement () . pl_PositionVector ;
#line 178 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
vToPlayer . Normalize ();
#line 180 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
fCosAngle = vToPlayer % vSide ;
#line 183 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(Abs (fCosAngle ) < CosFast (90.0f - fAngle )){
#line 185 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if((vToPlayer % vFront ) > 0.0f){
#line 186 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return TRUE ;
#line 187 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 188 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 189 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return FALSE ;
#line 190 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 192 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CPlayer * CCannonRotating::AcquireTarget() {
#line 194 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
INDEX ctMaxPlayers = GetMaxPlayers ();
#line 195 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CEntity * penPlayer ;
#line 197 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
for(INDEX i = 0;i < ctMaxPlayers ;i ++){
#line 198 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
penPlayer = GetPlayerEntity (i );
#line 199 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(penPlayer != NULL && DistanceTo (this , penPlayer ) < m_fFiringRangeFar ){
#line 201 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(IsInTheLineOfFire (penPlayer , m_fViewAngle )){
#line 203 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(IsVisible (penPlayer )){
#line 204 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return (CPlayer *) penPlayer ;
#line 205 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 206 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 207 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 208 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 209 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return NULL ;
#line 210 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 213 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
void CCannonRotating::CannonBlowUp(void)
#line 214 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
{
#line 215 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vNormalizedDamage = m_vDamage - m_vDamage * (m_fBlowUpAmount / m_vDamage . Length ());
#line 216 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
vNormalizedDamage /= Sqrt (vNormalizedDamage . Length ());
#line 217 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
vNormalizedDamage *= 0.75f;
#line 218 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
vNormalizedDamage += FLOAT3D (0.0f , 15.0f + FRnd () * 10.0f , 0.0f);
#line 220 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vBodySpeed = en_vCurrentTranslationAbsolute - en_vGravityDir * (en_vGravityDir % en_vCurrentTranslationAbsolute );
#line 223 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Debris_Begin (EIBT_WOOD , DPT_NONE , BET_NONE , 1.0f , vNormalizedDamage , vBodySpeed , 5.0f , 2.0f);
#line 225 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Debris_Spawn (this , this , MODEL_DEBRIS_MUZZLE , TEXTURE_CANNON , 0 , 0 , 0 , 0 , m_fSize ,
#line 226 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D (FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f));
#line 227 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Debris_Spawn (this , this , MODEL_DEBRIS_ROTATOR , TEXTURE_ROTATOR , 0 , 0 , 0 , 0 , m_fSize ,
#line 228 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D (FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f));
#line 229 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Debris_Spawn (this , this , MODEL_DEBRIS_ROTATOR , TEXTURE_ROTATOR , 0 , 0 , 0 , 0 , m_fSize ,
#line 230 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D (FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f));
#line 231 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Debris_Spawn (this , this , MODEL_DEBRIS_BASE , TEXTURE_TURRET , 0 , 0 , 0 , 0 , m_fSize ,
#line 232 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D (FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f));
#line 233 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Debris_Spawn (this , this , MODEL_BALL , TEXTURE_BALL , 0 , 0 , 0 , 0 , m_fSize / 2.0f ,
#line 234 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D (FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f));
#line 235 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Debris_Spawn (this , this , MODEL_BALL , TEXTURE_BALL , 0 , 0 , 0 , 0 , m_fSize / 2.0f ,
#line 236 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D (FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f , FRnd () * 0.6f + 0.2f));
#line 239 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CPlacement3D plExplosion = GetPlacement ();
#line 240 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CEntityPointer penExplosion = CreateEntity (plExplosion , CLASS_BASIC_EFFECT );
#line 241 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
ESpawnEffect eSpawnEffect ;
#line 242 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eSpawnEffect . colMuliplier = C_WHITE | CT_OPAQUE ;
#line 243 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eSpawnEffect . betType = BET_CANNON ;
#line 244 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT fSize = m_fBlowUpSize * 1.0f;
#line 245 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eSpawnEffect . vStretch = FLOAT3D (fSize , fSize , fSize );
#line 246 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
penExplosion -> Initialize (eSpawnEffect );
#line 249 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
plExplosion = GetPlacement ();
#line 250 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
penExplosion = CreateEntity (plExplosion , CLASS_BASIC_EFFECT );
#line 251 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eSpawnEffect . colMuliplier = C_WHITE | CT_OPAQUE ;
#line 252 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eSpawnEffect . betType = BET_CANNONSHOCKWAVE ;
#line 253 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
fSize = m_fBlowUpSize * 1.0f;
#line 254 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eSpawnEffect . vStretch = FLOAT3D (fSize , fSize , fSize );
#line 255 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
penExplosion -> Initialize (eSpawnEffect );
#line 258 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SwitchToEditorModel ();
#line 259 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetPhysicsFlags (EPF_MODEL_IMMATERIAL );
#line 260 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetCollisionFlags (ECF_IMMATERIAL );
#line 261 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 263 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
void CCannonRotating::PreMoving() {
#line 265 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
UpdateAttachmentRotations ();
#line 266 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CEnemyBase :: PreMoving ();
#line 267 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 269 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
void CCannonRotating::PostMoving() {
#line 270 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CEnemyBase :: PostMoving ();
#line 272 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetFlags (GetFlags () & ~ ENF_INRENDERING );
#line 273 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 276 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
BOOL CCannonRotating::AdjustShadingParameters(FLOAT3D & vLightDirection,COLOR & colLight,COLOR & colAmbient) {
#line 278 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CAttachmentModelObject & amo0 = * GetModelObject () -> GetAttachmentModel (TURRET_ATTACHMENT_ROTATORHEADING );
#line 279 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
amo0 . amo_plRelative . pl_OrientationAngle = Lerp (m_aBeginRotatorRotation , m_aEndRotatorRotation , _pTimer -> GetLerpFactor ());
#line 281 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CAttachmentModelObject & amo1 = * amo0 . amo_moModelObject . GetAttachmentModel (ROTATINGMECHANISM_ATTACHMENT_CANNON );
#line 282 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
amo1 . amo_plRelative . pl_OrientationAngle = Lerp (m_aBeginMuzzleRotation , m_aEndMuzzleRotation , _pTimer -> GetLerpFactor ());
#line 284 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return CEnemyBase :: AdjustShadingParameters (vLightDirection , colLight , colAmbient );
#line 285 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 288 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
void CCannonRotating::UpdateAttachmentRotations(void)
#line 289 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
{
#line 291 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_aBeginRotatorRotation = m_aEndRotatorRotation ;
#line 292 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_aEndRotatorRotation += m_fRotSpeedRotator * _pTimer -> TickQuantum ;
#line 294 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_aBeginMuzzleRotation = m_aEndMuzzleRotation ;
#line 295 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_aEndMuzzleRotation += m_fRotSpeedMuzzle * _pTimer -> TickQuantum ;
#line 296 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 298 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
void CCannonRotating::UpdateFiringPos() {
#line 299 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOATmatrix3D m ;
#line 301 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_vFiringPos = FIRING_POSITION_MUZZLE * m_fSize ;
#line 304 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
MakeRotationMatrixFast (m , m_aBeginRotatorRotation );
#line 305 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_vFiringPos = m_vFiringPos * m ;
#line 308 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
MakeRotationMatrixFast (m , m_aBeginMuzzleRotation );
#line 309 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_vFiringPos = m_vFiringPos * m ;
#line 312 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CAttachmentModelObject & amo0 = * GetModelObject () -> GetAttachmentModel (TURRET_ATTACHMENT_ROTATORHEADING );
#line 313 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CAttachmentModelObject & amo1 = * amo0 . amo_moModelObject . GetAttachmentModel (ROTATINGMECHANISM_ATTACHMENT_CANNON );
#line 314 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_vFiringPos += amo0 . amo_plRelative . pl_PositionVector + amo1 . amo_plRelative . pl_PositionVector ;
#line 315 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
BOOL CCannonRotating::
#line 319 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
MainLoop(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CCannonRotating_MainLoop
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CCannonRotating::MainLoop expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
#line 320 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetTimerAt(THINKTIME_NEVER);
Jump(STATE_CURRENT, 0x01590001, FALSE, EBegin());return TRUE;}BOOL CCannonRotating::H0x01590001_MainLoop_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590001
switch(__eeInput.ee_slEvent){case(EVENTCODE_EBegin):{const EBegin&e= (EBegin&)__eeInput;
#line 322 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Call(STATE_CURRENT, STATE_CCannonRotating_Scan, TRUE, EVoid());return TRUE;
#line 323 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return TRUE;
#line 324 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}ASSERT(FALSE);break;case(EVENTCODE_EDeactivate):{const EDeactivate&e= (EDeactivate&)__eeInput;
#line 326 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Jump(STATE_CURRENT, STATE_CCannonRotating_Inactive, TRUE, EVoid());return TRUE;
#line 327 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}ASSERT(FALSE);break;case(EVENTCODE_EDeath):{const EDeath&eDeath= (EDeath&)__eeInput;
#line 330 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Jump(STATE_CURRENT, STATE_CCannonRotating_Die, TRUE, eDeath );return TRUE;
#line 331 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}ASSERT(FALSE);break;default: return FALSE; break;
#line 332 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}return TRUE;}BOOL CCannonRotating::H0x01590002_MainLoop_02(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590002
;
#line 333 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Return(STATE_CURRENT,EVoid());
#line 333 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return TRUE; ASSERT(FALSE); return TRUE;};BOOL CCannonRotating::
#line 336 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Scan(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CCannonRotating_Scan
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CCannonRotating::Scan expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
#line 339 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Jump(STATE_CURRENT,0x0159000e, FALSE, EInternal());return TRUE;}BOOL CCannonRotating::H0x0159000e_Scan_11(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x0159000e
if(!(TRUE )){ Jump(STATE_CURRENT,0x0159000f, FALSE, EInternal());return TRUE;}
#line 340 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetTimerAfter(0.20f);
Jump(STATE_CURRENT, 0x01590004, FALSE, EBegin());return TRUE;}BOOL CCannonRotating::H0x01590004_Scan_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590004
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: return TRUE;case EVENTCODE_ETimer: Jump(STATE_CURRENT,0x01590005, FALSE, EInternal()); return TRUE;default: return FALSE; }}BOOL CCannonRotating::H0x01590005_Scan_02(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590005
;
#line 343 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
BOOL bPause = FALSE ;
#line 344 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(m_aBeginRotatorRotation (1) > (m_fScanAngle / 2.0f)){
#line 345 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fRotSpeedRotator = FLOAT3D (- m_fRotationSpeed , 0.0f , 0.0f);
#line 346 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(m_iMuzzleDir != - 1.0f){
#line 347 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_iMuzzleDir = - 1.0f;
#line 348 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
bPause = TRUE ;
#line 349 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 350 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}else if(m_aBeginRotatorRotation (1) < (- m_fScanAngle / 2.0f)){
#line 351 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fRotSpeedRotator = FLOAT3D (m_fRotationSpeed , 0.0f , 0.0f);
#line 352 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(m_iMuzzleDir != 1.0f){
#line 353 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_iMuzzleDir = 1.0f;
#line 354 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
bPause = TRUE ;
#line 355 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 356 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}else if(TRUE ){
#line 357 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fRotSpeedRotator = FLOAT3D (m_iMuzzleDir * m_fRotationSpeed , 0.0f , 0.0f);
#line 358 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 360 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(!(bPause )){ Jump(STATE_CURRENT,0x01590008, FALSE, EInternal());return TRUE;}
#line 361 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fRotSpeedRotator = FLOAT3D (0.0f , 0.0f , 0.0f);
#line 362 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetTimerAfter(0.5f);
Jump(STATE_CURRENT, 0x01590006, FALSE, EBegin());return TRUE;}BOOL CCannonRotating::H0x01590006_Scan_03(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590006
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: return TRUE;case EVENTCODE_ETimer: Jump(STATE_CURRENT,0x01590007, FALSE, EInternal()); return TRUE;default: return FALSE; }}BOOL CCannonRotating::H0x01590007_Scan_04(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590007
;Jump(STATE_CURRENT,0x01590008, FALSE, EInternal());return TRUE;}BOOL CCannonRotating::H0x01590008_Scan_05(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590008
#line 366 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CPlayer * pTarget = AcquireTarget ();
#line 367 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(!(pTarget )){ Jump(STATE_CURRENT,0x0159000d, FALSE, EInternal());return TRUE;}
#line 368 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(!((pTarget -> GetFlags () & ENF_ALIVE ) && ! (pTarget -> GetFlags () & ENF_DELETED ))){ Jump(STATE_CURRENT,0x0159000c, FALSE, EInternal());return TRUE;}
#line 370 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fRotSpeedRotator = FLOAT3D (0.0f , 0.0f , 0.0f);
#line 371 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_penEnemy = pTarget ;
#line 372 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fDistanceToPlayer = DistanceTo (this , pTarget );
#line 374 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(!(m_tmLastFireTime + m_fWaitAfterFire < _pTimer -> CurrentTick ())){ Jump(STATE_CURRENT,0x0159000b, FALSE, EInternal());return TRUE;}
#line 376 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
STATE_CCannonRotating_FireCannon, TRUE;
Jump(STATE_CURRENT, 0x01590009, FALSE, EBegin());return TRUE;}BOOL CCannonRotating::H0x01590009_Scan_06(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590009
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: Call(STATE_CURRENT, STATE_CCannonRotating_FireCannon, TRUE, EVoid());return TRUE;case EVENTCODE_EReturn: Jump(STATE_CURRENT,0x0159000a, FALSE, __eeInput); return TRUE;default: return FALSE; }}BOOL CCannonRotating::H0x0159000a_Scan_07(const CEntityEvent &__eeInput){
#undef STATE_CURRENT
#define STATE_CURRENT 0x0159000a
const EReturn&__e= (EReturn&)__eeInput;
;Jump(STATE_CURRENT,0x0159000b, FALSE, EInternal());return TRUE;}BOOL CCannonRotating::H0x0159000b_Scan_08(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x0159000b
Jump(STATE_CURRENT,0x0159000c, FALSE, EInternal());return TRUE;}BOOL CCannonRotating::H0x0159000c_Scan_09(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x0159000c
Jump(STATE_CURRENT,0x0159000d, FALSE, EInternal());return TRUE;}BOOL CCannonRotating::H0x0159000d_Scan_10(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x0159000d
Jump(STATE_CURRENT,0x0159000e, FALSE, EInternal());return TRUE;
#line 380 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}BOOL CCannonRotating::H0x0159000f_Scan_12(const CEntityEvent &__eeInput) {
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x0159000f
ASSERT(FALSE); return TRUE;};BOOL CCannonRotating::
#line 383 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Die(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CCannonRotating_Die
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EDeath, "CCannonRotating::Die expects 'EDeath' as input!"); const EDeath &eDeath = (const EDeath &)__eeInput;
#line 385 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetFlags (GetFlags () & ~ ENF_ALIVE );
#line 388 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CEntityPointer penKiller = eDeath . eLastDamage . penInflictor ;
#line 389 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(penKiller == NULL || ! IsOfClass (penKiller , "Player")){
#line 390 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
penKiller = m_penEnemy ;
#line 391 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 393 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(penKiller == NULL || ! IsOfClass (penKiller , "Player")){
#line 394 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
penKiller = FixupCausedToPlayer (this , penKiller , FALSE );
#line 395 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 398 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(penKiller != NULL ){
#line 400 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
EReceiveScore eScore ;
#line 401 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eScore . iPoints = m_iScore ;
#line 402 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
penKiller -> SendEvent (eScore );
#line 403 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(CountAsKill ())
#line 404 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
{
#line 405 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
penKiller -> SendEvent (EKilledEnemy ());
#line 406 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 408 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
EComputerMessage eMsg ;
#line 409 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eMsg . fnmMessage = GetComputerMessageName ();
#line 410 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(eMsg . fnmMessage != ""){
#line 411 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
penKiller -> SendEvent (eMsg );
#line 412 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 413 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 416 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SendToTarget (m_penDeathTarget , m_eetDeathType , penKiller );
#line 419 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(m_penSpawnerTarget ){
#line 420 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SendToTarget (m_penSpawnerTarget , EET_TRIGGER , this );
#line 421 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 424 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CannonBlowUp ();
#line 425 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Destroy ();
#line 426 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Return(STATE_CURRENT,EVoid());
#line 426 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return TRUE; ASSERT(FALSE); return TRUE;};BOOL CCannonRotating::
#line 429 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
RotateMuzzle(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CCannonRotating_RotateMuzzle
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CCannonRotating::RotateMuzzle expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
#line 431 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT fDeltaP = m_fDesiredMuzzlePitch - m_aBeginMuzzleRotation (2);
#line 434 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(Abs (fDeltaP ) < 5.0f){Return(STATE_CURRENT,EReturn ());return TRUE;}
#line 436 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fRotSpeedMuzzle = ANGLE3D (0.0f , MUZZLE_ROTATION_SPEED * Sgn (fDeltaP ) , 0.0f);
#line 438 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetTimerAfter(Abs (fDeltaP / MUZZLE_ROTATION_SPEED ));
Jump(STATE_CURRENT, 0x01590012, FALSE, EBegin());return TRUE;}BOOL CCannonRotating::H0x01590012_RotateMuzzle_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590012
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: return TRUE;case EVENTCODE_ETimer: Jump(STATE_CURRENT,0x01590013, FALSE, EInternal()); return TRUE;default: return FALSE; }}BOOL CCannonRotating::H0x01590013_RotateMuzzle_02(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590013
;
#line 439 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fRotSpeedMuzzle = ANGLE3D (0.0f , 0.0f , 0.0f);
#line 441 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Return(STATE_CURRENT,EReturn ());
#line 441 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return TRUE; ASSERT(FALSE); return TRUE;};BOOL CCannonRotating::
#line 444 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FireCannon(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CCannonRotating_FireCannon
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CCannonRotating::FireCannon expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
#line 446 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
UpdateFiringPos ();
#line 447 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vToTarget = m_penEnemy -> GetPlacement () . pl_PositionVector -
#line 448 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
GetPlacement () . pl_PositionVector + m_vFiringPos ;
#line 449 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
vToTarget . Normalize ();
#line 452 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vCannonFront = FLOAT3D (0.0f , 0.0f , - 1.0f) * GetRotationMatrix ();
#line 453 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOATmatrix3D m ;
#line 454 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
MakeRotationMatrixFast (m , m_aBeginRotatorRotation );
#line 455 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
vCannonFront = vCannonFront * m ;
#line 456 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
ANGLE aToPlayer = ACos (vToTarget % vCannonFront );
#line 457 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT fPitch = aToPlayer + 5.0f;
#line 458 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vCannonUp = FLOAT3D (0.0 , 1.0f , 0.0f) * GetRotationMatrix ();
#line 461 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(m_fDistanceToPlayer > m_fFiringRangeFar ){
#line 462 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Return(STATE_CURRENT,EReturn ());
#line 462 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return TRUE;
#line 464 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}else if(vToTarget % vCannonUp < 0.0f){
#line 465 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
fPitch = 5.0f;
#line 467 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}else if(m_fDistanceToPlayer > m_fFiringRangeClose ){
#line 468 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(aToPlayer < m_fMaxPitch ){
#line 469 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
fPitch = aToPlayer + m_fMaxPitch * (m_fDistanceToPlayer - m_fFiringRangeClose ) / (m_fFiringRangeFar - m_fFiringRangeClose );
#line 470 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}else if(TRUE ){
#line 471 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
fPitch = aToPlayer + 10.0f + m_fMaxPitch * (m_fDistanceToPlayer - m_fFiringRangeClose ) / (m_fFiringRangeFar - m_fFiringRangeClose );
#line 472 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 474 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
fPitch = Clamp (fPitch , 1.0f , 60.0f);
#line 475 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}
#line 477 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_vTarget = m_penEnemy -> GetPlacement () . pl_PositionVector ;
#line 479 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fDesiredMuzzlePitch = fPitch ;
#line 480 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
STATE_CCannonRotating_RotateMuzzle, TRUE;
Jump(STATE_CURRENT, 0x01590015, FALSE, EBegin());return TRUE;}BOOL CCannonRotating::H0x01590015_FireCannon_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590015
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: Call(STATE_CURRENT, STATE_CCannonRotating_RotateMuzzle, TRUE, EVoid());return TRUE;case EVENTCODE_EReturn: Jump(STATE_CURRENT,0x01590016, FALSE, __eeInput); return TRUE;default: return FALSE; }}BOOL CCannonRotating::H0x01590016_FireCannon_02(const CEntityEvent &__eeInput){
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590016
const EReturn&__e= (EReturn&)__eeInput;
;
#line 482 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vShooting = GetPlacement () . pl_PositionVector + m_vFiringPos ;
#line 483 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vSpeedDest = FLOAT3D (0.0f , 0.0f , 0.0f);
#line 484 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT fLaunchSpeed ;
#line 485 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT fRelativeHdg ;
#line 488 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
EntityInfo * peiTarget = (EntityInfo *) (m_penEnemy -> GetEntityInfo ());
#line 489 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CalculateAngularLaunchParams (vShooting , peiTarget -> vTargetCenter [ 1 ] - 6.0f / 3.0f , m_vTarget ,
#line 490 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
vSpeedDest , m_fDesiredMuzzlePitch , fLaunchSpeed , fRelativeHdg );
#line 493 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
FLOAT3D vShootTarget ;
#line 494 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
GetEntityInfoPosition (m_penEnemy , peiTarget -> vTargetCenter , vShootTarget );
#line 496 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CPlacement3D pl ;
#line 497 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
PrepareFreeFlyingProjectile (pl , vShootTarget , m_vFiringPos , ANGLE3D (fRelativeHdg , m_fDesiredMuzzlePitch , 0));
#line 498 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CEntityPointer penBall = CreateEntity (pl , CLASS_CANNONBALL );
#line 499 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
ELaunchCannonBall eLaunch ;
#line 500 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eLaunch . penLauncher = this ;
#line 501 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eLaunch . fLaunchPower = fLaunchSpeed ;
#line 502 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eLaunch . cbtType = CBT_IRON ;
#line 503 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
eLaunch . fSize = 1.0f;
#line 504 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
penBall -> Initialize (eLaunch );
#line 506 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_tmLastFireTime = _pTimer -> CurrentTick ();
#line 508 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Return(STATE_CURRENT,EReturn ());
#line 508 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
return TRUE; ASSERT(FALSE); return TRUE;};BOOL CCannonRotating::
#line 511 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Inactive(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CCannonRotating_Inactive
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CCannonRotating::Inactive expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
#line 513 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fRotSpeedMuzzle = ANGLE3D (0.0f , 0.0f , 0.0f);
#line 514 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fRotSpeedRotator = ANGLE3D (0.0f , 0.0f , 0.0f);
#line 515 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetTimerAt(THINKTIME_NEVER);
Jump(STATE_CURRENT, 0x01590018, FALSE, EBegin());return TRUE;}BOOL CCannonRotating::H0x01590018_Inactive_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590018
switch(__eeInput.ee_slEvent){case(EVENTCODE_EBegin):{const EBegin&e= (EBegin&)__eeInput;
return TRUE;}ASSERT(FALSE);break;case(EVENTCODE_EActivate):{const EActivate&e= (EActivate&)__eeInput;
#line 518 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Jump(STATE_CURRENT, STATE_CCannonRotating_MainLoop, TRUE, EVoid());return TRUE;
#line 519 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}ASSERT(FALSE);break;case(EVENTCODE_EDeath):{const EDeath&eDeath= (EDeath&)__eeInput;
#line 521 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Jump(STATE_CURRENT, STATE_CCannonRotating_Die, TRUE, eDeath );return TRUE;
#line 522 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}ASSERT(FALSE);break;default:{return TRUE;}ASSERT(FALSE);break;
#line 524 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
}return TRUE;}BOOL CCannonRotating::H0x01590019_Inactive_02(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x01590019
ASSERT(FALSE); return TRUE;};BOOL CCannonRotating::
#line 527 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Main(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT STATE_CCannonRotating_Main
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CCannonRotating::Main expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
#line 529 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
InitAsModel ();
#line 530 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetPhysicsFlags (EPF_MODEL_WALKING | EPF_HASLUNGS );
#line 531 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetCollisionFlags (ECF_MODEL );
#line 532 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetFlags (GetFlags () | ENF_ALIVE );
#line 533 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
en_fDensity = 2000.0f;
#line 536 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetModel (MODEL_TURRET );
#line 537 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetModelMainTexture (TEXTURE_TURRET );
#line 539 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
AddAttachment (TURRET_ATTACHMENT_ROTATORHEADING , MODEL_ROTATOR , TEXTURE_ROTATOR );
#line 540 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
CModelObject & amo0 = GetModelObject () -> GetAttachmentModel (TURRET_ATTACHMENT_ROTATORHEADING ) -> amo_moModelObject ;
#line 541 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
AddAttachmentToModel (this , amo0 , ROTATINGMECHANISM_ATTACHMENT_CANNON , MODEL_CANNON , TEXTURE_CANNON , 0 , 0 , 0);
#line 544 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fWalkSpeed = 0.0f;
#line 545 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_aWalkRotateSpeed = 0.0f;
#line 546 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fAttackRunSpeed = 0.0f;
#line 547 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_aAttackRotateSpeed = 0.0f;
#line 548 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fCloseRunSpeed = 0.0f;
#line 549 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_aCloseRotateSpeed = 0.0f;
#line 551 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fStopDistance = 100.0f;
#line 553 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fBlowUpAmount = 100.0f;
#line 554 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fBodyParts = 4;
#line 555 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fDamageWounded = 0.0f;
#line 556 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_iScore = 1000;
#line 557 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_sptType = SPT_WOOD ;
#line 560 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(m_fHealth <= 0.0f){m_fHealth = 1.0f;}
#line 561 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
m_fCloseFireTime = m_fAttackFireTime = m_fWaitAfterFire ;
#line 562 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetHealth (m_fHealth );m_fMaxHealth = m_fHealth ;
#line 563 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(m_fFiringRangeFar < m_fFiringRangeClose ){m_fFiringRangeFar = m_fFiringRangeClose + 1.0f;}
#line 566 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
GetModelObject () -> StretchModel (FLOAT3D (m_fSize , m_fSize , m_fSize ));
#line 568 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
ModelChangeNotify ();
#line 569 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
StandingAnim ();
#line 573 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetTimerAfter(0.05f);
Jump(STATE_CURRENT, 0x0159001a, FALSE, EBegin());return TRUE;}BOOL CCannonRotating::H0x0159001a_Main_01(const CEntityEvent &__eeInput) {
#undef STATE_CURRENT
#define STATE_CURRENT 0x0159001a
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: return TRUE;case EVENTCODE_ETimer: Jump(STATE_CURRENT,0x0159001b, FALSE, EInternal()); return TRUE;default: return FALSE; }}BOOL CCannonRotating::H0x0159001b_Main_02(const CEntityEvent &__eeInput){
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
#undef STATE_CURRENT
#define STATE_CURRENT 0x0159001b
;
#line 574 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
SetDesiredTranslation (FLOAT3D (0.0f , 0.0f , 0.0f));
#line 575 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
UpdateFiringPos ();
#line 577 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
if(! m_bActive ){Jump(STATE_CURRENT, STATE_CCannonRotating_Inactive, TRUE, EVoid());return TRUE;}
#line 578 "D:/SE1_GPL/Sources/EntitiesMP/CannonRotating.es"
Jump(STATE_CURRENT, STATE_CCannonRotating_MainLoop, TRUE, EVoid());return TRUE; ASSERT(FALSE); return TRUE;};