ScummVM API documentation
myst.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 MYST_SCRIPTS_MYST_H
23 #define MYST_SCRIPTS_MYST_H
24 
25 #include "common/scummsys.h"
26 #include "common/util.h"
27 #include "mohawk/myst_scripts.h"
28 
29 namespace Mohawk {
30 
31 struct MystScriptEntry;
32 
33 namespace MystStacks {
34 
35 #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
36 
37 class Myst : public MystScriptParser {
38 public:
39  explicit Myst(MohawkEngine_Myst *vm, MystStack stackId = kMystStack);
40  ~Myst() override;
41 
42  void disablePersistentScripts() override;
43  void runPersistentScripts() override;
44 
45 protected:
46  void setupOpcodes();
47  uint16 getVar(uint16 var) override;
48  void toggleVar(uint16 var) override;
49  bool setVarValue(uint16 var, uint16 value) override;
50 
51  uint16 getMap() override { return 9934; }
52 
53  void towerRotationMap_run();
54  virtual void libraryBookcaseTransform_run();
55  void generatorControlRoom_run();
56  void libraryCombinationBook_run();
57  void libraryBook_run();
58  void clockWheel_run();
59  void matchBurn_run();
60  void boilerPressureIncrease_run();
61  void boilerPressureDecrease_run();
62  void basementPressureIncrease_run();
63  void basementPressureDecrease_run();
64  void tree_run();
65  void imagerValidation_run();
66  void imager_run();
67  void observatory_run();
68  void observatoryMonthChange_run();
69  void observatoryDayChange_run();
70  void observatoryYearChange_run();
71  void observatoryTimeChange_run();
72  void greenBook_run();
73  void clockGears_run();
74  void gullsFly1_run();
75  void gullsFly2_run();
76  void gullsFly3_run();
77 
78  DECLARE_OPCODE(o_libraryBookPageTurnLeft);
79  DECLARE_OPCODE(o_libraryBookPageTurnRight);
80  DECLARE_OPCODE(o_fireplaceToggleButton);
81  DECLARE_OPCODE(o_fireplaceRotation);
82  DECLARE_OPCODE(o_courtyardBoxesCheckSolution);
83  DECLARE_OPCODE(o_towerRotationStart);
84  DECLARE_OPCODE(o_towerRotationEnd);
85  DECLARE_OPCODE(o_imagerChangeSelection);
86  DECLARE_OPCODE(o_dockVaultOpen);
87  DECLARE_OPCODE(o_dockVaultClose);
88  DECLARE_OPCODE(o_bookGivePage);
89  DECLARE_OPCODE(o_clockWheelsExecute);
90  DECLARE_OPCODE(o_imagerPlayButton);
91  DECLARE_OPCODE(o_imagerEraseButton);
92  DECLARE_OPCODE(o_towerElevatorAnimation);
93  DECLARE_OPCODE(o_generatorButtonPressed);
94  DECLARE_OPCODE(o_cabinSafeChangeDigit);
95  DECLARE_OPCODE(o_cabinSafeHandleStartMove);
96  DECLARE_OPCODE(o_cabinSafeHandleMove);
97  DECLARE_OPCODE(o_cabinSafeHandleEndMove);
98  DECLARE_OPCODE(o_treePressureReleaseStart);
99  DECLARE_OPCODE(o_observatoryMonthChangeStartIncrease);
100  DECLARE_OPCODE(o_observatoryMonthChangeStartDecrease);
101  DECLARE_OPCODE(o_observatoryDayChangeStartIncrease);
102  DECLARE_OPCODE(o_observatoryDayChangeStartDecrease);
103  DECLARE_OPCODE(o_observatoryGoButton);
104  DECLARE_OPCODE(o_observatoryMonthSliderMove);
105  DECLARE_OPCODE(o_observatoryDaySliderMove);
106  DECLARE_OPCODE(o_observatoryYearSliderMove);
107  DECLARE_OPCODE(o_observatoryTimeSliderMove);
108  DECLARE_OPCODE(o_circuitBreakerStartMove);
109  DECLARE_OPCODE(o_circuitBreakerMove);
110  DECLARE_OPCODE(o_circuitBreakerEndMove);
111  DECLARE_OPCODE(o_boilerIncreasePressureStart);
112  DECLARE_OPCODE(o_boilerLightPilot);
113  DECLARE_OPCODE(o_boilerIncreasePressureStop);
114  DECLARE_OPCODE(o_boilerDecreasePressureStart);
115  DECLARE_OPCODE(o_boilerDecreasePressureStop);
116  DECLARE_OPCODE(o_basementIncreasePressureStart);
117  DECLARE_OPCODE(o_basementIncreasePressureStop);
118  DECLARE_OPCODE(o_basementDecreasePressureStart);
119  DECLARE_OPCODE(o_basementDecreasePressureStop);
120  DECLARE_OPCODE(o_rocketPianoStart);
121  DECLARE_OPCODE(o_rocketPianoMove);
122  DECLARE_OPCODE(o_rocketPianoStop);
123  DECLARE_OPCODE(o_rocketSoundSliderStartMove);
124  DECLARE_OPCODE(o_rocketSoundSliderMove);
125  DECLARE_OPCODE(o_rocketSoundSliderEndMove);
126  DECLARE_OPCODE(o_rocketLeverStartMove);
127  DECLARE_OPCODE(o_rocketOpenBook);
128  DECLARE_OPCODE(o_rocketLeverMove);
129  DECLARE_OPCODE(o_rocketLeverEndMove);
130  DECLARE_OPCODE(o_cabinLeave);
131  DECLARE_OPCODE(o_treePressureReleaseStop);
132  DECLARE_OPCODE(o_observatoryMonthSliderStartMove);
133  DECLARE_OPCODE(o_observatoryMonthSliderEndMove);
134  DECLARE_OPCODE(o_observatoryDaySliderStartMove);
135  DECLARE_OPCODE(o_observatoryDaySliderEndMove);
136  DECLARE_OPCODE(o_observatoryYearSliderStartMove);
137  DECLARE_OPCODE(o_observatoryYearSliderEndMove);
138  DECLARE_OPCODE(o_observatoryTimeSliderStartMove);
139  DECLARE_OPCODE(o_observatoryTimeSliderEndMove);
140  DECLARE_OPCODE(o_libraryBookPageTurnStartLeft);
141  DECLARE_OPCODE(o_libraryBookPageTurnStartRight);
142  DECLARE_OPCODE(o_libraryCombinationBookStop);
143  DECLARE_OPCODE(o_cabinMatchLight);
144  DECLARE_OPCODE(o_courtyardBoxEnter);
145  DECLARE_OPCODE(o_courtyardBoxLeave);
146  DECLARE_OPCODE(o_clockMinuteWheelStartTurn);
147  DECLARE_OPCODE(o_clockWheelEndTurn);
148  DECLARE_OPCODE(o_clockHourWheelStartTurn);
149  DECLARE_OPCODE(o_clockLeverStartMove);
150  DECLARE_OPCODE(o_clockLeverMoveLeft);
151  DECLARE_OPCODE(o_clockLeverMoveRight);
152  DECLARE_OPCODE(o_clockLeverEndMove);
153  DECLARE_OPCODE(o_clockResetLeverStartMove);
154  DECLARE_OPCODE(o_clockResetLeverMove);
155  DECLARE_OPCODE(o_clockResetLeverEndMove);
156 
157  DECLARE_OPCODE(o_libraryCombinationBookStartRight);
158  DECLARE_OPCODE(o_libraryCombinationBookStartLeft);
159  DECLARE_OPCODE(o_observatoryTimeChangeStartIncrease);
160  DECLARE_OPCODE(o_observatoryTimeChangeStartDecrease);
161  DECLARE_OPCODE(o_observatoryChangeSettingStop);
162  DECLARE_OPCODE(o_observatoryYearChangeStartIncrease);
163  DECLARE_OPCODE(o_observatoryYearChangeStartDecrease);
164  DECLARE_OPCODE(o_dockVaultForceClose);
165  DECLARE_OPCODE(o_imagerEraseStop);
166 
167  DECLARE_OPCODE(o_libraryBook_init);
168  DECLARE_OPCODE(o_courtyardBox_init);
169  DECLARE_OPCODE(o_towerRotationMap_init);
170  DECLARE_OPCODE(o_forechamberDoor_init);
171  DECLARE_OPCODE(o_shipAccess_init);
172  DECLARE_OPCODE(o_butterflies_init);
173  DECLARE_OPCODE(o_imager_init);
174  DECLARE_OPCODE(o_libraryBookcaseTransform_init);
175  DECLARE_OPCODE(o_generatorControlRoom_init);
176  DECLARE_OPCODE(o_fireplace_init);
177  DECLARE_OPCODE(o_clockGears_init);
178  DECLARE_OPCODE(o_gulls1_init);
179  DECLARE_OPCODE(o_observatory_init);
180  DECLARE_OPCODE(o_gulls2_init);
181  DECLARE_OPCODE(o_treeCard_init);
182  DECLARE_OPCODE(o_treeEntry_init);
183  DECLARE_OPCODE(o_boilerMovies_init);
184  DECLARE_OPCODE(o_rocketSliders_init);
185  DECLARE_OPCODE(o_rocketLinkVideo_init);
186  DECLARE_OPCODE(o_greenBook_init);
187  DECLARE_OPCODE(o_gulls3_init);
188 
189  DECLARE_OPCODE(o_bookAddSpecialPage_exit);
190  DECLARE_OPCODE(o_treeCard_exit);
191  DECLARE_OPCODE(o_treeEntry_exit);
192  DECLARE_OPCODE(o_boiler_exit);
193  DECLARE_OPCODE(o_generatorControlRoom_exit);
194  DECLARE_OPCODE(o_rocketSliders_exit);
195 
196 
197  MystGameState::Myst &_state;
198 
199  bool _generatorControlRoomRunning;
200  uint16 _generatorVoltage; // 58
201 
202  uint16 _rocketPianoSound; // 292
203  MystAreaSlider *_rocketSlider1; // 248
204  MystAreaSlider *_rocketSlider2; // 252
205  MystAreaSlider *_rocketSlider3; // 256
206  MystAreaSlider *_rocketSlider4; // 260
207  MystAreaSlider *_rocketSlider5; // 264
208  uint16 _rocketSliderSound; // 294
209  uint16 _rocketLeverPosition; // 296
210  VideoEntryPtr _rocketLinkBook; // 268
211 
212  bool _libraryBookPagesTurning;
213  bool _libraryCombinationBookPagesTurning;
214  int16 _libraryBookPage; // 86
215  uint16 _libraryBookNumPages; // 88
216  uint16 _libraryBookBaseImage; // 90
217 
218  bool _butterfliesMoviePlayed; // 100
219 
220  bool _gullsFlying1;
221  bool _gullsFlying2;
222  bool _gullsFlying3;
223  uint32 _gullsNextTime; // 216
224 
225  bool _libraryBookcaseMoving;
226  MystAreaVideo *_libraryBookcaseMovie; // 104
227  uint16 _libraryBookcaseSoundId; // 284
228  bool _libraryBookcaseChanged; // 288
229  uint16 _libraryBookSound1; // 298
230  uint16 _libraryBookSound2; // 300
231 
232  uint16 _courtyardBoxSound; // 302
233 
234  bool _imagerValidationRunning;
235  MystAreaImageSwitch *_imagerRedButton; // 304
236  uint16 _imagerSound[4]; // 308 to 314
237  uint16 _imagerValidationCard; // 316
238  uint16 _imagerValidationStep; // 318
239 
240  bool _imagerRunning;
241  MystAreaVideo *_imagerMovie; // 64
242 
243  uint16 _fireplaceLines[6]; // 74 to 84
244 
245  uint16 _clockTurningWheel;
246 
247  VideoEntryPtr _clockGearsVideos[3]; // 148 to 156
248  VideoEntryPtr _clockWeightVideo; // 160
249  uint16 _clockGearsPositions[3]; // 164 to 168
250  uint16 _clockWeightPosition; // 172
251  bool _clockMiddleGearMovedAlone; // 176
252  bool _clockLeverPulled; // 328
253 
254  uint16 _dockVaultState; // 92
255 
256  bool _towerRotationMapRunning;
257  bool _towerRotationBlinkLabel;
258  uint16 _towerRotationBlinkLabelCount;
259  uint16 _towerRotationMapInitialized; // 292
260  MystAreaImageSwitch *_towerRotationMapTower; // 108
261  MystAreaImageSwitch *_towerRotationMapLabel; // 112
262  uint16 _towerRotationSpeed; // 124
263  bool _towerRotationMapClicked; // 132
264  bool _towerRotationOverSpot; // 136
265  const Common::Point _towerRotationCenter;
266 
267  bool _matchBurning;
268  uint16 _matchGoOutCnt;
269  uint16 _cabinDoorOpened; // 56
270  uint16 _cabinHandleDown; // 344
271  uint16 _cabinMatchState; // 60
272  uint32 _matchGoOutTime; // 144
273 
274  VideoEntryPtr _cabinFireMovie; // 240
275 
276  bool _cabinGaugeMovieEnabled;
277  VideoEntryPtr _cabinGaugeMovie; // 244
278 
279  bool _boilerPressureIncreasing;
280  bool _boilerPressureDecreasing;
281  bool _basementPressureIncreasing;
282  bool _basementPressureDecreasing;
283 
284  bool _treeStopped; // 236
285  MystAreaImageSwitch *_tree; // 220
286  MystArea *_treeAlcove; // 224
287  uint16 _treeMinPosition; // 228
288  uint16 _treeMinAccessiblePosition; // 230
289  uint16 _treeMaxAccessiblePosition; // 232
290 
291  bool _observatoryRunning;
292  bool _observatoryMonthChanging;
293  bool _observatoryDayChanging;
294  bool _observatoryYearChanging;
295  bool _observatoryTimeChanging;
296  MystAreaImageSwitch *_observatoryVisualizer; // 184
297  MystAreaImageSwitch *_observatoryGoButton; // 188
298  MystAreaSlider *_observatoryDaySlider; // 192
299  MystAreaSlider *_observatoryMonthSlider; // 196
300  MystAreaSlider *_observatoryYearSlider; // 200
301  MystAreaSlider *_observatoryTimeSlider; // 204
302  uint32 _observatoryLastTime; // 208
303  bool _observatoryNotInitialized; // 212
304  int16 _observatoryIncrement; // 346
305  MystAreaSlider *_observatoryCurrentSlider; // 348
306 
307  bool _greenBookRunning;
308 
309  void generatorRedrawRocket();
310  void generatorButtonValue(MystArea *button, uint16 &offset, uint16 &value);
311 
312  void rocketSliderMove();
313  uint16 rocketSliderGetSound(uint16 pos);
314  uint16 rocketCheckIfSoundMatches(uint16 sound1, uint16 sound2);
315  void rocketCheckSolution();
316 
317  void libraryBookPageTurnLeft();
318  void libraryBookPageTurnRight();
319  void libraryCombinationBookTurnRight();
320  void libraryCombinationBookTurnLeft();
321 
322  uint16 bookCountPages(uint16 var);
323 
324  void clockWheelStartTurn(uint16 wheel);
325  void clockWheelTurn(uint16 var);
326 
327  void clockLeverMove(bool leftLever);
328  void clockGearForwardOneStep(uint16 gear);
329  void clockWeightDownOneStep();
330  void clockGearsCheckSolution();
331  void clockReset();
332  void clockResetWeight();
333  void clockResetGear(uint16 gear);
334 
335  void towerRotationMapRotate();
336  void towerRotationMapRedraw();
337  void towerRotationDrawBuildings();
338  uint16 towerRotationMapComputeAngle();
339  Common::Point towerRotationMapComputeCoords(uint16 angle);
340  void towerRotationMapDrawLine(const Common::Point &end, bool rotationLabelVisible);
341 
342  void boilerFireInit();
343  void boilerFireUpdate(bool init);
344  void boilerGaugeInit();
345  Common::Rational boilerComputeGaugeRate(uint16 pressure, uint32 delay);
346  void boilerResetGauge(const Common::Rational &rate);
347 
348  void treeSetAlcoveAccessible();
349  uint32 treeNextMoveDelay(uint16 pressure);
350 
351  bool observatoryIsDDMMYYYY2400();
352  void observatorySetTargetToSetting();
353  void observatoryUpdateVisualizer(uint16 x, uint16 y);
354  void observatoryMonthChangeStart(bool increase);
355  void observatoryDayChangeStart(bool increase);
356  void observatoryYearChangeStart(bool increase);
357  void observatoryTimeChangeStart(bool increase);
358  void observatoryIncrementMonth(int16 increment);
359  void observatoryIncrementDay(int16 increment);
360  void observatoryIncrementYear(int16 increment);
361  void observatoryIncrementTime(int16 increment);
362  void observatoryUpdateMonth();
363  void observatoryUpdateDay();
364  void observatoryUpdateYear();
365  void observatoryUpdateTime();
366 };
367 
368 } // End of namespace MystStacks
369 } // End of namespace Mohawk
370 
371 #undef DECLARE_OPCODE
372 
373 #endif
Definition: myst_areas.h:107
Definition: rational.h:40
Definition: myst_scripts.h:60
Definition: myst_areas.h:216
Definition: myst.h:129
Definition: rect.h:45
Definition: myst_areas.h:59
Definition: myst_areas.h:154
Definition: myst.h:37
Definition: myst_state.h:192
Definition: bitmap.h:32