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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
/* 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.
*
*/
#ifndef SCUMM_SCRIPT_V6_H
#define SCUMM_SCRIPT_V6_H
#include "scumm/scumm.h"
namespace Scumm {
class ScummEngine_v6 : public ScummEngine {
protected:
enum ArrayType {
kBitArray = 1,
kNibbleArray = 2,
kByteArray = 3,
kStringArray = 4,
kIntArray = 5,
kDwordArray = 6
};
#include "common/pack-start.h" // START STRUCT PACKING
struct ArrayHeader {
int16 dim1;
int16 type;
int16 dim2;
byte data[1];
} PACKED_STRUCT;
#include "common/pack-end.h" // END STRUCT PACKING
struct TextObject {
int16 xpos, ypos;
byte color;
byte charset;
byte text[256];
};
/** BlastObjects to draw */
struct BlastObject {
uint16 number;
Common::Rect rect;
uint16 scaleX, scaleY;
uint16 image;
uint16 mode;
};
int _blastObjectQueuePos;
BlastObject _blastObjectQueue[200];
struct BlastText : TextObject {
Common::Rect rect;
bool center;
};
int _blastTextQueuePos;
BlastText _blastTextQueue[50];
// Akos Class
struct {
int16 cmd;
int16 actor;
int16 param1;
int16 param2;
} _akosQueue[32];
int16 _akosQueuePos;
byte _curActor;
int _curVerb;
int _curVerbSlot;
bool _forcedWaitForMessage;
bool _skipVideo;
public:
ScummEngine_v6(OSystem *syst, const DetectorResult &dr);
virtual void resetScumm();
protected:
virtual void setupOpcodes();
virtual void scummLoop_handleActors();
virtual void processKeyboard(Common::KeyState lastKeyHit);
virtual void setupScummVars();
virtual void decodeParseString(int a, int b);
virtual void readArrayFromIndexFile();
virtual byte *getStringAddress(ResId idx);
virtual void readMAXS(int blockSize);
virtual void palManipulateInit(int resID, int start, int end, int time);
virtual void drawDirtyScreenParts();
int getStackList(int *args, uint maxnum);
int popRoomAndObj(int *room);
ArrayHeader *getArray(int array);
byte *defineArray(int array, int type, int dim2, int dim1);
int findFreeArrayId();
public: // FIXME. TODO
void nukeArray(int array);
protected:
virtual int readArray(int array, int index, int base);
virtual void writeArray(int array, int index, int base, int value);
void shuffleArray(int num, int minIdx, int maxIdx);
virtual void setDefaultCursor();
void setCursorTransparency(int a);
void setCursorHotspot(int x, int y);
virtual void setCursorFromImg(uint img, uint room, uint imgindex);
void useIm01Cursor(const byte *im, int w, int h);
void useBompCursor(const byte *im, int w, int h);
void grabCursor(int x, int y, int w, int h);
void enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center);
void drawBlastTexts();
void removeBlastTexts();
void enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth,
int objectHeight, int scaleX, int scaleY, int image, int mode);
void drawBlastObjects();
void drawBlastObject(BlastObject *eo);
void removeBlastObjects();
void removeBlastObject(BlastObject *eo);
virtual void clearDrawQueues();
public:
bool akos_increaseAnims(const byte *akos, Actor *a);
bool akos_increaseAnim(Actor *a, int i, const byte *aksq, const uint16 *akfo, int numakfo);
protected:
void akos_queCommand(byte cmd, Actor *a, int param_1, int param_2);
virtual void akos_processQueue();
virtual void processActors();
int getSpecialBox(int x, int y);
int getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, int f);
/* Version 6 script opcodes */
void o6_setBlastObjectWindow();
void o6_pushByte();
void o6_pushWord();
void o6_pushByteVar();
void o6_pushWordVar();
void o6_byteArrayRead();
void o6_wordArrayRead();
void o6_byteArrayIndexedRead();
void o6_wordArrayIndexedRead();
void o6_dup();
void o6_pop();
void o6_not();
void o6_eq();
void o6_neq();
void o6_gt();
void o6_lt();
void o6_le();
void o6_ge();
void o6_add();
void o6_sub();
void o6_mul();
void o6_div();
void o6_land();
void o6_lor();
void o6_writeByteVar();
void o6_writeWordVar();
void o6_byteArrayWrite();
void o6_wordArrayWrite();
void o6_byteArrayIndexedWrite();
void o6_wordArrayIndexedWrite();
void o6_byteVarInc();
void o6_wordVarInc();
void o6_byteArrayInc();
void o6_wordArrayInc();
void o6_byteVarDec();
void o6_wordVarDec();
void o6_byteArrayDec();
void o6_wordArrayDec();
void o6_if();
void o6_ifNot();
void o6_jump();
void o6_startScript();
void o6_startScriptQuick();
void o6_startObject();
void o6_drawObject();
void o6_drawObjectAt();
void o6_stopObjectCode();
void o6_endCutscene();
void o6_cutscene();
void o6_stopMusic();
void o6_freezeUnfreeze();
void o6_cursorCommand();
void o6_breakHere();
void o6_ifClassOfIs();
void o6_setClass();
void o6_getState();
void o6_setState();
void o6_setOwner();
void o6_getOwner();
void o6_startSound();
void o6_stopSound();
void o6_startMusic();
void o6_stopObjectScript();
void o6_panCameraTo();
void o6_actorFollowCamera();
void o6_setCameraAt();
void o6_loadRoom();
void o6_stopScript();
void o6_walkActorToObj();
void o6_walkActorTo();
void o6_putActorAtXY();
void o6_putActorAtObject();
void o6_faceActor();
void o6_animateActor();
void o6_doSentence();
void o6_pickupObject();
void o6_loadRoomWithEgo();
void o6_getRandomNumber();
void o6_getRandomNumberRange();
void o6_getActorMoving();
void o6_isScriptRunning();
void o6_getActorRoom();
void o6_getObjectX();
void o6_getObjectY();
void o6_getObjectOldDir();
void o6_getObjectNewDir();
void o6_getActorWalkBox();
void o6_getActorCostume();
void o6_findInventory();
void o6_getInventoryCount();
void o6_getVerbFromXY();
void o6_beginOverride();
void o6_endOverride();
void o6_setObjectName();
void o6_isSoundRunning();
void o6_setBoxFlags();
void o6_createBoxMatrix();
void o6_resourceRoutines();
void o6_roomOps();
void o6_actorOps();
void o6_verbOps();
void o6_getActorFromXY();
void o6_findObject();
void o6_pseudoRoom();
void o6_getActorElevation();
void o6_getVerbEntrypoint();
void o6_arrayOps();
void o6_saveRestoreVerbs();
void o6_drawBox();
void o6_getActorWidth();
void o6_wait();
void o6_getActorScaleX();
void o6_getActorAnimCounter();
void o6_soundKludge();
void o6_isAnyOf();
void o6_systemOps();
void o6_isActorInBox();
void o6_delay();
void o6_delaySeconds();
void o6_delayMinutes();
void o6_stopSentence();
void o6_printLine();
void o6_printText();
void o6_printDebug();
void o6_printSystem();
void o6_printActor();
void o6_printEgo();
void o6_talkActor();
void o6_talkEgo();
void o6_dimArray();
void o6_dummy();
void o6_startObjectQuick();
void o6_startScriptQuick2();
void o6_dim2dimArray();
void o6_abs();
void o6_distObjectObject();
void o6_distObjectPt();
void o6_distPtPt();
virtual void o6_kernelSetFunctions();
void o6_delayFrames();
void o6_pickOneOf();
void o6_pickOneOfDefault();
void o6_jumpToScript();
void o6_isRoomScriptRunning();
void o6_kernelGetFunctions();
void o6_getAnimateVariable();
void o6_drawBlastObject();
void o6_getActorLayer();
void o6_stampObject();
void o6_bor();
void o6_band();
void o6_stopTalking();
void o6_findAllObjects();
void o6_pickVarRandom();
void o6_getDateTime();
void o6_getPixel();
void o6_setBoxSet();
void o6_shuffle();
byte VAR_VIDEONAME;
byte VAR_RANDOM_NR;
byte VAR_STRING2DRAW;
byte VAR_TIMEDATE_YEAR;
byte VAR_TIMEDATE_MONTH;
byte VAR_TIMEDATE_DAY;
byte VAR_TIMEDATE_HOUR;
byte VAR_TIMEDATE_MINUTE;
byte VAR_TIMEDATE_SECOND;
};
} // End of namespace Scumm
#endif
|