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