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