ScummVM API documentation
mechanical.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_MECHANICAL_H
23 #define MYST_SCRIPTS_MECHANICAL_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 Mechanical : public MystScriptParser {
38 public:
39  explicit Mechanical(MohawkEngine_Myst *vm);
40  ~Mechanical() override;
41 
42  void disablePersistentScripts() override;
43  void runPersistentScripts() override;
44 
45 private:
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 9931; }
52 
53  void birdSing_run();
54  void elevatorRotation_run();
55  void elevatorGoMiddle_run();
56  void fortressRotation_run();
57  void fortressSimulation_run();
58 
59  enum Direction {
60  kSouth = 0, // Starting Island with Myst linking book
61  kEast = 1, // Island with right half of code
62  kNorth = 2, // Island with left half of code
63  kWest = 3 // No island, just water
64  };
65 
66  DECLARE_OPCODE(o_throneEnablePassage);
67  DECLARE_OPCODE(o_birdCrankStart);
68  DECLARE_OPCODE(o_birdCrankStop);
69  DECLARE_OPCODE(o_snakeBoxTrigger);
70  DECLARE_OPCODE(o_fortressStaircaseMovie);
71  DECLARE_OPCODE(o_elevatorRotationStart);
72  DECLARE_OPCODE(o_elevatorRotationMove);
73  DECLARE_OPCODE(o_elevatorRotationStop);
74  DECLARE_OPCODE(o_fortressRotationSpeedStart);
75  DECLARE_OPCODE(o_fortressRotationSpeedMove);
76  DECLARE_OPCODE(o_fortressRotationSpeedStop);
77  DECLARE_OPCODE(o_fortressRotationBrakeStart);
78  DECLARE_OPCODE(o_fortressRotationBrakeMove);
79  DECLARE_OPCODE(o_fortressRotationBrakeStop);
80  DECLARE_OPCODE(o_fortressSimulationSpeedStart);
81  DECLARE_OPCODE(o_fortressSimulationSpeedMove);
82  DECLARE_OPCODE(o_fortressSimulationSpeedStop);
83  DECLARE_OPCODE(o_fortressSimulationBrakeStart);
84  DECLARE_OPCODE(o_fortressSimulationBrakeMove);
85  DECLARE_OPCODE(o_fortressSimulationBrakeStop);
86  DECLARE_OPCODE(o_elevatorWindowMovie);
87  DECLARE_OPCODE(o_elevatorGoMiddle);
88  DECLARE_OPCODE(o_elevatorTopMovie);
89  DECLARE_OPCODE(o_fortressRotationSetPosition); // Rotator control button (above elevator) has been pressed
90  DECLARE_OPCODE(o_mystStaircaseMovie);
91  DECLARE_OPCODE(o_elevatorWaitTimeout);
92  DECLARE_OPCODE(o_crystalEnterYellow);
93  DECLARE_OPCODE(o_crystalEnterGreen);
94  DECLARE_OPCODE(o_crystalEnterRed);
95  DECLARE_OPCODE(o_crystalLeaveYellow);
96  DECLARE_OPCODE(o_crystalLeaveGreen);
97  DECLARE_OPCODE(o_crystalLeaveRed);
98 
99  DECLARE_OPCODE(o_throne_init);
100  DECLARE_OPCODE(o_fortressStaircase_init);
101  DECLARE_OPCODE(o_bird_init);
102  DECLARE_OPCODE(o_snakeBox_init);
103  DECLARE_OPCODE(o_elevatorRotation_init);
104  DECLARE_OPCODE(o_fortressRotation_init);
105  DECLARE_OPCODE(o_fortressSimulation_init);
106  DECLARE_OPCODE(o_fortressSimulationStartup_init);
107 
109 
110  bool _mystStaircaseState; // 76
111 
112  bool _fortressRotationRunning;
113  bool _gearsWereRunning;
114  uint16 _fortressRotationSpeed; // 78
115  uint16 _fortressRotationBrake; // 80
116  uint16 _fortressDirection; // 82
117  uint16 _fortressRotationSounds[4]; // 86 to 92
118  MystAreaVideo *_fortressRotationGears; // 172
119 
120  bool _fortressRotationShortMovieWorkaround;
121  uint32 _fortressRotationShortMovieCount;
122  uint32 _fortressRotationShortMovieLast;
123 
124  bool _fortressSimulationRunning;
125  bool _fortressSimulationInit; // 94
126  uint16 _fortressSimulationSpeed; // 96
127  uint16 _fortressSimulationBrake; // 98
128  uint16 _fortressSimulationStartSound1; // 102
129  uint16 _fortressSimulationStartSound2; // 100
130  MystAreaVideo *_fortressSimulationHolo; // 160
131  MystAreaVideo *_fortressSimulationStartup; // 164
132 
133  // HACK: Support negative rates with edit lists
134  double _fortressSimulationHoloRate;
135  // END HACK
136 
137  uint16 _elevatorGoingDown; // 112
138 
139  float _elevatorRotationSpeed; // 120
140  float _elevatorRotationGearPosition; // 124
141  uint16 _elevatorRotationSoundId; // 128
142  bool _elevatorRotationLeverMoving; // 184
143 
144  bool _elevatorGoingMiddle; // 148
145  bool _elevatorTooLate;
146  uint16 _elevatorPosition; // 104
147  bool _elevatorInCabin; // 108
148  uint16 _elevatorTopCounter;
149  uint32 _elevatorNextTime;
150 
151  uint16 _crystalLit; // 130
152 
153  bool _birdSinging; // 144
154  uint32 _birdCrankStartTime; // 136
155  uint32 _birdSingEndTime; // 140
156  MystAreaVideo *_bird; // 152
157 
158 
159  MystAreaVideo *_snakeBox; // 156
160 };
161 
162 } // End of namespace MystStacks
163 } // End of namespace Mohawk
164 
165 #undef DECLARE_OPCODE
166 
167 #endif
Definition: myst_areas.h:107
Definition: mechanical.h:37
Definition: myst_scripts.h:60
Definition: myst.h:129
Definition: myst_state.h:269
Definition: bitmap.h:32