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