ScummVM API documentation
riven_card.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 RIVEN_CARD_H
23#define RIVEN_CARD_H
24
25#include "mohawk/riven_scripts.h"
26#include "mohawk/riven_sound.h"
27
28#include "common/rect.h"
29#include "common/system.h"
30
31namespace Mohawk {
32
33class RivenHotspot;
34struct MLSTRecord;
35
44class RivenCard {
45public:
46 RivenCard(MohawkEngine_Riven *vm, uint16 id);
47 ~RivenCard();
48
52 struct Picture {
53 uint16 index;
54 uint16 id;
55 Common::Rect rect;
56 };
57
59 void enter(bool unkMovies);
60
62 void leave();
63
65 void runScript(uint16 scriptType);
66
68 uint16 getId() const;
69
71 Picture getPicture(uint16 index) const;
72
74 void drawPicture(uint16 index, bool queue = false);
75
77 void playSound(uint16 index, bool queue = false);
78
80 SLSTRecord getSound(uint16 index) const;
81
83 void overrideSound(uint16 index, uint16 withIndex);
84
86 void playMovie(uint16 index, bool queue = false);
87
89 MLSTRecord getMovie(uint16 index) const;
90
93
96
99
101 RivenHotspot *getHotspotByName(const Common::String &name, bool optional = false) const;
102
104 RivenHotspot *findEnabledHotspotByName(const char **names) const;
105
107 RivenHotspot *getHotspotByBlstId(const uint16 blstId) const;
108
111
114
116 void activateHotspotEnableRecord(uint16 index);
117
119 void activateWaterEffect(uint16 index);
120
123
126
129
132
135
138
141
143 void dump() const;
144
145private:
146 void loadCardResource(uint16 id);
147 void loadHotspots(uint16 id);
148 void loadCardPictureList(uint16 id);
149 void loadCardSoundList(uint16 id);
150 void loadCardMovieList(uint16 id);
151 void loadCardHotspotEnableList(uint16 id);
152 void loadCardWaterEffectList(uint16 id);
153 void applyPatches(uint16 id);
154 void applyPropertiesPatchE2E(uint32 globalId);
155 void applyPropertiesPatch1518D(uint32 globalId);
156 void applyPropertiesPatch8EB7(uint32 globalId, const Common::String &var, uint16 hotspotId);
157 void applyPropertiesPatch2E76(uint32 globalId);
158 void applyPropertiesPatch22118(uint32 globalId);
159 void applyPropertiesPatch2B414(uint32 globalId);
160 void setCurrentCardVariable();
161
162 void moveHotspot(uint16 blstId, const Common::Rect &position);
163 void addMenuHotspot(uint16 blstId, const Common::Rect &position, uint16 index,
164 uint16 externalCommandNameId, const char *externalCommandName);
165
166 RivenScriptPtr getScript(uint16 scriptType) const;
167 void defaultLoadScript();
168
169 void updateMouseCursor();
170
171 struct HotspotEnableRecord {
172 uint16 index;
173 uint16 enabled;
174 uint16 hotspotId;
175 };
176
177 struct WaterEffectRecord {
178 uint16 index;
179 uint16 sfxeId;
180 uint16 u0;
181 };
182
183 MohawkEngine_Riven *_vm;
184
185 // General card data
186 uint16 _id;
187 int16 _name;
188 uint16 _zipModePlace;
189 RivenScriptList _scripts;
190
192 RivenHotspot *_hoveredHotspot;
193 RivenHotspot *_pressedHotspot;
194
195 // Resource lists
196 Common::Array<Picture> _pictureList;
197 Common::Array<SLSTRecord> _soundList;
198 Common::Array<MLSTRecord> _movieList;
199 Common::Array<HotspotEnableRecord> _hotspotEnableList;
200 Common::Array<WaterEffectRecord> _waterEffectList;
201};
202
204 uint16 index;
205 uint16 movieID;
206 uint16 playbackSlot;
207 uint16 left;
208 uint16 top;
209 uint16 lowBoundTime;
210 uint16 startTime;
211 uint16 highBoundTime;
212 uint16 loop;
213 uint16 volume;
214 uint16 rate;
215};
216
224public:
226
228 RivenScriptPtr getScript(uint16 scriptType) const;
229
231 void enable(bool e);
232
234 bool isEnabled() const;
235
237 bool isZip() const;
238
241
243 bool containsPoint(const Common::Point &point) const;
244
246 void setRect(const Common::Rect &rect);
247
249 uint16 getMouseCursor() const;
250
253
255 int16 getNameId() const;
256
258 uint16 getIndex() const;
259
261 uint16 getBlstId() const;
262
268 int16 getTransitionOffset() const;
269
271 void dump() const;
272
274 void applyScriptPatches(uint32 cardGlobalId);
275
277 void applyPropertiesPatches(uint32 cardGlobalId);
278
279private:
280 enum {
281 kFlagZip = 1,
282 kFlagEnabled = 2
283 };
284
285 void loadFromStream(Common::ReadStream *stream);
286
288
289 uint16 _blstID;
290 int16 _nameResource;
291 Common::Rect _rect;
292 uint16 _u0;
293 uint16 _mouseCursor;
294 uint16 _index;
295 int16 _transitionOffset;
296 uint16 _flags;
297 RivenScriptList _scripts;
298};
299
300} // End of namespace Mohawk
301
302#endif
Definition: array.h:52
Definition: stream.h:385
Definition: str.h:59
Definition: riven.h:91
Definition: riven_card.h:44
RivenHotspot * getHotspotByName(const Common::String &name, bool optional=false) const
void drawPicture(uint16 index, bool queue=false)
void activateWaterEffect(uint16 index)
RivenScriptPtr onMouseDown(const Common::Point &mouse)
RivenScriptPtr onMouseUpdate()
RivenScriptPtr onKeyAction(RivenAction keyAction)
Common::Array< RivenHotspot * > getHotspots() const
void playSound(uint16 index, bool queue=false)
RivenHotspot * getHotspotByBlstId(const uint16 blstId) const
RivenScriptPtr onMouseMove(const Common::Point &mouse)
void activateHotspotEnableRecord(uint16 index)
MLSTRecord getMovie(uint16 index) const
void runScript(uint16 scriptType)
RivenScriptPtr onMouseUp(const Common::Point &mouse)
void overrideSound(uint16 index, uint16 withIndex)
SLSTRecord getSound(uint16 index) const
RivenHotspot * getCurHotspot() const
RivenScriptPtr onFrame()
void dump() const
RivenHotspot * findEnabledHotspotByName(const char **names) const
RivenScriptPtr onMouseDragUpdate()
uint16 getId() const
Picture getPicture(uint16 index) const
void playMovie(uint16 index, bool queue=false)
void enter(bool unkMovies)
void initializeZipMode()
RivenHotspot * getHotspotContainingPoint(const Common::Point &point) const
Definition: riven_card.h:223
int16 getTransitionOffset() const
bool isZip() const
void enable(bool e)
bool isEnabled() const
uint16 getIndex() const
Common::Rect getRect() const
int16 getNameId() const
Common::String getName() const
void applyScriptPatches(uint32 cardGlobalId)
void applyPropertiesPatches(uint32 cardGlobalId)
RivenScriptPtr getScript(uint16 scriptType) const
void setRect(const Common::Rect &rect)
uint16 getMouseCursor() const
bool containsPoint(const Common::Point &point) const
uint16 getBlstId() const
Definition: bitmap.h:32
RivenAction
Definition: riven_actions.h:28
Definition: rect.h:144
Definition: rect.h:536
Definition: riven_card.h:203
Definition: riven_card.h:52
Definition: riven_sound.h:42