ScummVM API documentation
modal.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#ifndef NGI_MODAL_H
23#define NGI_MODAL_H
24
25#include "video/avi_decoder.h"
26
27namespace NGI {
28
29class PictureObject;
30class Picture;
31class Sound;
32
33struct FileInfo {
34 char filename[260];
35 bool empty;
36 char date[16];
37 int fx1;
38 int fx2;
39 int fy1;
40 int fy2;
41};
42
44 public:
45
46 BaseModalObject *_parentObj;
47 ObjType _objtype;
48
49 public:
50 BaseModalObject() : _parentObj(0) { _objtype = kObjTypeDefault; }
51 virtual ~BaseModalObject() {}
52
53 void deleteObject();
54
55 virtual bool pollEvent() = 0;
56 virtual bool handleMessage(ExCommand *message) = 0;
57 virtual bool init(int counterdiff) = 0;
58 virtual void update() = 0;
59
60 virtual void saveload() = 0;
61};
62
64 int _field_8;
65 int _introFlags;
66 int _countDown;
67 int _stillRunning;
68 int _sfxVolume;
69
70 public:
71 ModalIntro();
72 ~ModalIntro() override;
73
74 bool pollEvent() override { return true; }
75 bool handleMessage(ExCommand *message) override;
76 bool init(int counterdiff) override;
77 void update() override;
78 void saveload() override {}
79
80 void finish();
81};
82
84 int _field_8;
85 int _introFlags;
86 int _countDown;
87 int _stillRunning;
88 int _sfxVolume;
89
90 public:
92 ~ModalIntroDemo() override;
93
94 bool pollEvent() override { return true; }
95 bool handleMessage(ExCommand *message) override;
96 bool init(int counterdiff) override;
97 void update() override;
98 void saveload() override {}
99
100 void finish();
101};
102
104public:
105
106 bool pollEvent() override { return true; }
107 bool handleMessage(ExCommand *message) override { return true; }
108 bool init(int counterdiff) override { return false; }
109 void update() override {}
110 void saveload() override {}
111
112 void play(const char *fname);
113
114private:
115 Video::AVIDecoder _decoder;
116};
117
118class ModalMap : public BaseModalObject {
119 Scene *_mapScene;
120 PictureObject *_pic;
121 PictureObject *_picI03;
122 PictureObject *_highlightedPic;
123 bool _isRunning;
124 Common::Rect _rect1;
125 int _x;
126 int _y;
127 int _flag;
128 int _mouseX;
129 int _mouseY;
130 int _dragX;
131 int _dragY;
132 int _hotSpotDelay;
133 Common::Rect _rect2;
134
135 public:
136 ModalMap();
137 ~ModalMap() override;
138
139 bool pollEvent() override { return true; }
140 bool handleMessage(ExCommand *message) override;
141 bool init(int counterdiff) override;
142 virtual bool init2(int counterdiff);
143 void update() override;
144 void saveload() override {}
145
146 void initMap();
147
148private:
149 PictureObject *getScenePicture(int sceneId);
150 PictureObject *getSceneHPicture(PictureObject *obj);
151 bool checkScenePass(PreloadItem *item);
152 bool isSceneEnabled(int sceneId);
153
154 int findMapSceneId(int picId);
155 void clickButton(PictureObject *pic);
156};
157
159 int _flags;
160 int _counter;
161 int _sfxVolume;
162
163 public:
164 ModalFinal();
165 ~ModalFinal() override;
166
167 bool pollEvent() override { return true; }
168 bool handleMessage(ExCommand *message) override;
169 bool init(int counterdiff) override;
170 void update() override;
171 void saveload() override {}
172
173 void unloadScenes();
174};
175
177 Scene *_sceneTitles;
178 PictureObject *_creditsPic;
179 bool _fadeIn;
180 bool _fadeOut;
181 int _countdown;
182 int _sfxVolume;
183 int _currX;
184 int _currY;
185 int _maxY;
186
187 public:
188 ModalCredits();
189 ~ModalCredits() override;
190
191 bool pollEvent() override { return true; }
192 bool handleMessage(ExCommand *message) override;
193 bool init(int counterdiff) override;
194 void update() override;
195 void saveload() override {}
196};
197
198struct MenuArea {
199 int picIdL;
200 PictureObject *picObjD;
201 PictureObject *picObjL;
202};
203
205public:
206 Scene *_scene;
207 int _hoverAreaId;
209 int _menuSliderIdx;
210 int _musicSliderIdx;
211 MenuArea *_lastArea;
212 int _sliderOffset;
213 int _mfield_34;
214 Common::Rect _screct;
215 int _bgX;
216 int _bgY;
217 int _debugKeyCount;
218
219public:
221 ~ModalMainMenu() override {}
222
223 bool pollEvent() override { return true; }
224 bool handleMessage(ExCommand *message) override;
225 bool init(int counterdiff) override;
226 void update() override;
227 void saveload() override {}
228
229private:
230 bool isSaveAllowed();
231 void enableDebugMenuButton();
232 void setSliderPos();
233 void enableDebugMenu(char c);
234 int checkHover(Common::Point &point);
235 void updateVolume();
236 void updateSoundVolume(Sound &snd);
237 void updateSliderPos();
238 bool isOverArea(PictureObject *obj, Common::Point *point);
239};
240
242public:
243 Scene *_mainMenuScene;
244 Picture *_bg;
245 bool _isRunning;
246 Common::Rect _rect;
247 int _hx;
248 int _hy;
249
250public:
251 ModalHelp();
252 ~ModalHelp() override;
253
254 bool pollEvent() override { return true; }
255 bool handleMessage(ExCommand *message) override;
256 bool init(int counterdiff) override;
257 void update() override;
258 void saveload() override {}
259
260 void launch();
261};
262
264public:
265 ModalQuery();
266 ~ModalQuery() override;
267
268 bool pollEvent() override { return true; }
269 bool handleMessage(ExCommand *message) override;
270 bool init(int counterdiff) override;
271 void update() override;
272 void saveload() override {}
273
274 bool create(Scene *sc, Scene *bgScene, int picId);
275 int getQueryResult() { return _queryResult; }
276
277
278private:
279 Scene *_bgScene;
280 PictureObject *_bg;
281 PictureObject *_okBtn;
282 PictureObject *_cancelBtn;
283 int _queryResult;
284
285};
286
288public:
290 ~ModalSaveGame() override;
291
292 bool pollEvent() override { return true; }
293 bool handleMessage(ExCommand *message) override;
294 bool init(int counterdiff) override;
295 void update() override;
296 void saveload() override;
297
298 void processMouse(int x, int y);
299
300 void setScene(Scene *sc);
301 void setup(Scene *sc, int mode);
302 void processKey(int action);
303
304 char *getSaveName();
305 bool getFileInfo(int slot, FileInfo *fileinfo);
306
307 Common::Rect _rect;
308 int _oldBgX;
309 int _oldBgY;
310 PictureObject *_bgr;
311 PictureObject *_okD;
312 PictureObject *_okL;
313 PictureObject *_cancelD;
314 PictureObject *_cancelL;
315 PictureObject *_emptyD;
316 PictureObject *_emptyL;
317 PictureObject *_fullD;
318 PictureObject *_fullL;
319 Scene *_menuScene;
320 int _mode;
321 ModalQuery *_queryDlg;
325 int _queryRes;
326};
327
329 PictureObject *_bg;
330 PictureObject *_button;
331 PictureObject *_text;
332 int _clickedQuit;
333 int _countdown;
334 Scene *_scene;
335
336 public:
337 ModalDemo();
338 ~ModalDemo() override;
339
340 bool launch();
341
342 bool pollEvent() override { return true; }
343 bool handleMessage(ExCommand *message) override;
344 bool init(int counterdiff) override;
345 bool init2(int counterdiff);
346 void update() override;
347 void saveload() override {}
348};
349
350
351} // End of namespace NGI
352
353#endif /* NGI_MODAL_H */
Definition: array.h:52
Definition: modal.h:43
Definition: messages.h:59
Definition: modal.h:176
Definition: modal.h:328
Definition: modal.h:158
Definition: modal.h:241
Definition: modal.h:83
Definition: modal.h:63
Definition: modal.h:204
Definition: modal.h:118
Definition: modal.h:263
Definition: modal.h:287
Definition: modal.h:103
Definition: gfx.h:83
Definition: gfx.h:169
Definition: scene.h:32
Definition: sound.h:34
Definition: avi_decoder.h:65
Definition: rect.h:144
Definition: rect.h:536
Definition: modal.h:33
Definition: modal.h:198
Definition: gameloader.h:64