25 #include "engines/engine.h" 27 #include "common/array.h" 28 #include "common/error.h" 29 #include "common/keyboard.h" 30 #include "common/random.h" 31 #include "common/rect.h" 32 #include "common/stack.h" 33 #include "common/util.h" 34 #include "audio/mixer.h" 37 #include "agos/detection.h" 55 class SeekableReadStream;
66 kDebugOpcode = 1 << 0,
67 kDebugVGAOpcode = 1 << 1,
68 kDebugSubroutine = 1 << 2,
69 kDebugVGAScript = 1 << 3,
70 kDebugImageDump = 1 << 4
75 #define CHECK_BOUNDS(x, y) assert((uint)(x) < ARRAYSIZE(y)) 93 struct SubroutineLine;
103 uint16 width, height;
114 HitArea() { memset(
this, 0,
sizeof(*
this)); }
176 AnimTable() { memset(
this, 0,
sizeof(*
this)); }
180 ANIMATE_INT = 1 << 1,
181 ANIMATE_EVENT = 1 << 2,
182 SCROLL_EVENT = 1 << 3,
183 PLAYER_DAMAGE_EVENT = 1 << 4,
184 MONSTER_DAMAGE_EVENT = 1 << 5
194 #ifndef REDUCE_MEMORY_USAGE 195 # define _OPCODE(ver, x) { &ver::x, #x } 197 # define _OPCODE(ver, x) { &ver::x, "" } 203 static const byte SIMON1_RHYTHM_SFX[];
206 static const uint16 MUSIC_INDEX_BASE_SIMON2_GM = 1128 / 4;
208 static const uint16 MUSIC_INDEX_BASE_SIMON2_MT32 = (1128 + 612) / 4;
225 void syncSoundSettings()
override;
228 void syncSoundSettingsIntern();
229 void pauseEngineIntern(
bool pause)
override;
231 virtual void setupOpcodes();
232 uint16 _numOpcodes, _opcode;
236 void setupVgaOpcodes();
237 VgaOpcodeProc _vga_opcode_table[100];
238 uint8 _numVideoOpcodes;
240 virtual void setupVideoOpcodes(VgaOpcodeProc *op);
245 virtual void setupGame();
247 int getGameId()
const;
248 int getGameType()
const;
249 uint32 getFeatures()
const;
250 const char *getExtra()
const;
253 const char *getFileName(
int type)
const;
257 uint16 _vcGetOutOfCode;
260 uint32 *_gameOffsetsPtr;
262 uint8 _numMusic, _numSFX;
266 uint8 _numBitArray1, _numBitArray2, _numBitArray3, _numItemStore;
269 uint8 _vgaBaseDelay, _vgaPeriod;
271 uint16 _musicIndexBase;
272 uint16 _soundIndexBase;
273 uint16 _tableIndexBase;
274 uint16 _textIndexBase;
277 uint32 _tableMemSize;
286 byte *_strippedTxtMem;
289 uint32 _stringTabNum, _stringTabPos, _stringTabSize;
290 byte **_stringTabPtr;
292 Item **_itemArrayPtr;
293 uint32 _itemArraySize;
294 uint32 _itemArrayInited;
300 const byte *_codePtr;
302 byte **_localStringtable;
303 uint16 _stringIdLocalMin, _stringIdLocalMax;
306 uint16 _numRoomStates;
313 byte *_xtablesHeapPtrOrg;
314 uint32 _xtablesHeapCurPosOrg;
318 byte *_tablesHeapPtr, *_tablesHeapPtrOrg, *_tablesheapPtrNew;
319 uint32 _tablesHeapSize, _tablesHeapCurPos, _tablesHeapCurPosOrg;
320 uint32 _tablesHeapCurPosNew;
325 uint8 _recursionDepth;
333 bool _runScriptReturn1;
334 bool _runScriptCondition[40];
335 int16 _runScriptReturn[40];
337 bool _noParentNotify;
349 bool _copyProtection;
354 int16 _chanceModifier;
355 bool _restoreWindow6;
356 int16 _scrollX, _scrollXMax;
357 int16 _scrollY, _scrollYMax;
358 int16 _scrollCount, _scrollFlag;
359 uint16 _scrollWidth, _scrollHeight;
360 const byte *_scrollImage;
365 int16 _classMask, _classMode1, _classMode2;
372 uint16 _currentRoom, _superRoomNumber;
375 uint16 _hyperLink, _newLines;
376 uint16 _oracleMaxScrollY, _noOracleScroll;
379 int16 _scriptVerb, _scriptNoun1, _scriptNoun2;
380 int16 _scriptAdj1, _scriptAdj2;
385 Item *_subjectItem, *_objectItem;
386 Item *_currentPlayer;
388 Item *_hitAreaObjectItem;
392 Item *_hitAreaSubjectItem;
393 HitArea *_currentBox, *_currentVerbBox, *_lastVerbOn;
394 uint16 _currentBoxNum;
395 uint16 _needHitAreaRecalc;
410 int16 _printCharCurPos, _printCharMaxPos, _printCharPixelCount;
411 uint16 _numLettersToPrint;
415 uint32 getTime()
const;
419 uint32 _clockStopped, _gameStoppedClock;
422 TimeEvent *_firstTimeStruct, *_pendingDeleteTimeEvent;
429 bool _animatePointer;
430 byte _maxCursorWidth, _maxCursorHeight;
431 byte _mouseAnim, _mouseAnimMax, _mouseCursor;
432 byte _currentMouseAnim, _currentMouseCursor;
433 byte _oldMouseAnimMax, _oldMouseCursor;
434 uint16 _mouseHideCount;
437 bool _leftButtonDown, _rightButtonDown;
438 byte _leftButton, _leftButtonCount, _leftButtonOld;
441 bool _leftClick, _rightClick;
448 volatile uint16 _videoLockOut;
449 uint16 _scrollUpHitArea;
450 uint16 _scrollDownHitArea;
452 bool _fastFadeOutFlag;
455 uint16 _fastFadeCount;
456 volatile uint16 _fastFadeInFlag;
459 uint16 _screenWidth, _screenHeight;
460 uint16 _internalWidth, _internalHeight;
465 bool _exitCutscene, _picture8600;
468 int16 _lastMusicPlayed;
469 int16 _nextMusicToPlay;
470 bool _showPreposition;
471 bool _showMessageFlag;
475 uint16 _copyScnFlag, _vgaSpriteChanged;
477 byte *_block, *_blockEnd;
478 byte *_vgaMemPtr, *_vgaMemEnd, *_vgaMemBase;
479 byte *_vgaFrozenBase, *_vgaRealBase;
490 uint16 _vgaWaitFor, _lastVgaWaitFor;
491 uint16 _vgaCurSpriteId, _vgaCurZoneNum;
496 int16 _scaleX, _scaleY, _scaleWidth, _scaleHeight;
500 uint8 _opcode177Var1, _opcode177Var2;
501 uint8 _opcode178Var1, _opcode178Var2;
503 Item *_objectArray[50];
504 Item *_itemStore[50];
506 uint16 _shortText[40];
507 uint16 _shortTextX[40];
508 uint16 _shortTextY[40];
509 uint16 _longText[40];
510 uint16 _longSound[40];
512 uint16 _bitArray[128];
513 uint16 _bitArrayTwo[16];
514 uint16 _bitArrayThree[16];
515 int16 *_variableArray;
516 int16 *_variableArray2;
517 int16 *_variableArrayPtr;
525 TextLocation _textLocation1, _textLocation2, _textLocation3, _textLocation4;
527 byte _awaitTwoByteToken;
529 byte *_byteTokenStrings;
530 byte *_twoByteTokens;
531 byte *_twoByteTokenStrings;
532 byte *_secondTwoByteTokenStrings;
533 byte *_thirdTwoByteTokenStrings;
534 byte _textBuffer[180];
539 byte _stringReturnBuffer[2][180];
551 const uint16 *_pathFindArray[100];
553 uint8 _pathValues[400];
557 uint8 _pathValues1[400];
561 uint8 _currentPalette[768];
562 uint8 _displayPalette[768];
565 byte _videoBuf1[32000];
566 uint16 _videoWindows[128];
567 const byte *_pak98Buf;
568 byte _paletteModNext;
574 uint16 _moveXMin, _moveYMin;
575 uint16 _moveXMax, _moveYMax;
581 byte _lettersToPrintBuf[80];
600 uint16 _effectsVolume;
603 uint8 _saveGameNameLen;
604 uint16 _saveLoadRowCurPos;
605 uint16 _numSaveGameRows;
606 bool _saveDialogFlag;
610 byte _saveLoadType, _saveLoadSlot;
611 char _saveLoadName[108];
622 const byte *_vc10BasePtrOld;
623 byte _hebrewCharWidths[32];
630 uint32 _curSfxFileSize;
631 uint16 _sampleEnd, _sampleWait;
634 virtual uint16 to16Wrapper(uint value);
635 virtual uint16 readUint16Wrapper(
const void *src);
636 virtual uint32 readUint32Wrapper(
const void *src);
644 void allocateStringTable(
int num);
645 void setupStringTable(byte *mem,
int num);
646 void setupLocalStringTable(byte *mem,
int num);
650 virtual void loadGamePcFile();
652 void decompressData(
const char *srcName, byte *dst, uint32 offset, uint32 srcSize, uint32 dstSize);
654 void loadOffsets(
const char *filename,
int number, uint32 &file, uint32 &offset, uint32 &compressedSize, uint32 &size);
655 void loadSound(uint16 sound, int16 pan, int16 vol, uint16 type);
656 void playSfx(uint16 sound, uint16 freq, uint16 flags,
bool digitalOnly =
false,
bool midiOnly =
false);
657 void loadSound(uint16 sound, uint16 freq, uint16 flags);
659 virtual void playMidiSfx(uint16 sound);
660 void loadVoice(uint speechId);
663 void loadSoundFile(
const char *filename);
665 int getUserFlag(
Item *item,
int a);
666 int getUserFlag1(
Item *item,
int a);
667 int getUserItem(
Item *item,
int n);
668 void setUserFlag(
Item *item,
int a,
int b);
669 void setUserItem(
Item *item,
int n,
int m);
671 void paletteFadeOut(byte *palPtr, uint num, uint size);
673 void *allocateItem(uint size);
674 void *allocateTable(uint size);
675 void alignTableMem();
677 Child *findChildOfType(
Item *i, uint child);
678 Child *allocateChildBlock(
Item *i, uint type, uint size);
680 void allocItemHeap();
681 void allocTablesHeap();
690 Subroutine *getSubroutineByID(uint subroutineId);
693 void dumpAllSubroutines();
694 void dumpAllVgaImageFiles();
695 void dumpAllVgaScriptFiles();
696 void dumpSubroutines();
699 const byte *dumpOpcode(
const byte *p);
707 virtual void executeOpcode(
int opcode) = 0;
712 uint getNextVarContents();
713 uint getVarWrapper();
716 uint readVariable(uint16 variable);
717 void writeNextVarContents(uint16 contents);
718 void writeVariable(uint16 variable, uint16 contents);
720 Item *derefItem(uint item);
721 Item *getNextItemPtr();
722 uint getNextItemID();
723 uint getItem1ID() {
return 1;}
724 uint itemPtrToID(
Item *
id);
728 void uncompressText(byte *ptr);
729 byte *uncompressToken(byte a, byte *ptr);
731 void showMessageFormat(MSVC_PRINTF
const char *s, ...)
GCC_PRINTF(2, 3);
732 const byte *getStringPtrByID(uint16 stringId,
bool upperCase =
false);
733 const byte *getLocalStringByID(uint16 stringId);
734 uint getNextStringID();
736 void addTimeEvent(int32 timeout, uint16 subroutineId);
739 Item *findInByClass(
Item *i, int16 m);
740 Item *nextInByClass(
Item *i, int16 m);
741 Item *findMaster(int16 a, int16 n);
742 Item *nextMaster(
Item *item, int16 a, int16 n);
743 int wordMatch(
Item *item, int16 a, int16 n);
745 bool isRoom(
Item *item);
746 bool isObject(
Item *item);
747 bool isPlayer(
Item *item);
749 void itemChildrenChanged(
Item *item);
750 void unlinkItem(
Item *item);
751 void linkItem(
Item *item,
Item *parent);
753 void setItemParent(
Item *item,
Item *parent);
754 void setItemState(
Item *item,
int value);
756 void stopAnimate(uint16 a);
757 void stopAnimateSimon2(uint16 a, uint16 b);
759 void enableBox(uint hitarea);
760 void disableBox(uint hitarea);
761 void moveBox(uint hitarea,
int x,
int y);
762 bool isBoxDead(uint hitarea);
763 void undefineBox(uint hitarea);
764 void defineBox(
int id,
int x,
int y,
int width,
int height,
int flags,
int verb,
Item *itemPtr);
765 void defineBox(uint16
id, uint16 x, uint16 y, uint16 width, uint16 height, uint16 msg1, uint16 msg2, uint16 flags);
769 virtual void resetVerbs();
770 virtual void setVerb(
HitArea * ha);
771 virtual void hitarea_leave(
HitArea * ha,
bool state =
false);
772 void leaveHitAreaById(uint hitarea_id);
774 void sendSync(uint a);
775 void waitForSync(uint a);
777 uint getOffsetOfChild2Param(
SubObject *child, uint prop);
778 void scriptMouseOff();
780 void unfreezeBottom();
786 void setup_cond_c_helper();
788 uint16 getBackExit(
int n);
789 uint16 getDoorState(
Item *item, uint16 d);
790 uint16 getExitOf(
Item *item, uint16 d);
791 void changeDoorState(
SubRoom *r, uint16 d, uint16 n);
792 void setDoorState(
Item *i, uint16 d, uint16 n);
795 Item *getDoorOf(
Item *item, uint16 d);
796 Item *getExitOf_e1(
Item *item, uint16 d);
797 virtual void moveDirn(
Item *i, uint x);
799 virtual int canPlace(
Item *x,
Item *y);
801 int sizeContents(
Item *x);
802 virtual int sizeOfRec(
Item *o,
int d);
803 int sizeRec(
Item *x,
int d);
804 int weighUp(
Item *x);
805 int weightRec(
Item *x,
int d);
806 virtual int weightOf(
Item *x);
810 void drawMenuStrip(uint windowNum, uint menuNum);
811 void lightMenuStrip(
int a);
812 void unlightMenuStrip();
813 void lightMenuBox(uint hitarea);
815 uint menuFor_e2(
Item *item);
816 uint menuFor_ww(
Item *item, uint
id);
817 void clearMenuStrip();
818 void doMenuStrip(uint menuNum);
823 bool loadRoomItems(uint16 item);
825 virtual bool loadTablesIntoMem(uint16 subrId);
826 bool loadXTablesIntoMem(uint16 subrId);
827 void loadTextIntoMem(uint16 stringId);
829 uint loadTextFile(
const char *filename, byte *dst);
833 uint loadTextFile_simon1(
const char *filename, byte *dst);
839 uint loadTextFile_gme(
const char *filename, byte *dst);
843 bool kickoffTimeEvents();
844 void killAllTimers();
847 virtual void runSubroutine101();
852 WindowBlock *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fillColor, uint textColor);
855 void changeWindow(uint a);
856 void closeWindow(uint a);
857 void setTextColor(uint color);
858 virtual void windowPutChar(
WindowBlock *window, byte c, byte b = 0);
861 HitArea *findBox(uint hitarea_id);
862 virtual void boxController(uint x, uint y, uint mode);
863 void handleVerbClicked(uint verb);
864 virtual void clearName();
865 void displayName(
HitArea * ha);
866 void resetNameWindow();
867 void displayBoxStars();
868 void invertBox(
HitArea * ha, byte a, byte b, byte c, byte d);
870 virtual void handleMouseWheelUp();
871 virtual void handleMouseWheelDown();
873 virtual void initMouse();
874 virtual void handleMouseMoved();
875 virtual void drawMousePointer();
877 void drawArrow(uint16 x, uint16 y, int8 dir);
878 virtual void addArrows(
WindowBlock *window, uint8 num);
879 virtual void removeArrows(
WindowBlock *window, uint num);
881 virtual void drawIcon(
WindowBlock *window, uint icon, uint x, uint y);
882 virtual bool hasIcon(
Item *item);
883 virtual uint itemGetIconNumber(
Item *item);
884 virtual uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr);
886 virtual void drawIconArray(uint i,
Item *itemPtr,
int line,
int classMask);
887 void removeIconArray(uint num);
893 virtual bool processSpecialKeys();
894 void hitarea_stuff_helper();
898 uint getFeebleFontSize(byte chr);
900 void justifyOutPut(byte chr);
902 void loadZone(uint16 zoneNum,
bool useError =
true);
904 void animate(uint16 windowNum, uint16 zoneNum, uint16 vgaSpriteId, int16 x, int16 y, uint16 palette,
bool vgaScript =
false);
905 void setImage(uint16 vgaSpriteId,
bool vgaScript =
false);
906 void setWindowImage(uint16 mode, uint16 vgaSpriteId,
bool specialCase =
false);
907 virtual void setWindowImageEx(uint16 mode, uint16 vgaSpriteId);
912 const char *getPixelLength(
const char *
string, uint16 maxWidth, uint16 &pixels);
913 bool printNameOf(
Item *item, uint x, uint y);
914 bool printTextOf(uint a, uint x, uint y);
915 void printVerbOf(uint hitarea_id);
916 void showActionString(
const byte *
string);
918 virtual void printScreenText(uint vgaSpriteId, uint color,
const char *stringPtr, int16 x, int16 y, int16 width);
920 void renderStringAmiga(uint vgaSpriteId, uint color, uint width, uint height,
const char *txt);
921 void renderString(uint vgaSpriteId, uint color, uint width, uint height,
const char *txt);
923 void writeChar(
WindowBlock *window,
int x,
int y,
int offs,
int val);
925 byte *allocBlock(uint32 size);
926 void checkNoOverWrite();
927 void checkRunningAnims();
928 void checkAnims(uint a);
929 void checkZonePtrs();
930 void setZoneBuffers();
935 bool getBitFlag(uint bit);
936 void setBitFlag(uint bit,
bool value);
941 virtual void vc3_loadSprite();
944 void vc6_ifObjectHere();
945 void vc7_ifObjectNotHere();
946 void vc8_ifObjectIsAt();
947 void vc9_ifObjectStateIs();
950 void vc13_addToSpriteX();
951 void vc14_addToSpriteY();
953 void vc16_waitSync();
956 void vc20_setRepeat();
957 void vc21_endRepeat();
958 virtual void vc22_setPalette();
959 void vc23_setPriority();
960 void vc24_setSpriteXY();
961 void vc25_halt_sprite();
962 void vc26_setSubWindow();
963 void vc27_resetSprite();
965 void vc29_stopAllSounds();
966 void vc30_setFrameRate();
967 void vc31_setWindow();
968 void vc33_setMouseOn();
969 void vc34_setMouseOff();
970 void vc35_clearWindow();
971 virtual void vc36_setWindowImage();
972 void vc38_ifVarNotZero();
974 void vc40_scrollRight();
975 void vc41_scrollLeft();
976 void vc42_delayIfNotEQ();
982 void vc44_enableBox();
983 void vc45_disableBox();
985 void vc48_specialEffect();
987 void vc55_scanFlag();
991 void vc32_saveScreen();
992 void vc37_pokePalette();
995 void vc43_ifBitSet();
996 void vc44_ifBitClear();
997 void vc45_setWindowPalette();
998 void vc46_setPaletteSlot1();
999 void vc47_setPaletteSlot2();
1000 void vc48_setPaletteSlot3();
1002 void vc50_clearBit();
1003 void vc51_enableBox();
1004 void vc52_playSound();
1005 void vc53_dissolveIn();
1006 void vc54_dissolveOut();
1007 void vc55_moveBox();
1008 void vc56_fullScreen();
1009 void vc57_blackPalette();
1010 void vc58_checkCodeWheel();
1011 void vc58_changePriority();
1015 void vc60_stopAnimation();
1017 void vc62_fastFadeOut();
1018 virtual void vc63_fastFadeIn();
1021 void vc11_clearPathFinder();
1022 void vc17_setPathfinderItem();
1023 void vc32_copyVar();
1024 void vc37_addToSpriteY();
1025 void vc45_setSpriteX();
1026 void vc46_setSpriteY();
1027 void vc47_addToVar();
1028 virtual void vc48_setPathFinder();
1029 void vc59_ifSpeech();
1030 void vc61_setMaskImage();
1033 void vc56_delayLong();
1034 void vc59_stopAnimations();
1035 void vc64_ifSpeech();
1036 void vc65_slowFadeIn();
1037 void vc66_ifEqual();
1040 void vc69_playSeq();
1041 void vc70_joinSeq();
1042 void vc71_ifSeqWaiting();
1044 void vc73_setMark();
1045 void vc74_clearMark();
1048 void vc75_setScale();
1049 void vc76_setScaleXOffs();
1050 void vc77_setScaleYOffs();
1051 void vc78_computeXY();
1052 void vc79_computePosNum();
1053 void vc80_setOverlayImage();
1054 void vc81_setRandom();
1055 void vc82_getPathValue();
1056 void vc83_playSoundLoop();
1057 void vc84_stopSoundLoop();
1059 void setScriptCondition(
bool cond);
1060 bool getScriptCondition();
1061 void setScriptReturn(
int ret);
1062 int getScriptReturn();
1069 void o_notCarried();
1122 void o_haltAnimation();
1123 void o_restartAnimation();
1126 void o_getChildren();
1129 void o_killAnimate();
1133 void o_closeWindow();
1137 void o_disableBox();
1142 void o_unsetClass();
1147 void o_doClassIcons();
1149 void o_setAdjNoun();
1150 void o_saveUserGame();
1151 void o_loadUserGame();
1153 void o_restoreIcons();
1154 void o_freezeZones();
1155 void o_placeNoIcons();
1156 void o_clearTimers();
1160 int16 moreText(
Item *i);
1161 void lobjFunc(
Item *i,
const char *f);
1162 uint confirmYesOrNo(uint16 x, uint16 y);
1163 uint continueOrQuit();
1165 virtual void printStats();
1166 void synchChain(
Item *i);
1171 void drawImage_init(int16 image, uint16 palette, int16 x, int16 y, uint16 flags);
1176 void drawVertImageCompressed(
VC10_state *state);
1177 void drawVertImageUncompressed(
VC10_state *state);
1179 void setMoveRect(uint16 x, uint16 y, uint16 width, uint16 height);
1185 void updateBackendSurface(
Common::Rect *area = 0)
const;
1186 virtual void clearHiResTextLayer() {}
1188 int vcReadVarOrWord();
1189 uint vcReadNextWord(
bool forceLERead =
false);
1190 uint vcReadNextByte();
1191 uint vcReadVar(uint var);
1192 void vcWriteVar(uint var, int16 value);
1193 void vcSkipNextInstruction();
1195 int getScale(int16 y, int16 x);
1196 void checkScrollX(int16 x, int16 xpos);
1197 void checkScrollY(int16 y, int16 ypos);
1198 void centerScroll();
1200 virtual void clearVideoWindow(uint16 windowNum, uint16 color);
1201 void clearVideoBackGround(uint16 windowNum, uint16 color);
1203 void setPaletteSlot(uint16 srcOffs, uint8 dstOffs);
1204 void checkOnStopTable();
1205 void checkWaitEndTable();
1207 virtual bool ifObjectHere(uint16 val);
1208 virtual bool ifObjectAt(uint16 a, uint16 b);
1209 virtual bool ifObjectState(uint16 a, int16 b);
1211 bool isVgaQueueEmpty();
1212 void haltAnimation();
1213 void restartAnimation();
1214 void addVgaEvent(uint16 num, uint8 type,
const byte *codePtr, uint16 curSprite, uint16 curZoneNum);
1216 void processVgaEvents();
1217 void animateEvent(
const byte *codePtr, uint16 curZoneNum, uint16 curSprite);
1219 void drawStuff(
const byte *src, uint offs);
1225 bool isSpriteLoaded(uint16
id, uint16 zoneNum);
1228 void freeBox(uint index);
1230 void sendWindow(uint a);
1233 void colorBlock(
WindowBlock *window, uint16 x, uint16 y, uint16 w, uint16 h);
1236 void restoreBlock(uint16 left, uint16 top, uint16 right, uint16 bottom);
1239 byte *getBackGround();
1240 byte *getScaleBuf();
1242 byte *convertAmigaImage(
VC10_state *state,
bool compressed);
1244 bool decrunchFile(byte *src, byte *dst, uint32 size);
1245 void loadVGABeardFile(uint16
id);
1246 void loadVGAVideoFile(uint16
id, uint8 type,
bool useError =
true);
1247 bool loadVGASoundFile(uint16
id, uint8 type);
1249 void openGameFile();
1250 void readGameFile(
void *dst, uint32 offs, uint32 size);
1252 virtual void timerProc();
1254 virtual void animateSprites();
1257 void dirtyClipCheck(int16 x, int16 y, int16 w, int16 h);
1258 void dirtyBackGround();
1259 void restoreBackGround();
1262 void clearSurfaces();
1263 void displayScreen();
1265 void dumpVideoScript(
const byte *src,
bool singeOpcode);
1266 virtual void dumpVgaFile(
const byte *vga);
1267 void dumpVgaScript(
const byte *ptr, uint16 res, uint16
id);
1268 void dumpVgaScriptAlways(
const byte *ptr, uint16 res, uint16
id);
1270 void dumpVgaBitmaps(uint16 zoneNum);
1272 void dumpSingleBitmap(
int file,
int image,
const byte *offs,
int w,
int h, byte base);
1273 void dumpBitmap(
const char *filename,
const byte *offs, uint16 w, uint16 h,
int flags,
const byte *palette, byte base);
1274 void palLoad(byte *pal,
const byte *vga1,
int a,
int b);
1276 void fillBackFromBackGround(uint16 height, uint16 width);
1277 void fillBackFromFront();
1278 void fillBackGroundFromBack();
1279 void fillBackGroundFromFront();
1281 virtual void doOutput(
const byte *src, uint len);
1284 virtual void quickLoadOrSave();
1286 byte *vc10_uncompressFlip(
const byte *src, uint16 w, uint16 h);
1287 byte *vc10_flip(
const byte *src, uint16 w, uint16 h);
1289 Item *getNextItemPtrStrange();
1291 virtual bool loadGame(
const Common::String &filename,
bool restartMode =
false);
1292 virtual bool saveGame(uint slot,
const char *caption);
1294 void openTextWindow();
1295 void tidyIconArray(uint i);
1299 virtual void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr);
1306 void loadMusic(uint16 track,
bool forceSimon2GmData =
false,
bool useSimon2Remapping =
false);
1307 void playModule(uint16 music);
1308 virtual void playMusic(uint16 music, uint16 track);
1311 void delay(uint delay);
1314 void waitForMark(uint i);
1315 void scrollScreen();
1317 void decodeColumn(byte *dst,
const byte *src, uint16 height, uint16 pitch);
1318 void decodeRow(byte *dst,
const byte *src, uint16 width, uint16 pitch);
1319 void hitarea_stuff_helper_2();
1324 virtual void vcStopAnimation(uint16 zone, uint16 sprite);
1326 virtual bool confirmOverWrite(
WindowBlock *window);
1327 int16 matchSaveGame(
const char *name, uint16 max);
1328 void disableFileBoxes();
1329 virtual void userGame(
bool load);
1330 void userGameBackSpace(
WindowBlock *window,
int x, byte b = 0);
1331 void fileError(
WindowBlock *window,
bool saveError);
1333 int countSaveGames();
1349 void setupGame()
override;
1350 void setupOpcodes()
override;
1351 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1353 void executeOpcode(
int opcode)
override;
1355 int actCallD(
int n);
1357 void opn_opcode00();
1362 void opn_opcode05();
1363 void opn_opcode06();
1364 void opn_opcode07();
1365 void opn_opcode08();
1366 void opn_opcode09();
1367 void opn_opcode10();
1368 void opn_opcode11();
1369 void opn_opcode12();
1370 void opn_opcode13();
1371 void opn_opcode14();
1372 void opn_opcode15();
1373 void opn_opcode16();
1378 void opn_opcode21();
1379 void opn_opcode22();
1380 void opn_opcode23();
1381 void opn_opcode24();
1382 void opn_opcode25();
1383 void opn_opcode26();
1384 void opn_opcode27();
1385 void opn_opcode28();
1386 void opn_opcode29();
1387 void opn_opcode30();
1388 void opn_opcode31();
1389 void opn_opcode32();
1390 void opn_opcode33();
1391 void opn_opcode34();
1392 void opn_opcode35();
1393 void opn_opcode36();
1394 void opn_opcode37();
1395 void opn_opcode38();
1396 void opn_opcode39();
1397 void opn_opcode40();
1398 void opn_opcode41();
1399 void opn_opcode42();
1400 void opn_opcode43();
1401 void opn_opcode44();
1402 void opn_opcode45();
1403 void opn_opcode46();
1404 void opn_opcode47();
1405 void opn_opcode48();
1406 void opn_opcode49();
1407 void opn_opcode50();
1408 void opn_opcode51();
1409 void opn_opcode52();
1410 void opn_opcode53();
1411 void opn_opcode54();
1412 void opn_opcode55();
1413 void opn_opcode56();
1414 void opn_opcode57();
1415 void opn_opcode62();
1416 void opn_opcode63();
1430 StackFrame() { memset(
this, 0,
sizeof(*
this)); }
1437 int _dolineReturnVal;
1439 byte *_dataBase, *_textBase;
1440 uint32 _dataBaseSize, _textBaseSize;
1445 char _inputline[61];
1450 const char *_mouseString, *_mouseString1;
1451 char _objectName1[15], _objectName2[15];
1452 char _inMessage[20];
1453 char _placeMessage[15];
1456 uint16 _intputCounter, _inputMax;
1457 uint16 _mousePrintFG;
1461 uint32 _quickptr[16];
1462 uint16 _quickshort[12];
1465 char _keyboardBuffer[61];
1468 int16 _objectCountS;
1484 uint16 getptr(uint32 pos);
1485 uint32 getlong(uint32 pos);
1487 void loadGamePcFile()
override;
1489 int bitextract(uint32 ptr,
int offs);
1491 int doline(
int needsave);
1492 int setposition(
int process,
int line);
1495 char *getMessage(
char *msg, uint16 num);
1496 void getResponse(uint16 charNum, uint16 objNum, uint16 &msgNum1, uint16 &msgNum2);
1497 void getObjectName(
char *v, uint16 x);
1500 void setbitf(uint32 ptr,
int offs,
int val);
1502 void writeval(uint8 *ptr,
int val);
1504 void addstack(
int type);
1506 void popstack(
int type);
1507 void funccpy(
int *store);
1508 void funcentry(
int *storestore,
int procn);
1512 int gvwrd(uint8 *wptr,
int mask);
1513 int wrdmatch(uint8 *word1,
int mask1, uint8 *word2,
int mask2);
1515 bool testContainer(uint16 a);
1516 bool testObvious(uint16 a);
1517 bool testSeen(uint16 a);
1519 bool ifObjectInInv(uint16 a);
1520 int inventoryOn(
int val);
1523 void execMouseHit(
HitArea *ha);
1535 void drawIconHitBar();
1537 void printIcon(
HitArea *ha, uint8 i, uint8 r);
1538 void windowPutChar(
WindowBlock *window, byte c, byte b = 0)
override;
1540 bool badload(int8 errorNum);
1547 uint32 ftext(uint32 base,
int n);
1548 char *unctok(
char *c,
int n);
1549 void uncomstr(
char *c, uint32 x);
1552 void pcl(
const char *s);
1554 void plocd(
int n,
int m);
1555 void pobjd(
int n,
int m);
1556 void ptext(uint32 tptr);
1558 void clearVideoWindow(uint16 windowNum, uint16 color)
override;
1559 void setWindowImageEx(uint16 mode, uint16 vga_res)
override;
1561 bool ifObjectHere(uint16 val)
override;
1562 bool ifObjectAt(uint16 a, uint16 b)
override;
1563 bool ifObjectState(uint16 a, int16 b)
override;
1565 void boxController(uint x, uint y, uint mode)
override;
1566 void timerProc()
override;
1568 void addChar(uint8 chr);
1570 void clearInputLine();
1571 void handleKeyboard();
1572 void handleMouseMoved()
override;
1573 void interact(
char *buffer, uint8 size);
1575 bool processSpecialKeys()
override;
1592 void setupGame()
override;
1593 void setupOpcodes()
override;
1594 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1596 void executeOpcode(
int opcode)
override;
1599 void oe1_notPresent();
1602 void oe1_notCarried();
1605 void oe1_notSibling();
1608 void oe1_isPlayer();
1616 void oe1_moveDirn();
1623 void oe1_isCalled();
1626 void oe1_setUserItem();
1627 void oe1_getUserItem();
1629 void oe1_doorExit();
1630 void oe1_loadGame();
1631 void oe1_clearUserItem();
1632 void oe1_findMaster();
1633 void oe1_nextMaster();
1635 void oe1_stopAnimate();
1638 void oe1_enableInput();
1641 void oe1_playTune();
1642 void oe1_bitClear();
1645 void oe1_zoneDisk();
1646 void oe1_printStats();
1647 void oe1_stopTune();
1648 void oe1_printPlayerDamage();
1649 void oe1_printMonsterDamage();
1650 void oe1_pauseGame();
1651 void oe1_printPlayerHit();
1652 void oe1_printMonsterHit();
1657 OpcodeProcElvira1 proc;
1663 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1664 void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr)
override;
1666 void clearHiResTextLayer()
override;
1670 Graphics::FontSJIS *_sjisFont;
1672 uint16 _sjisCurChar;
1680 void setupGame()
override;
1681 void setupOpcodes()
override;
1682 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1684 void executeOpcode(
int opcode)
override;
1686 void oe2_moveDirn();
1689 void oe2_isCalled();
1691 void oe2_drawItem();
1693 void oe2_pauseGame();
1694 void oe2_setDoorOpen();
1695 void oe2_setDoorClosed();
1696 void oe2_setDoorLocked();
1697 void oe2_ifDoorOpen();
1698 void oe2_ifDoorClosed();
1699 void oe2_ifDoorLocked();
1700 void oe2_storeItem();
1705 void oe2_bNotZero();
1706 void oe2_getOValue();
1707 void oe2_setOValue();
1709 void oe2_printStats();
1710 void oe2_setSuperRoom();
1711 void oe2_getSuperRoom();
1712 void oe2_setExitOpen();
1713 void oe2_setExitClosed();
1714 void oe2_setExitLocked();
1715 void oe2_ifExitOpen();
1716 void oe2_ifExitClosed();
1717 void oe2_ifExitLocked();
1718 void oe2_playEffect();
1719 void oe2_getDollar2();
1720 void oe2_setSRExit();
1721 void oe2_printPlayerDamage();
1722 void oe2_printMonsterDamage();
1723 void oe2_isAdjNoun();
1727 void oe2_b2NotZero();
1729 void printStats()
override;
1733 OpcodeProcElvira2 proc;
1741 bool loadGame(
const Common::String &filename,
bool restartMode =
false)
override;
1742 bool saveGame(uint slot,
const char *caption)
override;
1744 void addArrows(
WindowBlock *window, uint8 num)
override;
1745 void removeArrows(
WindowBlock *window, uint num)
override;
1747 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1748 bool hasIcon(
Item *item)
override;
1749 uint itemGetIconNumber(
Item *item)
override;
1750 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1752 void moveDirn(
Item *i, uint x)
override;
1753 int canPlace(
Item *x,
Item *y)
override;
1754 int sizeOfRec(
Item *o,
int d)
override;
1755 int weightOf(
Item *x)
override;
1757 int changeExitStates(
SubSuperRoom *sr,
int n,
int d, uint16 s);
1758 uint16 getExitState(
Item *item, uint16 x, uint16 d);
1759 void setExitState(
Item *i, uint16 n, uint16 d, uint16 s);
1760 void setSRExit(
Item *i,
int n,
int d, uint16 s);
1762 void handleMouseWheelUp()
override;
1763 void handleMouseWheelDown()
override;
1765 virtual void listSaveGames();
1766 bool confirmOverWrite(
WindowBlock *window)
override;
1767 void userGame(
bool load)
override;
1768 virtual int userGameGetKey(
bool *b, uint maxChar);
1778 void setupGame()
override;
1779 void setupOpcodes()
override;
1780 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1782 void executeOpcode(
int opcode)
override;
1784 void boxTextMessage(
const char *x);
1785 void boxTextMsg(
const char *x);
1787 uint16 getBoxSize();
1788 uint16 checkFit(
char *Ptr,
int width,
int lines);
1791 void oww_addTextBox();
1792 void oww_setShortText();
1793 void oww_setLongText();
1794 void oww_printLongText();
1796 void oww_textMenu();
1797 void oww_pauseGame();
1798 void oww_boxMessage();
1800 void oww_boxLongText();
1801 void oww_printBox();
1803 void oww_lockZones();
1804 void oww_unlockZones();
1809 OpcodeProcWaxworks proc;
1816 char _boxBuffer[310];
1817 char *_boxBufferPtr;
1822 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1824 void boxController(uint x, uint y, uint mode)
override;
1826 void addArrows(
WindowBlock *window, uint8 num)
override;
1827 void removeArrows(
WindowBlock *window, uint num)
override;
1829 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1831 bool loadTablesIntoMem(uint16 subrId)
override;
1833 void moveDirn(
Item *i, uint x)
override;
1835 bool confirmOverWrite(
WindowBlock *window)
override;
1843 static const int SIMON1_GMF_SIZE[];
1849 void setupGame()
override;
1850 void setupOpcodes()
override;
1851 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1853 void executeOpcode(
int opcode)
override;
1855 void vc22_setPalette()
override;
1859 void os1_pauseGame();
1860 void os1_screenTextBox();
1861 void os1_screenTextMsg();
1862 void os1_playEffect();
1863 void os1_screenTextPObj();
1864 void os1_getPathPosn();
1865 void os1_scnTxtLongText();
1867 void os1_mouseOff();
1868 void os1_loadBeard();
1869 void os1_unloadBeard();
1870 void os1_unloadZone();
1871 void os1_loadStrings();
1872 void os1_unfreezeZones();
1873 void os1_specialFade();
1878 OpcodeProcSimon1 proc;
1888 void dumpVgaFile(
const byte *vga)
override;
1890 void clearName()
override;
1892 void handleMouseWheelUp()
override;
1893 void handleMouseWheelDown()
override;
1895 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1897 void initMouse()
override;
1898 void handleMouseMoved()
override;
1900 void addArrows(
WindowBlock *window, uint8 num)
override;
1901 void removeArrows(
WindowBlock *window, uint num)
override;
1903 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1905 virtual void playSpeech(uint16 speechId, uint16 vgaSpriteId);
1907 void listSaveGames()
override;
1908 void userGame(
bool load)
override;
1909 int userGameGetKey(
bool *b, uint maxChar)
override;
1911 void playMusic(uint16 music, uint16 track)
override;
1912 void playMidiSfx(uint16 sound)
override;
1914 void vcStopAnimation(uint16 zone, uint16 sprite)
override;
1924 void setupGame()
override;
1925 void setupOpcodes()
override;
1926 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1928 void executeOpcode(
int opcode)
override;
1930 void os2_printLongText();
1933 void os2_stopAnimate();
1934 void os2_playTune();
1935 void os2_screenTextPObj();
1937 void os2_mouseOff();
1938 void os2_isShortText();
1939 void os2_clearMarks();
1940 void os2_waitMark();
1945 OpcodeProcSimon2 proc;
1951 void clearName()
override;
1953 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1955 void addArrows(
WindowBlock *window, uint8 num)
override;
1956 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1958 void clearVideoWindow(uint16 windowNum, uint16 color)
override;
1960 void playSpeech(uint16 speechId, uint16 vgaSpriteId)
override;
1964 void playMusic(uint16 music, uint16 track)
override;
1973 ~AGOSEngine_Feeble()
override;
1975 void setupGame()
override;
1976 void setupOpcodes()
override;
1977 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1979 void executeOpcode(
int opcode)
override;
1981 void vc36_setWindowImage()
override;
1982 void vc48_setPathFinder()
override;
1986 void off_addTextBox();
1987 void off_printLongText();
1989 void off_oracleTextDown();
1990 void off_oracleTextUp();
1993 void off_saveUserGame();
1994 void off_loadUserGame();
1995 void off_listSaveGames();
1997 void off_screenTextBox();
1999 void off_isAdjNoun();
2000 void off_hyperLinkOn();
2001 void off_hyperLinkOff();
2002 void off_checkPaths();
2003 void off_screenTextPObj();
2005 void off_mouseOff();
2006 void off_loadVideo();
2007 void off_playVideo();
2008 void off_centerScroll();
2009 void off_resetPVCount();
2010 void off_setPathValues();
2011 void off_stopClock();
2012 void off_restartClock();
2013 void off_setColor();
2017 void off_b3NotZero();
2020 friend class MoviePlayer;
2021 friend class MoviePlayerDXA;
2022 friend class MoviePlayerSMK;
2024 typedef void (AGOSEngine_Feeble::*OpcodeProcFeeble) ();
2025 struct OpcodeEntryFeeble {
2026 OpcodeProcFeeble proc;
2030 const OpcodeEntryFeeble *_opcodesFeeble;
2032 MoviePlayer *_moviePlayer;
2034 uint8 _interactiveVideo;
2035 uint16 _vgaCurSpritePriority;
2037 uint16 to16Wrapper(uint value)
override;
2038 uint16 readUint16Wrapper(
const void *src)
override;
2039 uint32 readUint32Wrapper(
const void *src)
override;
2041 void setLoyaltyRating(byte rating);
2043 void playVideo(
const char *filename,
bool lastSceneUsed =
false);
2044 void stopInteractiveVideo();
2047 void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
2049 void handleMouseWheelUp()
override;
2050 void handleMouseWheelDown()
override;
2052 void drawMousePart(
int image, byte x, byte y);
2053 void initMouse()
override;
2054 void drawMousePointer()
override;
2056 void animateSprites()
override;
2057 void animateSpritesByY();
2060 void swapCharacterLogo();
2061 void timerProc()
override;
2063 void addArrows(
WindowBlock *window, uint8 num)
override;
2064 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
2066 void resetVerbs()
override;
2067 void setVerb(
HitArea * ha)
override;
2068 void hitarea_leave(
HitArea * ha,
bool state =
false)
override;
2069 void invertBox(
HitArea *ha,
bool state);
2072 void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr)
override;
2074 void clearName()
override;
2076 void drawIconArray(uint i,
Item *itemPtr,
int line,
int classMask)
override;
2080 void dumpVgaFile(
const byte *vga)
override;
2082 void doOutput(
const byte *src, uint len)
override;
2084 void printScreenText(uint vgaSpriteId, uint color,
const char *stringPtr, int16 x, int16 y, int16 width)
override;
2086 void printInteractText(uint16 num,
const char *
string);
2087 void sendInteractText(uint16 num, MSVC_PRINTF
const char *fmt, ...)
GCC_PRINTF(3, 4);
2089 void checkLinkBox();
2090 void hyperLinkOn(uint16 x);
2091 void hyperLinkOff();
2095 void runSubroutine101()
override;
2102 void oracleTextUp();
2103 void oracleTextDown();
2104 void scrollOracle();
2105 void scrollOracleUp();
2106 void scrollOracleDown();
2108 void listSaveGamesFeeble();
2109 void saveUserGame(
int slot);
2113 void quickLoadOrSave()
override;
2116 class AGOSEngine_FeebleDemo :
public AGOSEngine_Feeble {
2125 void initMouse()
override;
2126 void drawMousePointer()
override;
2131 void handleWobble();
2133 void startInteractiveVideo(
const char *filename);
2134 void waitForSpace();
2137 class AGOSEngine_PuzzlePack :
public AGOSEngine_Feeble {
2142 void setupGame()
override;
2143 void setupOpcodes()
override;
2145 void executeOpcode(
int opcode)
override;
2147 void vc3_loadSprite()
override;
2148 void vc63_fastFadeIn()
override;
2150 void opp_iconifyWindow();
2151 void opp_restoreOopsPosition();
2152 void opp_loadMouseImage();
2154 void opp_setShortText();
2155 void opp_loadHiScores();
2156 void opp_checkHiScores();
2158 void opp_saveUserGame();
2159 void opp_loadUserGame();
2160 void opp_playTune();
2161 void opp_saveOopsPosition();
2162 void opp_resetGameTime();
2163 void opp_resetPVCount();
2164 void opp_setPathValues();
2165 void opp_pauseClock();
2168 typedef void (AGOSEngine_PuzzlePack::*OpcodeProcPuzzlePack) ();
2169 struct OpcodeEntryPuzzlePack {
2170 OpcodeProcPuzzlePack proc;
2174 const OpcodeEntryPuzzlePack *_opcodesPuzzlePack;
2179 void initMouse()
override;
2180 void handleMouseMoved()
override;
2181 void drawMousePointer()
override;
2183 void resetVerbs()
override;
2185 void loadMouseImage();
2187 void startOverlayAnims();
2188 void startAnOverlayAnim();
2190 void printInfoText(
const char *itemText);
2196 class AGOSEngine_DIMP :
public AGOSEngine_PuzzlePack {
2201 void setupOpcodes()
override;
2203 void executeOpcode(
int opcode)
override;
2206 typedef void (AGOSEngine_DIMP::*OpcodeProcDIMP) ();
2207 struct OpcodeEntryDIMP {
2208 OpcodeProcDIMP proc;
2212 const OpcodeEntryDIMP *_opcodesDIMP;
2214 int16 _iconToggleCount, _voiceCount;
2215 uint32 _lastTickCount;
2216 uint32 _startSecondCount, _tSecondCount;
2218 void odp_saveUserGame();
2219 void odp_loadUserGame();
2222 void timerProc()
override;
EngineFeature
Definition: engine.h:250
ErrorCode getCode() const
Definition: error.h:115
No error occurred.
Definition: error.h:48
int tagOfParentDoline
tag of the doline "instance" to which this StackFrame belongs
Definition: agos.h:1429
int FORCEINLINE GCC_PRINTF(2, 0) int vsprintf_s(T(&dst)[N]
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: detection.h:40
Definition: keyboard.h:294
Definition: debugger.h:31
int _tagOfActiveDoline
tag of the active doline "instance"
Definition: agos.h:1436
Common::Error run() override
Definition: agos.h:216
Language
Definition: language.h:45