ScummVM API documentation
miscrecords.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 NANCY_ACTION_RECORDTYPES_H
23 #define NANCY_ACTION_RECORDTYPES_H
24 
25 #include "engines/nancy/action/actionrecord.h"
26 
27 namespace Nancy {
28 
29 class NancyEngine;
30 
31 namespace Action {
32 
33 // Changes the palette for the current scene's background. TVD only.
35 public:
36  void readData(Common::SeekableReadStream &stream) override;
37  void execute() override;
38 
39  byte _paletteID;
40  byte _unknownEnum; // enum w values 1-3
41  uint16 _paletteStart;
42  uint16 _paletteSize;
43 
44 protected:
45  Common::String getRecordTypeName() const override { return "PaletteThisScene"; }
46 };
47 
48 // Changes the palette for the next scene's background. TVD only.
50 public:
51  void readData(Common::SeekableReadStream &stream) override;
52  void execute() override;
53 
54  byte _paletteID;
55 
56 protected:
57  Common::String getRecordTypeName() const override { return "PaletteNextScene"; }
58 };
59 
60 // Turns on (temporary) lightning effect. TVD Only.
61 class LightningOn : public ActionRecord {
62 public:
63  void readData(Common::SeekableReadStream &stream) override;
64  void execute() override;
65 
66  int16 _distance;
67  uint16 _pulseTime;
68  int16 _rgbPercent;
69 
70 protected:
71  Common::String getRecordTypeName() const override { return "LightningOn"; }
72 };
73 
74 // Requests either a fade between two scenes, or a fade to black; fade executes when scene is changed. Nancy2 and up.
75 class SpecialEffect : public ActionRecord {
76 public:
77  void readData(Common::SeekableReadStream &stream) override;
78  void execute() override;
79 
80  byte _type = 1;
81  uint16 _fadeToBlackTime = 0;
82  uint16 _frameTime = 0;
83  uint16 _totalTime = 0;
84  Common::Rect _rect;
85 
86 protected:
87  Common::String getRecordTypeName() const override { return "SpecialEffect"; }
88 };
89 
90 // Adds a caption to the textbox.
91 class TextBoxWrite : public ActionRecord {
92 public:
93  void readData(Common::SeekableReadStream &stream) override;
94  void execute() override;
95 
96  Common::String _text;
97 
98 protected:
99  Common::String getRecordTypeName() const override { return "TextBoxWrite"; }
100 };
101 
102 // Clears the textbox. Used very rarely.
103 class TextboxClear : public ActionRecord {
104 public:
105  void readData(Common::SeekableReadStream &stream) override;
106  void execute() override;
107 
108 protected:
109  Common::String getRecordTypeName() const override { return "TextboxClear"; }
110 };
111 
112 // Nancy 10+ replacement for TextBoxWrite. Pushes a line of conversation
113 // text into the new (UICO-driven) textbox
114 class FrameTextBox : public ActionRecord {
115 public:
116  enum Variant {
117  kVariant74 = 74,
118  kVariant75 = 75,
119  kVariant81 = 81
120  };
121 
122  FrameTextBox(Variant variant) : _variant(variant), _flags(0), _slot(0) {}
123 
124  void readData(Common::SeekableReadStream &stream) override;
125  void execute() override;
126 
127  Variant _variant;
128  Common::String _text;
129  int16 _flags;
130  int16 _slot;
131 
132 protected:
133  Common::String getRecordTypeName() const override { return "FrameTextBox"; }
134 };
135 
136 // Nancy 10+ opcode 29. Toggles whether one of the taskbar popups
137 // (inventory / notebook / cellphone) is enabled.
138 class ControlUIItems : public ActionRecord {
139 public:
140  enum UIType {
141  kUITypeInventory = 1,
142  kUITypeNotebook = 2,
143  kUITypeCellphone = 3
144  };
145 
146  void readData(Common::SeekableReadStream &stream) override;
147  void execute() override;
148 
149  uint16 _uiButton = 0;
150  byte _flagA = 0; // 0, 1 or 10
151  byte _flagB = 0; // 0 = clear, 1 = enable+remember scene
152  int16 _scene1 = 0; // start scene id (9999 = none)
153  int16 _scene2 = 0; // end scene id (9999 = none)
154 
155 protected:
156  Common::String getRecordTypeName() const override { return "ControlUIItems"; }
157 };
158 
159 // Nancy 10+ opcode 32. Prepares a UI popup
161 public:
162  void readData(Common::SeekableReadStream &stream) override;
163  void execute() override;
164 
165  int32 _uiType = 0;
166  int32 _signalValue = 0;
167 
168 protected:
169  Common::String getRecordTypeName() const override { return "UIPopupPrepScene"; }
170 };
171 
172 // Nancy 10+ opcode 131. Pushes a new entry into either the cellphone
173 // search-results list (mode 0) or the URL link list (mode 1).
174 class AddSearchLink : public ActionRecord {
175 public:
176  void readData(Common::SeekableReadStream &stream) override;
177  void execute() override;
178 
179  int16 _mode = 0;
180  Common::String _key;
181  Common::String _value;
182  int16 _extra = 0;
183  int16 _flag = 0;
184  int16 _scene = 0;
185 
186 protected:
187  Common::String getRecordTypeName() const override { return "AddSearchLink"; }
188 };
189 
190 // Changes the in-game time. Used prior to the introduction of SetPlayerClock.
192 public:
193  void readData(Common::SeekableReadStream &stream) override;
194  void execute() override;
195 
196  byte _relative;
197  uint16 _hours;
198  uint16 _minutes;
199 
200 protected:
201  Common::String getRecordTypeName() const override { return "BumpPlayerClock"; }
202 };
203 
204 // Creates a Second Chance save.
206 public:
207  void readData(Common::SeekableReadStream &stream) override;
208  void execute() override;
209 
210 protected:
211  Common::String getRecordTypeName() const override { return "SaveContinueGame"; }
212 };
213 
214 // Stops the screen from rendering. Our rendering system is different from the original engine's,
215 // so we have no use for this.
217 public:
218  void readData(Common::SeekableReadStream &stream) override;
219 
220 protected:
221  Common::String getRecordTypeName() const override { return "TurnOffMainRendering"; }
222 };
223 
224 // Restarts screen rendering. Our rendering system is different from the original engine's,
225 // so we have no use for this.
227 public:
228  void readData(Common::SeekableReadStream &stream) override;
229 
230 protected:
231  Common::String getRecordTypeName() const override { return "TurnOnMainRendering"; }
232 };
233 
234 // Starts the timer. Used in combination with Dependency types that check for
235 // how much time has passed since the timer was started.
237 public:
238  void readData(Common::SeekableReadStream &stream) override;
239  void execute() override;
240 
241 protected:
242  Common::String getRecordTypeName() const override { return "ResetAndStartTimer"; }
243 };
244 
245 // Stops the timer.
246 class StopTimer : public ActionRecord {
247 public:
248  void readData(Common::SeekableReadStream &stream) override;
249  void execute() override;
250 
251 protected:
252  Common::String getRecordTypeName() const override { return "StopTimer"; }
253 };
254 
255 // Returns the player back to the main menu
256 class GotoMenu : public ActionRecord {
257 public:
258  void readData(Common::SeekableReadStream &stream) override;
259  void execute() override;
260 
261 protected:
262  Common::String getRecordTypeName() const override { return "GotoMenu"; }
263 };
264 
265 // Stops the game and boots the player back to the Menu screen, while also making sure
266 // they can't Continue. The devs took care to add Second Chance saves before every one
267 // of these, to make sure the player can return to a state just before the dangerous part.
268 class LoseGame : public ActionRecord {
269 public:
270  void readData(Common::SeekableReadStream &stream) override;
271  void execute() override;
272 
273 protected:
274  Common::String getRecordTypeName() const override { return "LoseGame"; }
275 };
276 
277 // Adds a scene to the "stack" (which is just a single value). Used in combination with PopScene.
278 class PushScene : public ActionRecord {
279 public:
280  void readData(Common::SeekableReadStream &stream) override;
281  void execute() override;
282 
283 protected:
284  Common::String getRecordTypeName() const override { return "PushScene"; }
285 };
286 
287 // Changes to the scene pushed onto the "stack". Scenes can be pushed via PushScene, or Conversation types.
288 class PopScene : public ActionRecord {
289 public:
290  void readData(Common::SeekableReadStream &stream) override;
291  void execute() override;
292 
293 protected:
294  Common::String getRecordTypeName() const override { return "PopScene"; }
295 };
296 
297 // Ends the game and boots the player to the Credits screen.
298 // TODO: The original engine also sets a config option called PlayerWonTheGame,
299 // which in turn is used to trigger whichever event flag marks that the player
300 // has beat the game at least once, which in turn allows easter eggs to be shown.
301 // We currently support none of this.
302 class WinGame : public ActionRecord {
303 public:
304  void readData(Common::SeekableReadStream &stream) override;
305  void execute() override;
306 
307 protected:
308  Common::String getRecordTypeName() const override { return "WinGame"; }
309 };
310 
311 // Checks how many hints the player is allowed to get. If they are still allowed hints,
312 // it selects an appropriate one and plays its sound/displays its caption in the Textbox.
313 // The hint system was _only_ used in nancy1, since it's pretty limited and overly punishing.
314 class HintSystem : public ActionRecord {
315 public:
316  void readData(Common::SeekableReadStream &stream) override;
317  void execute() override;
318 
319  byte _characterID; // 0x00
320  SoundDescription _genericSound; // 0x01
321 
322  const Hint *selectedHint;
323  int16 _hintID;
324 
325  void selectHint();
326 
327 protected:
328  Common::String getRecordTypeName() const override { return "HintSystem"; }
329 };
330 
331 } // End of namespace Action
332 } // End of namespace Nancy
333 
334 #endif // NANCY_ACTION_MISCRECORDS_H
Definition: miscrecords.h:61
Definition: miscrecords.h:138
Definition: str.h:59
Definition: miscrecords.h:268
Definition: commontypes.h:302
Definition: miscrecords.h:278
Definition: miscrecords.h:302
Definition: miscrecords.h:226
Definition: rect.h:524
Definition: actionrecord.h:162
Definition: miscrecords.h:91
Definition: stream.h:745
Definition: miscrecords.h:75
Definition: miscrecords.h:103
Definition: miscrecords.h:246
Definition: miscrecords.h:34
Definition: miscrecords.h:256
Definition: miscrecords.h:216
Definition: actionrecord.h:97
Definition: miscrecords.h:160
Definition: miscrecords.h:288
Definition: miscrecords.h:114
Definition: miscrecords.h:205
Definition: commontypes.h:255
Definition: miscrecords.h:236
Definition: miscrecords.h:49
Definition: miscrecords.h:191
Definition: miscrecords.h:314
Definition: actionmanager.h:32