aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/myst_scripts_selenitic.h
blob: 05c0233d4505ea9dddc1bbb72af026dd251a66d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/engines/mohawk/myst_scripts.h $
 * $Id: myst_scripts.h 47541 2010-01-25 01:39:44Z lordhoto $
 *
 */

#ifndef MYST_SCRIPTS_SELENITIC_H
#define MYST_SCRIPTS_SELENITIC_H

#include "common/scummsys.h"
#include "common/util.h"
#include "mohawk/myst_scripts.h"

namespace Mohawk {

#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, uint16 argc, uint16 *argv)

class MohawkEngine_Myst;
class MystResourceType8;
struct MystScriptEntry;

class MystScriptParser_Selenitic : public MystScriptParser {
public:
	MystScriptParser_Selenitic(MohawkEngine_Myst *vm);
	~MystScriptParser_Selenitic();

	void disableInitOpcodes();
	void runPersistentOpcodes();

private:
	void setupOpcodes();
	uint16 getVar(uint16 var);
	void toggleVar(uint16 var);
	bool setVarValue(uint16 var, uint16 value);

	void o_203_soundReceiver_run();
	void o_203_soundReceiver_disable();

	DECLARE_OPCODE(opcode_100);
	DECLARE_OPCODE(opcode_101);
	DECLARE_OPCODE(o_102_soundReceiverSigma);
	DECLARE_OPCODE(o_103_soundReceiverRight);
	DECLARE_OPCODE(o_104_soundReceiverLeft);
	DECLARE_OPCODE(o_105_109_soundReceiverSource);
	DECLARE_OPCODE(opcode_110);
	DECLARE_OPCODE(o_111_soundReceiverUpdateSound);
	DECLARE_OPCODE(o_112_soundLockMove);
	DECLARE_OPCODE(o_113_soundLockStartMove);
	DECLARE_OPCODE(o_114_soundLockEndMove);
	DECLARE_OPCODE(o_115_soundLockButton);
	DECLARE_OPCODE(o_117_soundReceiverEndMove);

	DECLARE_OPCODE(opcode_200);
	DECLARE_OPCODE(opcode_201);
	DECLARE_OPCODE(opcode_202);
	DECLARE_OPCODE(o_203_soundReceiver_init);
	DECLARE_OPCODE(o_204_soundLock_init);
	DECLARE_OPCODE(opcode_205);
	DECLARE_OPCODE(opcode_206);

	bool _sound_receiver_sigma_pressed; // 6
	MystResourceType8 *_sound_receiver_sources[5]; // 92 -> 108
	MystResourceType8 *_sound_receiver_current_source; // 112
	uint16 *_sound_receiver_position; // 116
	uint16 _sound_receiver_direction; // 120
	uint16 _sound_receiver_speed; // 122
	uint32 _sound_receiver_start_time; //124
	MystResourceType8 *_sound_receiver_viewer; // 128
	MystResourceType8 *_sound_receiver_right_button; // 132
	MystResourceType8 *_sound_receiver_left_button; // 136
	MystResourceType8 *_sound_receiver_angle_1; // 140
	MystResourceType8 *_sound_receiver_angle_2; // 144
	MystResourceType8 *_sound_receiver_angle_3; // 148
	MystResourceType8 *_sound_receiver_angle_4; // 152
	MystResourceType8 *_sound_receiver_sigma_button; // 156

	bool _maze_runner_door_opened; //160

	uint16 _sound_lock_sound_id;
	MystResourceType10 *_sound_lock_slider_1; // 164
	MystResourceType10 *_sound_lock_slider_2; // 168
	MystResourceType10 *_sound_lock_slider_3; // 172
	MystResourceType10 *_sound_lock_slider_4; // 176
	MystResourceType10 *_sound_lock_slider_5; // 180
	MystResourceType8 *_sound_lock_button; // 184

	void sound_receiver_left_right(uint direction);
	void sound_receiver_update();
	void sound_receiver_draw_view();
	void sound_receiver_draw_angle();
	void sound_receiver_increase_speed();
	void sound_receiver_update_sound();
	uint16 sound_receiver_current_sound(uint16 source, uint16 position);
	void sound_receiver_solution(uint16 source, uint16 &solution, bool &enabled);

	uint16 soundLockCurrentSound(uint16 position, bool pixels);
	MystResourceType10 *soundLockSliderFromVar(uint16 var);
	void soundLockCheckSolution(MystResourceType10 *slider, uint16 value, uint16 solution, bool &solved);

	void redrawResource(MystResource *_resource);
};

}

#undef DECLARE_OPCODE

#endif