22 #ifndef PRINCE_SCRIPT_H 23 #define PRINCE_SCRIPT_H 25 #include "common/random.h" 26 #include "common/endian.h" 27 #include "common/array.h" 28 #include "common/stream.h" 30 #include "prince/flags.h" 38 struct BackgroundAnim;
60 bool loadRoom(byte *roomData);
61 int getOptionOffset(
int option);
88 static const int16 kMaxRooms = 60;
120 uint16 readScript16(uint32 address);
121 uint32 readScript32(uint32 address);
123 uint32 getStartGameOffset();
124 uint32 getLocationInitScript(
int initRoomTableOffset,
int roomNr);
125 int16 getLightX(
int locationNr);
126 int16 getLightY(
int locationNr);
127 int32 getShadowScale(
int locationNr);
128 uint8 *getRoomOffset(
int locationNr);
129 int32 getOptionStandardOffset(
int option);
130 uint8 *getHeroAnimName(
int offset);
134 void installObjects(
int offset);
137 int scanMobEvents(
int mobMask,
int dataEventOffset);
138 int scanMobEventsWithItem(
int mobMask,
int dataEventOffset,
int itemMask);
140 byte getMobVisible(
int roomMobOffset, uint16 mob);
141 void setMobVisible(
int roomMobOffset, uint16 mob, byte value);
143 uint32 getBackAnimId(
int roomBackAnimOffset,
int slot);
144 void setBackAnimId(
int roomBackAnimOffset,
int slot,
int animId);
146 byte getObjId(
int roomObjOffset,
int slot);
147 void setObjId(
int roomObjOffset,
int slot, byte objectId);
149 const char *getString(uint32 offset) {
150 return (
const char *)(&_data[offset]);
164 void setFlagValue(Flags::Id flag, int32 value);
165 int32 getFlagValue(Flags::Id flag);
167 void resetAllFlags();
169 static const uint16 kFlagMask = 0x8000;
170 static const uint16 kMaxFlags = 2000;
172 int32 _flags[kMaxFlags];
179 void stopBg() { _bgOpcodePC = 0; }
183 void storeNewPC(
int opcodePC);
187 void setBgOpcodePC(uint32 value);
188 void setFgOpcodePC(uint32 value);
190 uint32 getCurrentString();
191 void setCurrentString(uint32 value);
194 void setString(byte *newString);
195 void increaseString();
197 void setResult(byte value);
204 uint32 _currentInstruction;
210 uint32 _lastInstruction;
216 static const uint32 _STACK_SIZE = 500;
217 uint32 _stack[_STACK_SIZE];
221 uint32 currentString;
227 byte _stringBuf[1024];
228 uint32 _currentString;
234 uint32 step(uint32 opcodePC);
235 uint16 readScript16();
236 uint32 readScript32();
237 int32 readScriptFlagValue();
238 Flags::Id readScriptFlagId();
239 int checkSeq(byte *
string);
241 void debugInterpreter(
const char *s, ...);
244 static OpcodeFunc _opcodes[];
246 static const uint kGiveLetterScriptFix = 79002;
247 static const uint kSecondBirdAnimationScriptFix = 45658;
251 void O_WAITFOREVER();
252 void O_BLACKPALETTE();
253 void O_SETUPPALETTE();
261 void O_CHECKANIMEND();
263 void O_CHECKANIMFRAME();
264 void O_PUTBACKANIM();
265 void O_REMBACKANIM();
266 void O_CHECKBACKANIMFRAME();
267 void O_FREEALLSAMPLES();
278 void O_BACKANIMUPDATEOFF();
279 void O_BACKANIMUPDATEON();
280 void O_CHANGECURSOR();
281 void O_CHANGEANIMTYPE();
308 void O_OBSOLETE_GETACTION();
309 void O_ADDWALKAREA();
310 void O_REMWALKAREA();
311 void O_RESTOREWALKAREA();
318 void O_FREEPRELOAD();
322 void O_SETHEROANIM();
323 void O_WAITHEROANIM();
324 void O_GETHERODATA();
325 void O_GETMOUSEBUTTON();
326 void O_CHANGEFRAMES();
327 void O_CHANGEBACKFRAMES();
328 void O_GETBACKANIMDATA();
329 void O_GETANIMDATA();
331 void O_SETBACKFRAME();
333 void O_TALKBACKANIM();
341 void O_SETSTRINGOFFSET();
344 void O_SWAPOBJECTS();
345 void O_CHANGEHEROSET();
349 void O_ENABLEDIALOGOPT();
350 void O_DISABLEDIALOGOPT();
351 void O_SHOWDIALOGBOX();
353 void O_BACKANIMRANGE();
363 void O_ANIMUPDATEOFF();
364 void O_ANIMUPDATEON();
366 void O_ADDINVQUIET();
368 void O_SETBACKANIMDATA();
370 void O_CHECKFLCFRAME();
371 void O_CHECKFLCEND();
373 void O_TALKHEROSTOP();
379 void O_SWAPINVENTORY();
380 void O_CLEARINVENTORY();
386 void O_VIEWFLCLOOP();
388 void O_OPENINVENTORY();
394 void O_BREAK_POINT();
Definition: animation.h:30