ScummVM API documentation
cstime_game.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 MOHAWK_CSTIME_GAME_H
23 #define MOHAWK_CSTIME_GAME_H
24 
25 #include "mohawk/cstime.h"
26 #include "mohawk/sound.h" // CueList
27 
28 namespace Mohawk {
29 
30 class Feature;
31 class CSTimeCase;
32 class CSTimeScene;
33 
34 class Region {
35 public:
36  void loadFrom(Common::SeekableReadStream *stream);
37  bool containsPoint(Common::Point &pos) const;
38 
40 };
41 
42 struct CSTimeAmbient {
43  uint16 delay;
44  Feature *feature;
45  uint32 nextTime;
46 };
47 
48 class CSTimeChar {
49 public:
50  CSTimeChar(MohawkEngine_CSTime *vm, CSTimeScene *scene, uint id);
51  ~CSTimeChar();
52 
53  void idle();
54  void setupAmbientAnims(bool onetime);
55  void idleAmbients();
56  void stopAmbients(bool restpos);
57  void setupRestPos();
58  void removeChr();
59  uint16 getChrBaseId();
60  uint getScriptCount();
61  void playNIS(uint16 id);
62  bool NISIsDone();
63  void removeNIS();
64  void startFlapping(uint16 id);
65  void interruptFlapping();
66 
67  uint16 _unknown1, _unknown2, _unknown3;
69  bool _enabled;
70  uint16 _flappingState;
71 
72 protected:
74  CSTimeScene *_scene;
75  uint _id;
76 
77  Feature *_NIS;
78  Feature *_restFeature;
79  Feature *_talkFeature;
80  Feature *_talkFeature1, *_talkFeature2, *_talkFeature3;
81 
82  uint16 _playingWaveId;
83  CueList _cueList;
84  uint _nextCue;
85  uint32 _lastTime1, _lastTime2, _lastTime3;
86 
87  bool _resting;
88  byte _waveStatus;
89  byte _surfingState;
90 
91  void installAmbientAnim(uint id, uint32 flags);
92  uint16 getChrTypeScriptBase();
93  void playFlapWave(uint16 id);
94  void updateWaveStatus();
95  void setupTalk();
96  void idleTalk();
97  void stopFlapping();
98 };
99 
101  uint16 stringId;
102  uint16 state;
103  uint16 invObjId;
104  uint16 cursor;
106  Region region;
107 };
108 
110  uint16 sceneId, hotspotId;
111 };
112 
114  uint16 sceneId, hotspotId, stringId;
116 };
117 
118 #define TIME_CUFFS_ID 0
120  uint16 id, stringId, hotspotId, featureId, canTake;
121  Feature *feature;
122  bool featureDisabled;
126 };
127 
128 struct CSTimeQaR {
129  bool finished;
130  uint16 id;
131  uint16 unknown1;
132  uint16 questionStringId;
133  uint16 responseStringId;
134  uint16 unknown2;
135  uint16 nextQaRsId;
137 };
138 
140 public:
143 
144  void start();
145  void finishProcessingQaR();
146  void end(bool useLastClicked, bool runEvents = true);
147  void display();
148  void selectItemsToDisplay();
149 
150  void mouseDown(Common::Point &pos);
151  void mouseMove(Common::Point &pos);
152  void mouseUp(Common::Point &pos);
153 
154  void incrementTalkCount() { _talkCount++; }
155  uint16 getNameId() { return _nameId; }
156  uint16 getSourceChar() { return _sourceChar; }
157  void setSourceChar(uint16 source) { _sourceChar = source; }
158  void setAsked(uint qar, uint entry);
159  bool getAsked(uint qar, uint entry) { return _asked[qar][entry]; }
160 
161  void setState(uint state) { _state = state; }
162  uint getState() { return _state; }
163 
164 protected:
165  MohawkEngine_CSTime *_vm;
166  uint _id;
167 
168  uint _state;
169 
170  uint16 _nameId;
171  uint16 _greeting, _greeting2;
172 
173  uint _talkCount;
174  uint16 _sourceChar;
175 
176  uint16 _currEntry, _currHover;
177  uint16 _nextToProcess;
178 
179  bool _asked[8][5];
181  Common::Array<uint> _itemsToDisplay;
182 
183  void clear();
184  void loadQaR(CSTimeQaR &qar, uint16 id);
185 
186  void highlightLine(uint line);
187  void unhighlightLine(uint line);
188 };
189 
190 class CSTimeScene {
191 public:
192  CSTimeScene(MohawkEngine_CSTime *vm, CSTimeCase *case_, uint id);
193  ~CSTimeScene();
194 
195  void installGroup();
196  void buildScene();
197  void leave();
198  uint16 getSceneId();
199  void mouseDown(Common::Point &pos);
200  void mouseMove(Common::Point &pos);
201  void mouseUp(Common::Point &pos);
202  void idle();
203  void setupAmbientAnims();
204  void idleAmbientAnims();
205  bool eventIsActive();
206 
207  void setCursorForCurrentPoint();
208  void drawHotspots(); // debugging
209 
210  uint16 getBubbleType() { return _bubbleType; }
211  const Common::Array<CSTimeEvent> &getEvents(bool second);
212  const Common::Array<CSTimeHotspot> &getHotspots() { return _hotspots; }
213  CSTimeHotspot &getHotspot(uint id) { return _hotspots[id]; }
214  uint16 getInvObjForCurrentHotspot() { return _hotspots[_currHotspot].invObjId; }
215  CSTimeChar *getChar(uint id) { return _chars[id]; }
216  uint16 getHelperId() { return _helperId; }
217  uint getId() { return _id; }
218 
219  uint _visitCount;
220  CSTimeChar *_activeChar;
221 
222  Common::Array<Feature *> _objectFeatures;
223 
224 protected:
225  MohawkEngine_CSTime *_vm;
226  CSTimeCase *_case;
227  uint _id;
228 
229  uint16 _currHotspot;
230  uint16 _hoverHotspot;
231 
232  void load();
233  void cursorOverHotspot(uint id);
234  void mouseDownOnHotspot(uint id);
235  void mouseUpOnHotspot(uint id);
236  bool hotspotContainsEvent(uint id, uint16 eventType);
237 
238  uint16 _unknown1, _unknown2, _helperId;
239  uint16 _bubbleType;
240  uint16 _numObjects;
241  Common::Array<CSTimeEvent> _events, _events2;
244 };
245 
246 class CSTimeCase {
247 public:
248  CSTimeCase(MohawkEngine_CSTime *vm, uint id);
249  virtual ~CSTimeCase();
250 
251  uint getId() { return _id; }
252  Common::String &getRolloverText(uint id) { return _rolloverText[id]; }
253  CSTimeScene *getCurrScene();
254  void setCurrScene(uint16 id) { _currScene = id; }
255  void setConversation(uint id) { _currConv = _conversations[id]; }
256  CSTimeConversation *getCurrConversation() { return _currConv; }
257  uint16 getNoteFeatureId(uint16 id) { return _noteFeatureId[id]; }
258 
259  // Hard-coded per-case logic, implemented in subclasses.
260  virtual bool checkConvCondition(uint16 conditionId) = 0;
261  virtual bool checkAmbientCondition(uint16 charId, uint16 ambientId) = 0;
262  virtual bool checkObjectCondition(uint16 objectId) = 0;
263  virtual void selectHelpStrings() = 0;
264  virtual void handleConditionalEvent(const CSTimeEvent &event) = 0;
265 
267 
268 protected:
269  MohawkEngine_CSTime *_vm;
270  uint _id;
271 
272  uint16 _currScene;
273  uint16 _noteFeatureId[3];
274  Common::Array<Common::String> _rolloverText;
277  CSTimeConversation *_currConv;
278 
279  void loadRolloverText();
280  CSTimeInventoryObject *loadInventoryObject(uint id);
281 };
282 
283 } // End of namespace Mohawk
284 
285 #endif
Definition: view.h:107
Definition: cstime_game.h:190
Definition: str.h:59
Definition: cstime_game.h:119
Definition: cstime_game.h:128
Definition: stream.h:745
Definition: cstime.h:113
Definition: cstime_game.h:48
Definition: cstime_game.h:139
Definition: sound.h:74
Definition: cstime_game.h:113
Definition: cstime_game.h:42
Definition: rect.h:45
Definition: cstime_game.h:109
Definition: cstime_game.h:246
Definition: cstime.h:129
Definition: cstime_game.h:34
Definition: cstime_game.h:100
Definition: bitmap.h:32