ScummVM API documentation
GameEnemy_Spider.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of Penumbra Overture.
26  */
27 
28 #ifndef GAME_GAME_ENEMY_SPIDER_H
29 #define GAME_GAME_ENEMY_SPIDER_H
30 
31 #include "hpl1/engine/engine.h"
32 #include "hpl1/penumbra-overture/GameEnemy.h"
33 
34 using namespace hpl;
35 
36 //-----------------------------------------
37 
38 class cGameEnemy_Spider;
39 
40 // BASE STATE
42 public:
43  iGameEnemyState_Spider_Base(int alId, cInit *apInit, iGameEnemy *apEnemy);
44 
45  virtual void OnSeePlayer(const cVector3f &avPosition, float afChance);
46  virtual bool OnHearNoise(const cVector3f &avPosition, float afVolume);
47  virtual void OnTakeHit(float afDamage);
48  virtual void OnDeath(float afDamage);
49  virtual void OnFlashlight(const cVector3f &avPosition);
50 
51  virtual void OnAnimationOver(const tString &asAnimName) {}
52 
53  virtual void OnDraw() {}
54  virtual void OnPostSceneDraw() {}
55 
56 protected:
57  cGameEnemy_Spider *mpEnemySpider;
58 };
59 
60 //-----------------------------------------
61 
62 // IDLE STATE
64 public:
65  cGameEnemyState_Spider_Idle(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Spider_Base(alId, apInit, apEnemy) {}
66 
67  void OnEnterState(iGameEnemyState *apPrevState);
68  void OnLeaveState(iGameEnemyState *apNextState);
69 
70  void OnUpdate(float afTimeStep);
71 
72  // void OnSeePlayer(const cVector3f &avPosition, float afChance){}
73 
74 private:
75  bool mbStopped;
76  float mfNextWalkTime;
77 };
78 
79 //-----------------------------------------
80 
81 // HUNT STATE
83 public:
84  cGameEnemyState_Spider_Hunt(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Spider_Base(alId, apInit, apEnemy) {}
85 
86  void OnEnterState(iGameEnemyState *apPrevState);
87  void OnLeaveState(iGameEnemyState *apNextState);
88 
89  void OnUpdate(float afTimeStep);
90 
91  void OnSeePlayer(const cVector3f &avPosition, float afChance);
92  bool OnHearNoise(const cVector3f &avPosition, float afVolume);
93 
94  void OnDraw();
95 
96 private:
97  float mfUpdatePathCount;
98  float mfUpdateFreq;
99  bool mbFreePlayerPath;
100  bool mbLostPlayer;
101  float mfLostPlayerCount;
102  float mfMaxLostPlayerCount;
103 };
104 
105 //-----------------------------------------
106 
107 // ATTACK STATE
109 public:
110  cGameEnemyState_Spider_Attack(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Spider_Base(alId, apInit, apEnemy) {}
111 
112  void OnEnterState(iGameEnemyState *apPrevState);
113  void OnLeaveState(iGameEnemyState *apNextState);
114 
115  void OnUpdate(float afTimeStep);
116 
117  void OnAnimationOver(const tString &asName);
118 
119  void OnPostSceneDraw();
120 
121  void OnSeePlayer(const cVector3f &avPosition, float afChance) {}
122  bool OnHearNoise(const cVector3f &avPosition, float afVolume) { return false; }
123  void OnFlashlight(const cVector3f &avPosition);
124 
125 private:
126  float mfDamageTimer;
127  float mfJumpTimer;
128  bool mbAttacked;
129 };
130 
131 //-----------------------------------------
132 
133 // FLEE STATE
135 public:
136  cGameEnemyState_Spider_Flee(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Spider_Base(alId, apInit, apEnemy) {}
137 
138  void OnEnterState(iGameEnemyState *apPrevState);
139  void OnLeaveState(iGameEnemyState *apNextState);
140 
141  void OnUpdate(float afTimeStep);
142 
143  void OnSeePlayer(const cVector3f &avPosition, float afChance) {}
144  void OnFlashlight(const cVector3f &avPosition) {}
145 
146 private:
147  // float mfTimer;
148  // float mfBackAngle;
149  // bool mbBackwards;
150 };
151 
152 //-----------------------------------------
153 
154 // KNOCKDOWN STATE
156 public:
157  cGameEnemyState_Spider_KnockDown(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Spider_Base(alId, apInit, apEnemy) {}
158 
159  void OnEnterState(iGameEnemyState *apPrevState);
160  void OnLeaveState(iGameEnemyState *apNextState);
161 
162  void OnUpdate(float afTimeStep);
163 
164  void OnSeePlayer(const cVector3f &avPosition, float afChance) {}
165  bool OnHearNoise(const cVector3f &avPosition, float afVolume) { return false; }
166  void OnTakeHit(float afDamage) {}
167 
168  void OnAnimationOver(const tString &asName);
169 
170 private:
171  float mfTimer;
172  bool mbCheckAnim;
173 };
174 
175 //-----------------------------------------
176 
177 // DEAD STATE
179 public:
180  cGameEnemyState_Spider_Dead(int alId, cInit *apInit, iGameEnemy *apEnemy) : iGameEnemyState_Spider_Base(alId, apInit, apEnemy) {}
181 
182  void OnEnterState(iGameEnemyState *apPrevState);
183  void OnLeaveState(iGameEnemyState *apNextState);
184 
185  void OnUpdate(float afTimeStep);
186 
187  void OnSeePlayer(const cVector3f &avPosition, float afChance) {}
188  bool OnHearNoise(const cVector3f &avPosition, float afVolume) { return false; }
189  void OnFlashlight(const cVector3f &avPosition) {}
190  void OnTakeHit(float afDamage) {}
191  void OnDeath(float afDamage) {}
192 };
193 
194 //-----------------------------------------
195 
197 public:
198  cGameEnemy_Spider(cInit *apInit, const tString &asName, TiXmlElement *apGameElem);
200 
201  void OnLoad();
202 
203  void OnUpdate(float afTimeStep);
204 
205  void ShowPlayer(const cVector3f &avPlayerFeetPos);
206 
207  bool MoveToPos(const cVector3f &avFeetPos);
208 
209  bool IsFighting();
210 
211  iCollideShape *GetAttackShape() { return mpAttackShape; }
212 
213  // State properties
214  bool mbPathFind;
215 
216  float mfIdleFOV;
217  tString msIdleFoundPlayerSound;
218  float mfIdleMinSeeChance;
219  float mfIdleMinHearVolume;
220  float mfIdleMinWaitLength;
221  float mfIdleMaxWaitLength;
222 
223  float mfHuntFOV;
224  float mfHuntSpeed;
225  float mfHuntForLostPlayerTime;
226  float mfHuntMinSeeChance;
227  float mfHuntMinHearVolume;
228 
229  float mfAttackDistance;
230  float mfAttackForce;
231  float mfAttackJumpTime;
232  float mfAttackDamageTime;
233  cVector3f mvAttackDamageSize;
234  float mfAttackDamageRange;
235  float mfAttackMinDamage;
236  float mfAttackMaxDamage;
237  tString msAttackStartSound;
238  tString msAttackHitSound;
239  float mfAttackMinMass;
240  float mfAttackMaxMass;
241  float mfAttackMinImpulse;
242  float mfAttackMaxImpulse;
243  int mlAttackStrength;
244 
245  float mfFleeMinDistance;
246  float mfFleeMaxDistance;
247  bool mbFleeFromFlashlight;
248 
249  tString msKnockDownSound;
250 
251  tString msDeathSound;
252 
253 private:
254  iCollideShape *mpAttackShape;
255 };
256 
257 //-----------------------------------------
258 
259 #endif // GAME_GAME_ENEMY_SPIDER_H
Definition: AI.h:36
Definition: str.h:59
Definition: GameEnemy_Spider.h:82
Definition: GameEnemy_Spider.h:196
Definition: GameEnemy_Spider.h:178
Definition: GameEnemy_Spider.h:155
Definition: GameEnemy_Spider.h:108
Definition: GameEnemy_Spider.h:41
Definition: GameEnemy_Spider.h:134
Definition: CollideShape.h:50
Definition: GameEnemy_Spider.h:63
Definition: tinyxml.h:864
Definition: GameEnemy.h:152
Definition: GameEnemy.h:189
Definition: Init.h:70