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" 36 #include "backends/keymapper/action.h" 37 #include "backends/keymapper/keymapper.h" 40 #include "agos/detection.h" 58 class SeekableReadStream;
67 class SeekableAudioStream;
73 kDebugOpcode = 1 << 0,
74 kDebugVGAOpcode = 1 << 1,
75 kDebugSubroutine = 1 << 2,
76 kDebugVGAScript = 1 << 3,
77 kDebugImageDump = 1 << 4
90 kActionToggleFastMode,
91 kActionToggleSwitchCharacter,
92 kActionToggleSubtitle,
94 kActionToggleHitboxName,
95 kActionToggleSoundEffects,
96 kActionToggleBackgroundSound,
99 kActionTextSpeedMedium,
100 kActionTextSpeedSlow,
101 kActionSpeed_GTYPEPP,
109 #define CHECK_BOUNDS(x, y) assert((uint)(x) < ARRAYSIZE(y)) 127 struct SubroutineLine;
137 uint16 width, height;
148 HitArea() { memset(
this, 0,
sizeof(*
this)); }
210 AnimTable() { memset(
this, 0,
sizeof(*
this)); }
214 ANIMATE_INT = 1 << 1,
215 ANIMATE_EVENT = 1 << 2,
216 SCROLL_EVENT = 1 << 3,
217 PLAYER_DAMAGE_EVENT = 1 << 4,
218 MONSTER_DAMAGE_EVENT = 1 << 5
228 #ifndef REDUCE_MEMORY_USAGE 229 # define _OPCODE(ver, x) { &ver::x, #x } 231 # define _OPCODE(ver, x) { &ver::x, "" } 237 static const byte SIMON1_RHYTHM_SFX[];
240 static const uint16 MUSIC_INDEX_BASE_SIMON2_GM = 1128 / 4;
242 static const uint16 MUSIC_INDEX_BASE_SIMON2_MT32 = (1128 + 612) / 4;
259 void syncSoundSettings()
override;
262 void syncSoundSettingsIntern();
263 void pauseEngineIntern(
bool pause)
override;
265 virtual void setupOpcodes();
266 uint16 _numOpcodes, _opcode;
270 void setupVgaOpcodes();
271 VgaOpcodeProc _vga_opcode_table[100];
272 uint8 _numVideoOpcodes;
274 virtual void setupVideoOpcodes(VgaOpcodeProc *op);
279 virtual void setupGame();
281 int getGameId()
const;
282 int getGameType()
const;
283 uint32 getFeatures()
const;
284 const char *getExtra()
const;
287 const char *getFileName(
int type)
const;
291 uint16 _vcGetOutOfCode;
294 uint32 *_gameOffsetsPtr;
296 uint8 _numMusic, _numSFX;
300 uint8 _numBitArray1, _numBitArray2, _numBitArray3, _numItemStore;
303 uint8 _vgaBaseDelay, _vgaPeriod;
305 uint16 _musicIndexBase;
306 uint16 _soundIndexBase;
307 uint16 _tableIndexBase;
308 uint16 _textIndexBase;
311 uint32 _tableMemSize;
322 byte *_strippedTxtMem;
325 uint32 _stringTabNum, _stringTabPos, _stringTabSize;
326 byte **_stringTabPtr;
328 Item **_itemArrayPtr;
329 uint32 _itemArraySize;
330 uint32 _itemArrayInited;
336 const byte *_codePtr;
338 byte **_localStringtable;
339 uint16 _stringIdLocalMin, _stringIdLocalMax;
342 uint16 _numRoomStates;
349 byte *_xtablesHeapPtrOrg;
350 uint32 _xtablesHeapCurPosOrg;
354 byte *_tablesHeapPtr, *_tablesHeapPtrOrg, *_tablesheapPtrNew;
355 uint32 _tablesHeapSize, _tablesHeapCurPos, _tablesHeapCurPosOrg;
356 uint32 _tablesHeapCurPosNew;
361 uint8 _recursionDepth;
369 bool _runScriptReturn1;
370 bool _runScriptCondition[40];
371 int16 _runScriptReturn[40];
373 bool _noParentNotify;
385 bool _copyProtection;
390 int16 _chanceModifier;
391 bool _restoreWindow6;
392 int16 _scrollX, _scrollXMax;
393 int16 _scrollY, _scrollYMax;
394 int16 _scrollCount, _scrollFlag;
395 uint16 _scrollWidth, _scrollHeight;
396 const byte *_scrollImage;
401 int16 _classMask, _classMode1, _classMode2;
408 uint16 _currentRoom, _superRoomNumber;
411 uint16 _hyperLink, _newLines;
412 uint16 _oracleMaxScrollY, _noOracleScroll;
415 int16 _scriptVerb, _scriptNoun1, _scriptNoun2;
416 int16 _scriptAdj1, _scriptAdj2;
421 Item *_subjectItem, *_objectItem;
422 Item *_currentPlayer;
424 Item *_hitAreaObjectItem;
428 Item *_hitAreaSubjectItem;
429 HitArea *_currentBox, *_currentVerbBox, *_lastVerbOn;
430 uint16 _currentBoxNum;
431 uint16 _needHitAreaRecalc;
446 int16 _printCharCurPos, _printCharMaxPos, _printCharPixelCount;
447 uint16 _numLettersToPrint;
451 uint32 getTime()
const;
455 uint32 _clockStopped, _gameStoppedClock;
458 TimeEvent *_firstTimeStruct, *_pendingDeleteTimeEvent;
465 bool _animatePointer;
466 byte _maxCursorWidth, _maxCursorHeight;
467 byte _mouseAnim, _mouseAnimMax, _mouseCursor;
468 byte _currentMouseAnim, _currentMouseCursor;
469 byte _oldMouseAnimMax, _oldMouseCursor;
470 uint16 _mouseHideCount;
473 bool _leftButtonDown, _rightButtonDown;
474 byte _leftButton, _leftButtonCount, _leftButtonOld;
477 bool _leftClick, _rightClick;
484 volatile uint16 _videoLockOut;
485 uint16 _scrollUpHitArea;
486 uint16 _scrollDownHitArea;
488 bool _fastFadeOutFlag;
491 uint16 _fastFadeCount;
492 volatile uint16 _fastFadeInFlag;
495 uint16 _screenWidth, _screenHeight;
496 uint16 _internalWidth, _internalHeight;
501 bool _exitCutscene, _picture8600;
504 int16 _lastMusicPlayed;
505 int16 _nextMusicToPlay;
506 bool _showPreposition;
507 bool _showMessageFlag;
511 uint16 _copyScnFlag, _vgaSpriteChanged;
513 byte *_block, *_blockEnd;
514 byte *_vgaMemPtr, *_vgaMemEnd, *_vgaMemBase;
515 byte *_vgaFrozenBase, *_vgaRealBase;
526 uint16 _vgaWaitFor, _lastVgaWaitFor;
527 uint16 _vgaCurSpriteId, _vgaCurZoneNum;
532 int16 _scaleX, _scaleY, _scaleWidth, _scaleHeight;
536 uint8 _opcode177Var1, _opcode177Var2;
537 uint8 _opcode178Var1, _opcode178Var2;
539 Item *_objectArray[50];
540 Item *_itemStore[50];
542 uint16 _shortText[40];
543 uint16 _shortTextX[40];
544 uint16 _shortTextY[40];
545 uint16 _longText[40];
546 uint16 _longSound[40];
548 uint16 _bitArray[128];
549 uint16 _bitArrayTwo[16];
550 uint16 _bitArrayThree[16];
551 int16 *_variableArray;
552 int16 *_variableArray2;
553 int16 *_variableArrayPtr;
561 TextLocation _textLocation1, _textLocation2, _textLocation3, _textLocation4;
563 byte _awaitTwoByteToken;
565 byte *_byteTokenStrings;
566 byte *_twoByteTokens;
567 byte *_twoByteTokenStrings;
568 byte *_secondTwoByteTokenStrings;
569 byte *_thirdTwoByteTokenStrings;
570 byte _textBuffer[180];
575 byte _stringReturnBuffer[2][180];
587 const uint16 *_pathFindArray[100];
589 uint8 _pathValues[400];
593 uint8 _pathValues1[400];
597 uint8 _currentPalette[768];
598 uint8 _displayPalette[768];
601 byte _videoBuf1[32000];
602 uint16 _videoWindows[128];
603 const byte *_pak98Buf;
604 byte _paletteModNext;
610 uint16 _moveXMin, _moveYMin;
611 uint16 _moveXMax, _moveYMax;
617 byte _lettersToPrintBuf[80];
638 uint16 _effectsVolume;
641 uint8 _saveGameNameLen;
642 uint16 _saveLoadRowCurPos;
643 uint16 _numSaveGameRows;
644 bool _saveDialogFlag;
648 byte _saveLoadType, _saveLoadSlot;
649 char _saveLoadName[108];
660 const byte *_vc10BasePtrOld;
661 byte _hebrewCharWidths[32];
668 uint32 _curSfxFileSize;
669 uint16 _sampleEnd, _sampleWait;
672 virtual uint16 to16Wrapper(uint value);
673 virtual uint16 readUint16Wrapper(
const void *src);
674 virtual uint32 readUint32Wrapper(
const void *src);
682 void allocateStringTable(
int num);
683 void setupStringTable(byte *mem,
int num);
684 void setupLocalStringTable(byte *mem,
int num);
688 virtual void loadGamePcFile();
690 void decompressData(
const char *srcName, byte *dst, uint32 offset, uint32 srcSize, uint32 dstSize);
692 void loadOffsets(
const char *filename,
int number, uint32 &file, uint32 &offset, uint32 &compressedSize, uint32 &size);
693 void loadSound(uint16 sound, int16 pan, int16 vol, uint16 type);
694 void playSfx(uint16 sound, uint16 freq, uint16 flags,
bool digitalOnly =
false,
bool midiOnly =
false);
695 void loadSound(uint16 sound, uint16 freq, uint16 flags);
697 virtual void playMidiSfx(uint16 sound);
698 void loadVoice(uint speechId);
701 void loadSoundFile(
const char *filename);
703 int getUserFlag(
Item *item,
int a);
704 int getUserFlag1(
Item *item,
int a);
705 int getUserItem(
Item *item,
int n);
706 void setUserFlag(
Item *item,
int a,
int b);
707 void setUserItem(
Item *item,
int n,
int m);
709 void paletteFadeOut(byte *palPtr, uint num, uint size);
711 void *allocateItem(uint size);
712 void *allocateTable(uint size);
713 void alignTableMem();
715 Child *findChildOfType(
Item *i, uint child);
716 Child *allocateChildBlock(
Item *i, uint type, uint size);
718 void allocItemHeap();
719 void allocTablesHeap();
728 Subroutine *getSubroutineByID(uint subroutineId);
731 void dumpAllSubroutines();
732 void dumpAllVgaImageFiles();
733 void dumpAllVgaScriptFiles();
734 void dumpSubroutines();
737 const byte *dumpOpcode(
const byte *p);
745 virtual void executeOpcode(
int opcode) = 0;
750 uint getNextVarContents();
751 uint getVarWrapper();
754 uint readVariable(uint16 variable);
755 void writeNextVarContents(uint16 contents);
756 void writeVariable(uint16 variable, uint16 contents);
758 Item *derefItem(uint item);
759 Item *getNextItemPtr();
760 uint getNextItemID();
761 uint getItem1ID() {
return 1;}
762 uint itemPtrToID(
Item *
id);
766 void uncompressText(byte *ptr);
767 byte *uncompressToken(byte a, byte *ptr);
769 void showMessageFormat(MSVC_PRINTF
const char *s, ...)
GCC_PRINTF(2, 3);
770 const byte *getStringPtrByID(uint16 stringId,
bool upperCase =
false);
771 const byte *getLocalStringByID(uint16 stringId);
772 uint getNextStringID();
774 void addTimeEvent(int32 timeout, uint16 subroutineId);
777 Item *findInByClass(
Item *i, int16 m);
778 Item *nextInByClass(
Item *i, int16 m);
779 Item *findMaster(int16 a, int16 n);
780 Item *nextMaster(
Item *item, int16 a, int16 n);
781 int wordMatch(
Item *item, int16 a, int16 n);
783 bool isRoom(
Item *item);
784 bool isObject(
Item *item);
785 bool isPlayer(
Item *item);
787 void itemChildrenChanged(
Item *item);
788 void unlinkItem(
Item *item);
789 void linkItem(
Item *item,
Item *parent);
791 void setItemParent(
Item *item,
Item *parent);
792 void setItemState(
Item *item,
int value);
794 void stopAnimate(uint16 a);
795 void stopAnimateSimon2(uint16 a, uint16 b);
797 void enableBox(uint hitarea);
798 void disableBox(uint hitarea);
799 void moveBox(uint hitarea,
int x,
int y);
800 bool isBoxDead(uint hitarea);
801 void undefineBox(uint hitarea);
802 void defineBox(
int id,
int x,
int y,
int width,
int height,
int flags,
int verb,
Item *itemPtr);
803 void defineBox(uint16
id, uint16 x, uint16 y, uint16 width, uint16 height, uint16 msg1, uint16 msg2, uint16 flags);
807 virtual void resetVerbs();
808 virtual void setVerb(
HitArea * ha);
809 virtual void hitarea_leave(
HitArea * ha,
bool state =
false);
810 void leaveHitAreaById(uint hitarea_id);
812 void sendSync(uint a);
813 void waitForSync(uint a);
815 uint getOffsetOfChild2Param(
SubObject *child, uint prop);
816 void scriptMouseOff();
818 void unfreezeBottom();
824 void setup_cond_c_helper();
826 uint16 getBackExit(
int n);
827 uint16 getDoorState(
Item *item, uint16 d);
828 uint16 getExitOf(
Item *item, uint16 d);
829 void changeDoorState(
SubRoom *r, uint16 d, uint16 n);
830 void setDoorState(
Item *i, uint16 d, uint16 n);
833 Item *getDoorOf(
Item *item, uint16 d);
834 Item *getExitOf_e1(
Item *item, uint16 d);
835 virtual void moveDirn(
Item *i, uint x);
837 virtual int canPlace(
Item *x,
Item *y);
839 int sizeContents(
Item *x);
840 virtual int sizeOfRec(
Item *o,
int d);
841 int sizeRec(
Item *x,
int d);
842 int weighUp(
Item *x);
843 int weightRec(
Item *x,
int d);
844 virtual int weightOf(
Item *x);
848 void drawMenuStrip(uint windowNum, uint menuNum);
849 void lightMenuStrip(
int a);
850 void unlightMenuStrip();
851 void lightMenuBox(uint hitarea);
853 uint menuFor_e2(
Item *item);
854 uint menuFor_ww(
Item *item, uint
id);
855 void clearMenuStrip();
856 void doMenuStrip(uint menuNum);
861 bool loadRoomItems(uint16 item);
863 virtual bool loadTablesIntoMem(uint16 subrId);
864 bool loadXTablesIntoMem(uint16 subrId);
865 void loadTextIntoMem(uint16 stringId);
867 uint loadTextFile(
const char *filename, byte *dst);
871 uint loadTextFile_simon1(
const char *filename, byte *dst);
877 uint loadTextFile_gme(
const char *filename, byte *dst);
881 bool kickoffTimeEvents();
882 void killAllTimers();
885 virtual void runSubroutine101();
890 WindowBlock *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fillColor, uint textColor);
893 void changeWindow(uint a);
894 void closeWindow(uint a);
895 void setTextColor(uint color);
896 virtual void windowPutChar(
WindowBlock *window, byte c, byte b = 0);
899 HitArea *findBox(uint hitarea_id);
900 virtual void boxController(uint x, uint y, uint mode);
901 void handleVerbClicked(uint verb);
902 virtual void clearName();
903 void displayName(
HitArea * ha);
904 void resetNameWindow();
905 void displayBoxStars();
906 void invertBox(
HitArea * ha, byte a, byte b, byte c, byte d);
908 virtual void handleMouseWheelUp();
909 virtual void handleMouseWheelDown();
911 virtual void initMouse();
912 virtual void handleMouseMoved();
913 virtual void drawMousePointer();
915 void drawArrow(uint16 x, uint16 y, int8 dir);
916 virtual void addArrows(
WindowBlock *window, uint8 num);
917 virtual void removeArrows(
WindowBlock *window, uint num);
919 virtual void drawIcon(
WindowBlock *window, uint icon, uint x, uint y);
920 virtual bool hasIcon(
Item *item);
921 virtual uint itemGetIconNumber(
Item *item);
922 virtual uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr);
924 virtual void drawIconArray(uint i,
Item *itemPtr,
int line,
int classMask);
925 void removeIconArray(uint num);
931 virtual bool processSpecialKeys();
932 void hitarea_stuff_helper();
936 uint getFeebleFontSize(byte chr);
938 void justifyOutPut(byte chr);
940 void loadZone(uint16 zoneNum,
bool useError =
true);
942 void animate(uint16 windowNum, uint16 zoneNum, uint16 vgaSpriteId, int16 x, int16 y, uint16 palette,
bool vgaScript =
false);
943 void setImage(uint16 vgaSpriteId,
bool vgaScript =
false);
944 void setWindowImage(uint16 mode, uint16 vgaSpriteId,
bool specialCase =
false);
945 virtual void setWindowImageEx(uint16 mode, uint16 vgaSpriteId);
950 const char *getPixelLength(
const char *
string, uint16 maxWidth, uint16 &pixels);
951 bool printNameOf(
Item *item, uint x, uint y);
952 bool printTextOf(uint a, uint x, uint y);
953 void printVerbOf(uint hitarea_id);
954 void showActionString(
const byte *
string);
956 virtual void printScreenText(uint vgaSpriteId, uint color,
const char *stringPtr, int16 x, int16 y, int16 width);
958 void renderStringAmiga(uint vgaSpriteId, uint color, uint width, uint height,
const char *txt);
959 void renderString(uint vgaSpriteId, uint color, uint width, uint height,
const char *txt);
961 void writeChar(
WindowBlock *window,
int x,
int y,
int offs,
int val);
963 byte *allocBlock(uint32 size);
964 void checkNoOverWrite();
965 void checkRunningAnims();
966 void checkAnims(uint a);
967 void checkZonePtrs();
968 void setZoneBuffers();
973 bool getBitFlag(uint bit);
974 void setBitFlag(uint bit,
bool value);
979 virtual void vc3_loadSprite();
982 void vc6_ifObjectHere();
983 void vc7_ifObjectNotHere();
984 void vc8_ifObjectIsAt();
985 void vc9_ifObjectStateIs();
988 void vc13_addToSpriteX();
989 void vc14_addToSpriteY();
991 void vc16_waitSync();
994 void vc20_setRepeat();
995 void vc21_endRepeat();
996 virtual void vc22_setPalette();
997 void vc23_setPriority();
998 void vc24_setSpriteXY();
999 void vc25_halt_sprite();
1000 void vc26_setSubWindow();
1001 void vc27_resetSprite();
1002 void vc28_playSFX();
1003 void vc29_stopAllSounds();
1004 void vc30_setFrameRate();
1005 void vc31_setWindow();
1006 void vc33_setMouseOn();
1007 void vc34_setMouseOff();
1008 void vc35_clearWindow();
1009 virtual void vc36_setWindowImage();
1010 void vc38_ifVarNotZero();
1012 void vc40_scrollRight();
1013 void vc41_scrollLeft();
1014 void vc42_delayIfNotEQ();
1020 void vc44_enableBox();
1021 void vc45_disableBox();
1023 void vc48_specialEffect();
1025 void vc55_scanFlag();
1028 void vc17_waitEnd();
1029 void vc32_saveScreen();
1030 void vc37_pokePalette();
1033 void vc43_ifBitSet();
1034 void vc44_ifBitClear();
1035 void vc45_setWindowPalette();
1036 void vc46_setPaletteSlot1();
1037 void vc47_setPaletteSlot2();
1038 void vc48_setPaletteSlot3();
1040 void vc50_clearBit();
1041 void vc51_enableBox();
1042 void vc52_playSound();
1043 void vc53_dissolveIn();
1044 void vc54_dissolveOut();
1045 void vc55_moveBox();
1046 void vc56_fullScreen();
1047 void vc57_blackPalette();
1048 void vc58_checkCodeWheel();
1049 void vc58_changePriority();
1053 void vc60_stopAnimation();
1055 void vc62_fastFadeOut();
1056 virtual void vc63_fastFadeIn();
1059 void vc11_clearPathFinder();
1060 void vc17_setPathfinderItem();
1061 void vc32_copyVar();
1062 void vc37_addToSpriteY();
1063 void vc45_setSpriteX();
1064 void vc46_setSpriteY();
1065 void vc47_addToVar();
1066 virtual void vc48_setPathFinder();
1067 void vc59_ifSpeech();
1068 void vc61_setMaskImage();
1071 void vc56_delayLong();
1072 void vc59_stopAnimations();
1073 void vc64_ifSpeech();
1074 void vc65_slowFadeIn();
1075 void vc66_ifEqual();
1078 void vc69_playSeq();
1079 void vc70_joinSeq();
1080 void vc71_ifSeqWaiting();
1082 void vc73_setMark();
1083 void vc74_clearMark();
1086 void vc75_setScale();
1087 void vc76_setScaleXOffs();
1088 void vc77_setScaleYOffs();
1089 void vc78_computeXY();
1090 void vc79_computePosNum();
1091 void vc80_setOverlayImage();
1092 void vc81_setRandom();
1093 void vc82_getPathValue();
1094 void vc83_playSoundLoop();
1095 void vc84_stopSoundLoop();
1097 void setScriptCondition(
bool cond);
1098 bool getScriptCondition();
1099 void setScriptReturn(
int ret);
1100 int getScriptReturn();
1107 void o_notCarried();
1160 void o_haltAnimation();
1161 void o_restartAnimation();
1164 void o_getChildren();
1167 void o_killAnimate();
1171 void o_closeWindow();
1175 void o_disableBox();
1180 void o_unsetClass();
1185 void o_doClassIcons();
1187 void o_setAdjNoun();
1188 void o_saveUserGame();
1189 void o_loadUserGame();
1191 void o_restoreIcons();
1192 void o_freezeZones();
1193 void o_placeNoIcons();
1194 void o_clearTimers();
1198 int16 moreText(
Item *i);
1199 void lobjFunc(
Item *i,
const char *f);
1200 uint confirmYesOrNo(uint16 x, uint16 y);
1201 uint continueOrQuit();
1203 virtual void printStats();
1204 void synchChain(
Item *i);
1209 void drawImage_init(int16 image, uint16 palette, int16 x, int16 y, uint16 flags);
1214 void drawVertImageCompressed(
VC10_state *state);
1215 void drawVertImageUncompressed(
VC10_state *state);
1217 void setMoveRect(uint16 x, uint16 y, uint16 width, uint16 height);
1223 void updateBackendSurface(
Common::Rect *area = 0)
const;
1224 virtual void clearHiResTextLayer() {}
1226 int vcReadVarOrWord();
1227 uint vcReadNextWord(
bool forceLERead =
false);
1228 uint vcReadNextByte();
1229 uint vcReadVar(uint var);
1230 void vcWriteVar(uint var, int16 value);
1231 void vcSkipNextInstruction();
1233 int getScale(int16 y, int16 x);
1234 void checkScrollX(int16 x, int16 xpos);
1235 void checkScrollY(int16 y, int16 ypos);
1236 void centerScroll();
1238 virtual void clearVideoWindow(uint16 windowNum, uint16 color);
1239 void clearVideoBackGround(uint16 windowNum, uint16 color);
1241 void setPaletteSlot(uint16 srcOffs, uint8 dstOffs);
1242 void checkOnStopTable();
1243 void checkWaitEndTable();
1245 virtual bool ifObjectHere(uint16 val);
1246 virtual bool ifObjectAt(uint16 a, uint16 b);
1247 virtual bool ifObjectState(uint16 a, int16 b);
1249 bool isVgaQueueEmpty();
1250 void haltAnimation();
1251 void restartAnimation();
1252 void addVgaEvent(uint16 num, uint8 type,
const byte *codePtr, uint16 curSprite, uint16 curZoneNum);
1254 void processVgaEvents();
1255 void animateEvent(
const byte *codePtr, uint16 curZoneNum, uint16 curSprite);
1257 void drawStuff(
const byte *src, uint offs);
1263 bool isSpriteLoaded(uint16
id, uint16 zoneNum);
1266 void freeBox(uint index);
1268 void sendWindow(uint a);
1271 void colorBlock(
WindowBlock *window, uint16 x, uint16 y, uint16 w, uint16 h);
1274 void restoreBlock(uint16 left, uint16 top, uint16 right, uint16 bottom);
1277 byte *getBackGround();
1278 byte *getScaleBuf();
1280 byte *convertAmigaImage(
VC10_state *state,
bool compressed);
1282 bool decrunchFile(byte *src, byte *dst, uint32 size);
1283 void loadVGABeardFile(uint16
id);
1284 void loadVGAVideoFile(uint16
id, uint8 type,
bool useError =
true);
1285 bool loadVGASoundFile(uint16
id, uint8 type);
1287 void openGameFile();
1288 void readGameFile(
void *dst, uint32 offs, uint32 size);
1290 virtual void timerProc();
1292 virtual void animateSprites();
1295 void dirtyClipCheck(int16 x, int16 y, int16 w, int16 h);
1296 void dirtyBackGround();
1297 void restoreBackGround();
1300 void clearSurfaces();
1301 void displayScreen();
1303 void dumpVideoScript(
const byte *src,
bool singeOpcode);
1304 virtual void dumpVgaFile(
const byte *vga);
1305 void dumpVgaScript(
const byte *ptr, uint16 res, uint16
id);
1306 void dumpVgaScriptAlways(
const byte *ptr, uint16 res, uint16
id);
1308 void dumpVgaBitmaps(uint16 zoneNum);
1310 void dumpSingleBitmap(
int file,
int image,
const byte *offs,
int w,
int h, byte base);
1311 void dumpBitmap(
const char *filename,
const byte *offs, uint16 w, uint16 h,
int flags,
const byte *palette, byte base);
1312 void palLoad(byte *pal,
const byte *vga1,
int a,
int b);
1314 void fillBackFromBackGround(uint16 height, uint16 width);
1315 void fillBackFromFront();
1316 void fillBackGroundFromBack();
1317 void fillBackGroundFromFront();
1319 virtual void doOutput(
const byte *src, uint len);
1322 virtual void quickLoadOrSave();
1324 byte *vc10_uncompressFlip(
const byte *src, uint16 w, uint16 h);
1325 byte *vc10_flip(
const byte *src, uint16 w, uint16 h);
1327 Item *getNextItemPtrStrange();
1329 virtual bool loadGame(
const Common::String &filename,
bool restartMode =
false);
1330 virtual bool saveGame(uint slot,
const char *caption);
1332 void openTextWindow();
1333 void tidyIconArray(uint i);
1337 virtual void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr);
1344 void loadMusic(uint16 track,
bool forceSimon2GmData =
false,
bool useSimon2Remapping =
false);
1345 void playModule(uint16 music);
1346 virtual void playMusic(uint16 music, uint16 track);
1349 void delay(uint delay);
1352 void waitForMark(uint i);
1353 void scrollScreen();
1355 void decodeColumn(byte *dst,
const byte *src, uint16 height, uint16 pitch);
1356 void decodeRow(byte *dst,
const byte *src, uint16 width, uint16 pitch);
1357 void hitarea_stuff_helper_2();
1362 virtual void vcStopAnimation(uint16 zone, uint16 sprite);
1364 virtual bool confirmOverWrite(
WindowBlock *window);
1365 int16 matchSaveGame(
const char *name, uint16 max);
1366 void disableFileBoxes();
1367 virtual void userGame(
bool load);
1368 void userGameBackSpace(
WindowBlock *window,
int x, byte b = 0);
1369 void fileError(
WindowBlock *window,
bool saveError);
1371 int countSaveGames();
1387 void setupGame()
override;
1388 void setupOpcodes()
override;
1389 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1391 void executeOpcode(
int opcode)
override;
1393 int actCallD(
int n);
1395 void opn_opcode00();
1400 void opn_opcode05();
1401 void opn_opcode06();
1402 void opn_opcode07();
1403 void opn_opcode08();
1404 void opn_opcode09();
1405 void opn_opcode10();
1406 void opn_opcode11();
1407 void opn_opcode12();
1408 void opn_opcode13();
1409 void opn_opcode14();
1410 void opn_opcode15();
1411 void opn_opcode16();
1416 void opn_opcode21();
1417 void opn_opcode22();
1418 void opn_opcode23();
1419 void opn_opcode24();
1420 void opn_opcode25();
1421 void opn_opcode26();
1422 void opn_opcode27();
1423 void opn_opcode28();
1424 void opn_opcode29();
1425 void opn_opcode30();
1426 void opn_opcode31();
1427 void opn_opcode32();
1428 void opn_opcode33();
1429 void opn_opcode34();
1430 void opn_opcode35();
1431 void opn_opcode36();
1432 void opn_opcode37();
1433 void opn_opcode38();
1434 void opn_opcode39();
1435 void opn_opcode40();
1436 void opn_opcode41();
1437 void opn_opcode42();
1438 void opn_opcode43();
1439 void opn_opcode44();
1440 void opn_opcode45();
1441 void opn_opcode46();
1442 void opn_opcode47();
1443 void opn_opcode48();
1444 void opn_opcode49();
1445 void opn_opcode50();
1446 void opn_opcode51();
1447 void opn_opcode52();
1448 void opn_opcode53();
1449 void opn_opcode54();
1450 void opn_opcode55();
1451 void opn_opcode56();
1452 void opn_opcode57();
1453 void opn_opcode62();
1454 void opn_opcode63();
1468 StackFrame() { memset(
this, 0,
sizeof(*
this)); }
1475 int _dolineReturnVal;
1477 byte *_dataBase, *_textBase;
1478 uint32 _dataBaseSize, _textBaseSize;
1483 char _inputline[61];
1488 const char *_mouseString, *_mouseString1;
1489 char _objectName1[15], _objectName2[15];
1490 char _inMessage[20];
1491 char _placeMessage[15];
1494 uint16 _intputCounter, _inputMax;
1495 uint16 _mousePrintFG;
1499 uint32 _quickptr[16];
1500 uint16 _quickshort[12];
1503 char _keyboardBuffer[61];
1506 int16 _objectCountS;
1522 bool _keymapEnabled;
1524 uint16 getptr(uint32 pos);
1525 uint32 getlong(uint32 pos);
1527 void loadGamePcFile()
override;
1529 int bitextract(uint32 ptr,
int offs);
1531 int doline(
int needsave);
1532 int setposition(
int process,
int line);
1535 char *getMessage(
char *msg, uint16 num);
1536 void getResponse(uint16 charNum, uint16 objNum, uint16 &msgNum1, uint16 &msgNum2);
1537 void getObjectName(
char *v, uint16 x);
1540 void setbitf(uint32 ptr,
int offs,
int val);
1542 void writeval(uint8 *ptr,
int val);
1544 void addstack(
int type);
1546 void popstack(
int type);
1547 void funccpy(
int *store);
1548 void funcentry(
int *storestore,
int procn);
1552 int gvwrd(uint8 *wptr,
int mask);
1553 int wrdmatch(uint8 *word1,
int mask1, uint8 *word2,
int mask2);
1555 bool testContainer(uint16 a);
1556 bool testObvious(uint16 a);
1557 bool testSeen(uint16 a);
1559 bool ifObjectInInv(uint16 a);
1560 int inventoryOn(
int val);
1563 void execMouseHit(
HitArea *ha);
1575 void drawIconHitBar();
1577 void printIcon(
HitArea *ha, uint8 i, uint8 r);
1578 void windowPutChar(
WindowBlock *window, byte c, byte b = 0)
override;
1580 bool badload(int8 errorNum);
1587 uint32 ftext(uint32 base,
int n);
1588 char *unctok(
char *c,
int n);
1589 void uncomstr(
char *c, uint32 x);
1592 void pcl(
const char *s);
1594 void plocd(
int n,
int m);
1595 void pobjd(
int n,
int m);
1596 void ptext(uint32 tptr);
1598 void clearVideoWindow(uint16 windowNum, uint16 color)
override;
1599 void setWindowImageEx(uint16 mode, uint16 vga_res)
override;
1601 bool ifObjectHere(uint16 val)
override;
1602 bool ifObjectAt(uint16 a, uint16 b)
override;
1603 bool ifObjectState(uint16 a, int16 b)
override;
1605 void boxController(uint x, uint y, uint mode)
override;
1606 void timerProc()
override;
1608 void addChar(uint8 chr);
1610 void clearInputLine();
1611 void handleKeyboard();
1612 void handleMouseMoved()
override;
1613 void interact(
char *buffer, uint8 size);
1615 bool processSpecialKeys()
override;
1632 void setupGame()
override;
1633 void setupOpcodes()
override;
1634 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1636 void executeOpcode(
int opcode)
override;
1639 void oe1_notPresent();
1642 void oe1_notCarried();
1645 void oe1_notSibling();
1648 void oe1_isPlayer();
1656 void oe1_moveDirn();
1663 void oe1_isCalled();
1666 void oe1_setUserItem();
1667 void oe1_getUserItem();
1669 void oe1_doorExit();
1670 void oe1_loadGame();
1671 void oe1_clearUserItem();
1672 void oe1_findMaster();
1673 void oe1_nextMaster();
1675 void oe1_stopAnimate();
1678 void oe1_enableInput();
1681 void oe1_playTune();
1682 void oe1_bitClear();
1685 void oe1_zoneDisk();
1686 void oe1_printStats();
1687 void oe1_stopTune();
1688 void oe1_printPlayerDamage();
1689 void oe1_printMonsterDamage();
1690 void oe1_pauseGame();
1691 void oe1_printPlayerHit();
1692 void oe1_printMonsterHit();
1697 OpcodeProcElvira1 proc;
1703 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1704 void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr)
override;
1706 void clearHiResTextLayer()
override;
1710 Graphics::FontSJIS *_sjisFont;
1712 uint16 _sjisCurChar;
1720 void setupGame()
override;
1721 void setupOpcodes()
override;
1722 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1724 void executeOpcode(
int opcode)
override;
1726 void oe2_moveDirn();
1729 void oe2_isCalled();
1731 void oe2_drawItem();
1733 void oe2_pauseGame();
1734 void oe2_setDoorOpen();
1735 void oe2_setDoorClosed();
1736 void oe2_setDoorLocked();
1737 void oe2_ifDoorOpen();
1738 void oe2_ifDoorClosed();
1739 void oe2_ifDoorLocked();
1740 void oe2_storeItem();
1745 void oe2_bNotZero();
1746 void oe2_getOValue();
1747 void oe2_setOValue();
1749 void oe2_printStats();
1750 void oe2_setSuperRoom();
1751 void oe2_getSuperRoom();
1752 void oe2_setExitOpen();
1753 void oe2_setExitClosed();
1754 void oe2_setExitLocked();
1755 void oe2_ifExitOpen();
1756 void oe2_ifExitClosed();
1757 void oe2_ifExitLocked();
1758 void oe2_playEffect();
1759 void oe2_getDollar2();
1760 void oe2_setSRExit();
1761 void oe2_printPlayerDamage();
1762 void oe2_printMonsterDamage();
1763 void oe2_isAdjNoun();
1767 void oe2_b2NotZero();
1769 void printStats()
override;
1773 OpcodeProcElvira2 proc;
1781 bool loadGame(
const Common::String &filename,
bool restartMode =
false)
override;
1782 bool saveGame(uint slot,
const char *caption)
override;
1784 void addArrows(
WindowBlock *window, uint8 num)
override;
1785 void removeArrows(
WindowBlock *window, uint num)
override;
1787 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1788 bool hasIcon(
Item *item)
override;
1789 uint itemGetIconNumber(
Item *item)
override;
1790 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1792 void moveDirn(
Item *i, uint x)
override;
1793 int canPlace(
Item *x,
Item *y)
override;
1794 int sizeOfRec(
Item *o,
int d)
override;
1795 int weightOf(
Item *x)
override;
1797 int changeExitStates(
SubSuperRoom *sr,
int n,
int d, uint16 s);
1798 uint16 getExitState(
Item *item, uint16 x, uint16 d);
1799 void setExitState(
Item *i, uint16 n, uint16 d, uint16 s);
1800 void setSRExit(
Item *i,
int n,
int d, uint16 s);
1802 void handleMouseWheelUp()
override;
1803 void handleMouseWheelDown()
override;
1805 virtual void listSaveGames();
1806 bool confirmOverWrite(
WindowBlock *window)
override;
1807 void userGame(
bool load)
override;
1808 virtual int userGameGetKey(
bool *b, uint maxChar);
1818 void setupGame()
override;
1819 void setupOpcodes()
override;
1820 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1822 void executeOpcode(
int opcode)
override;
1824 void boxTextMessage(
const char *x);
1825 void boxTextMsg(
const char *x);
1827 uint16 getBoxSize();
1828 uint16 checkFit(
char *Ptr,
int width,
int lines);
1831 void oww_addTextBox();
1832 void oww_setShortText();
1833 void oww_setLongText();
1834 void oww_printLongText();
1836 void oww_textMenu();
1837 void oww_pauseGame();
1838 void oww_boxMessage();
1840 void oww_boxLongText();
1841 void oww_printBox();
1843 void oww_lockZones();
1844 void oww_unlockZones();
1849 OpcodeProcWaxworks proc;
1856 char _boxBuffer[310];
1857 char *_boxBufferPtr;
1862 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1864 void boxController(uint x, uint y, uint mode)
override;
1866 void addArrows(
WindowBlock *window, uint8 num)
override;
1867 void removeArrows(
WindowBlock *window, uint num)
override;
1869 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1871 bool loadTablesIntoMem(uint16 subrId)
override;
1873 void moveDirn(
Item *i, uint x)
override;
1875 bool confirmOverWrite(
WindowBlock *window)
override;
1883 static const int SIMON1_GMF_SIZE[];
1889 void setupGame()
override;
1890 void setupOpcodes()
override;
1891 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1893 void executeOpcode(
int opcode)
override;
1895 void vc22_setPalette()
override;
1899 void os1_pauseGame();
1900 void os1_screenTextBox();
1901 void os1_screenTextMsg();
1902 void os1_playEffect();
1903 void os1_screenTextPObj();
1904 void os1_getPathPosn();
1905 void os1_scnTxtLongText();
1907 void os1_mouseOff();
1908 void os1_loadBeard();
1909 void os1_unloadBeard();
1910 void os1_unloadZone();
1911 void os1_loadStrings();
1912 void os1_unfreezeZones();
1913 void os1_specialFade();
1918 OpcodeProcSimon1 proc;
1928 void dumpVgaFile(
const byte *vga)
override;
1930 void clearName()
override;
1932 void handleMouseWheelUp()
override;
1933 void handleMouseWheelDown()
override;
1935 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1937 void initMouse()
override;
1938 void handleMouseMoved()
override;
1940 void addArrows(
WindowBlock *window, uint8 num)
override;
1941 void removeArrows(
WindowBlock *window, uint num)
override;
1943 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1945 virtual void playSpeech(uint16 speechId, uint16 vgaSpriteId);
1947 void listSaveGames()
override;
1948 void userGame(
bool load)
override;
1949 int userGameGetKey(
bool *b, uint maxChar)
override;
1951 void playMusic(uint16 music, uint16 track)
override;
1952 void playMidiSfx(uint16 sound)
override;
1954 void vcStopAnimation(uint16 zone, uint16 sprite)
override;
1964 void setupGame()
override;
1965 void setupOpcodes()
override;
1966 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1968 void executeOpcode(
int opcode)
override;
1970 void os2_printLongText();
1973 void os2_stopAnimate();
1974 void os2_playTune();
1975 void os2_screenTextPObj();
1977 void os2_mouseOff();
1978 void os2_isShortText();
1979 void os2_clearMarks();
1980 void os2_waitMark();
1985 OpcodeProcSimon2 proc;
1991 void clearName()
override;
1993 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1995 void addArrows(
WindowBlock *window, uint8 num)
override;
1996 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1998 void clearVideoWindow(uint16 windowNum, uint16 color)
override;
2000 void playSpeech(uint16 speechId, uint16 vgaSpriteId)
override;
2004 void playMusic(uint16 music, uint16 track)
override;
2013 ~AGOSEngine_Feeble()
override;
2015 void setupGame()
override;
2016 void setupOpcodes()
override;
2017 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
2019 void executeOpcode(
int opcode)
override;
2021 void vc36_setWindowImage()
override;
2022 void vc48_setPathFinder()
override;
2026 void off_addTextBox();
2027 void off_printLongText();
2029 void off_oracleTextDown();
2030 void off_oracleTextUp();
2033 void off_saveUserGame();
2034 void off_loadUserGame();
2035 void off_listSaveGames();
2037 void off_screenTextBox();
2039 void off_isAdjNoun();
2040 void off_hyperLinkOn();
2041 void off_hyperLinkOff();
2042 void off_checkPaths();
2043 void off_screenTextPObj();
2045 void off_mouseOff();
2046 void off_loadVideo();
2047 void off_playVideo();
2048 void off_centerScroll();
2049 void off_resetPVCount();
2050 void off_setPathValues();
2051 void off_stopClock();
2052 void off_restartClock();
2053 void off_setColor();
2057 void off_b3NotZero();
2060 friend class MoviePlayer;
2061 friend class MoviePlayerDXA;
2062 friend class MoviePlayerSMK;
2064 typedef void (AGOSEngine_Feeble::*OpcodeProcFeeble) ();
2065 struct OpcodeEntryFeeble {
2066 OpcodeProcFeeble proc;
2070 const OpcodeEntryFeeble *_opcodesFeeble;
2072 MoviePlayer *_moviePlayer;
2074 uint8 _interactiveVideo;
2075 uint16 _vgaCurSpritePriority;
2077 uint16 to16Wrapper(uint value)
override;
2078 uint16 readUint16Wrapper(
const void *src)
override;
2079 uint32 readUint32Wrapper(
const void *src)
override;
2081 void setLoyaltyRating(byte rating);
2083 void playVideo(
const char *filename,
bool lastSceneUsed =
false);
2084 void stopInteractiveVideo();
2087 void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
2089 void handleMouseWheelUp()
override;
2090 void handleMouseWheelDown()
override;
2092 void drawMousePart(
int image, byte x, byte y);
2093 void initMouse()
override;
2094 void drawMousePointer()
override;
2096 void animateSprites()
override;
2097 void animateSpritesByY();
2100 void swapCharacterLogo();
2101 void timerProc()
override;
2103 void addArrows(
WindowBlock *window, uint8 num)
override;
2104 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
2106 void resetVerbs()
override;
2107 void setVerb(
HitArea * ha)
override;
2108 void hitarea_leave(
HitArea * ha,
bool state =
false)
override;
2109 void invertBox(
HitArea *ha,
bool state);
2112 void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr)
override;
2114 void clearName()
override;
2116 void drawIconArray(uint i,
Item *itemPtr,
int line,
int classMask)
override;
2120 void dumpVgaFile(
const byte *vga)
override;
2122 void doOutput(
const byte *src, uint len)
override;
2124 void printScreenText(uint vgaSpriteId, uint color,
const char *stringPtr, int16 x, int16 y, int16 width)
override;
2126 void printInteractText(uint16 num,
const char *
string);
2127 void sendInteractText(uint16 num, MSVC_PRINTF
const char *fmt, ...)
GCC_PRINTF(3, 4);
2129 void checkLinkBox();
2130 void hyperLinkOn(uint16 x);
2131 void hyperLinkOff();
2135 void runSubroutine101()
override;
2142 void oracleTextUp();
2143 void oracleTextDown();
2144 void scrollOracle();
2145 void scrollOracleUp();
2146 void scrollOracleDown();
2148 void listSaveGamesFeeble();
2149 void saveUserGame(
int slot);
2153 void quickLoadOrSave()
override;
2156 class AGOSEngine_FeebleDemo :
public AGOSEngine_Feeble {
2165 void initMouse()
override;
2166 void drawMousePointer()
override;
2171 void handleWobble();
2173 void startInteractiveVideo(
const char *filename);
2174 void waitForSpace();
2177 class AGOSEngine_PuzzlePack :
public AGOSEngine_Feeble {
2182 void setupGame()
override;
2183 void setupOpcodes()
override;
2185 void executeOpcode(
int opcode)
override;
2187 void vc3_loadSprite()
override;
2188 void vc63_fastFadeIn()
override;
2190 void opp_iconifyWindow();
2191 void opp_restoreOopsPosition();
2192 void opp_loadMouseImage();
2194 void opp_setShortText();
2195 void opp_loadHiScores();
2196 void opp_checkHiScores();
2198 void opp_saveUserGame();
2199 void opp_loadUserGame();
2200 void opp_playTune();
2201 void opp_saveOopsPosition();
2202 void opp_resetGameTime();
2203 void opp_resetPVCount();
2204 void opp_setPathValues();
2205 void opp_pauseClock();
2208 typedef void (AGOSEngine_PuzzlePack::*OpcodeProcPuzzlePack) ();
2209 struct OpcodeEntryPuzzlePack {
2210 OpcodeProcPuzzlePack proc;
2214 const OpcodeEntryPuzzlePack *_opcodesPuzzlePack;
2219 void initMouse()
override;
2220 void handleMouseMoved()
override;
2221 void drawMousePointer()
override;
2223 void resetVerbs()
override;
2225 void loadMouseImage();
2227 void startOverlayAnims();
2228 void startAnOverlayAnim();
2230 void printInfoText(
const char *itemText);
2236 class AGOSEngine_DIMP :
public AGOSEngine_PuzzlePack {
2241 void setupOpcodes()
override;
2243 void executeOpcode(
int opcode)
override;
2246 typedef void (AGOSEngine_DIMP::*OpcodeProcDIMP) ();
2247 struct OpcodeEntryDIMP {
2248 OpcodeProcDIMP proc;
2252 const OpcodeEntryDIMP *_opcodesDIMP;
2254 int16 _iconToggleCount, _voiceCount;
2255 uint32 _lastTickCount;
2256 uint32 _startSecondCount, _tSecondCount;
2258 void odp_saveUserGame();
2259 void odp_loadUserGame();
2262 void timerProc()
override;
EngineFeature
Definition: engine.h:253
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:1467
Definition: audiostream.h:212
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:1474
Common::Error run() override
Definition: agos.h:250
Language
Definition: language.h:45