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;
90 kActionToggleFastMode,
91 kActionToggleSwitchCharacter,
92 kActionToggleSubtitle,
94 kActionToggleHitboxName,
95 kActionToggleSoundEffects,
96 kActionToggleBackgroundSound,
97 kActionToggleFightMode,
100 kActionTextSpeedMedium,
101 kActionTextSpeedSlow,
102 kActionSpeed_GTYPEPP,
110 #define CHECK_BOUNDS(x, y) assert((uint)(x) < ARRAYSIZE(y)) 128 struct SubroutineLine;
138 uint16 width, height;
149 HitArea() { memset(
this, 0,
sizeof(*
this)); }
211 AnimTable() { memset(
this, 0,
sizeof(*
this)); }
215 ANIMATE_INT = 1 << 1,
216 ANIMATE_EVENT = 1 << 2,
217 SCROLL_EVENT = 1 << 3,
218 PLAYER_DAMAGE_EVENT = 1 << 4,
219 MONSTER_DAMAGE_EVENT = 1 << 5
229 #ifndef REDUCE_MEMORY_USAGE 230 # define _OPCODE(ver, x) { &ver::x, #x } 232 # define _OPCODE(ver, x) { &ver::x, "" } 238 static const byte SIMON1_RHYTHM_SFX[];
241 static const uint16 MUSIC_INDEX_BASE_SIMON2_GM = 1128 / 4;
243 static const uint16 MUSIC_INDEX_BASE_SIMON2_MT32 = (1128 + 612) / 4;
260 void syncSoundSettings()
override;
263 void syncSoundSettingsIntern();
264 void pauseEngineIntern(
bool pause)
override;
266 virtual void setupOpcodes();
267 uint16 _numOpcodes, _opcode;
271 void setupVgaOpcodes();
272 VgaOpcodeProc _vga_opcode_table[100];
273 uint8 _numVideoOpcodes;
275 virtual void setupVideoOpcodes(VgaOpcodeProc *op);
280 virtual void setupGame();
282 int getGameId()
const;
283 int getGameType()
const;
284 uint32 getFeatures()
const;
285 const char *getExtra()
const;
288 const char *getFileName(
int type)
const;
292 uint16 _vcGetOutOfCode;
295 uint32 *_gameOffsetsPtr;
297 uint8 _numMusic, _numSFX;
301 uint8 _numBitArray1, _numBitArray2, _numBitArray3, _numItemStore;
304 uint8 _vgaBaseDelay, _vgaPeriod;
306 uint16 _musicIndexBase;
307 uint16 _soundIndexBase;
308 uint16 _tableIndexBase;
309 uint16 _textIndexBase;
312 uint32 _tableMemSize;
323 byte *_strippedTxtMem;
326 uint32 _stringTabNum, _stringTabPos, _stringTabSize;
327 byte **_stringTabPtr;
329 Item **_itemArrayPtr;
330 uint32 _itemArraySize;
331 uint32 _itemArrayInited;
337 const byte *_codePtr;
339 byte **_localStringtable;
340 uint16 _stringIdLocalMin, _stringIdLocalMax;
343 uint16 _numRoomStates;
350 byte *_xtablesHeapPtrOrg;
351 uint32 _xtablesHeapCurPosOrg;
355 byte *_tablesHeapPtr, *_tablesHeapPtrOrg, *_tablesheapPtrNew;
356 uint32 _tablesHeapSize, _tablesHeapCurPos, _tablesHeapCurPosOrg;
357 uint32 _tablesHeapCurPosNew;
362 uint8 _recursionDepth;
370 bool _runScriptReturn1;
371 bool _runScriptCondition[40];
372 int16 _runScriptReturn[40];
374 bool _noParentNotify;
386 bool _copyProtection;
391 int16 _chanceModifier;
392 bool _restoreWindow6;
393 int16 _scrollX, _scrollXMax;
394 int16 _scrollY, _scrollYMax;
395 int16 _scrollCount, _scrollFlag;
396 uint16 _scrollWidth, _scrollHeight;
397 const byte *_scrollImage;
402 int16 _classMask, _classMode1, _classMode2;
409 uint16 _currentRoom, _superRoomNumber;
412 uint16 _hyperLink, _newLines;
413 uint16 _oracleMaxScrollY, _noOracleScroll;
416 int16 _scriptVerb, _scriptNoun1, _scriptNoun2;
417 int16 _scriptAdj1, _scriptAdj2;
422 Item *_subjectItem, *_objectItem;
423 Item *_currentPlayer;
425 Item *_hitAreaObjectItem;
429 Item *_hitAreaSubjectItem;
430 HitArea *_currentBox, *_currentVerbBox, *_lastVerbOn;
431 uint16 _currentBoxNum;
432 uint16 _needHitAreaRecalc;
447 int16 _printCharCurPos, _printCharMaxPos, _printCharPixelCount;
448 uint16 _numLettersToPrint;
452 uint32 getTime()
const;
456 uint32 _clockStopped, _gameStoppedClock;
459 TimeEvent *_firstTimeStruct, *_pendingDeleteTimeEvent;
466 bool _animatePointer;
467 byte _maxCursorWidth, _maxCursorHeight;
468 byte _mouseAnim, _mouseAnimMax, _mouseCursor;
469 byte _currentMouseAnim, _currentMouseCursor;
470 byte _oldMouseAnimMax, _oldMouseCursor;
471 uint16 _mouseHideCount;
474 bool _leftButtonDown, _rightButtonDown;
475 byte _leftButton, _leftButtonCount, _leftButtonOld;
478 bool _leftClick, _rightClick;
485 volatile uint16 _videoLockOut;
486 uint16 _scrollUpHitArea;
487 uint16 _scrollDownHitArea;
489 bool _fastFadeOutFlag;
492 uint16 _fastFadeCount;
493 volatile uint16 _fastFadeInFlag;
496 uint16 _screenWidth, _screenHeight;
497 uint16 _internalWidth, _internalHeight;
502 bool _exitCutscene, _picture8600;
505 int16 _lastMusicPlayed;
506 int16 _nextMusicToPlay;
507 bool _showPreposition;
508 bool _showMessageFlag;
512 uint16 _copyScnFlag, _vgaSpriteChanged;
514 byte *_block, *_blockEnd;
515 byte *_vgaMemPtr, *_vgaMemEnd, *_vgaMemBase;
516 byte *_vgaFrozenBase, *_vgaRealBase;
527 uint16 _vgaWaitFor, _lastVgaWaitFor;
528 uint16 _vgaCurSpriteId, _vgaCurZoneNum;
533 int16 _scaleX, _scaleY, _scaleWidth, _scaleHeight;
537 uint8 _opcode177Var1, _opcode177Var2;
538 uint8 _opcode178Var1, _opcode178Var2;
540 Item *_objectArray[50];
541 Item *_itemStore[50];
543 uint16 _shortText[40];
544 uint16 _shortTextX[40];
545 uint16 _shortTextY[40];
546 uint16 _longText[40];
547 uint16 _longSound[40];
549 uint16 _bitArray[128];
550 uint16 _bitArrayTwo[16];
551 uint16 _bitArrayThree[16];
552 int16 *_variableArray;
553 int16 *_variableArray2;
554 int16 *_variableArrayPtr;
562 TextLocation _textLocation1, _textLocation2, _textLocation3, _textLocation4;
564 byte _awaitTwoByteToken;
566 byte *_byteTokenStrings;
567 byte *_twoByteTokens;
568 byte *_twoByteTokenStrings;
569 byte *_secondTwoByteTokenStrings;
570 byte *_thirdTwoByteTokenStrings;
571 byte _textBuffer[180];
576 byte _stringReturnBuffer[2][180];
588 const uint16 *_pathFindArray[100];
590 uint8 _pathValues[400];
594 uint8 _pathValues1[400];
598 uint8 _currentPalette[768];
599 uint8 _displayPalette[768];
602 byte _videoBuf1[32000];
603 uint16 _videoWindows[128];
604 const byte *_pak98Buf;
605 byte _paletteModNext;
611 uint16 _moveXMin, _moveYMin;
612 uint16 _moveXMax, _moveYMax;
618 byte _lettersToPrintBuf[80];
639 uint16 _effectsVolume;
642 uint8 _saveGameNameLen;
643 uint16 _saveLoadRowCurPos;
644 uint16 _numSaveGameRows;
645 bool _saveDialogFlag;
649 byte _saveLoadType, _saveLoadSlot;
650 char _saveLoadName[108];
661 const byte *_vc10BasePtrOld;
662 byte _hebrewCharWidths[32];
669 uint32 _curSfxFileSize;
670 uint16 _sampleEnd, _sampleWait;
673 virtual uint16 to16Wrapper(uint value);
674 virtual uint16 readUint16Wrapper(
const void *src);
675 virtual uint32 readUint32Wrapper(
const void *src);
683 void allocateStringTable(
int num);
684 void setupStringTable(byte *mem,
int num);
685 void setupLocalStringTable(byte *mem,
int num);
689 virtual void loadGamePcFile();
691 void decompressData(
const char *srcName, byte *dst, uint32 offset, uint32 srcSize, uint32 dstSize);
693 void loadOffsets(
const char *filename,
int number, uint32 &file, uint32 &offset, uint32 &compressedSize, uint32 &size);
694 void loadSound(uint16 sound, int16 pan, int16 vol, uint16 type);
695 void playSfx(uint16 sound, uint16 freq, uint16 flags,
bool digitalOnly =
false,
bool midiOnly =
false);
696 void loadSound(uint16 sound, uint16 freq, uint16 flags);
698 virtual void playMidiSfx(uint16 sound);
699 void loadVoice(uint speechId);
702 void loadSoundFile(
const char *filename);
704 int getUserFlag(
Item *item,
int a);
705 int getUserFlag1(
Item *item,
int a);
706 int getUserItem(
Item *item,
int n);
707 void setUserFlag(
Item *item,
int a,
int b);
708 void setUserItem(
Item *item,
int n,
int m);
710 void paletteFadeOut(byte *palPtr, uint num, uint size);
712 void *allocateItem(uint size);
713 void *allocateTable(uint size);
714 void alignTableMem();
716 Child *findChildOfType(
Item *i, uint child);
717 Child *allocateChildBlock(
Item *i, uint type, uint size);
719 void allocItemHeap();
720 void allocTablesHeap();
729 Subroutine *getSubroutineByID(uint subroutineId);
732 void dumpAllSubroutines();
733 void dumpAllVgaImageFiles();
734 void dumpAllVgaScriptFiles();
735 void dumpSubroutines();
738 const byte *dumpOpcode(
const byte *p);
746 virtual void executeOpcode(
int opcode) = 0;
751 uint getNextVarContents();
752 uint getVarWrapper();
755 uint readVariable(uint16 variable);
756 void writeNextVarContents(uint16 contents);
757 void writeVariable(uint16 variable, uint16 contents);
759 Item *derefItem(uint item);
760 Item *getNextItemPtr();
761 uint getNextItemID();
762 uint getItem1ID() {
return 1;}
763 uint itemPtrToID(
Item *
id);
767 void uncompressText(byte *ptr);
768 byte *uncompressToken(byte a, byte *ptr);
770 void showMessageFormat(MSVC_PRINTF
const char *s, ...)
GCC_PRINTF(2, 3);
771 const byte *getStringPtrByID(uint16 stringId,
bool upperCase =
false);
772 const byte *getLocalStringByID(uint16 stringId);
773 uint getNextStringID();
775 void addTimeEvent(int32 timeout, uint16 subroutineId);
778 Item *findInByClass(
Item *i, int16 m);
779 Item *nextInByClass(
Item *i, int16 m);
780 Item *findMaster(int16 a, int16 n);
781 Item *nextMaster(
Item *item, int16 a, int16 n);
782 int wordMatch(
Item *item, int16 a, int16 n);
784 bool isRoom(
Item *item);
785 bool isObject(
Item *item);
786 bool isPlayer(
Item *item);
788 void itemChildrenChanged(
Item *item);
789 void unlinkItem(
Item *item);
790 void linkItem(
Item *item,
Item *parent);
792 void setItemParent(
Item *item,
Item *parent);
793 void setItemState(
Item *item,
int value);
795 void stopAnimate(uint16 a);
796 void stopAnimateSimon2(uint16 a, uint16 b);
798 void enableBox(uint hitarea);
799 void disableBox(uint hitarea);
800 void moveBox(uint hitarea,
int x,
int y);
801 bool isBoxDead(uint hitarea);
802 void undefineBox(uint hitarea);
803 void defineBox(
int id,
int x,
int y,
int width,
int height,
int flags,
int verb,
Item *itemPtr);
804 void defineBox(uint16
id, uint16 x, uint16 y, uint16 width, uint16 height, uint16 msg1, uint16 msg2, uint16 flags);
808 virtual void resetVerbs();
809 virtual void setVerb(
HitArea * ha);
810 virtual void hitarea_leave(
HitArea * ha,
bool state =
false);
811 void leaveHitAreaById(uint hitarea_id);
813 void sendSync(uint a);
814 void waitForSync(uint a);
816 uint getOffsetOfChild2Param(
SubObject *child, uint prop);
817 void scriptMouseOff();
819 void unfreezeBottom();
825 void setup_cond_c_helper();
827 uint16 getBackExit(
int n);
828 uint16 getDoorState(
Item *item, uint16 d);
829 uint16 getExitOf(
Item *item, uint16 d);
830 void changeDoorState(
SubRoom *r, uint16 d, uint16 n);
831 void setDoorState(
Item *i, uint16 d, uint16 n);
834 Item *getDoorOf(
Item *item, uint16 d);
835 Item *getExitOf_e1(
Item *item, uint16 d);
836 virtual void moveDirn(
Item *i, uint x);
838 virtual int canPlace(
Item *x,
Item *y);
840 int sizeContents(
Item *x);
841 virtual int sizeOfRec(
Item *o,
int d);
842 int sizeRec(
Item *x,
int d);
843 int weighUp(
Item *x);
844 int weightRec(
Item *x,
int d);
845 virtual int weightOf(
Item *x);
849 void drawMenuStrip(uint windowNum, uint menuNum);
850 void lightMenuStrip(
int a);
851 void unlightMenuStrip();
852 void lightMenuBox(uint hitarea);
854 uint menuFor_e2(
Item *item);
855 uint menuFor_ww(
Item *item, uint
id);
856 void clearMenuStrip();
857 void doMenuStrip(uint menuNum);
862 bool loadRoomItems(uint16 item);
864 virtual bool loadTablesIntoMem(uint16 subrId);
865 bool loadXTablesIntoMem(uint16 subrId);
866 void loadTextIntoMem(uint16 stringId);
868 uint loadTextFile(
const char *filename, byte *dst);
872 uint loadTextFile_simon1(
const char *filename, byte *dst);
878 uint loadTextFile_gme(
const char *filename, byte *dst);
882 bool kickoffTimeEvents();
883 void killAllTimers();
886 virtual void runSubroutine101();
891 WindowBlock *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fillColor, uint textColor);
894 void changeWindow(uint a);
895 void closeWindow(uint a);
896 void setTextColor(uint color);
897 virtual void windowPutChar(
WindowBlock *window, byte c, byte b = 0);
900 HitArea *findBox(uint hitarea_id);
901 virtual void boxController(uint x, uint y, uint mode);
902 void handleVerbClicked(uint verb);
903 virtual void clearName();
904 void displayName(
HitArea * ha);
905 void resetNameWindow();
906 void displayBoxStars();
907 void invertBox(
HitArea * ha, byte a, byte b, byte c, byte d);
909 virtual void handleMouseWheelUp();
910 virtual void handleMouseWheelDown();
912 virtual void initMouse();
913 virtual void handleMouseMoved();
914 virtual void drawMousePointer();
916 void drawArrow(uint16 x, uint16 y, int8 dir);
917 virtual void addArrows(
WindowBlock *window, uint8 num);
918 virtual void removeArrows(
WindowBlock *window, uint num);
920 virtual void drawIcon(
WindowBlock *window, uint icon, uint x, uint y);
921 virtual bool hasIcon(
Item *item);
922 virtual uint itemGetIconNumber(
Item *item);
923 virtual uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr);
925 virtual void drawIconArray(uint i,
Item *itemPtr,
int line,
int classMask);
926 void removeIconArray(uint num);
932 virtual bool processSpecialKeys();
933 void hitarea_stuff_helper();
937 uint getFeebleFontSize(byte chr);
939 void justifyOutPut(byte chr);
941 void loadZone(uint16 zoneNum,
bool useError =
true);
943 void animate(uint16 windowNum, uint16 zoneNum, uint16 vgaSpriteId, int16 x, int16 y, uint16 palette,
bool vgaScript =
false);
944 void setImage(uint16 vgaSpriteId,
bool vgaScript =
false);
945 void setWindowImage(uint16 mode, uint16 vgaSpriteId,
bool specialCase =
false);
946 virtual void setWindowImageEx(uint16 mode, uint16 vgaSpriteId);
951 const char *getPixelLength(
const char *
string, uint16 maxWidth, uint16 &pixels);
952 bool printNameOf(
Item *item, uint x, uint y);
953 bool printTextOf(uint a, uint x, uint y);
954 void printVerbOf(uint hitarea_id);
955 void showActionString(
const byte *
string);
957 virtual void printScreenText(uint vgaSpriteId, uint color,
const char *stringPtr, int16 x, int16 y, int16 width);
959 void renderStringAmiga(uint vgaSpriteId, uint color, uint width, uint height,
const char *txt);
960 void renderString(uint vgaSpriteId, uint color, uint width, uint height,
const char *txt);
962 void writeChar(
WindowBlock *window,
int x,
int y,
int offs,
int val);
964 byte *allocBlock(uint32 size);
965 void checkNoOverWrite();
966 void checkRunningAnims();
967 void checkAnims(uint a);
968 void checkZonePtrs();
969 void setZoneBuffers();
974 bool getBitFlag(uint bit);
975 void setBitFlag(uint bit,
bool value);
980 virtual void vc3_loadSprite();
983 void vc6_ifObjectHere();
984 void vc7_ifObjectNotHere();
985 void vc8_ifObjectIsAt();
986 void vc9_ifObjectStateIs();
989 void vc13_addToSpriteX();
990 void vc14_addToSpriteY();
992 void vc16_waitSync();
995 void vc20_setRepeat();
996 void vc21_endRepeat();
997 virtual void vc22_setPalette();
998 void vc23_setPriority();
999 void vc24_setSpriteXY();
1000 void vc25_halt_sprite();
1001 void vc26_setSubWindow();
1002 void vc27_resetSprite();
1003 void vc28_playSFX();
1004 void vc29_stopAllSounds();
1005 void vc30_setFrameRate();
1006 void vc31_setWindow();
1007 void vc33_setMouseOn();
1008 void vc34_setMouseOff();
1009 void vc35_clearWindow();
1010 virtual void vc36_setWindowImage();
1011 void vc38_ifVarNotZero();
1013 void vc40_scrollRight();
1014 void vc41_scrollLeft();
1015 void vc42_delayIfNotEQ();
1021 void vc44_enableBox();
1022 void vc45_disableBox();
1024 void vc48_specialEffect();
1026 void vc55_scanFlag();
1029 void vc17_waitEnd();
1030 void vc32_saveScreen();
1031 void vc37_pokePalette();
1034 void vc43_ifBitSet();
1035 void vc44_ifBitClear();
1036 void vc45_setWindowPalette();
1037 void vc46_setPaletteSlot1();
1038 void vc47_setPaletteSlot2();
1039 void vc48_setPaletteSlot3();
1041 void vc50_clearBit();
1042 void vc51_enableBox();
1043 void vc52_playSound();
1044 void vc53_dissolveIn();
1045 void vc54_dissolveOut();
1046 void vc55_moveBox();
1047 void vc56_fullScreen();
1048 void vc57_blackPalette();
1049 void vc58_checkCodeWheel();
1050 void vc58_changePriority();
1054 void vc60_stopAnimation();
1056 void vc62_fastFadeOut();
1057 virtual void vc63_fastFadeIn();
1060 void vc11_clearPathFinder();
1061 void vc17_setPathfinderItem();
1062 void vc32_copyVar();
1063 void vc37_addToSpriteY();
1064 void vc45_setSpriteX();
1065 void vc46_setSpriteY();
1066 void vc47_addToVar();
1067 virtual void vc48_setPathFinder();
1068 void vc59_ifSpeech();
1069 void vc61_setMaskImage();
1072 void vc56_delayLong();
1073 void vc59_stopAnimations();
1074 void vc64_ifSpeech();
1075 void vc65_slowFadeIn();
1076 void vc66_ifEqual();
1079 void vc69_playSeq();
1080 void vc70_joinSeq();
1081 void vc71_ifSeqWaiting();
1083 void vc73_setMark();
1084 void vc74_clearMark();
1087 void vc75_setScale();
1088 void vc76_setScaleXOffs();
1089 void vc77_setScaleYOffs();
1090 void vc78_computeXY();
1091 void vc79_computePosNum();
1092 void vc80_setOverlayImage();
1093 void vc81_setRandom();
1094 void vc82_getPathValue();
1095 void vc83_playSoundLoop();
1096 void vc84_stopSoundLoop();
1098 void setScriptCondition(
bool cond);
1099 bool getScriptCondition();
1100 void setScriptReturn(
int ret);
1101 int getScriptReturn();
1108 void o_notCarried();
1161 void o_haltAnimation();
1162 void o_restartAnimation();
1165 void o_getChildren();
1168 void o_killAnimate();
1172 void o_closeWindow();
1176 void o_disableBox();
1181 void o_unsetClass();
1186 void o_doClassIcons();
1188 void o_setAdjNoun();
1189 void o_saveUserGame();
1190 void o_loadUserGame();
1192 void o_restoreIcons();
1193 void o_freezeZones();
1194 void o_placeNoIcons();
1195 void o_clearTimers();
1199 int16 moreText(
Item *i);
1200 void lobjFunc(
Item *i,
const char *f);
1201 uint confirmYesOrNo(uint16 x, uint16 y);
1202 uint continueOrQuit();
1204 virtual void printStats();
1205 void synchChain(
Item *i);
1210 void drawImage_init(int16 image, uint16 palette, int16 x, int16 y, uint16 flags);
1215 void drawVertImageCompressed(
VC10_state *state);
1216 void drawVertImageUncompressed(
VC10_state *state);
1218 void setMoveRect(uint16 x, uint16 y, uint16 width, uint16 height);
1224 void updateBackendSurface(
Common::Rect *area = 0)
const;
1225 virtual void clearHiResTextLayer() {}
1227 int vcReadVarOrWord();
1228 uint vcReadNextWord(
bool forceLERead =
false);
1229 uint vcReadNextByte();
1230 uint vcReadVar(uint var);
1231 void vcWriteVar(uint var, int16 value);
1232 void vcSkipNextInstruction();
1234 int getScale(int16 y, int16 x);
1235 void checkScrollX(int16 x, int16 xpos);
1236 void checkScrollY(int16 y, int16 ypos);
1237 void centerScroll();
1239 virtual void clearVideoWindow(uint16 windowNum, uint16 color);
1240 void clearVideoBackGround(uint16 windowNum, uint16 color);
1242 void setPaletteSlot(uint16 srcOffs, uint8 dstOffs);
1243 void checkOnStopTable();
1244 void checkWaitEndTable();
1246 virtual bool ifObjectHere(uint16 val);
1247 virtual bool ifObjectAt(uint16 a, uint16 b);
1248 virtual bool ifObjectState(uint16 a, int16 b);
1250 bool isVgaQueueEmpty();
1251 void haltAnimation();
1252 void restartAnimation();
1253 void addVgaEvent(uint16 num, uint8 type,
const byte *codePtr, uint16 curSprite, uint16 curZoneNum);
1255 void processVgaEvents();
1256 void animateEvent(
const byte *codePtr, uint16 curZoneNum, uint16 curSprite);
1258 void drawStuff(
const byte *src, uint offs);
1264 bool isSpriteLoaded(uint16
id, uint16 zoneNum);
1267 void freeBox(uint index);
1269 void sendWindow(uint a);
1272 void colorBlock(
WindowBlock *window, uint16 x, uint16 y, uint16 w, uint16 h);
1275 void restoreBlock(uint16 left, uint16 top, uint16 right, uint16 bottom);
1278 byte *getBackGround();
1279 byte *getScaleBuf();
1281 byte *convertAmigaImage(
VC10_state *state,
bool compressed);
1283 bool decrunchFile(byte *src, byte *dst, uint32 size);
1284 void loadVGABeardFile(uint16
id);
1285 void loadVGAVideoFile(uint16
id, uint8 type,
bool useError =
true);
1286 bool loadVGASoundFile(uint16
id, uint8 type);
1288 void openGameFile();
1289 void readGameFile(
void *dst, uint32 offs, uint32 size);
1291 virtual void timerProc();
1293 virtual void animateSprites();
1296 void dirtyClipCheck(int16 x, int16 y, int16 w, int16 h);
1297 void dirtyBackGround();
1298 void restoreBackGround();
1301 void clearSurfaces();
1302 void displayScreen();
1304 void dumpVideoScript(
const byte *src,
bool singeOpcode);
1305 virtual void dumpVgaFile(
const byte *vga);
1306 void dumpVgaScript(
const byte *ptr, uint16 res, uint16
id);
1307 void dumpVgaScriptAlways(
const byte *ptr, uint16 res, uint16
id);
1309 void dumpVgaBitmaps(uint16 zoneNum);
1311 void dumpSingleBitmap(
int file,
int image,
const byte *offs,
int w,
int h, byte base);
1312 void dumpBitmap(
const char *filename,
const byte *offs, uint16 w, uint16 h,
int flags,
const byte *palette, byte base);
1313 void palLoad(byte *pal,
const byte *vga1,
int a,
int b);
1315 void fillBackFromBackGround(uint16 height, uint16 width);
1316 void fillBackFromFront();
1317 void fillBackGroundFromBack();
1318 void fillBackGroundFromFront();
1320 virtual void doOutput(
const byte *src, uint len);
1323 virtual void quickLoadOrSave();
1325 byte *vc10_uncompressFlip(
const byte *src, uint16 w, uint16 h);
1326 byte *vc10_flip(
const byte *src, uint16 w, uint16 h);
1328 Item *getNextItemPtrStrange();
1330 virtual bool loadGame(
const Common::String &filename,
bool restartMode =
false);
1331 virtual bool saveGame(uint slot,
const char *caption);
1333 void openTextWindow();
1334 void tidyIconArray(uint i);
1338 virtual void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr);
1345 void loadMusic(uint16 track,
bool forceSimon2GmData =
false,
bool useSimon2Remapping =
false);
1346 void playModule(uint16 music);
1347 virtual void playMusic(uint16 music, uint16 track);
1350 void delay(uint delay);
1353 void waitForMark(uint i);
1354 void scrollScreen();
1356 void decodeColumn(byte *dst,
const byte *src, uint16 height, uint16 pitch);
1357 void decodeRow(byte *dst,
const byte *src, uint16 width, uint16 pitch);
1358 void hitarea_stuff_helper_2();
1363 virtual void vcStopAnimation(uint16 zone, uint16 sprite);
1365 virtual bool confirmOverWrite(
WindowBlock *window);
1366 int16 matchSaveGame(
const char *name, uint16 max);
1367 void disableFileBoxes();
1368 virtual void userGame(
bool load);
1369 void userGameBackSpace(
WindowBlock *window,
int x, byte b = 0);
1370 void fileError(
WindowBlock *window,
bool saveError);
1372 int countSaveGames();
1375 void enterSaveLoadScreen(
bool entering);
1389 void setupGame()
override;
1390 void setupOpcodes()
override;
1391 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1393 void executeOpcode(
int opcode)
override;
1395 int actCallD(
int n);
1397 void opn_opcode00();
1402 void opn_opcode05();
1403 void opn_opcode06();
1404 void opn_opcode07();
1405 void opn_opcode08();
1406 void opn_opcode09();
1407 void opn_opcode10();
1408 void opn_opcode11();
1409 void opn_opcode12();
1410 void opn_opcode13();
1411 void opn_opcode14();
1412 void opn_opcode15();
1413 void opn_opcode16();
1418 void opn_opcode21();
1419 void opn_opcode22();
1420 void opn_opcode23();
1421 void opn_opcode24();
1422 void opn_opcode25();
1423 void opn_opcode26();
1424 void opn_opcode27();
1425 void opn_opcode28();
1426 void opn_opcode29();
1427 void opn_opcode30();
1428 void opn_opcode31();
1429 void opn_opcode32();
1430 void opn_opcode33();
1431 void opn_opcode34();
1432 void opn_opcode35();
1433 void opn_opcode36();
1434 void opn_opcode37();
1435 void opn_opcode38();
1436 void opn_opcode39();
1437 void opn_opcode40();
1438 void opn_opcode41();
1439 void opn_opcode42();
1440 void opn_opcode43();
1441 void opn_opcode44();
1442 void opn_opcode45();
1443 void opn_opcode46();
1444 void opn_opcode47();
1445 void opn_opcode48();
1446 void opn_opcode49();
1447 void opn_opcode50();
1448 void opn_opcode51();
1449 void opn_opcode52();
1450 void opn_opcode53();
1451 void opn_opcode54();
1452 void opn_opcode55();
1453 void opn_opcode56();
1454 void opn_opcode57();
1455 void opn_opcode62();
1456 void opn_opcode63();
1470 StackFrame() { memset(
this, 0,
sizeof(*
this)); }
1477 int _dolineReturnVal;
1479 byte *_dataBase, *_textBase;
1480 uint32 _dataBaseSize, _textBaseSize;
1485 char _inputline[61];
1490 const char *_mouseString, *_mouseString1;
1491 char _objectName1[15], _objectName2[15];
1492 char _inMessage[20];
1493 char _placeMessage[15];
1496 uint16 _intputCounter, _inputMax;
1497 uint16 _mousePrintFG;
1501 uint32 _quickptr[16];
1502 uint16 _quickshort[12];
1505 char _keyboardBuffer[61];
1508 int16 _objectCountS;
1524 bool _keymapEnabled;
1526 uint16 getptr(uint32 pos);
1527 uint32 getlong(uint32 pos);
1529 void loadGamePcFile()
override;
1531 int bitextract(uint32 ptr,
int offs);
1533 int doline(
int needsave);
1534 int setposition(
int process,
int line);
1537 char *getMessage(
char *msg, uint16 num);
1538 void getResponse(uint16 charNum, uint16 objNum, uint16 &msgNum1, uint16 &msgNum2);
1539 void getObjectName(
char *v, uint16 x);
1542 void setbitf(uint32 ptr,
int offs,
int val);
1544 void writeval(uint8 *ptr,
int val);
1546 void addstack(
int type);
1548 void popstack(
int type);
1549 void funccpy(
int *store);
1550 void funcentry(
int *storestore,
int procn);
1554 int gvwrd(uint8 *wptr,
int mask);
1555 int wrdmatch(uint8 *word1,
int mask1, uint8 *word2,
int mask2);
1557 bool testContainer(uint16 a);
1558 bool testObvious(uint16 a);
1559 bool testSeen(uint16 a);
1561 bool ifObjectInInv(uint16 a);
1562 int inventoryOn(
int val);
1565 void execMouseHit(
HitArea *ha);
1577 void drawIconHitBar();
1579 void printIcon(
HitArea *ha, uint8 i, uint8 r);
1580 void windowPutChar(
WindowBlock *window, byte c, byte b = 0)
override;
1582 bool badload(int8 errorNum);
1589 uint32 ftext(uint32 base,
int n);
1590 char *unctok(
char *c,
int n);
1591 void uncomstr(
char *c, uint32 x);
1594 void pcl(
const char *s);
1596 void plocd(
int n,
int m);
1597 void pobjd(
int n,
int m);
1598 void ptext(uint32 tptr);
1600 void clearVideoWindow(uint16 windowNum, uint16 color)
override;
1601 void setWindowImageEx(uint16 mode, uint16 vga_res)
override;
1603 bool ifObjectHere(uint16 val)
override;
1604 bool ifObjectAt(uint16 a, uint16 b)
override;
1605 bool ifObjectState(uint16 a, int16 b)
override;
1607 void boxController(uint x, uint y, uint mode)
override;
1608 void timerProc()
override;
1610 void addChar(uint8 chr);
1612 void clearInputLine();
1613 void handleKeyboard();
1614 void handleMouseMoved()
override;
1615 void interact(
char *buffer, uint8 size);
1617 bool processSpecialKeys()
override;
1634 void setupGame()
override;
1635 void setupOpcodes()
override;
1636 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1638 void executeOpcode(
int opcode)
override;
1641 void oe1_notPresent();
1644 void oe1_notCarried();
1647 void oe1_notSibling();
1650 void oe1_isPlayer();
1658 void oe1_moveDirn();
1665 void oe1_isCalled();
1668 void oe1_setUserItem();
1669 void oe1_getUserItem();
1671 void oe1_doorExit();
1672 void oe1_loadGame();
1673 void oe1_clearUserItem();
1674 void oe1_findMaster();
1675 void oe1_nextMaster();
1677 void oe1_stopAnimate();
1680 void oe1_enableInput();
1683 void oe1_playTune();
1684 void oe1_bitClear();
1687 void oe1_zoneDisk();
1688 void oe1_printStats();
1689 void oe1_stopTune();
1690 void oe1_printPlayerDamage();
1691 void oe1_printMonsterDamage();
1692 void oe1_pauseGame();
1693 void oe1_printPlayerHit();
1694 void oe1_printMonsterHit();
1699 OpcodeProcElvira1 proc;
1705 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1706 void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr)
override;
1708 void clearHiResTextLayer()
override;
1712 Graphics::FontSJIS *_sjisFont;
1714 uint16 _sjisCurChar;
1722 void setupGame()
override;
1723 void setupOpcodes()
override;
1724 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1726 void executeOpcode(
int opcode)
override;
1728 void oe2_moveDirn();
1731 void oe2_isCalled();
1733 void oe2_drawItem();
1735 void oe2_pauseGame();
1736 void oe2_setDoorOpen();
1737 void oe2_setDoorClosed();
1738 void oe2_setDoorLocked();
1739 void oe2_ifDoorOpen();
1740 void oe2_ifDoorClosed();
1741 void oe2_ifDoorLocked();
1742 void oe2_storeItem();
1747 void oe2_bNotZero();
1748 void oe2_getOValue();
1749 void oe2_setOValue();
1751 void oe2_printStats();
1752 void oe2_setSuperRoom();
1753 void oe2_getSuperRoom();
1754 void oe2_setExitOpen();
1755 void oe2_setExitClosed();
1756 void oe2_setExitLocked();
1757 void oe2_ifExitOpen();
1758 void oe2_ifExitClosed();
1759 void oe2_ifExitLocked();
1760 void oe2_playEffect();
1761 void oe2_getDollar2();
1762 void oe2_setSRExit();
1763 void oe2_printPlayerDamage();
1764 void oe2_printMonsterDamage();
1765 void oe2_isAdjNoun();
1769 void oe2_b2NotZero();
1771 void printStats()
override;
1775 OpcodeProcElvira2 proc;
1783 bool loadGame(
const Common::String &filename,
bool restartMode =
false)
override;
1784 bool saveGame(uint slot,
const char *caption)
override;
1786 void addArrows(
WindowBlock *window, uint8 num)
override;
1787 void removeArrows(
WindowBlock *window, uint num)
override;
1789 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1790 bool hasIcon(
Item *item)
override;
1791 uint itemGetIconNumber(
Item *item)
override;
1792 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1794 void moveDirn(
Item *i, uint x)
override;
1795 int canPlace(
Item *x,
Item *y)
override;
1796 int sizeOfRec(
Item *o,
int d)
override;
1797 int weightOf(
Item *x)
override;
1799 int changeExitStates(
SubSuperRoom *sr,
int n,
int d, uint16 s);
1800 uint16 getExitState(
Item *item, uint16 x, uint16 d);
1801 void setExitState(
Item *i, uint16 n, uint16 d, uint16 s);
1802 void setSRExit(
Item *i,
int n,
int d, uint16 s);
1804 void handleMouseWheelUp()
override;
1805 void handleMouseWheelDown()
override;
1807 virtual void listSaveGames();
1808 bool confirmOverWrite(
WindowBlock *window)
override;
1809 void userGame(
bool load)
override;
1810 virtual int userGameGetKey(
bool *b, uint maxChar);
1820 void setupGame()
override;
1821 void setupOpcodes()
override;
1822 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1824 void executeOpcode(
int opcode)
override;
1826 void boxTextMessage(
const char *x);
1827 void boxTextMsg(
const char *x);
1829 uint16 getBoxSize();
1830 uint16 checkFit(
char *Ptr,
int width,
int lines);
1833 void oww_addTextBox();
1834 void oww_setShortText();
1835 void oww_setLongText();
1836 void oww_printLongText();
1838 void oww_textMenu();
1839 void oww_pauseGame();
1840 void oww_boxMessage();
1842 void oww_boxLongText();
1843 void oww_printBox();
1845 void oww_lockZones();
1846 void oww_unlockZones();
1851 OpcodeProcWaxworks proc;
1858 char _boxBuffer[310];
1859 char *_boxBufferPtr;
1864 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1866 void boxController(uint x, uint y, uint mode)
override;
1868 void addArrows(
WindowBlock *window, uint8 num)
override;
1869 void removeArrows(
WindowBlock *window, uint num)
override;
1871 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1873 bool loadTablesIntoMem(uint16 subrId)
override;
1875 void moveDirn(
Item *i, uint x)
override;
1877 bool confirmOverWrite(
WindowBlock *window)
override;
1885 static const int SIMON1_GMF_SIZE[];
1891 void setupGame()
override;
1892 void setupOpcodes()
override;
1893 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1895 void executeOpcode(
int opcode)
override;
1897 void vc22_setPalette()
override;
1901 void os1_pauseGame();
1902 void os1_screenTextBox();
1903 void os1_screenTextMsg();
1904 void os1_playEffect();
1905 void os1_screenTextPObj();
1906 void os1_getPathPosn();
1907 void os1_scnTxtLongText();
1909 void os1_mouseOff();
1910 void os1_loadBeard();
1911 void os1_unloadBeard();
1912 void os1_unloadZone();
1913 void os1_loadStrings();
1914 void os1_unfreezeZones();
1915 void os1_specialFade();
1920 OpcodeProcSimon1 proc;
1930 void dumpVgaFile(
const byte *vga)
override;
1932 void clearName()
override;
1934 void handleMouseWheelUp()
override;
1935 void handleMouseWheelDown()
override;
1937 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1939 void initMouse()
override;
1940 void handleMouseMoved()
override;
1942 void addArrows(
WindowBlock *window, uint8 num)
override;
1943 void removeArrows(
WindowBlock *window, uint num)
override;
1945 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1947 virtual void playSpeech(uint16 speechId, uint16 vgaSpriteId);
1949 void listSaveGames()
override;
1950 void userGame(
bool load)
override;
1951 int userGameGetKey(
bool *b, uint maxChar)
override;
1953 void playMusic(uint16 music, uint16 track)
override;
1954 void playMidiSfx(uint16 sound)
override;
1956 void vcStopAnimation(uint16 zone, uint16 sprite)
override;
1966 void setupGame()
override;
1967 void setupOpcodes()
override;
1968 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1970 void executeOpcode(
int opcode)
override;
1972 void os2_printLongText();
1975 void os2_stopAnimate();
1976 void os2_playTune();
1977 void os2_screenTextPObj();
1979 void os2_mouseOff();
1980 void os2_isShortText();
1981 void os2_clearMarks();
1982 void os2_waitMark();
1987 OpcodeProcSimon2 proc;
1993 void clearName()
override;
1995 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1997 void addArrows(
WindowBlock *window, uint8 num)
override;
1998 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
2000 void clearVideoWindow(uint16 windowNum, uint16 color)
override;
2002 void playSpeech(uint16 speechId, uint16 vgaSpriteId)
override;
2006 void playMusic(uint16 music, uint16 track)
override;
2015 ~AGOSEngine_Feeble()
override;
2017 void setupGame()
override;
2018 void setupOpcodes()
override;
2019 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
2021 void executeOpcode(
int opcode)
override;
2023 void vc36_setWindowImage()
override;
2024 void vc48_setPathFinder()
override;
2028 void off_addTextBox();
2029 void off_printLongText();
2031 void off_oracleTextDown();
2032 void off_oracleTextUp();
2035 void off_saveUserGame();
2036 void off_loadUserGame();
2037 void off_listSaveGames();
2039 void off_screenTextBox();
2041 void off_isAdjNoun();
2042 void off_hyperLinkOn();
2043 void off_hyperLinkOff();
2044 void off_checkPaths();
2045 void off_screenTextPObj();
2047 void off_mouseOff();
2048 void off_loadVideo();
2049 void off_playVideo();
2050 void off_centerScroll();
2051 void off_resetPVCount();
2052 void off_setPathValues();
2053 void off_stopClock();
2054 void off_restartClock();
2055 void off_setColor();
2059 void off_b3NotZero();
2062 friend class MoviePlayer;
2063 friend class MoviePlayerDXA;
2064 friend class MoviePlayerSMK;
2066 typedef void (AGOSEngine_Feeble::*OpcodeProcFeeble) ();
2067 struct OpcodeEntryFeeble {
2068 OpcodeProcFeeble proc;
2072 const OpcodeEntryFeeble *_opcodesFeeble;
2074 MoviePlayer *_moviePlayer;
2076 uint8 _interactiveVideo;
2077 uint16 _vgaCurSpritePriority;
2079 uint16 to16Wrapper(uint value)
override;
2080 uint16 readUint16Wrapper(
const void *src)
override;
2081 uint32 readUint32Wrapper(
const void *src)
override;
2083 void setLoyaltyRating(byte rating);
2085 void playVideo(
const char *filename,
bool lastSceneUsed =
false);
2086 void stopInteractiveVideo();
2089 void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
2091 void handleMouseWheelUp()
override;
2092 void handleMouseWheelDown()
override;
2094 void drawMousePart(
int image, byte x, byte y);
2095 void initMouse()
override;
2096 void drawMousePointer()
override;
2098 void animateSprites()
override;
2099 void animateSpritesByY();
2102 void swapCharacterLogo();
2103 void timerProc()
override;
2105 void addArrows(
WindowBlock *window, uint8 num)
override;
2106 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
2108 void resetVerbs()
override;
2109 void setVerb(
HitArea * ha)
override;
2110 void hitarea_leave(
HitArea * ha,
bool state =
false)
override;
2111 void invertBox(
HitArea *ha,
bool state);
2114 void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr)
override;
2116 void clearName()
override;
2118 void drawIconArray(uint i,
Item *itemPtr,
int line,
int classMask)
override;
2122 void dumpVgaFile(
const byte *vga)
override;
2124 void doOutput(
const byte *src, uint len)
override;
2126 void printScreenText(uint vgaSpriteId, uint color,
const char *stringPtr, int16 x, int16 y, int16 width)
override;
2128 void printInteractText(uint16 num,
const char *
string);
2129 void sendInteractText(uint16 num, MSVC_PRINTF
const char *fmt, ...)
GCC_PRINTF(3, 4);
2131 void checkLinkBox();
2132 void hyperLinkOn(uint16 x);
2133 void hyperLinkOff();
2137 void runSubroutine101()
override;
2144 void oracleTextUp();
2145 void oracleTextDown();
2146 void scrollOracle();
2147 void scrollOracleUp();
2148 void scrollOracleDown();
2150 void listSaveGamesFeeble();
2151 void saveUserGame(
int slot);
2155 void quickLoadOrSave()
override;
2158 class AGOSEngine_FeebleDemo :
public AGOSEngine_Feeble {
2167 void initMouse()
override;
2168 void drawMousePointer()
override;
2173 void handleWobble();
2175 void startInteractiveVideo(
const char *filename);
2176 void waitForSpace();
2179 class AGOSEngine_PuzzlePack :
public AGOSEngine_Feeble {
2184 void setupGame()
override;
2185 void setupOpcodes()
override;
2187 void executeOpcode(
int opcode)
override;
2189 void vc3_loadSprite()
override;
2190 void vc63_fastFadeIn()
override;
2192 void opp_iconifyWindow();
2193 void opp_restoreOopsPosition();
2194 void opp_loadMouseImage();
2196 void opp_setShortText();
2197 void opp_loadHiScores();
2198 void opp_checkHiScores();
2200 void opp_saveUserGame();
2201 void opp_loadUserGame();
2202 void opp_playTune();
2203 void opp_saveOopsPosition();
2204 void opp_resetGameTime();
2205 void opp_resetPVCount();
2206 void opp_setPathValues();
2207 void opp_pauseClock();
2210 typedef void (AGOSEngine_PuzzlePack::*OpcodeProcPuzzlePack) ();
2211 struct OpcodeEntryPuzzlePack {
2212 OpcodeProcPuzzlePack proc;
2216 const OpcodeEntryPuzzlePack *_opcodesPuzzlePack;
2221 void initMouse()
override;
2222 void handleMouseMoved()
override;
2223 void drawMousePointer()
override;
2225 void resetVerbs()
override;
2227 void loadMouseImage();
2229 void startOverlayAnims();
2230 void startAnOverlayAnim();
2232 void printInfoText(
const char *itemText);
2238 class AGOSEngine_DIMP :
public AGOSEngine_PuzzlePack {
2243 void setupOpcodes()
override;
2245 void executeOpcode(
int opcode)
override;
2248 typedef void (AGOSEngine_DIMP::*OpcodeProcDIMP) ();
2249 struct OpcodeEntryDIMP {
2250 OpcodeProcDIMP proc;
2254 const OpcodeEntryDIMP *_opcodesDIMP;
2256 int16 _iconToggleCount, _voiceCount;
2257 uint32 _lastTickCount;
2258 uint32 _startSecondCount, _tSecondCount;
2260 void odp_saveUserGame();
2261 void odp_loadUserGame();
2264 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:1469
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:1476
Common::Error run() override
Definition: agos.h:251
Language
Definition: language.h:45