ScummVM API documentation
navigationrecords.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_NAVIGATIONRECORDS_H
23 #define NANCY_ACTION_NAVIGATIONRECORDS_H
24 
25 #include "engines/nancy/action/actionrecord.h"
26 
27 namespace Nancy {
28 namespace Action {
29 
30 // Simply changes the scene
31 class SceneChange : public ActionRecord {
32 public:
33  void readData(Common::SeekableReadStream &stream) override;
34  void execute() override;
35 
36  SceneChangeDescription _sceneChange;
37 
38  Common::String getRecordExtraInfo() const override { return Common::String::format("Scene %d", _sceneChange.sceneID); }
39 
40 protected:
41  Common::String getRecordTypeName() const override { return "SceneChange"; }
42 };
43 
44 // Changes the scene when clicked
46 public:
48  _hasHotspot = false;
49  _hoverCursor = CursorManager::kNormal;
50  }
51  virtual ~HotSingleFrameSceneChange() {}
52 
53  void readData(Common::SeekableReadStream &stream) override;
54  void execute() override;
55 
56  CursorManager::CursorType getHoverCursor() const override { return _hoverCursor; }
57  bool cursorSetFromScript() const override { return false; }
58 
59  HotspotDescription _sceneHotspot;
60 
61  bool canHaveHotspot() const override { return true; }
62 
63 protected:
64  CursorManager::CursorType _hoverCursor;
65 
66  Common::String getRecordTypeName() const override { return "HotSingleFrameSceneChange"; }
67 };
68 
69 // Changes the scene when clicked. Hotspot can move along with scene background frame.
70 // Nancy4 introduced several sub-types with a specific mouse cursor to show when
71 // hovering; all of them are handled in this class as well.
73 public:
74  HotMultiframeSceneChange(CursorManager::CursorType hoverCursor, bool isTerse = false) :
75  _hoverCursor(hoverCursor), _isTerse(isTerse) {}
76  virtual ~HotMultiframeSceneChange() {}
77 
78  void readData(Common::SeekableReadStream &stream) override;
79  void execute() override;
80 
81  CursorManager::CursorType getHoverCursor() const override { return _hoverCursor; }
82  bool cursorSetFromScript() const override { return _isTerse; }
83 
85  bool _isTerse = false;
86 
87  bool canHaveHotspot() const override { return true; }
88 
89 protected:
90  Common::String getRecordTypeName() const override {
91  if (_isTerse)
92  return "HotMultiframeSceneChangeTerse";
93 
94  switch (_hoverCursor) {
95  case CursorManager::kMoveForward:
96  return "HotMultiframeForwardSceneChange";
97  case CursorManager::kMoveUp:
98  return "HotMultiframeUpSceneChange";
99  case CursorManager::kMoveDown:
100  return "HotMultiframeDownSceneChange";
101  default:
102  return "HotMultiframeSceneChange";
103  }
104  }
105 
106  CursorManager::CursorType _hoverCursor;
107 };
108 
109 // Changes the scene when clicked; does _not_ move with scene background.
110 // Nancy4 introduced several sub-types with a specific mouse cursor to show when
111 // hovering; all of them are handled in this class as well.
113 public:
114  Hot1FrSceneChange(CursorManager::CursorType hoverCursor, bool dynamicCursor = false, bool isTerse = false) :
115  _hoverCursor(hoverCursor), _dynamicCursor(dynamicCursor), _isTerse(isTerse) {}
116  virtual ~Hot1FrSceneChange() {}
117 
118  void readData(Common::SeekableReadStream &stream) override;
119  void execute() override;
120 
121  CursorManager::CursorType getHoverCursor() const override { return _hoverCursor; }
122  bool cursorSetFromScript() const override { return _dynamicCursor; }
123 
124  HotspotDescription _hotspotDesc;
125  bool _isTerse = false;
126  bool _dynamicCursor = false;
127 
128  bool canHaveHotspot() const override { return true; }
129 
130 protected:
131  Common::String getRecordTypeName() const override {
132  if (_isTerse)
133  return "HotSceneChangeTerse";
134 
135  switch (_hoverCursor) {
136  case CursorManager::kExit:
137  return "Hot1FrExitSceneChange";
138  case CursorManager::kMoveForward:
139  return "Hot1FrForwardSceneChange";
140  case CursorManager::kMoveBackward:
141  return "Hot1FrBackSceneChange";
142  case CursorManager::kMoveUp:
143  return "Hot1FrUpSceneChange";
144  case CursorManager::kMoveDown:
145  return "Hot1FrDownSceneChange";
146  case CursorManager::kMoveLeft:
147  return "Hot1FrLeftSceneChange";
148  case CursorManager::kMoveRight:
149  return "Hot1FrRightSceneChange";
150  default:
151  return "Hot1FrSceneChange";
152  }
153  }
154 
155  CursorManager::CursorType _hoverCursor;
156 };
157 
158 // Changes the scene when clicked. Hotspot can move along with scene background frame.
159 // However, the scene it changes to can be one of two options, picked based on
160 // a provided condition.
162 public:
163  void readData(Common::SeekableReadStream &stream) override;
164  void execute() override;
165 
166  SceneChangeWithFlag _onTrue;
167  SceneChangeWithFlag _onFalse;
168  byte _condType;
169  uint16 _conditionID;
170  byte _conditionPayload;
172 
173  bool canHaveHotspot() const override { return true; }
174 
175 protected:
176  Common::String getRecordTypeName() const override { return "HotMultiframeMultisceneChange"; }
177 };
178 
179 // Changes the scene when clicked. Hotspot can move along with scene background frame.
180 // However, the scene it changes to can be one of several options, picked based on
181 // the item the player is currently holding.
183 public:
184  void readData(Common::SeekableReadStream &stream) override;
185  void execute() override;
186 
188  Common::Array<uint16> _cursorTypes;
189 
190  SceneChangeDescription _defaultScene;
192 
193  Common::String getRecordExtraInfo() const override { return Common::String::format("Default scene %d", _defaultScene.sceneID); }
194 
195 protected:
196  Common::String getRecordTypeName() const override { return "HotMultiframeMultisceneCursorTypeSceneChange"; }
197 };
198 
199 // Simply switches to the Map state. TVD/nancy1 only.
200 class MapCall : public ActionRecord {
201 public:
202  void readData(Common::SeekableReadStream &stream) override;
203  void execute() override;
204 
205  CursorManager::CursorType getHoverCursor() const override { return CursorManager::kExit; }
206 
207 protected:
208  Common::String getRecordTypeName() const override { return "MapCall"; }
209 };
210 
211 // Switches to the Map state when clicked; does _not_ move with background frame. TVD/nancy1 only.
212 class MapCallHot1Fr : public MapCall {
213 public:
214  void readData(Common::SeekableReadStream &stream) override;
215  void execute() override;
216 
217  HotspotDescription _hotspotDesc;
218 
219  bool canHaveHotspot() const override { return true; }
220 
221 protected:
222  Common::String getRecordTypeName() const override { return "MapCallHot1Fr"; }
223 };
224 
225 // Switches to the Map state when clicked. Hotspot can move along with scene background frame. TVD/nancy1 only.
227 public:
228  void readData(Common::SeekableReadStream &stream) override;
229  void execute() override;
230 
232 
233  bool canHaveHotspot() const override { return true; }
234 
235 protected:
236  Common::String getRecordTypeName() const override { return "MapCallHotMultiframe"; }
237 };
238 
239 } // End of namespace Action
240 } // End of namespace Nancy
241 
242 #endif // NANCY_ACTION_NAVIGATIONRECORDS_H
Definition: navigationrecords.h:200
Definition: navigationrecords.h:161
Definition: str.h:59
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: commontypes.h:165
Definition: array.h:52
Definition: navigationrecords.h:31
Definition: stream.h:745
Definition: commontypes.h:185
Definition: navigationrecords.h:72
Definition: navigationrecords.h:45
Definition: actionrecord.h:98
Definition: navigationrecords.h:226
Definition: navigationrecords.h:212
Definition: navigationrecords.h:112
Definition: commontypes.h:194
Definition: actionmanager.h:32