mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-26 04:05:53 +01:00
289 lines
12 KiB
C++
289 lines
12 KiB
C++
|
/*
|
||
|
* This file is generated by Entity Class Compiler, (c) CroTeam 1997-98
|
||
|
*/
|
||
|
|
||
|
#line 4 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
|
||
|
#include "StdH.h"
|
||
|
|
||
|
#include <EntitiesMP/EnemyDive.h>
|
||
|
#include <EntitiesMP/EnemyDive_tables.h>
|
||
|
void CEnemyDive::SetDefaultProperties(void) {
|
||
|
m_EedtType = EDT_DIVE_ONLY ;
|
||
|
m_bInLiquid = TRUE ;
|
||
|
m_fDiveWalkSpeed = 1.0f;
|
||
|
m_aDiveWalkRotateSpeed = AngleDeg(10.0f);
|
||
|
m_fDiveAttackRunSpeed = 1.0f;
|
||
|
m_aDiveAttackRotateSpeed = AngleDeg(10.0f);
|
||
|
m_fDiveCloseRunSpeed = 1.0f;
|
||
|
m_aDiveCloseRotateSpeed = AngleDeg(10.0f);
|
||
|
m_fDiveAttackDistance = 50.0f;
|
||
|
m_fDiveCloseDistance = 10.0f;
|
||
|
m_fDiveAttackFireTime = 2.0f;
|
||
|
m_fDiveCloseFireTime = 1.0f;
|
||
|
m_fDiveStopDistance = 0.0f;
|
||
|
m_fDiveIgnoreRange = 200.0f;
|
||
|
m_fDiveLockOnEnemyTime = 0.0f;
|
||
|
CEnemyBase::SetDefaultProperties();
|
||
|
}
|
||
|
FLOAT & CEnemyDive::GetProp(FLOAT & m_fBase)
|
||
|
#line 50 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
{
|
||
|
#line 51 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
if(m_bInLiquid ){
|
||
|
#line 52 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return * ((& m_fBase ) + (& m_fDiveWalkSpeed - & m_fWalkSpeed ));
|
||
|
#line 53 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}else {
|
||
|
#line 54 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return m_fBase ;
|
||
|
#line 55 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
#line 56 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
|
||
|
#line 59 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
void CEnemyDive::StartPathFinding(void)
|
||
|
#line 60 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
{
|
||
|
#line 61 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_dtDestination = DT_PLAYERSPOTTED ;
|
||
|
#line 62 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_vPlayerSpotted = PlayerDestinationPos ();
|
||
|
#line 63 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
void CEnemyDive::AdjustDifficulty(void)
|
||
|
#line 66 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
{
|
||
|
#line 67 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
FLOAT fMoveSpeed = GetSP () -> sp_fEnemyMovementSpeed ;
|
||
|
#line 68 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
FLOAT fAttackSpeed = GetSP () -> sp_fEnemyMovementSpeed ;
|
||
|
#line 71 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_fDiveAttackRunSpeed *= fMoveSpeed ;
|
||
|
#line 72 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_aDiveAttackRotateSpeed *= fMoveSpeed ;
|
||
|
#line 73 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_fDiveCloseRunSpeed *= fMoveSpeed ;
|
||
|
#line 74 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_aDiveCloseRotateSpeed *= fMoveSpeed ;
|
||
|
#line 75 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_fDiveAttackFireTime *= 1 / fAttackSpeed ;
|
||
|
#line 76 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_fDiveCloseFireTime *= 1 / fAttackSpeed ;
|
||
|
#line 77 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_fDiveLockOnEnemyTime *= 1 / fAttackSpeed ;
|
||
|
#line 79 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
CEnemyBase :: AdjustDifficulty ();
|
||
|
#line 80 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
BOOL CEnemyDive::CanHitEnemy(CEntity * penTarget,FLOAT fCosAngle) {
|
||
|
#line 83 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
if(IsInPlaneFrustum (penTarget , fCosAngle )){
|
||
|
#line 84 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return IsVisibleCheckAll (penTarget );
|
||
|
#line 85 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
#line 86 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return FALSE ;
|
||
|
#line 87 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
|
||
|
#line 91 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
void CEnemyDive::PostMoving(void) {
|
||
|
#line 92 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
CEnemyBase :: PostMoving ();
|
||
|
#line 94 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
if(m_EedtType != EDT_GROUND_ONLY && ! m_bInLiquid && en_fImmersionFactor > 0.9f &&
|
||
|
#line 95 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
(GetWorld () -> wo_actContentTypes [ en_iDnContent ] . ct_ulFlags & CTF_SWIMABLE )){
|
||
|
#line 96 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_bInLiquid = TRUE ;
|
||
|
#line 97 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
ChangeCollisionToLiquid ();
|
||
|
#line 98 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
SendEvent (ERestartAttack ());
|
||
|
#line 99 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
#line 101 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
if(m_EedtType != EDT_DIVE_ONLY && m_bInLiquid && (en_fImmersionFactor < 0.5f || en_fImmersionFactor == 1.0f) &&
|
||
|
#line 102 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
en_penReference != NULL && ! (GetWorld () -> wo_actContentTypes [ en_iUpContent ] . ct_ulFlags & CTF_SWIMABLE )){
|
||
|
#line 103 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_bInLiquid = FALSE ;
|
||
|
#line 104 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
ChangeCollisionToGround ();
|
||
|
#line 105 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
SendEvent (ERestartAttack ());
|
||
|
#line 106 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
#line 107 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
ULONG CEnemyDive::SetDesiredMovement(void)
|
||
|
#line 117 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
{
|
||
|
#line 119 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
if(! m_bInLiquid ){
|
||
|
#line 121 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return CEnemyBase :: SetDesiredMovement ();
|
||
|
#line 122 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
#line 125 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
ULONG ulFlags = CEnemyBase :: SetDesiredMovement ();
|
||
|
#line 128 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
if(m_fMoveSpeed > 0.0f){
|
||
|
#line 130 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
FLOAT3D vTranslation = (m_vDesiredPosition - GetPlacement () . pl_PositionVector ) * ! en_mRotation ;
|
||
|
#line 131 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
vTranslation (1) = 0.0f;
|
||
|
#line 132 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
if(vTranslation (3) > 0){
|
||
|
#line 133 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
vTranslation (3) = 0.0f;
|
||
|
#line 134 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
#line 135 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
vTranslation . Normalize ();
|
||
|
#line 136 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
vTranslation *= m_fMoveSpeed ;
|
||
|
#line 137 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
SetDesiredTranslation (vTranslation );
|
||
|
#line 138 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
#line 140 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return ulFlags ;
|
||
|
#line 141 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
|
||
|
#line 144 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
BOOL CEnemyDive::MayMoveToAttack(void)
|
||
|
#line 145 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
{
|
||
|
#line 146 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return WouldNotLeaveAttackRadius ();
|
||
|
#line 147 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
|
||
|
#line 153 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
void CEnemyDive::SetEntityPosition() {
|
||
|
#line 154 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
switch(m_EedtType ){
|
||
|
#line 155 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
case EDT_GROUND_ONLY :
|
||
|
#line 156 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_bInLiquid = FALSE ;
|
||
|
#line 157 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
break ;
|
||
|
#line 158 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
case EDT_DIVE_ONLY :
|
||
|
#line 159 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
m_bInLiquid = TRUE ;
|
||
|
#line 160 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
break ;
|
||
|
#line 161 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
case EDT_GROUND_DIVE :
|
||
|
#line 162 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
break ;
|
||
|
#line 163 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
#line 166 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
if(m_bInLiquid ){
|
||
|
#line 167 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
ChangeCollisionToLiquid ();
|
||
|
#line 168 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}else {
|
||
|
#line 169 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
ChangeCollisionToGround ();
|
||
|
#line 170 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
#line 172 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
StandingAnim ();
|
||
|
#line 173 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}
|
||
|
void CEnemyDive::ChangeCollisionToLiquid(void) {}
|
||
|
void CEnemyDive::ChangeCollisionToGround(void) {}
|
||
|
BOOL CEnemyDive::
|
||
|
#line 192 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Hit(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CEnemyDive_Hit
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CEnemyDive::Hit expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 194 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
if(m_bInLiquid ){
|
||
|
#line 195 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Jump(STATE_CURRENT, STATE_CEnemyDive_DiveHit, TRUE, EVoid());return TRUE;
|
||
|
#line 196 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}else {
|
||
|
#line 197 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Jump(STATE_CURRENT, STATE_CEnemyDive_GroundHit, TRUE, EVoid());return TRUE;
|
||
|
#line 198 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
} ASSERT(FALSE); return TRUE;};BOOL CEnemyDive::
|
||
|
#line 202 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Fire(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CEnemyDive_Fire
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CEnemyDive::Fire expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 204 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
if(m_bInLiquid ){
|
||
|
#line 205 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Jump(STATE_CURRENT, STATE_CEnemyDive_DiveFire, TRUE, EVoid());return TRUE;
|
||
|
#line 206 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
}else {
|
||
|
#line 207 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Jump(STATE_CURRENT, STATE_CEnemyDive_GroundFire, TRUE, EVoid());return TRUE;
|
||
|
#line 208 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
} ASSERT(FALSE); return TRUE;};BOOL CEnemyDive::
|
||
|
#line 215 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
MainLoop(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CEnemyDive_MainLoop
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CEnemyDive::MainLoop expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 216 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
SetEntityPosition ();
|
||
|
#line 217 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Jump(STATE_CURRENT, STATE_CEnemyBase_MainLoop, FALSE, EVoid());return TRUE; ASSERT(FALSE); return TRUE;};BOOL CEnemyDive::
|
||
|
#line 221 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Main(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CEnemyDive_Main
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CEnemyDive::Main expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 222 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Return(STATE_CURRENT,EVoid());
|
||
|
#line 222 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return TRUE; ASSERT(FALSE); return TRUE;};BOOL CEnemyDive::
|
||
|
#line 231 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
GroundHit(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CEnemyDive_GroundHit
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CEnemyDive::GroundHit expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 233 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Return(STATE_CURRENT,EReturn ());
|
||
|
#line 233 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return TRUE; ASSERT(FALSE); return TRUE;};BOOL CEnemyDive::
|
||
|
#line 236 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
GroundFire(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CEnemyDive_GroundFire
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CEnemyDive::GroundFire expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 238 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Return(STATE_CURRENT,EReturn ());
|
||
|
#line 238 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return TRUE; ASSERT(FALSE); return TRUE;};BOOL CEnemyDive::
|
||
|
#line 242 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
DiveHit(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CEnemyDive_DiveHit
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CEnemyDive::DiveHit expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 244 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Return(STATE_CURRENT,EReturn ());
|
||
|
#line 244 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return TRUE; ASSERT(FALSE); return TRUE;};BOOL CEnemyDive::
|
||
|
#line 248 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
DiveFire(const CEntityEvent &__eeInput) {
|
||
|
#undef STATE_CURRENT
|
||
|
#define STATE_CURRENT STATE_CEnemyDive_DiveFire
|
||
|
ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_EVoid, "CEnemyDive::DiveFire expects 'EVoid' as input!"); const EVoid &e = (const EVoid &)__eeInput;
|
||
|
#line 250 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
Return(STATE_CURRENT,EReturn ());
|
||
|
#line 250 "D:/SE1_GPL/Sources/EntitiesMP/EnemyDive.es"
|
||
|
return TRUE; ASSERT(FALSE); return TRUE;};
|