28 #ifndef GAME_GAME_ENEMY_H 29 #define GAME_GAME_ENEMY_H 31 #include "hpl1/engine/engine.h" 32 #include "hpl1/penumbra-overture/GameEntity.h" 34 #include "hpl1/penumbra-overture/CharacterMove.h" 46 #define STATE_ATTACK 2 48 #define STATE_KNOCKDOWN 4 50 #define STATE_PATROL 6 51 #define STATE_INVESTIGATE 7 52 #define STATE_BREAKDOOR 8 53 #define STATE_CALLBACKUP 9 54 #define STATE_MOVETO 10 56 #define STATE_ATTENTION 12 61 enum eEnemyMoveState {
62 eEnemyMoveState_Backward,
63 eEnemyMoveState_Stopped,
64 eEnemyMoveState_Walking,
65 eEnemyMoveState_Running,
66 eEnemyMoveState_LastEnum
99 float afMaxDistance = 10);
130 bool mbHasBeenActivated;
134 int mlCurrentPatrolNode;
136 float mfDisappearTime;
137 bool mbDisappearActive;
138 bool mbHasDisappeared;
160 virtual void OnUpdate(
float afTimeStep) = 0;
162 virtual void OnDraw() = 0;
163 virtual void OnPostSceneDraw() = 0;
165 virtual void OnSeePlayer(
const cVector3f &avPosition,
float afChance) = 0;
166 virtual bool OnHearNoise(
const cVector3f &avPosition,
float afVolume) = 0;
167 virtual void OnTakeHit(
float afDamage) = 0;
168 virtual void OnDeath(
float afDamage) = 0;
169 virtual void OnAnimationOver(
const tString &asAnimName) = 0;
170 virtual void OnFlashlight(
const cVector3f &avPosition) = 0;
172 void SetPreviousState(
int alX) { mlPreviousState = alX; }
173 int GetPreviousState() {
return mlPreviousState; }
175 int GetId() {
return mlId; }
201 void OnPlayerInteract();
207 void OnPostLoadScripts();
210 void OnPostSceneDraw();
211 virtual void ExtraPostSceneDraw() {}
213 void Update(
float afTimeStep);
215 bool IsLoading() {
return mbLoading; }
217 void OnDamage(
float afX);
218 void OnDeath(
float afX);
220 void OnFlashlight(
const cVector3f &avPos);
222 virtual void OnSetActive(
bool abX);
224 virtual bool MoveToPos(
const cVector3f &avFeetPos) = 0;
226 virtual void ShowPlayer(
const cVector3f &avPlayerFeetPos) {}
228 virtual bool IsFighting() {
return false; }
235 void SetFOV(
float afAngle) { mfFOV = afAngle; }
237 const tString &GetHitPS() {
return msHitPS; }
238 const tString &GetEnemyType() {
return msEnemyType; }
240 const tString &GetCloseMusic() {
return msCloseMusic; }
241 int GetCloseMusicPrio() {
return mlCloseMusicPrio; }
242 float GetCloseMusicStartDist() {
return mfCloseMusicStartDist; }
243 float GetCloseMusicStopDist() {
return mfCloseMusicStopDist; }
245 const tString &GetAttackMusic() {
return msAttackMusic; }
246 int GetAttackMusicPrio() {
return mlAttackMusicPrio; }
250 void ChangeState(
int alId);
252 int GetCurrentStateId() {
return mlCurrentState; }
257 eGameTriggerType GetTriggerTypes() {
return mTriggerTypes; }
259 float GetTriggerUpdateCount() {
return mfTriggerUpdateCount; }
260 void SetTriggerUpdateCount(
float afX) { mfTriggerUpdateCount = afX; }
261 float GetTriggerUpdateRate() {
return mfTriggerUpdateRate; }
263 void SetSkipSoundTriggerCount(
float afX) { mfSkipSoundTriggerCount = afX; }
266 void PlayAnim(
const tString &asName,
bool abLoop,
float afFadeTime,
267 bool abDependsOnSpeed =
false,
float afSpeedMul = 1.0f,
268 bool abSyncWithPrevFrame =
false,
269 bool abOverideMoveState =
true);
270 void UseMoveStateAnimations();
274 void PlaySound(
const tString &asName);
277 void SetOnDeathCallback(
const tString &asFunc) { msOnDeathCallback = asFunc; }
278 void SetOnAttackCallback(
const tString &asFunc) { msOnAttackCallback = asFunc; }
279 tString GetOnAttackCallback() {
return msOnAttackCallback; }
284 cVector3f GetLastPlayerPos() {
return mvLastPlayerPos; }
285 void SetLastPlayerPos(
const cVector3f &avPos) { mvLastPlayerPos = avPos; }
287 void SetTempPosition(
const cVector3f &avPos) { mvTempPosition = avPos; }
288 cVector3f GetTempPosition() {
return mvTempPosition; }
290 void SetTempFloat(
float afX) { mfTempFloat = afX; }
291 float GetTempFloat() {
return mfTempFloat; }
298 bool CheckForTeamMate(
float afMaxDist,
bool abCheckIfFighting);
300 bool IsAttracted() {
return mbIsAttracted; }
301 void SetAttracted(
bool abX) { mbIsAttracted = abX; }
303 bool GetUsesTriggers() {
return mbUsesTriggers; }
304 void SetUsesTriggers(
bool abX) { mbUsesTriggers = abX; }
307 void AddPatrolNode(
const tString &asNode,
float afTime,
const tString &asAnimation);
308 cEnemyPatrolNode *GetPatrolNode(
int alIdx) {
return &mvPatrolNodes[alIdx]; }
309 int GetPatrolNodeNum() {
return (
int)mvPatrolNodes.size(); }
310 cEnemyPatrolNode *CurrentPatrolNode() {
return &mvPatrolNodes[mlCurrentPatrolNode]; }
312 void ClearPatrolNodes();
314 int GetCurrentPatrolNode() {
return mlCurrentPatrolNode; }
315 float GetWaitTime() {
return mfWaitTime; }
316 float GetWaitTimeCount() {
return mfWaitTimeCount; }
318 void SetCurrentPatrolNode(
int alX) { mlCurrentPatrolNode = alX; }
319 void IncCurrentPatrolNode() {
320 mlCurrentPatrolNode++;
321 if (mlCurrentPatrolNode >= (
int)mvPatrolNodes.size())
322 mlCurrentPatrolNode = 0;
324 void SetWaitTime(
float afX) { mfWaitTime = afX; }
325 void SetWaitTimeCount(
float afX) { mfWaitTimeCount = afX; }
326 void AddWaitTimeCount(
float afX) { mfWaitTimeCount += afX; }
328 float GetDoorBreakCount() {
return mfDoorBreakCount; }
329 void SetDoorBreakCount(
float afX) { mfDoorBreakCount = afX; }
330 void AddDoorBreakCount(
float afX) { mfDoorBreakCount += afX; }
332 const cVector3f &GetModelOffsetAngles() {
return mvModelOffsetAngles; }
335 virtual void OnUpdate(
float afTimeStep) = 0;
336 virtual void OnLoad() = 0;
344 void UpdateEnemyPose(
float afTimeStep);
346 void UpdateAnimations(
float afTimeStep);
347 void UpdateCheckForPlayer(
float afTimeStep);
353 bool mbSetFeetAtGroundOnStart;
354 bool mbAttachMeshToBody;
355 bool mbRemoveAttackerOnDisable;
362 eGameTriggerType mTriggerTypes;
368 float mfTriggerUpdateCount;
369 float mfTriggerUpdateRate;
371 float mfSkipSoundTriggerCount;
386 bool mbAnimationIsSpeedDependant;
387 float mfAnimationSpeedMul;
389 bool mbOverideMoveState;
390 eEnemyMoveState mMoveState;
399 bool mbAlignToGroundNormal;
404 bool mbHasBeenActivated;
411 float mfCanSeePlayerCount;
412 float mfCheckForPlayerCount;
413 float mfCheckForPlayerRate;
415 int mlPlayerInLOSCount;
416 int mlMaxPlayerInLOSCount;
418 float mfCalcPlayerHiddenPosCount;
420 float mfDamageSoundTimer;
427 int mlCurrentPatrolNode;
429 float mfWaitTimeCount;
431 float mfDoorBreakCount;
438 float mfDisappearMinTime;
439 float mfDisappearMaxTime;
440 float mfDisappearMinDistance;
443 bool mbDisappearFreezesRagdoll;
445 float mfDisappearTime;
446 bool mbDisappearActive;
447 bool mbHasDisappeared;
450 int mlCloseMusicPrio;
451 float mfCloseMusicStartDist;
452 float mfCloseMusicStopDist;
455 int mlAttackMusicPrio;
464 float mfMaxForwardSpeed;
465 float mfMaxBackwardSpeed;
467 float mfAcceleration;
468 float mfDeacceleration;
470 float mfMaxTurnSpeed;
471 float mfAngleDistTurnMul;
473 float mfMinBreakAngle;
474 float mfBreakAngleMul;
476 float mfSpeedMoveAnimMul;
477 float mfTurnSpeedMoveAnimMul;
482 float mfIdleToMoveLimit;
483 float mfMoveToLideLimit;
490 float mfMinAttackDist;
497 float mfStoppedToWalkSpeed;
498 float mfWalkToStoppedSpeed;
499 float mfWalkToRunSpeed;
500 float mfRunToWalkSpeed;
501 float mfMoveAnimSpeedMul;
507 float mfMinStunSpeed;
508 float mfMinStunImpulse;
509 float mfObjectCollideStun;
510 float mfStunDamageMul;
532 #endif // GAME_GAME_ENEMY_H
Definition: PhysicsWorld.h:92
Definition: GameEnemy.h:95
Definition: GameEnemy.h:126
Definition: GameEnemy.h:113
Definition: TriggerHandler.h:42
Definition: PhysicsWorld.h:100
Definition: AnimationState.h:80
Definition: SerializeClass.h:230
Definition: GameEntity.h:76
Definition: PhysicsBody.h:117
Definition: World3D.h:179
Definition: AINodeContainer.h:158
Definition: EntityLoader_Object.h:52
Definition: tinyxml.h:864
Definition: GameEnemy.h:152
Definition: CharacterMove.h:69
Definition: GameEnemy.h:189
Definition: GameEntity.h:126
Definition: GameEnemy.h:71
Definition: GameEnemy.h:517
Definition: GameEnemy.h:82