mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-25 19:55:54 +01:00
281 lines
14 KiB
C++
281 lines
14 KiB
C++
/*
|
|
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
|
|
*/
|
|
|
|
#line 6 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
|
|
#include "StdH.h"
|
|
#include "ModelsMP/Enemies/AirElemental/ShockwaveBase.h"
|
|
#include "ModelsMP/Enemies/AirElemental/Shockwave.h"
|
|
|
|
#include <EntitiesMP/AirShockwave.h>
|
|
#include <EntitiesMP/AirShockwave_tables.h>
|
|
CEntityEvent *EAirShockwave::MakeCopy(void) { CEntityEvent *peeCopy = new EAirShockwave(*this); return peeCopy;}
|
|
EAirShockwave::EAirShockwave() : CEntityEvent(EVENTCODE_EAirShockwave) {;
|
|
ClearToDefault(penLauncher);
|
|
ClearToDefault(fHeight);
|
|
ClearToDefault(fEndWidth);
|
|
ClearToDefault(fDuration);
|
|
};
|
|
#line 22 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
|
|
// shockwave
|
|
#define ECF_SHOCKAWAVE ( \
|
|
((ECBI_BRUSH|ECBI_MODEL|ECBI_CORPSE|ECBI_ITEM|ECBI_PROJECTILE_MAGIC|ECBI_PROJECTILE_SOLID)<<ECB_TEST) |\
|
|
((ECBI_BRUSH|ECBI_MODEL|ECBI_CORPSE|ECBI_ITEM|ECBI_PROJECTILE_MAGIC|ECBI_PROJECTILE_SOLID)<<ECB_PASS) |\
|
|
((ECBI_MODEL)<<ECB_IS))
|
|
#define EPF_SHOCKAWAVE ( \
|
|
EPF_ONBLOCK_STOP|EPF_ORIENTEDBYGRAVITY|EPF_ABSOLUTETRANSLATE)
|
|
|
|
#define SHOCKWAVE_HEIGHT 5.0f
|
|
#define SHOCKWAVE_WIDTH 0.1f
|
|
|
|
|
|
void CAirShockwave::SetDefaultProperties(void) {
|
|
m_penLauncher = NULL;
|
|
m_fHeight = 0.0f;
|
|
m_fEndWidth = 0.0f;
|
|
m_tmBegin = 0.0f;
|
|
m_tmEnd = 0.0f;
|
|
m_fDuration = 0.0f;
|
|
m_bGrowing = FALSE ;
|
|
m_tmLastGrow = 0.0f;
|
|
m_fFadeStartTime = 0.0f;
|
|
m_fFadeStartPercent = 0.6f;
|
|
m_fStretchY = 0.0f;
|
|
m_fBeginStretchXZ = 0.0f;
|
|
m_fEndStretchXZ = 0.0f;
|
|
m_boxMaxSize = FLOATaabbox3D(FLOAT3D (0 , 0 , 0) , FLOAT3D (1 , 1 , 1));
|
|
m_bFadeOut = FALSE ;
|
|
CMovableModelEntity::SetDefaultProperties();
|
|
}
|
|
|
|
#line 71 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
CModelObject * CAirShockwave::ShockwaveModel(void) {
|
|
#line 72 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
CAttachmentModelObject & amo0 = * GetModelObject () -> GetAttachmentModel (SHOCKWAVEBASE_ATTACHMENT_SHOCKWAVE );
|
|
#line 73 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
return & (amo0 . amo_moModelObject );
|
|
#line 74 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}
|
|
|
|
#line 77 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
BOOL CAirShockwave::AdjustShadingParameters(FLOAT3D & vLightDirection,COLOR & colLight,COLOR & colAmbient) {
|
|
#line 79 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
if(m_bGrowing ){
|
|
#line 80 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOAT3D vSize ;
|
|
#line 81 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOAT fLifeTime = _pTimer -> GetLerpedCurrentTick () - m_tmBegin ;
|
|
#line 82 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
vSize (1) = (fLifeTime / m_fDuration ) * (m_fEndStretchXZ - m_fBeginStretchXZ ) + m_fBeginStretchXZ ;
|
|
#line 83 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
vSize (2) = m_fStretchY ;
|
|
#line 84 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
vSize (3) = vSize (1);
|
|
#line 86 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
ShockwaveModel () -> StretchModel (vSize );
|
|
#line 89 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
if((fLifeTime / m_fDuration ) > m_fFadeStartPercent && ! m_bFadeOut ){
|
|
#line 90 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_bFadeOut = TRUE ;
|
|
#line 91 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_fFadeStartTime = _pTimer -> GetLerpedCurrentTick ();
|
|
#line 92 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}
|
|
#line 95 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_tmLastGrow = _pTimer -> GetLerpedCurrentTick ();
|
|
#line 96 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}
|
|
#line 99 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
if(m_bFadeOut ){
|
|
#line 100 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOAT fTimeRemain = m_tmEnd - _pTimer -> GetLerpedCurrentTick ();
|
|
#line 101 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOAT fFadeTime = (1 - m_fFadeStartPercent ) * m_fDuration ;
|
|
#line 102 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
if(fTimeRemain < 0.0f){fTimeRemain = 0.0f;}
|
|
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
COLOR colAlpha = ShockwaveModel () -> mo_colBlendColor ;
|
|
#line 104 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
colAlpha = (colAlpha & 0xffffff00) + (COLOR (fTimeRemain / fFadeTime * 0xff) & 0xff);
|
|
#line 105 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
ShockwaveModel () -> mo_colBlendColor = colAlpha ;
|
|
#line 106 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}
|
|
#line 107 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
return CMovableModelEntity :: AdjustShadingParameters (vLightDirection , colLight , colAmbient );
|
|
#line 108 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}
|
|
|
|
#line 112 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
void CAirShockwave::LaunchEntity(CEntity * pen) {
|
|
#line 114 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
if(IsOfClass (pen , "AirElemental") || IsOfClass (pen , "Twister")
|
|
#line 115 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
|| IsDerivedFromClass (pen , "Item") || IsOfClass (pen , "AirShockwave")){
|
|
#line 116 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
return ;
|
|
#line 117 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}
|
|
#line 118 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
if(pen -> GetPhysicsFlags () & EPF_MOVABLE ){
|
|
#line 119 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOAT3D vSpeed ;
|
|
#line 120 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
vSpeed = pen -> GetPlacement () . pl_PositionVector - GetPlacement () . pl_PositionVector ;
|
|
#line 121 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
if(vSpeed (2) < vSpeed . Length () * 0.5f){vSpeed (2) = vSpeed . Length () * 0.5f;}
|
|
#line 122 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
vSpeed . Normalize ();
|
|
#line 123 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
vSpeed = vSpeed * 50.0f;
|
|
#line 124 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
((CMovableEntity &) * pen ) . GiveImpulseTranslationAbsolute (vSpeed );
|
|
#line 125 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}
|
|
#line 126 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}
|
|
|
|
#line 128 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
void CAirShockwave::TestForCollisionAndLaunchEntity() {
|
|
#line 130 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
static CStaticStackArray < CEntity * > apenNearEntities ;
|
|
#line 131 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOAT fLifeTime = _pTimer -> CurrentTick () - m_tmBegin ;
|
|
#line 132 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOAT fCurrentRadius = Lerp (SHOCKWAVE_WIDTH , m_fEndWidth , fLifeTime / m_fDuration ) / 2.0f;
|
|
#line 134 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOATaabbox3D m_boxCurrent = m_boxMaxSize ;
|
|
#line 135 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_boxCurrent += GetPlacement () . pl_PositionVector ;
|
|
#line 138 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOAT fBeltWidth = m_fEndWidth * _pTimer -> TickQuantum * 2.0f / m_fDuration ;
|
|
#line 140 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
GetWorld () -> FindEntitiesNearBox (m_boxCurrent , apenNearEntities );
|
|
#line 141 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
for(INDEX i = 0;i < apenNearEntities . Count ();i ++)
|
|
#line 142 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
{
|
|
#line 143 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOAT fDistance = DistanceTo (this , apenNearEntities [ i ]);
|
|
#line 144 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOATaabbox3D m_boxEntity ;
|
|
#line 145 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
apenNearEntities [ i ] -> GetBoundingBox (m_boxEntity );
|
|
#line 146 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
if(fDistance < (fCurrentRadius + fBeltWidth / 2.0f) && fDistance > (fCurrentRadius - fBeltWidth / 2.0f) &&
|
|
#line 147 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_boxEntity . HasContactWith (m_boxCurrent )){
|
|
#line 148 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
LaunchEntity (apenNearEntities [ i ]);
|
|
#line 149 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}
|
|
#line 150 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}
|
|
#line 152 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
CMovableModelEntity :: PreMoving ();
|
|
#line 153 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}
|
|
BOOL CAirShockwave::
|
|
#line 158 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
Main(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT STATE_CAirShockwave_Main
|
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EAirShockwave, "CAirShockwave::Main expects 'EAirShockwave' as input!"); const EAirShockwave &eas = (const EAirShockwave &)__eeInput;
|
|
#line 160 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
ASSERT (eas . penLauncher != NULL );
|
|
#line 161 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
ASSERT (eas . fHeight > 0.0f);
|
|
#line 162 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
ASSERT (eas . fEndWidth > 0.1f);
|
|
#line 163 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
ASSERT (eas . fDuration > 0.0f);
|
|
#line 164 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_penLauncher = eas . penLauncher ;
|
|
#line 165 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_fHeight = eas . fHeight ;
|
|
#line 166 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_fEndWidth = eas . fEndWidth ;
|
|
#line 167 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_fDuration = eas . fDuration ;
|
|
#line 170 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_fStretchY = m_fHeight / SHOCKWAVE_HEIGHT ;
|
|
#line 171 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_fBeginStretchXZ = 1.0f;
|
|
#line 172 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_fEndStretchXZ = m_fEndWidth / SHOCKWAVE_WIDTH ;
|
|
#line 174 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOAT3D v1 = FLOAT3D (- m_fEndWidth / 2.0f , 0.0f , - m_fEndWidth / 2.0f);
|
|
#line 175 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
FLOAT3D v2 = FLOAT3D (+ m_fEndWidth / 2.0f , m_fHeight , + m_fEndWidth / 2.0f);
|
|
#line 176 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_boxMaxSize = FLOATaabbox3D (v1 , v2 );
|
|
#line 179 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
InitAsModel ();
|
|
#line 180 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
SetPhysicsFlags (EPF_SHOCKAWAVE );
|
|
#line 181 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
SetCollisionFlags (ECF_SHOCKAWAVE );
|
|
#line 182 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
SetFlags (GetFlags () | ENF_SEETHROUGH );
|
|
#line 185 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
SetModel (MODEL_INVISIBLE );
|
|
#line 186 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
AddAttachmentToModel (this , * GetModelObject () , SHOCKWAVEBASE_ATTACHMENT_SHOCKWAVE , MODEL_SHOCKWAVE , TEXTURE_SHOCKWAVE , 0 , 0 , 0);
|
|
#line 187 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
GetModelObject () -> StretchModel (FLOAT3D (1.0f , 1.0f , 1.0f));
|
|
#line 188 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
ModelChangeNotify ();
|
|
#line 189 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
ShockwaveModel () -> StretchModel (FLOAT3D (m_fBeginStretchXZ , m_fStretchY , m_fBeginStretchXZ ));
|
|
#line 191 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
SetTimerAfter(_pTimer -> TickQuantum );
|
|
Jump(STATE_CURRENT, 0x015d0001, FALSE, EBegin());return TRUE;}BOOL CAirShockwave::H0x015d0001_Main_01(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x015d0001
|
|
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: return TRUE;case EVENTCODE_ETimer: Jump(STATE_CURRENT,0x015d0002, FALSE, EInternal()); return TRUE;default: return FALSE; }}BOOL CAirShockwave::H0x015d0002_Main_02(const CEntityEvent &__eeInput){
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x015d0002
|
|
;
|
|
#line 193 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_tmBegin = _pTimer -> CurrentTick ();
|
|
#line 194 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_tmEnd = m_tmBegin + m_fDuration ;
|
|
#line 195 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_tmLastGrow = _pTimer -> CurrentTick ();
|
|
#line 196 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
m_bGrowing = TRUE ;
|
|
#line 198 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
Jump(STATE_CURRENT,0x015d0005, FALSE, EInternal());return TRUE;}BOOL CAirShockwave::H0x015d0005_Main_05(const CEntityEvent &__eeInput)
|
|
#line 199 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
{
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x015d0005
|
|
if(!(_pTimer -> CurrentTick () < m_tmEnd )){ Jump(STATE_CURRENT,0x015d0006, FALSE, EInternal());return TRUE;}
|
|
#line 200 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
SetTimerAfter(_pTimer -> TickQuantum );
|
|
Jump(STATE_CURRENT, 0x015d0003, FALSE, EBegin());return TRUE;}BOOL CAirShockwave::H0x015d0003_Main_03(const CEntityEvent &__eeInput) {
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x015d0003
|
|
switch(__eeInput.ee_slEvent) {case EVENTCODE_EBegin: return TRUE;case EVENTCODE_ETimer: Jump(STATE_CURRENT,0x015d0004, FALSE, EInternal()); return TRUE;default: return FALSE; }}BOOL CAirShockwave::H0x015d0004_Main_04(const CEntityEvent &__eeInput){
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x015d0004
|
|
;
|
|
#line 201 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
TestForCollisionAndLaunchEntity ();Jump(STATE_CURRENT,0x015d0005, FALSE, EInternal());return TRUE;
|
|
#line 202 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
}BOOL CAirShockwave::H0x015d0006_Main_06(const CEntityEvent &__eeInput) {
|
|
ASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);
|
|
#undef STATE_CURRENT
|
|
#define STATE_CURRENT 0x015d0006
|
|
|
|
#line 204 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
Destroy ();
|
|
#line 205 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
Return(STATE_CURRENT,EVoid());
|
|
#line 205 "D:/SE1_GPL/Sources/EntitiesMP/AirShockwave.es"
|
|
return TRUE; ASSERT(FALSE); return TRUE;}; |