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