ScummVM API documentation
actions.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 ZVISION_ACTIONS_H
23 #define ZVISION_ACTIONS_H
24 
25 #include "common/path.h"
26 #include "common/str.h"
27 #include "common/rect.h"
28 
29 namespace ZVision {
30 
31 // Forward declaration of ZVision. This file is included before ZVision is declared
32 class ZVision;
33 class ScriptManager;
34 class ValueSlot;
35 
40 class ResultAction {
41 public:
42  ResultAction(ZVision *engine, int32 slotkey);
43  virtual ~ResultAction() {}
52  virtual bool execute() = 0;
53 protected:
54  ZVision *_engine;
55  ScriptManager *_scriptManager;
56  int32 _slotKey;
57 };
58 
59 class ActionAdd : public ResultAction {
60 public:
61  ActionAdd(ZVision *engine, int32 slotkey, const Common::String &line);
62  ~ActionAdd();
63  bool execute() override;
64 
65 private:
66  uint32 _key;
67  ValueSlot *_value;
68 };
69 
70 class ActionAssign : public ResultAction {
71 public:
72  ActionAssign(ZVision *engine, int32 slotkey, const Common::String &line);
73  ~ActionAssign() override;
74  bool execute() override;
75 
76 private:
77  uint32 _key;
78  ValueSlot *_value;
79 };
80 
81 class ActionAttenuate : public ResultAction {
82 public:
83  ActionAttenuate(ZVision *engine, int32 slotkey, const Common::String &line);
84  bool execute() override;
85 
86 private:
87  uint32 _key;
88  int32 _attenuation;
89 };
90 
92 public:
93  ActionChangeLocation(ZVision *engine, int32 slotkey, const Common::String &line);
94  bool execute() override;
95 
96 private:
97  char _world;
98  char _room;
99  char _node;
100  char _view;
101  uint32 _offset;
102 };
103 
105 public:
106  ActionCrossfade(ZVision *engine, int32 slotkey, const Common::String &line);
107  bool execute() override;
108 
109 private:
110  uint32 _keyOne;
111  uint32 _keyTwo;
112  int32 _oneStartVolume;
113  int32 _twoStartVolume;
114  int32 _oneEndVolume;
115  int32 _twoEndVolume;
116  int32 _timeInMillis;
117 };
118 
119 class ActionCursor : public ResultAction {
120 public:
121  ActionCursor(ZVision *engine, int32 slotkey, const Common::String &line);
122  bool execute() override;
123 
124 private:
125  uint8 _action;
126 };
127 
129 public:
130  ActionDelayRender(ZVision *engine, int32 slotkey, const Common::String &line);
131  bool execute() override;
132 
133 private:
134  uint32 _framesToDelay;
135 };
136 
138 public:
139  ActionDisableControl(ZVision *engine, int32 slotkey, const Common::String &line);
140  bool execute() override;
141 
142 private:
143  uint32 _key;
144 };
145 
147 public:
148  ActionDisplayMessage(ZVision *engine, int32 slotkey, const Common::String &line);
149  bool execute() override;
150 
151 private:
152  int16 _control;
153  int16 _msgid;
154 };
155 
156 class ActionDissolve : public ResultAction {
157 public:
158  ActionDissolve(ZVision *engine);
159  bool execute() override;
160 };
161 
162 class ActionDistort : public ResultAction {
163 public:
164  ActionDistort(ZVision *engine, int32 slotkey, const Common::String &line);
165  ~ActionDistort() override;
166  bool execute() override;
167 
168 private:
169  int16 _distSlot;
170  int16 _speed;
171  float _startAngle;
172  float _endAngle;
173  float _startLineScale;
174  float _endLineScale;
175 };
176 
178 public:
179  ActionEnableControl(ZVision *engine, int32 slotkey, const Common::String &line);
180  bool execute() override;
181 
182 private:
183  uint32 _key;
184 };
185 
187 public:
188  ActionFlushMouseEvents(ZVision *engine, int32 slotkey);
189  bool execute() override;
190 };
191 
193 public:
194  ActionInventory(ZVision *engine, int32 slotkey, const Common::String &line);
195  bool execute() override;
196 private:
197  int8 _type;
198  int32 _key;
199 };
200 
201 class ActionKill : public ResultAction {
202 public:
203  ActionKill(ZVision *engine, int32 slotkey, const Common::String &line);
204  bool execute() override;
205 
206 private:
207  uint32 _key;
208  uint32 _type;
209 };
210 
212 public:
213  ActionMenuBarEnable(ZVision *engine, int32 slotkey, const Common::String &line);
214  bool execute() override;
215 private:
216  uint16 _menus;
217 };
218 
219 class ActionMusic : public ResultAction {
220 public:
221  ActionMusic(ZVision *engine, int32 slotkey, const Common::String &line, bool global);
222  ~ActionMusic() override;
223  bool execute() override;
224 
225 private:
226  Common::Path _fileName;
227  bool _loop;
228  ValueSlot *_volume;
229  bool _universe;
230  bool _midi;
231  int8 _note;
232  int8 _prog;
233 };
234 
235 class ActionPanTrack : public ResultAction {
236 public:
237  ActionPanTrack(ZVision *engine, int32 slotkey, const Common::String &line);
238  ~ActionPanTrack() override;
239  bool execute() override;
240 
241 private:
242  int32 _pos;
243  uint32 _musicSlot;
244 };
245 
247 public:
248  ActionPlayAnimation(ZVision *engine, int32 slotkey, const Common::String &line);
249  ~ActionPlayAnimation() override;
250  bool execute() override;
251 
252 private:
253  Common::Path _fileName;
254  uint32 _x;
255  uint32 _y;
256  uint32 _x2;
257  uint32 _y2;
258  uint32 _start;
259  uint32 _end;
260  int32 _mask;
261  int32 _framerate;
262  int32 _loopCount;
263 };
264 
266 public:
267  ActionPlayPreloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line);
268  bool execute() override;
269 
270 private:
271  uint32 _controlKey;
272  uint32 _x1;
273  uint32 _y1;
274  uint32 _x2;
275  uint32 _y2;
276  uint _startFrame;
277  uint _endFrame;
278  uint _loopCount;
279 };
280 
282 public:
283  ActionPreloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line);
284  ~ActionPreloadAnimation() override;
285  bool execute() override;
286 
287 private:
288  Common::Path _fileName;
289  int32 _mask;
290  int32 _framerate;
291 };
292 
294 public:
295  ActionPreferences(ZVision *engine, int32 slotkey, const Common::String &line);
296  bool execute() override;
297 
298 private:
299  bool _save;
300 };
301 
302 class ActionQuit : public ResultAction {
303 public:
304  ActionQuit(ZVision *engine, int32 slotkey) : ResultAction(engine, slotkey) {}
305  bool execute() override;
306 };
307 
308 class ActionRegion : public ResultAction {
309 public:
310  ActionRegion(ZVision *engine, int32 slotkey, const Common::String &line);
311  ~ActionRegion() override;
312  bool execute() override;
313 
314 private:
315  Common::String _art;
316  Common::String _custom;
317  Common::Rect _rect;
318  uint16 _delay;
319  uint16 _type;
320  uint16 _unk1;
321  uint16 _unk2;
322 };
323 
324 // Only used by ZGI (locations cd6e, cd6k, dg2f, dg4e, dv1j)
326 public:
327  ActionUnloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line);
328  bool execute() override;
329 private:
330  uint32 _key;
331 };
332 
333 class ActionRandom : public ResultAction {
334 public:
335  ActionRandom(ZVision *engine, int32 slotkey, const Common::String &line);
336  ~ActionRandom() override;
337  bool execute() override;
338 
339 private:
340  ValueSlot *_max;
341 };
342 
344 public:
345  ActionRestoreGame(ZVision *engine, int32 slotkey, const Common::String &line);
346  bool execute() override;
347 
348 private:
349  Common::Path _fileName;
350 };
351 
352 class ActionRotateTo : public ResultAction {
353 public:
354  ActionRotateTo(ZVision *engine, int32 slotkey, const Common::String &line);
355  bool execute() override;
356 
357 private:
358  int32 _toPos;
359  int32 _time;
360 };
361 
363 public:
364  ActionSetPartialScreen(ZVision *engine, int32 slotkey, const Common::String &line);
365  bool execute() override;
366 
367 private:
368  uint _x;
369  uint _y;
370  Common::Path _fileName;
371  int32 _backgroundColor;
372 };
373 
375 public:
376  ActionSetScreen(ZVision *engine, int32 slotkey, const Common::String &line);
377  bool execute() override;
378 
379 private:
380  Common::Path _fileName;
381 };
382 
383 class ActionStop : public ResultAction {
384 public:
385  ActionStop(ZVision *engine, int32 slotkey, const Common::String &line);
386  bool execute() override;
387 
388 private:
389  uint32 _key;
390 };
391 
393 public:
394  ActionStreamVideo(ZVision *engine, int32 slotkey, const Common::String &line);
395  bool execute() override;
396 
397 private:
398  enum {
399  DIFFERENT_DIMENSIONS = 0x1 // 0x1 flags that the destRect dimensions are different from the original video dimensions
400  };
401 
402  Common::Path _fileName;
403  uint _x1;
404  uint _y1;
405  uint _x2;
406  uint _y2;
407  uint _flags;
408  bool _skippable;
409 };
410 
412 public:
413  ActionSyncSound(ZVision *engine, int32 slotkey, const Common::String &line);
414  bool execute() override;
415 
416 private:
417  int _syncto;
418  Common::Path _fileName;
419 };
420 
421 class ActionTimer : public ResultAction {
422 public:
423  ActionTimer(ZVision *engine, int32 slotkey, const Common::String &line);
424  ~ActionTimer() override;
425  bool execute() override;
426 private:
427  ValueSlot *_time;
428 };
429 
430 class ActionTtyText : public ResultAction {
431 public:
432  ActionTtyText(ZVision *engine, int32 slotkey, const Common::String &line);
433  ~ActionTtyText() override;
434  bool execute() override;
435 
436 private:
437  Common::Path _filename;
438  uint32 _delay;
439  Common::Rect _r;
440 };
441 } // End of namespace ZVision
442 
443 #endif
Definition: actions.h:40
Definition: actions.h:104
Definition: actions.h:374
Definition: str.h:59
Definition: actions.h:333
Definition: actions.h:421
Definition: actions.h:192
Definition: actions.h:219
Definition: actions.h:246
Definition: actions.h:352
Definition: script_manager.h:144
Definition: actions.h:91
Definition: rect.h:144
Definition: actions.h:156
Definition: path.h:52
Definition: actions.h:70
Definition: actions.h:59
virtual bool execute()=0
Definition: actions.h:128
Definition: clock.h:29
Definition: actions.h:265
Definition: actions.h:146
Definition: actions.h:430
Definition: actions.h:201
Definition: actions.h:293
Definition: actions.h:137
Definition: actions.h:343
Definition: actions.h:362
Definition: actions.h:325
Definition: actions.h:177
Definition: actions.h:162
Definition: script_manager.h:369
Definition: actions.h:392
Definition: actions.h:383
Definition: actions.h:235
Definition: actions.h:211
Definition: actions.h:186
Definition: actions.h:119
Definition: actions.h:411
Definition: actions.h:81
Definition: actions.h:302
Definition: actions.h:281
Definition: actions.h:308