ScummVM API documentation
EffectHandler.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_EFFECT_HANDLER_H
29 #define GAME_EFFECT_HANDLER_H
30 
31 #include "hpl1/engine/engine.h"
32 
33 using namespace hpl;
34 
35 class cInit;
36 
37 //-----------------------------------------
38 
40 public:
41  cEffect_Underwater(cInit *apInit, cGraphicsDrawer *apDrawer);
43 
44  void Update(float afTimeStep);
45  void OnDraw();
46  void Reset();
47 
48  void SetActive(bool abX);
49  bool IsActive() { return mbActive; }
50 
51  void SetColor(const cColor &aColor) { mColor = aColor; }
52 
53 private:
54  cInit *mpInit;
55  cGraphicsDrawer *mpDrawer;
56 
57  cGfxObject *mpWhiteGfx;
58 
59  bool mbActive;
60 
61  cColor mColor;
62 };
63 
64 //-----------------------------------------
65 
67 public:
68  float mfMaxSize;
69  float mfSize;
70  float mfTime;
71  float mfFadeInTime;
72  float mfMaxFadeInTime;
73  float mfFadeOutTime;
74  float mfMaxFadeOutTime;
75 };
76 
78 public:
79  cEffect_ShakeScreen(cInit *apInit);
81 
82  void Start(float afAmount, float afTime, float afFadeInTime, float afFadeOutTime);
83 
84  void Update(float afTimeStep);
85  void Reset();
86 
87  cVector3f GetScreenAdd() { return mvAdd; }
88 
89 private:
90  cInit *mpInit;
91 
92  cVector3f mvAdd;
93 
95 };
96 
97 //-----------------------------------------
98 class cGameSaveArea;
100 public:
101  cEffect_SaveEffect(cInit *apInit, cGraphicsDrawer *apDrawer);
103 
104  void NormalSave(const cVector3f &avPos, cGameSaveArea *apSaveArea);
105  void AutoSave();
106 
107  void Update(float afTimeStep);
108  void OnDraw();
109  void Reset();
110 
111 private:
112  void NormalSaveUpdate(float afTimeStep);
113  void AutoSaveUpdate(float afTimeStep);
114 
115  cInit *mpInit;
116  cGraphicsDrawer *mpDrawer;
117 
118  cGfxObject *mpFlashGfx;
119 
120  cGameSaveArea *mpSaveArea;
121 
122  tWString msMessage;
123 
124  bool mbActive;
125  int mlState;
126  bool mbAutoSave;
127 
128  cVector3f mvPosition;
129 
130  float mfFlashAlpha;
131  cColor mFlashColor;
132 
133  float mfTime;
134 
135  float mfStartFov;
136  float mfFov;
137 };
138 
139 //-----------------------------------------
140 
142 public:
143  cEffect_DepthOfField(cInit *apInit);
145 
146  void SetDisabled(bool abX);
147  bool IsDisabled() { return mbDisabled; }
148 
149  void SetActive(bool abX, float afFadeTime);
150  bool IsActive() { return mbActive; }
151 
152  void SetUp(float afNearPlane, float afFocalPlane, float afFarPlane);
153 
154  void SetFocusBody(iPhysicsBody *apBody) { mpFocusBody = apBody; }
155  void FocusOnBody(iPhysicsBody *apBody);
156 
157  void Update(float afTimeStep);
158 
159  void Reset();
160 
161 private:
162  cInit *mpInit;
163  cRendererPostEffects *mpPostEffects;
164 
165  iPhysicsBody *mpFocusBody;
166 
167  bool mbActive;
168  bool mbDisabled;
169 
170  float mfFadeSpeed;
171 
172  float mfMaxBlur;
173 };
174 //-----------------------------------------
175 
177 public:
178  cEffect_Flash(cInit *apInit, cGraphicsDrawer *apDrawer);
179  ~cEffect_Flash();
180 
181  void Start(float afFadeIn, float afWhite, float afFadeOut);
182 
183  void Update(float afTimeStep);
184  void OnDraw();
185  void Reset();
186 
187 private:
188  cInit *mpInit;
189  cGraphicsDrawer *mpDrawer;
190 
191  cGfxObject *mpWhiteGfx;
192 
193  bool mbActive;
194  float mfAlpha;
195 
196  int mlStep;
197 
198  float mfCount;
199 
200  float mfFadeInSpeed;
201  float mfWhiteSpeed;
202  float mfFadeOutSpeed;
203 };
204 
205 //-----------------------------------------
206 
207 class cSubTitle {
208 public:
209  tWString msMessage;
210  float mfCount;
211  float mfAlpha;
212  bool mbActive;
213 };
214 
217 
219 public:
220  cEffect_SubTitle(cInit *apInit, cGraphicsDrawer *apDrawer);
221  ~cEffect_SubTitle();
222 
223  void Add(const tWString &asMessage, float afTime, bool abRemovePrevious);
224 
225  void Update(float afTimeStep);
226  void OnDraw();
227  void Reset();
228 
229 private:
230  cInit *mpInit;
231  cGraphicsDrawer *mpDrawer;
232 
233  FontData *mpFont;
234 
235  tSubTitleList mlstSubTitles;
236 };
237 
238 //-----------------------------------------
239 
241 public:
242  cEffect_WaveGravity(cInit *apInit);
244 
245  void SetActive(bool abX);
246  // alDir: 0=Xaxis 1=Zaxis
247  void Setup(float afMaxAngle, float afSwingLength, float afGravitySize, int alDir);
248 
249  void Update(float afTimeStep);
250  void Reset();
251 
252 private:
253  cInit *mpInit;
254 
255  bool mbActive;
256 
257  float mfMaxAngle;
258  float mfSwingLength;
259  float mfSize;
260  int mlDir;
261 
262  float mfTime;
263 };
264 
265 //-----------------------------------------
266 
267 class cEffectHandler : public iUpdateable {
268 public:
269  cEffectHandler(cInit *apInit);
270  ~cEffectHandler();
271 
272  void OnStart();
273  void Update(float afTimeStep);
274  void Reset();
275  void OnDraw();
276 
277  cEffect_Flash *GetFlash() { return mpFlash; }
278  cEffect_WaveGravity *GetWaveGravity() { return mpWaveGravity; }
279  cEffect_SubTitle *GetSubTitle() { return mpSubTitle; }
280  cEffect_DepthOfField *GetDepthOfField() { return mpDepthOfField; }
281  cEffect_SaveEffect *GetSaveEffect() { return mpSaveEffect; }
282  cEffect_ShakeScreen *GetShakeScreen() { return mpShakeScreen; }
283  cEffect_Underwater *GetUnderwater() { return mpUnderwater; }
284 
285 private:
286  cInit *mpInit;
287  cGraphicsDrawer *mpDrawer;
288 
289  cEffect_Flash *mpFlash;
290  cEffect_WaveGravity *mpWaveGravity;
291  cEffect_SubTitle *mpSubTitle;
292  cEffect_DepthOfField *mpDepthOfField;
293  cEffect_SaveEffect *mpSaveEffect;
294  cEffect_ShakeScreen *mpShakeScreen;
295  cEffect_Underwater *mpUnderwater;
296 };
297 
298 #endif // GAME_EFFECT_HANDLER_H
Definition: AI.h:36
Definition: EffectHandler.h:66
Definition: font_data.h:67
Definition: EffectHandler.h:240
Definition: EffectHandler.h:267
Definition: GraphicsDrawer.h:77
Definition: EffectHandler.h:39
Definition: GameSaveArea.h:56
Definition: EffectHandler.h:99
Definition: ustr.h:57
Definition: RendererPostEffects.h:71
Definition: GfxObject.h:38
Definition: PhysicsBody.h:117
Definition: EffectHandler.h:218
Definition: Updateable.h:35
Definition: EffectHandler.h:176
Definition: Color.h:37
Definition: EffectHandler.h:77
Definition: list_intern.h:51
Definition: EffectHandler.h:207
Definition: Init.h:70
Definition: EffectHandler.h:141