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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
/* 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$
* $Id$
*
*/
#ifndef PARALLACTION_EXEC_H
#define PARALLACTION_EXEC_H
#include "common/util.h"
#include "parallaction/objects.h"
namespace Parallaction {
typedef Common::Functor0<void> Opcode;
typedef Common::Array<const Opcode*> OpcodeSet;
#define DECLARE_UNQUALIFIED_COMMAND_OPCODE(op) void cmdOp_##op()
#define DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(op) void instOp_##op()
class Parallaction_ns;
class Parallaction_br;
class CommandExec {
protected:
struct ParallactionStruct1 {
CommandPtr cmd;
ZonePtr z;
} _ctxt;
OpcodeSet _opcodes;
public:
virtual void init() = 0;
virtual void run(CommandList &list, ZonePtr z = nullZonePtr);
CommandExec() {
}
virtual ~CommandExec() {
for (Common::Array<const Opcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++i)
delete *i;
_opcodes.clear();
}
};
class CommandExec_ns : public CommandExec {
Parallaction_ns *_vm;
protected:
void updateGetZone(ZonePtr z, bool visible);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(invalid);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(set);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(clear);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(start);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(speak);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(get);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(location);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(open);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(close);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(on);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(off);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(call);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(toggle);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(drop);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(quit);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(move);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(stop);
public:
void init();
CommandExec_ns(Parallaction_ns* vm);
~CommandExec_ns();
};
class CommandExec_br : public CommandExec_ns {
protected:
Parallaction_br *_vm;
DECLARE_UNQUALIFIED_COMMAND_OPCODE(location);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(open);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(close);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(on);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(off);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(call);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(drop);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(move);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(start);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(stop);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(character);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(followme);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(onmouse);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(offmouse);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(add);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(leave);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(inc);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(dec);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(ifeq);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(iflt);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(ifgt);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(let);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(music);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(fix);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(unfix);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(zeta);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(scroll);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(swap);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(give);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(text);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(part);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(testsfx);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(ret);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(onsave);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(offsave);
public:
void init();
CommandExec_br(Parallaction_br* vm);
~CommandExec_br();
};
class ProgramExec {
protected:
struct ParallactionStruct2 {
AnimationPtr anim;
ProgramPtr program;
InstructionList::iterator inst;
uint16 modCounter;
bool suspend;
} _ctxt;
const char **_instructionNames;
OpcodeSet _opcodes;
uint16 _modCounter;
public:
virtual void init() = 0;
virtual void runScripts(ProgramList::iterator first, ProgramList::iterator last);
ProgramExec() : _modCounter(0) {
}
virtual ~ProgramExec() {
for (Common::Array<const Opcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++i)
delete *i;
_opcodes.clear();
}
};
class ProgramExec_ns : public ProgramExec {
Parallaction_ns *_vm;
protected:
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(invalid);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(on);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(off);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(loop);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endloop);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(null);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(call);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(inc);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(set);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(put);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(wait);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(start);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(sound);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(move);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endscript);
public:
void init();
ProgramExec_ns(Parallaction_ns *vm);
~ProgramExec_ns();
};
class ProgramExec_br : public ProgramExec_ns {
Parallaction_br *_vm;
protected:
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(on);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(off);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(loop);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(inc);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(dec);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(set);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(put);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(wait);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(start);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(process);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(move);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(color);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(mask);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(print);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(text);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(mul);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(div);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(ifeq);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(iflt);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(ifgt);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endif);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(stop);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endscript);
public:
void init();
ProgramExec_br(Parallaction_br *vm);
~ProgramExec_br();
};
} // namespace Parallaction
#endif
|