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