25 #include "common/savefile.h" 26 #include "common/array.h" 27 #include "common/list.h" 28 #include "common/ptr.h" 32 #define SCRIPT_STACK_SIZE 50 33 #define LOCAL_VARS_SIZE 50 44 typedef int (FWScript::*OpFunc)();
66 void reinit(
unsigned int len);
68 int16 &operator[](
unsigned int idx);
69 int16 operator[](
unsigned int idx)
const;
93 int getNextLabel(
const FWScriptInfo &info,
int offset)
const;
105 void setData(
const FWScriptInfo &info,
const byte *data);
107 byte getByte(
unsigned int pos)
const;
108 uint16 getWord(
unsigned int pos)
const;
109 const char *getString(
unsigned int pos)
const;
110 uint16 getLabel(
const FWScriptInfo &info, byte index, uint16 offset)
const;
133 int16
run() {
return _runCount++; }
152 static const Opcode *_opcodeTable;
153 static unsigned int _numOpcodes;
155 int o1_modifyObjectParam();
156 int o1_getObjectParam();
157 int o1_addObjectParam();
158 int o1_subObjectParam();
159 int o1_mulObjectParam();
160 int o1_divObjectParam();
161 int o1_compareObjectParam();
162 int o1_setupObject();
163 int o1_checkCollision();
170 int o1_modifyObjectParam2();
172 int o1_unloadMask0();
173 int o1_addToBgList();
175 int o1_unloadMask1();
177 int o1_unloadMask4();
178 int o1_addSpriteFilledToBgList();
179 int o1_clearBgIncrustList();
183 int o1_gotoIfSupEqu();
185 int o1_gotoIfInfEqu();
188 int o1_removeLabel();
190 int o1_startGlobalScript();
191 int o1_endGlobalScript();
197 int o1_loadNewPrcName();
198 int o1_requestCheckPendingDataLoad();
199 int o1_blitAndFade();
200 int o1_fadeToBlack();
201 int o1_transformPaletteRange();
202 int o1_setDefaultMenuBgColor();
207 int o1_loadGlobalVar();
208 int o1_compareGlobalVar();
209 int o1_declareFunctionName();
210 int o1_freePartRange();
211 int o1_unloadAllMasks();
212 int o1_setScreenDimensions();
213 int o1_displayBackground();
214 int o1_initializeZoneData();
215 int o1_setZoneDataEntry();
216 int o1_getZoneDataEntry();
217 int o1_setPlayerCommandPosY();
218 int o1_allowPlayerInput();
219 int o1_disallowPlayerInput();
220 int o1_changeDataDisk();
223 int o1_fadeOutMusic();
229 int o1_playSampleSwapped();
230 int o1_disableSystemMenu();
232 int o1_unloadMask5();
237 int o2_addSeqListElement();
240 int o2_playSampleAlt();
241 int o2_clearSeqList();
242 int o2_modifySeqListElement();
243 int o2_isSeqRunning();
244 int o2_gotoIfSupNearest();
245 int o2_gotoIfSupEquNearest();
246 int o2_gotoIfInfNearest();
247 int o2_gotoIfInfEquNearest();
248 int o2_gotoIfEquNearest();
249 int o2_gotoIfDiffNearest();
250 int o2_startObjectScript();
251 int o2_stopObjectScript();
253 int o2_addBackground();
254 int o2_removeBackground();
257 int o2_wasZoneChecked();
260 int o2_useBgScroll();
261 int o2_setAdditionalBgVScroll();
263 int o2_addGfxElementType20();
264 int o2_removeGfxElementType20();
265 int o2_addGfxElementType21();
266 int o2_removeGfxElementType21();
268 int o2_unloadMask22();
271 uint16 getNextWord();
272 const char *getNextString();
283 static void setupTable();
306 static const Opcode *_opcodeTable;
307 static unsigned int _numOpcodes;
313 static void setupTable();
327 virtual OpFunc opcodeHandler(byte opcode)
const;
332 virtual const char *opcodeInfo(byte opcode)
const;
346 OpFunc opcodeHandler(byte opcode)
const override;
351 const char *opcodeInfo(byte opcode)
const override;
367 #define NUM_MAX_SCRIPT 50 371 void decompileScript(
const byte *scriptPtr, uint16 scriptSize, uint16 scriptIdx);
372 void dumpScript(
char *dumpName);
374 #define OP_loadPart 0x3F 375 #define OP_loadNewPrcName 0x41 376 #define OP_requestCheckPendingDataLoad 0x42 377 #define OP_endScript 0x50 379 void addScriptToGlobalScripts(uint16 idx);
380 int16 checkCollision(int16 objIdx, int16 x, int16 y, int16 numZones, int16 zoneIdx);
382 void runObjectScript(int16 entryIdx);
384 void executeObjectScripts();
385 void executeGlobalScripts();
387 void purgeObjectScripts();
388 void purgeGlobalScripts();
uint16 _param2
Additional parameter not used at the moment.
Definition: script.h:123
Definition: savefile.h:54
int16 run()
Definition: script.h:133
int16 _index
Index in script table.
Definition: script.h:281
uint16 _param3
Additional parameter not used at the moment.
Definition: script.h:124
uint16 _param1
Additional parameter not used at the moment.
Definition: script.h:122
int16 _runCount
How many times the script was used.
Definition: script.h:121
uint16 _size
Bytecode length.
Definition: script.h:96