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/rect.h"
27 #include "common/str.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 = NULL;
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 = NULL;
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; // Sound source position; NB in panoramas (all original game scripts), this is specified as the X background coordinate; otherwise it is specified in azimuth degrees.
243  uint8 _mag; // Magnitude of effect (not used by original game scripts); 255 for fully directional sound, 0 for fully ambient
244  bool _resetMusicNode; // If true (default, original game scripts have no concept of this), associated music slot value is reset to a value of 2 upon creation of this object.
245  // This seems necessary to ensure all original game pan-track effects load correctly, though it is still unclear exactly what the original intent of these values was.
246  // So far, best guess for music slotkey values is: 0 = has never been loaded, 1 = loaded and actively playing now, 2 = has loaded & played & then subsequently been killed.
247  // Since there is literally nothing in the game scripts that sets some of these values to 2, and certain pan_tracks require it to be 2 for the puzzle that creates them to trigger, the original game engine code must have set these values to 2 manually somehow upon conditions being met to allow a pan_track to be created?
248  bool _staticScreen; // Used by auxiliary scripts to apply directionality to audio in static screens; not used in original game scripts.
249  bool _resetMixerOnDelete; // Unnecessary and should be set false for original scripts; useful in some cases in extra scripts to avoid brief volume spikes on location changes
250  uint32 _musicSlot;
251 };
252 
254 public:
255  ActionPlayAnimation(ZVision *engine, int32 slotkey, const Common::String &line);
256  ~ActionPlayAnimation() override;
257  bool execute() override;
258 
259 private:
260  Common::Path _fileName;
261  uint32 _x;
262  uint32 _y;
263  uint32 _x2;
264  uint32 _y2;
265  uint32 _start;
266  uint32 _end;
267  int32 _mask;
268  int32 _framerate;
269  int32 _loopCount;
270 };
271 
273 public:
274  ActionPlayPreloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line);
275  bool execute() override;
276 
277 private:
278  uint32 _controlKey;
279  uint32 _x1;
280  uint32 _y1;
281  uint32 _x2;
282  uint32 _y2;
283  uint _startFrame;
284  uint _endFrame;
285  uint _loopCount;
286 };
287 
289 public:
290  ActionPreloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line);
291  ~ActionPreloadAnimation() override;
292  bool execute() override;
293 
294 private:
295  Common::Path _fileName;
296  int32 _mask;
297  int32 _framerate;
298 };
299 
301 public:
302  ActionPreferences(ZVision *engine, int32 slotkey, const Common::String &line);
303  bool execute() override;
304 
305 private:
306  bool _save;
307 };
308 
309 class ActionQuit : public ResultAction {
310 public:
311  ActionQuit(ZVision *engine, int32 slotkey) : ResultAction(engine, slotkey) {}
312  bool execute() override;
313 };
314 
315 class ActionRegion : public ResultAction {
316 public:
317  ActionRegion(ZVision *engine, int32 slotkey, const Common::String &line);
318  ~ActionRegion() override;
319  bool execute() override;
320 
321 private:
322  Common::String _art;
323  Common::String _custom;
324  Common::Rect _rect;
325  uint16 _delay;
326  uint16 _type;
327  uint16 _unk1;
328  uint16 _unk2;
329 };
330 
331 // Only used by ZGI (locations cd6e, cd6k, dg2f, dg4e, dv1j)
333 public:
334  ActionUnloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line);
335  bool execute() override;
336 private:
337  uint32 _key;
338 };
339 
340 class ActionRandom : public ResultAction {
341 public:
342  ActionRandom(ZVision *engine, int32 slotkey, const Common::String &line);
343  ~ActionRandom() override;
344  bool execute() override;
345 
346 private:
347  ValueSlot *_max;
348 };
349 
351 public:
352  ActionRestoreGame(ZVision *engine, int32 slotkey, const Common::String &line);
353  bool execute() override;
354 
355 private:
356  Common::Path _fileName;
357 };
358 
359 class ActionRotateTo : public ResultAction {
360 public:
361  ActionRotateTo(ZVision *engine, int32 slotkey, const Common::String &line);
362  bool execute() override;
363 
364 private:
365  int32 _toPos;
366  int32 _time;
367 };
368 
370 public:
371  ActionSetPartialScreen(ZVision *engine, int32 slotkey, const Common::String &line);
372  bool execute() override;
373 
374 private:
375  uint _x;
376  uint _y;
377  Common::Path _fileName;
378  int32 _backgroundColor;
379 };
380 
382 public:
383  ActionSetScreen(ZVision *engine, int32 slotkey, const Common::String &line);
384  bool execute() override;
385 
386 private:
387  Common::Path _fileName;
388 };
389 
390 class ActionStop : public ResultAction {
391 public:
392  ActionStop(ZVision *engine, int32 slotkey, const Common::String &line);
393  bool execute() override;
394 
395 private:
396  uint32 _key;
397 };
398 
400 public:
401  ActionStreamVideo(ZVision *engine, int32 slotkey, const Common::String &line);
402  bool execute() override;
403 
404 private:
405  Common::Path _fileName;
406  uint _x1;
407  uint _y1;
408  uint _x2;
409  uint _y2;
410  uint _flags;
411  bool _skippable;
412 };
413 
415 public:
416  ActionSyncSound(ZVision *engine, int32 slotkey, const Common::String &line);
417  bool execute() override;
418 
419 private:
420  int _syncto;
421  Common::Path _fileName;
422 };
423 
424 class ActionTimer : public ResultAction {
425 public:
426  ActionTimer(ZVision *engine, int32 slotkey, const Common::String &line);
427  ~ActionTimer() override;
428  bool execute() override;
429 private:
430  ValueSlot *_time;
431 };
432 
433 class ActionTtyText : public ResultAction {
434 public:
435  ActionTtyText(ZVision *engine, int32 slotkey, const Common::String &line);
436  ~ActionTtyText() override;
437  bool execute() override;
438 
439 private:
440  Common::Path _filename;
441  uint32 _delay;
442  Common::Rect _r;
443 };
444 } // End of namespace ZVision
445 
446 #endif
Definition: actions.h:40
Definition: actions.h:104
Definition: actions.h:381
Definition: str.h:59
Definition: actions.h:340
Definition: actions.h:424
Definition: actions.h:192
Definition: actions.h:219
Definition: actions.h:253
Definition: actions.h:359
Definition: script_manager.h:143
Definition: actions.h:91
Definition: rect.h:524
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: focus_list.h:27
Definition: actions.h:272
Definition: actions.h:146
Definition: actions.h:433
Definition: actions.h:201
Definition: actions.h:300
Definition: actions.h:137
Definition: actions.h:350
Definition: actions.h:369
Definition: actions.h:332
Definition: actions.h:177
Definition: actions.h:162
Definition: script_manager.h:381
Definition: actions.h:399
Definition: actions.h:390
Definition: actions.h:235
Definition: actions.h:211
Definition: actions.h:186
Definition: actions.h:119
Definition: actions.h:414
Definition: actions.h:81
Definition: actions.h:309
Definition: actions.h:288
Definition: actions.h:315