ScummVM API documentation
selenitic.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_SELENITIC_H
23 #define MYST_SCRIPTS_SELENITIC_H
24 
25 #include "common/scummsys.h"
26 #include "common/util.h"
27 #include "mohawk/myst_scripts.h"
28 
29 namespace Mohawk {
30 
31 class MystAreaImageSwitch;
32 struct MystScriptEntry;
33 
34 namespace MystStacks {
35 
36 #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
37 
38 class Selenitic : public MystScriptParser {
39 public:
40  explicit Selenitic(MohawkEngine_Myst *vm);
41  ~Selenitic() override;
42 
43  void disablePersistentScripts() override;
44  void runPersistentScripts() override;
45 
46 private:
47  void setupOpcodes();
48  uint16 getVar(uint16 var) override;
49  void toggleVar(uint16 var) override;
50  bool setVarValue(uint16 var, uint16 value) override;
51 
52  uint16 getMap() override { return 9930; }
53 
54  DECLARE_OPCODE(o_mazeRunnerMove);
55  DECLARE_OPCODE(o_mazeRunnerSoundRepeat);
56  DECLARE_OPCODE(o_soundReceiverSigma);
57  DECLARE_OPCODE(o_soundReceiverRight);
58  DECLARE_OPCODE(o_soundReceiverLeft);
59  DECLARE_OPCODE(o_soundReceiverSource);
60  DECLARE_OPCODE(o_mazeRunnerDoorButton);
61  DECLARE_OPCODE(o_soundReceiverUpdateSound);
62  DECLARE_OPCODE(o_soundLockMove);
63  DECLARE_OPCODE(o_soundLockStartMove);
64  DECLARE_OPCODE(o_soundLockEndMove);
65  DECLARE_OPCODE(o_soundLockButton);
66  DECLARE_OPCODE(o_soundReceiverEndMove);
67 
68  DECLARE_OPCODE(o_mazeRunnerCompass_init);
69  DECLARE_OPCODE(o_mazeRunnerWindow_init);
70  DECLARE_OPCODE(o_mazeRunnerLight_init);
71  DECLARE_OPCODE(o_soundReceiver_init);
72  DECLARE_OPCODE(o_soundLock_init);
73  DECLARE_OPCODE(o_mazeRunnerRight_init);
74  DECLARE_OPCODE(o_mazeRunnerLeft_init);
75 
76  enum SoundReceiverSpeed {
77  kSoundReceiverSpeedStill = 0,
78  kSoundReceiverSpeedSlow = 1,
79  kSoundReceiverSpeedNormal = 5, // The original has this at 10
80  kSoundReceiverSpeedFast = 10, // The original has this at 50 too fast!
81  kSoundReceiverSpeedFaster = 13 // The original has this at 100, way too fast!
82  };
83 
84  void soundReceiver_run();
85 
87 
88  bool _soundReceiverRunning;
89  bool _soundReceiverSigmaPressed; // 6
90  MystAreaImageSwitch *_soundReceiverSources[5]; // 92 -> 108
91  MystAreaImageSwitch *_soundReceiverCurrentSource; // 112
92  uint16 *_soundReceiverPosition; // 116
93  uint16 _soundReceiverDirection; // 120
94  SoundReceiverSpeed _soundReceiverSpeed; // 122
95  uint32 _soundReceiverStartTime; //124
96  uint _soundReceiverNearBlinkCounter;
97  MystAreaImageSwitch *_soundReceiverViewer; // 128
98  MystAreaImageSwitch *_soundReceiverRightButton; // 132
99  MystAreaImageSwitch *_soundReceiverLeftButton; // 136
100  MystAreaImageSwitch *_soundReceiverAngle1; // 140
101  MystAreaImageSwitch *_soundReceiverAngle2; // 144
102  MystAreaImageSwitch *_soundReceiverAngle3; // 148
103  MystAreaImageSwitch *_soundReceiverAngle4; // 152
104  MystAreaImageSwitch *_soundReceiverSigmaButton; // 156
105 
106  static const uint16 _mazeRunnerMap[300][4];
107  static const uint8 _mazeRunnerVideos[300][4];
108 
109  uint16 _mazeRunnerPosition; // 56
110  uint16 _mazeRunnerDirection; // 58
111  MystAreaImageSwitch *_mazeRunnerWindow; // 68
112  MystAreaImageSwitch *_mazeRunnerCompass; // 72
113  MystAreaImageSwitch *_mazeRunnerLight; // 76
114  MystAreaImageSwitch *_mazeRunnerRightButton; // 80
115  MystAreaImageSwitch *_mazeRunnerLeftButton; // 84
116  bool _mazeRunnerDoorOpened; // 160
117 
118  uint16 _soundLockSoundId;
119  MystAreaSlider *_soundLockSlider1; // 164
120  MystAreaSlider *_soundLockSlider2; // 168
121  MystAreaSlider *_soundLockSlider3; // 172
122  MystAreaSlider *_soundLockSlider4; // 176
123  MystAreaSlider *_soundLockSlider5; // 180
124  MystAreaImageSwitch *_soundLockButton; // 184
125 
126  void soundReceiverLeftRight(uint direction);
127  void soundReceiverUpdate();
128  void soundReceiverSetSubimageRect() const;
129  void soundReceiverDrawView();
130  void soundReceiverDrawAngle();
131  void soundReceiverIncreaseSpeed();
132  void soundReceiverUpdateSound();
133  uint16 soundReceiverCurrentSound(uint16 source, uint16 position);
134  void soundReceiverSolution(uint16 source, uint16 &solution, bool &enabled);
135 
136  uint16 soundLockCurrentSound(uint16 position, bool pixels);
137  MystAreaSlider *soundLockSliderFromVar(uint16 var);
138  void soundLockCheckSolution(MystAreaSlider *slider, uint16 value, uint16 solution, bool &solved);
139 
140  bool mazeRunnerForwardAllowed(uint16 position);
141  void mazeRunnerUpdateCompass();
142  void mazeRunnerPlaySoundHelp();
143  void mazeRunnerPlayVideo(uint16 video, uint16 pos);
144  void mazeRunnerBacktrack(uint16 &oldPosition);
145 };
146 
147 } // End of namespace MystStacks
148 }
149 
150 #undef DECLARE_OPCODE
151 
152 #endif
Definition: myst_state.h:298
Definition: myst_scripts.h:60
Definition: myst_areas.h:216
Definition: myst.h:129
Definition: selenitic.h:38
Definition: myst_areas.h:154
Definition: bitmap.h:32