ScummVM API documentation
datarecords.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_DATARECORDS_H
23 #define NANCY_ACTION_DATARECORDS_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 selected value inside the TableData. Value can be incremented, decremented, or not changed.
34 // Also responsible for checking whether all values are correct (as described in the TABL chunk). nancy6 only.
36 public:
37  void readData(Common::SeekableReadStream &stream) override;
38  void execute() override;
39 
40  CursorManager::CursorType getHoverCursor() const override { return (CursorManager::CursorType)_cursorType; }
41  bool cursorSetFromScript() const override { return true; }
42 
43 protected:
44  Common::String getRecordTypeName() const override { return "TableIndexSetValueHS"; }
45 
46  uint16 _tableIndex = 0;
47  byte _valueChangeType = kNoChangeTableValue;
48  int16 _entryCorrectFlagID = -1;
49  int16 _allEntriesCorrectFlagID = -1;
50 
52  uint16 _cursorType = 1;
54 };
55 
56 // Sets (or adds to) a value inside the TableData struct
57 class SetValue : public ActionRecord {
58 public:
59  void readData(Common::SeekableReadStream &stream) override;
60  void execute() override;
61 
62 protected:
63  Common::String getRecordTypeName() const override { return "SetValue"; }
64 
65  byte _index = 0;
66  bool _shouldSet = false;
67  int16 _value = kNoTableValue;
68 };
69 
70 class SetValueCombo : public ActionRecord {
71 public:
72  void readData(Common::SeekableReadStream &stream) override;
73  void execute() override;
74 
75 protected:
76  Common::String getRecordTypeName() const override { return "SetValueCombo"; }
77 
78  byte _valueIndex = 0;
79  Common::Array<byte> _indices;
80  Common::Array<int16> _percentages;
81 };
82 
83 class ValueTest : public ActionRecord {
84 public:
85  void readData(Common::SeekableReadStream &stream) override;
86  void execute() override;
87 
88 protected:
89  Common::String getRecordTypeName() const override { return "ValueTest"; }
90 
91  byte _valueIndex = 0;
92  byte _testType = 0;
93  byte _condition = 0;
94  Common::Array<byte> _indicesToTest;
95 
96  int16 _flagToSet = kFlagNoLabel;
97 };
98 
99 // Sets up to 10 flags at once.
100 class EventFlags : public ActionRecord {
101 public:
102  EventFlags(bool terse = false) : _isTerse(terse) {}
103  virtual ~EventFlags() {}
104 
105  void readData(Common::SeekableReadStream &stream) override;
106  void execute() override;
107 
109  bool _isTerse;
110 
111 protected:
112  Common::String getRecordTypeName() const override { return _isTerse ? "EventFlagsTerse" : "EventFlags"; }
113 };
114 
115 // Sets up to 10 flags when clicked. Hotspot can move alongside background frame.
117 public:
118  EventFlagsMultiHS(bool isCursor, bool terse = false) : EventFlags(terse), _isCursor(isCursor) {}
119  virtual ~EventFlagsMultiHS() {}
120 
121  void readData(Common::SeekableReadStream &stream) override;
122  void execute() override;
123 
124  CursorManager::CursorType getHoverCursor() const override;
125  bool cursorSetFromScript() const override { return true; }
126 
127  CursorManager::CursorType _hoverCursor = CursorManager::kHotspot;
129 
130  bool _isCursor;
131 
132  bool canHaveHotspot() const override { return true; }
133 
134 protected:
135  Common::String getRecordTypeName() const override { return _isCursor ? (_isTerse ? "EventFlagsHSTerse" : "EventFlagsCursorHS") : "EventFlagsMultiHS"; }
136 };
137 
138 // Nancy 11+ AR 96. Sets each of a list of event flags to a random boolean value.
140 public:
141  void readData(Common::SeekableReadStream &stream) override;
142  void execute() override;
143 
144  Common::Array<int16> _flagLabels;
145 
146 protected:
147  Common::String getRecordTypeName() const override { return "RandomizeEventFlags"; }
148 };
149 
150 // Sets the difficulty level for the current save. Only appears at the start of the game.
151 // First appears in nancy1. Nancy1 and nancy2 have three difficulty values, while later games
152 // only have two: 0 and 2.
154 public:
155  void readData(Common::SeekableReadStream &stream) override;
156  void execute() override;
157 
158  uint16 _difficulty = 0;
159  FlagDescription _flag;
160 
161 protected:
162  Common::String getRecordTypeName() const override { return "DifficultyLevel"; }
163 };
164 
166 public:
167  enum Type { kAdd, kDelete, kMark };
168 
169  ModifyListEntry(Type type) : _type(type) {}
170  virtual ~ModifyListEntry() {}
171 
172  void readData(Common::SeekableReadStream &stream) override;
173  void execute() override;
174 
175  Type _type;
176 
177  uint16 _surfaceID = 0;
178  Common::String _stringID;
179  uint16 _mark = 0;
180  uint16 _sceneID = kNoScene;
181 
182 protected:
183  Common::String getRecordTypeName() const override;
184 };
185 
186 } // End of namespace Action
187 } // End of namespace Nancy
188 
189 #endif // NANCY_ACTION_DATARECORDS_H
Definition: commontypes.h:200
Definition: str.h:59
Definition: array.h:52
Definition: datarecords.h:35
Definition: datarecords.h:70
Definition: stream.h:745
Definition: datarecords.h:153
Definition: datarecords.h:139
Definition: datarecords.h:83
Definition: datarecords.h:165
Definition: datarecords.h:100
Definition: actionrecord.h:97
Definition: datarecords.h:57
Definition: commontypes.h:167
Definition: actionmanager.h:32
Definition: datarecords.h:116