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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
/* 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 MADE_SCRIPTFUNCS_H
#define MADE_SCRIPTFUNCS_H
#include "common/util.h"
#include "common/file.h"
#include "common/func.h"
#include "common/stream.h"
namespace Made {
class MadeEngine;
typedef Common::Functor2<int16, int16*, int16> ExternalFunc;
class ScriptFunctions {
public:
ScriptFunctions(MadeEngine *vm) : _vm(vm) {}
virtual ~ScriptFunctions() {}
int16 callFunction(uint16 index, int16 argc, int16 *argv) {
if (index >= _externalFuncs.size()) {
// TODO: ERROR!
return 0;
}
return (*_externalFuncs[index])(argc, argv);
}
virtual void setupExternalsTable() = 0;
protected:
MadeEngine *_vm;
Audio::SoundHandle _audioStreamHandle;
Audio::SoundHandle _voiceStreamHandle;
Common::Array<const ExternalFunc*> _externalFuncs;
};
class ScriptFunctionsLgop2 : public ScriptFunctions {
public:
ScriptFunctionsLgop2(MadeEngine *vm) : ScriptFunctions(vm) {}
~ScriptFunctionsLgop2() {}
void setupExternalsTable();
protected:
int16 o1_SYSTEM(int16 argc, int16 *argv);
int16 o1_INITGRAF(int16 argc, int16 *argv);
int16 o1_RESTOREGRAF(int16 argc, int16 *argv);
int16 o1_DRAWPIC(int16 argc, int16 *argv);
int16 o1_CLS(int16 argc, int16 *argv);
int16 o1_SHOWPAGE(int16 argc, int16 *argv);
int16 o1_EVENT(int16 argc, int16 *argv);
int16 o1_EVENTX(int16 argc, int16 *argv);
int16 o1_EVENTY(int16 argc, int16 *argv);
int16 o1_EVENTKEY(int16 argc, int16 *argv);
int16 o1_VISUALFX(int16 argc, int16 *argv);
int16 o1_PLAYSND(int16 argc, int16 *argv);
int16 o1_PLAYMUS(int16 argc, int16 *argv);
int16 o1_STOPMUS(int16 argc, int16 *argv);
int16 o1_ISMUS(int16 argc, int16 *argv);
int16 o1_TEXTPOS(int16 argc, int16 *argv);
int16 o1_FLASH(int16 argc, int16 *argv);
int16 o1_PLAYNOTE(int16 argc, int16 *argv);
int16 o1_STOPNOTE(int16 argc, int16 *argv);
int16 o1_PLAYTELE(int16 argc, int16 *argv);
int16 o1_STOPTELE(int16 argc, int16 *argv);
int16 o1_HIDECURS(int16 argc, int16 *argv);
int16 o1_SHOWCURS(int16 argc, int16 *argv);
int16 o1_MUSICBEAT(int16 argc, int16 *argv);
int16 o1_SCREENLOCK(int16 argc, int16 *argv);
int16 o1_ADDSPRITE(int16 argc, int16 *argv);
int16 o1_FREEANIM(int16 argc, int16 *argv);
int16 o1_DRAWSPRITE(int16 argc, int16 *argv);
int16 o1_ERASESPRITES(int16 argc, int16 *argv);
int16 o1_UPDATESPRITES(int16 argc, int16 *argv);
int16 o1_GETTIMER(int16 argc, int16 *argv);
int16 o1_SETTIMER(int16 argc, int16 *argv);
int16 o1_RESETTIMER(int16 argc, int16 *argv);
int16 o1_ALLOCTIMER(int16 argc, int16 *argv);
int16 o1_FREETIMER(int16 argc, int16 *argv);
int16 o1_PALETTELOCK(int16 argc, int16 *argv);
int16 o1_FONT(int16 argc, int16 *argv);
int16 o1_DRAWTEXT(int16 argc, int16 *argv);
int16 o1_HOMETEXT(int16 argc, int16 *argv);
int16 o1_TEXTRECT(int16 argc, int16 *argv);
int16 o1_TEXTXY(int16 argc, int16 *argv);
int16 o1_DROPSHADOW(int16 argc, int16 *argv);
int16 o1_TEXTCOLOR(int16 argc, int16 *argv);
int16 o1_OUTLINE(int16 argc, int16 *argv);
int16 o1_LOADCURSOR(int16 argc, int16 *argv);
int16 o1_SETGROUND(int16 argc, int16 *argv);
int16 o1_RESTEXT(int16 argc, int16 *argv);
int16 o1_ADDMASK(int16 argc, int16 *argv);
int16 o1_SETMASK(int16 argc, int16 *argv);
int16 o1_ISSND(int16 argc, int16 *argv);
int16 o1_STOPSND(int16 argc, int16 *argv);
int16 o1_PLAYVOICE(int16 argc, int16 *argv);
};
class ScriptFunctionsRtz : public ScriptFunctions {
public:
ScriptFunctionsRtz(MadeEngine *vm) : ScriptFunctions(vm) {}
~ScriptFunctionsRtz() {}
void setupExternalsTable();
protected:
int16 o1_SYSTEM(int16 argc, int16 *argv);
int16 o1_INITGRAF(int16 argc, int16 *argv);
int16 o1_RESTOREGRAF(int16 argc, int16 *argv);
int16 o1_DRAWPIC(int16 argc, int16 *argv);
int16 o1_CLS(int16 argc, int16 *argv);
int16 o1_SHOWPAGE(int16 argc, int16 *argv);
int16 o1_EVENT(int16 argc, int16 *argv);
int16 o1_EVENTX(int16 argc, int16 *argv);
int16 o1_EVENTY(int16 argc, int16 *argv);
int16 o1_EVENTKEY(int16 argc, int16 *argv);
int16 o1_VISUALFX(int16 argc, int16 *argv);
int16 o1_PLAYSND(int16 argc, int16 *argv);
int16 o1_PLAYMUS(int16 argc, int16 *argv);
int16 o1_STOPMUS(int16 argc, int16 *argv);
int16 o1_ISMUS(int16 argc, int16 *argv);
int16 o1_TEXTPOS(int16 argc, int16 *argv);
int16 o1_FLASH(int16 argc, int16 *argv);
int16 o1_PLAYNOTE(int16 argc, int16 *argv);
int16 o1_STOPNOTE(int16 argc, int16 *argv);
int16 o1_PLAYTELE(int16 argc, int16 *argv);
int16 o1_STOPTELE(int16 argc, int16 *argv);
int16 o1_HIDECURS(int16 argc, int16 *argv);
int16 o1_SHOWCURS(int16 argc, int16 *argv);
int16 o1_MUSICBEAT(int16 argc, int16 *argv);
int16 o1_SCREENLOCK(int16 argc, int16 *argv);
int16 o1_ADDSPRITE(int16 argc, int16 *argv);
int16 o1_FREEANIM(int16 argc, int16 *argv);
int16 o1_DRAWSPRITE(int16 argc, int16 *argv);
int16 o1_ERASESPRITES(int16 argc, int16 *argv);
int16 o1_UPDATESPRITES(int16 argc, int16 *argv);
int16 o1_GETTIMER(int16 argc, int16 *argv);
int16 o1_SETTIMER(int16 argc, int16 *argv);
int16 o1_RESETTIMER(int16 argc, int16 *argv);
int16 o1_ALLOCTIMER(int16 argc, int16 *argv);
int16 o1_FREETIMER(int16 argc, int16 *argv);
int16 o1_PALETTELOCK(int16 argc, int16 *argv);
int16 o1_FONT(int16 argc, int16 *argv);
int16 o1_DRAWTEXT(int16 argc, int16 *argv);
int16 o1_HOMETEXT(int16 argc, int16 *argv);
int16 o1_TEXTRECT(int16 argc, int16 *argv);
int16 o1_TEXTXY(int16 argc, int16 *argv);
int16 o1_DROPSHADOW(int16 argc, int16 *argv);
int16 o1_TEXTCOLOR(int16 argc, int16 *argv);
int16 o1_OUTLINE(int16 argc, int16 *argv);
int16 o1_LOADCURSOR(int16 argc, int16 *argv);
int16 o1_SETGROUND(int16 argc, int16 *argv);
int16 o1_RESTEXT(int16 argc, int16 *argv);
int16 o1_CLIPAREA(int16 argc, int16 *argv);
int16 o1_SETCLIP(int16 argc, int16 *argv);
int16 o1_ISSND(int16 argc, int16 *argv);
int16 o1_STOPSND(int16 argc, int16 *argv);
int16 o1_PLAYVOICE(int16 argc, int16 *argv);
int16 o1_CDPLAY(int16 argc, int16 *argv);
int16 o1_STOPCD(int16 argc, int16 *argv);
int16 o1_CDSTATUS(int16 argc, int16 *argv);
int16 o1_CDTIME(int16 argc, int16 *argv);
int16 o1_CDPLAYSEG(int16 argc, int16 *argv);
int16 o1_PRINTF(int16 argc, int16 *argv);
int16 o1_MONOCLS(int16 argc, int16 *argv);
int16 o1_SNDENERGY(int16 argc, int16 *argv);
int16 o1_CLEARTEXT(int16 argc, int16 *argv);
int16 o1_ANIMTEXT(int16 argc, int16 *argv);
int16 o1_TEXTWIDTH(int16 argc, int16 *argv);
int16 o1_PLAYMOVIE(int16 argc, int16 *argv);
int16 o1_LOADSND(int16 argc, int16 *argv);
int16 o1_LOADMUS(int16 argc, int16 *argv);
int16 o1_LOADPIC(int16 argc, int16 *argv);
int16 o1_MUSICVOL(int16 argc, int16 *argv);
int16 o1_RESTARTEVENTS(int16 argc, int16 *argv);
int16 o1_PLACESPRITE(int16 argc, int16 *argv);
int16 o1_PLACETEXT(int16 argc, int16 *argv);
int16 o1_DELETECHANNEL(int16 argc, int16 *argv);
int16 o1_CHANNELTYPE(int16 argc, int16 *argv);
int16 o1_SETSTATE(int16 argc, int16 *argv);
int16 o1_SETLOCATION(int16 argc, int16 *argv);
int16 o1_SETCONTENT(int16 argc, int16 *argv);
int16 o1_EXCLUDEAREA(int16 argc, int16 *argv);
int16 o1_SETEXCLUDE(int16 argc, int16 *argv);
int16 o1_GETSTATE(int16 argc, int16 *argv);
int16 o1_PLACEANIM(int16 argc, int16 *argv);
int16 o1_SETFRAME(int16 argc, int16 *argv);
int16 o1_GETFRAME(int16 argc, int16 *argv);
int16 o1_GETFRAMECOUNT(int16 argc, int16 *argv);
int16 o1_PICWIDTH(int16 argc, int16 *argv);
int16 o1_PICHEIGHT(int16 argc, int16 *argv);
int16 o1_SOUNDRATE(int16 argc, int16 *argv);
int16 o1_DRAWANIMPIC(int16 argc, int16 *argv);
int16 o1_LOADANIM(int16 argc, int16 *argv);
int16 o1_READTEXT(int16 argc, int16 *argv);
int16 o1_READMENU(int16 argc, int16 *argv);
int16 o1_DRAWMENU(int16 argc, int16 *argv);
int16 o1_MENUCOUNT(int16 argc, int16 *argv);
int16 o1_SAVEGAME(int16 argc, int16 *argv);
int16 o1_LOADGAME(int16 argc, int16 *argv);
int16 o1_GAMENAME(int16 argc, int16 *argv);
int16 o1_SHAKESCREEN(int16 argc, int16 *argv);
int16 o1_PLACEMENU(int16 argc, int16 *argv);
int16 o1_SETVOLUME(int16 argc, int16 *argv);
int16 o1_WHATSYNTH(int16 argc, int16 *argv);
int16 o1_SLOWSYSTEM(int16 argc, int16 *argv);
};
class ScriptFunctionsMhne : public ScriptFunctions {
public:
ScriptFunctionsMhne(MadeEngine *vm) : ScriptFunctions(vm) {}
~ScriptFunctionsMhne() {}
void setupExternalsTable();
protected:
int16 o1_SYSTEM(int16 argc, int16 *argv);
int16 o1_INITGRAF(int16 argc, int16 *argv);
int16 o1_RESTOREGRAF(int16 argc, int16 *argv);
int16 o1_DRAWPIC(int16 argc, int16 *argv);
int16 o1_CLS(int16 argc, int16 *argv);
int16 o1_SHOWPAGE(int16 argc, int16 *argv);
int16 o1_EVENT(int16 argc, int16 *argv);
int16 o1_EVENTX(int16 argc, int16 *argv);
int16 o1_EVENTY(int16 argc, int16 *argv);
int16 o1_EVENTKEY(int16 argc, int16 *argv);
int16 o1_VISUALFX(int16 argc, int16 *argv);
int16 o1_PLAYSND(int16 argc, int16 *argv);
int16 o1_PLAYMUS(int16 argc, int16 *argv);
int16 o1_STOPMUS(int16 argc, int16 *argv);
int16 o1_ISMUS(int16 argc, int16 *argv);
int16 o1_TEXTPOS(int16 argc, int16 *argv);
int16 o1_FLASH(int16 argc, int16 *argv);
int16 o1_PLAYNOTE(int16 argc, int16 *argv);
int16 o1_STOPNOTE(int16 argc, int16 *argv);
int16 o1_PLAYTELE(int16 argc, int16 *argv);
int16 o1_STOPTELE(int16 argc, int16 *argv);
int16 o1_HIDECURS(int16 argc, int16 *argv);
int16 o1_SHOWCURS(int16 argc, int16 *argv);
int16 o1_MUSICBEAT(int16 argc, int16 *argv);
int16 o1_SCREENLOCK(int16 argc, int16 *argv);
int16 o1_ADDSPRITE(int16 argc, int16 *argv);
int16 o1_FREEANIM(int16 argc, int16 *argv);
int16 o1_DRAWSPRITE(int16 argc, int16 *argv);
int16 o1_ERASESPRITES(int16 argc, int16 *argv);
int16 o1_UPDATESPRITES(int16 argc, int16 *argv);
int16 o1_GETTIMER(int16 argc, int16 *argv);
int16 o1_SETTIMER(int16 argc, int16 *argv);
int16 o1_RESETTIMER(int16 argc, int16 *argv);
int16 o1_ALLOCTIMER(int16 argc, int16 *argv);
int16 o1_FREETIMER(int16 argc, int16 *argv);
int16 o1_PALETTELOCK(int16 argc, int16 *argv);
int16 o1_FONT(int16 argc, int16 *argv);
int16 o1_DRAWTEXT(int16 argc, int16 *argv);
int16 o1_HOMETEXT(int16 argc, int16 *argv);
int16 o1_TEXTRECT(int16 argc, int16 *argv);
int16 o1_TEXTXY(int16 argc, int16 *argv);
int16 o1_DROPSHADOW(int16 argc, int16 *argv);
int16 o1_TEXTCOLOR(int16 argc, int16 *argv);
int16 o1_OUTLINE(int16 argc, int16 *argv);
int16 o1_LOADCURSOR(int16 argc, int16 *argv);
int16 o1_SETGROUND(int16 argc, int16 *argv);
int16 o1_RESTEXT(int16 argc, int16 *argv);
int16 o1_ADDMASK(int16 argc, int16 *argv);
int16 o1_SETMASK(int16 argc, int16 *argv);
int16 o1_ISSND(int16 argc, int16 *argv);
int16 o1_STOPSND(int16 argc, int16 *argv);
int16 o1_PLAYVOICE(int16 argc, int16 *argv);
int16 o1_CDPLAY(int16 argc, int16 *argv);
int16 o1_STOPCD(int16 argc, int16 *argv);
int16 o1_CDSTATUS(int16 argc, int16 *argv);
int16 o1_CDTIME(int16 argc, int16 *argv);
int16 o1_CDPLAYSEG(int16 argc, int16 *argv);
};
} // End of namespace Made
#endif /* MADE_H */
|