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;
72 class ElviraAtariSTPlayer;
92 kActionToggleFastMode,
93 kActionToggleSwitchCharacter,
94 kActionToggleSubtitle,
96 kActionToggleHitboxName,
97 kActionToggleSoundEffects,
98 kActionToggleBackgroundSound,
99 kActionToggleFightMode,
101 kActionTextSpeedFast,
102 kActionTextSpeedMedium,
103 kActionTextSpeedSlow,
104 kActionSpeed_GTYPEPP,
112 #define CHECK_BOUNDS(x, y) assert((uint)(x) < ARRAYSIZE(y)) 130 struct SubroutineLine;
140 uint16 width, height;
151 HitArea() { memset(
this, 0,
sizeof(*
this)); }
213 AnimTable() { memset(
this, 0,
sizeof(*
this)); }
217 ANIMATE_INT = 1 << 1,
218 ANIMATE_EVENT = 1 << 2,
219 SCROLL_EVENT = 1 << 3,
220 PLAYER_DAMAGE_EVENT = 1 << 4,
221 MONSTER_DAMAGE_EVENT = 1 << 5
231 #ifndef REDUCE_MEMORY_USAGE 232 # define _OPCODE(ver, x) { &ver::x, #x } 234 # define _OPCODE(ver, x) { &ver::x, "" } 240 static const byte SIMON1_RHYTHM_SFX[];
243 static const uint16 MUSIC_INDEX_BASE_SIMON2_GM = 1128 / 4;
245 static const uint16 MUSIC_INDEX_BASE_SIMON2_MT32 = (1128 + 612) / 4;
262 void syncSoundSettings()
override;
265 void syncSoundSettingsIntern();
266 void pauseEngineIntern(
bool pause)
override;
268 virtual void setupOpcodes();
269 uint16 _numOpcodes, _opcode;
273 void setupVgaOpcodes();
274 VgaOpcodeProc _vga_opcode_table[100];
275 uint8 _numVideoOpcodes;
277 virtual void setupVideoOpcodes(VgaOpcodeProc *op);
282 virtual void setupGame();
284 int getGameId()
const;
285 int getGameType()
const;
286 uint32 getFeatures()
const;
287 const char *getExtra()
const;
290 const char *getFileName(
int type)
const;
294 uint16 _vcGetOutOfCode;
297 uint32 *_gameOffsetsPtr;
299 uint8 _numMusic, _numSFX;
303 uint8 _numBitArray1, _numBitArray2, _numBitArray3, _numItemStore;
306 uint8 _vgaBaseDelay, _vgaPeriod;
308 uint16 _musicIndexBase;
309 uint16 _soundIndexBase;
310 uint16 _tableIndexBase;
311 uint16 _textIndexBase;
314 uint32 _tableMemSize;
325 byte *_strippedTxtMem;
328 uint32 _stringTabNum, _stringTabPos, _stringTabSize;
329 byte **_stringTabPtr;
331 Item **_itemArrayPtr;
332 uint32 _itemArraySize;
333 uint32 _itemArrayInited;
339 const byte *_codePtr;
341 byte **_localStringtable;
342 uint16 _stringIdLocalMin, _stringIdLocalMax;
345 uint16 _numRoomStates;
352 byte *_xtablesHeapPtrOrg;
353 uint32 _xtablesHeapCurPosOrg;
357 byte *_tablesHeapPtr, *_tablesHeapPtrOrg, *_tablesheapPtrNew;
358 uint32 _tablesHeapSize, _tablesHeapCurPos, _tablesHeapCurPosOrg;
359 uint32 _tablesHeapCurPosNew;
364 uint8 _recursionDepth;
372 bool _runScriptReturn1;
373 bool _runScriptCondition[40];
374 int16 _runScriptReturn[40];
376 bool _noParentNotify;
388 bool _copyProtection;
393 int16 _chanceModifier;
394 bool _restoreWindow6;
395 int16 _scrollX, _scrollXMax;
396 int16 _scrollY, _scrollYMax;
397 int16 _scrollCount, _scrollFlag;
398 uint16 _scrollWidth, _scrollHeight;
399 const byte *_scrollImage;
404 int16 _classMask, _classMode1, _classMode2;
411 uint16 _currentRoom, _superRoomNumber;
414 uint16 _hyperLink, _newLines;
415 uint16 _oracleMaxScrollY, _noOracleScroll;
418 int16 _scriptVerb, _scriptNoun1, _scriptNoun2;
419 int16 _scriptAdj1, _scriptAdj2;
424 Item *_subjectItem, *_objectItem;
425 Item *_currentPlayer;
427 Item *_hitAreaObjectItem;
431 Item *_hitAreaSubjectItem;
432 HitArea *_currentBox, *_currentVerbBox, *_lastVerbOn;
433 uint16 _currentBoxNum;
434 uint16 _needHitAreaRecalc;
449 int16 _printCharCurPos, _printCharMaxPos, _printCharPixelCount;
450 uint16 _numLettersToPrint;
454 uint32 getTime()
const;
458 uint32 _clockStopped, _gameStoppedClock;
461 TimeEvent *_firstTimeStruct, *_pendingDeleteTimeEvent;
468 bool _animatePointer;
469 byte _maxCursorWidth, _maxCursorHeight;
470 byte _mouseAnim, _mouseAnimMax, _mouseCursor;
471 byte _currentMouseAnim, _currentMouseCursor;
472 byte _oldMouseAnimMax, _oldMouseCursor;
473 uint16 _mouseHideCount;
476 bool _leftButtonDown, _rightButtonDown;
477 byte _leftButton, _leftButtonCount, _leftButtonOld;
480 bool _leftClick, _rightClick;
487 volatile uint16 _videoLockOut;
488 uint16 _scrollUpHitArea;
489 uint16 _scrollDownHitArea;
491 bool _fastFadeOutFlag;
494 uint16 _fastFadeCount;
495 volatile uint16 _fastFadeInFlag;
498 uint16 _screenWidth, _screenHeight;
499 uint16 _internalWidth, _internalHeight;
504 bool _exitCutscene, _picture8600;
507 int16 _lastMusicPlayed;
508 int16 _nextMusicToPlay;
509 bool _showPreposition;
510 bool _showMessageFlag;
514 uint16 _copyScnFlag, _vgaSpriteChanged;
516 byte *_block, *_blockEnd;
517 byte *_vgaMemPtr, *_vgaMemEnd, *_vgaMemBase;
518 byte *_vgaFrozenBase, *_vgaRealBase;
529 uint16 _vgaWaitFor, _lastVgaWaitFor;
530 uint16 _vgaCurSpriteId, _vgaCurZoneNum;
535 int16 _scaleX, _scaleY, _scaleWidth, _scaleHeight;
539 uint8 _opcode177Var1, _opcode177Var2;
540 uint8 _opcode178Var1, _opcode178Var2;
542 Item *_objectArray[50];
543 Item *_itemStore[50];
545 uint16 _shortText[40];
546 uint16 _shortTextX[40];
547 uint16 _shortTextY[40];
548 uint16 _longText[40];
549 uint16 _longSound[40];
551 uint16 _bitArray[128];
552 uint16 _bitArrayTwo[16];
553 uint16 _bitArrayThree[16];
554 int16 *_variableArray;
555 int16 *_variableArray2;
556 int16 *_variableArrayPtr;
564 TextLocation _textLocation1, _textLocation2, _textLocation3, _textLocation4;
566 byte _awaitTwoByteToken;
568 byte *_byteTokenStrings;
569 byte *_twoByteTokens;
570 byte *_twoByteTokenStrings;
571 byte *_secondTwoByteTokenStrings;
572 byte *_thirdTwoByteTokenStrings;
573 byte _textBuffer[180];
578 byte _stringReturnBuffer[2][180];
590 const uint16 *_pathFindArray[100];
592 uint8 _pathValues[400];
596 uint8 _pathValues1[400];
600 uint8 _currentPalette[768];
601 uint8 _displayPalette[768];
604 byte _videoBuf1[32000];
605 uint16 _videoWindows[128];
606 const byte *_pak98Buf;
607 byte _paletteModNext;
613 uint16 _moveXMin, _moveYMin;
614 uint16 _moveXMax, _moveYMax;
620 byte _lettersToPrintBuf[80];
642 uint16 _effectsVolume;
645 uint8 _saveGameNameLen;
646 uint16 _saveLoadRowCurPos;
647 uint16 _numSaveGameRows;
648 bool _saveDialogFlag;
652 byte _saveLoadType, _saveLoadSlot;
653 char _saveLoadName[108];
664 const byte *_vc10BasePtrOld;
665 byte _hebrewCharWidths[32];
672 uint32 _curSfxFileSize;
673 uint16 _sampleEnd, _sampleWait;
676 virtual uint16 to16Wrapper(uint value);
677 virtual uint16 readUint16Wrapper(
const void *src);
678 virtual uint32 readUint32Wrapper(
const void *src);
686 void allocateStringTable(
int num);
687 void setupStringTable(byte *mem,
int num);
688 void setupLocalStringTable(byte *mem,
int num);
692 virtual void loadGamePcFile();
694 void decompressData(
const char *srcName, byte *dst, uint32 offset, uint32 srcSize, uint32 dstSize);
696 void drawPnSqueezedChar(
WindowBlock *window, uint x, uint y, byte chr);
697 void loadOffsets(
const char *filename,
int number, uint32 &file, uint32 &offset, uint32 &compressedSize, uint32 &size);
698 void loadSound(uint16 sound, int16 pan, int16 vol, uint16 type);
699 void playSfx(uint16 sound, uint16 freq, uint16 flags,
bool digitalOnly =
false,
bool midiOnly =
false);
700 void loadSound(uint16 sound, uint16 freq, uint16 flags);
702 virtual void playMidiSfx(uint16 sound);
703 void loadVoice(uint speechId);
706 void loadSoundFile(
const char *filename);
708 int getUserFlag(
Item *item,
int a);
709 int getUserFlag1(
Item *item,
int a);
710 int getUserItem(
Item *item,
int n);
711 void setUserFlag(
Item *item,
int a,
int b);
712 void setUserItem(
Item *item,
int n,
int m);
714 void paletteFadeOut(byte *palPtr, uint num, uint size);
716 void *allocateItem(uint size);
717 void *allocateTable(uint size);
718 void alignTableMem();
720 Child *findChildOfType(
Item *i, uint child);
721 Child *allocateChildBlock(
Item *i, uint type, uint size);
723 void allocItemHeap();
724 void allocTablesHeap();
733 Subroutine *getSubroutineByID(uint subroutineId);
736 void dumpAllSubroutines();
737 void dumpAllVgaImageFiles();
738 void dumpAllVgaScriptFiles();
739 void dumpSubroutines();
742 const byte *dumpOpcode(
const byte *p);
750 virtual void executeOpcode(
int opcode) = 0;
755 uint getNextVarContents();
756 uint getVarWrapper();
759 uint readVariable(uint16 variable);
760 void writeNextVarContents(uint16 contents);
761 void writeVariable(uint16 variable, uint16 contents);
763 Item *derefItem(uint item);
764 Item *getNextItemPtr();
765 uint getNextItemID();
766 uint getItem1ID() {
return 1;}
767 uint itemPtrToID(
Item *
id);
771 void uncompressText(byte *ptr);
772 byte *uncompressToken(byte a, byte *ptr);
774 void showMessageFormat(MSVC_PRINTF
const char *s, ...)
GCC_PRINTF(2, 3);
775 const byte *getStringPtrByID(uint16 stringId,
bool upperCase =
false);
776 const byte *getLocalStringByID(uint16 stringId);
777 uint getNextStringID();
779 void addTimeEvent(int32 timeout, uint16 subroutineId);
782 Item *findInByClass(
Item *i, int16 m);
783 Item *nextInByClass(
Item *i, int16 m);
784 Item *findMaster(int16 a, int16 n);
785 Item *nextMaster(
Item *item, int16 a, int16 n);
786 int wordMatch(
Item *item, int16 a, int16 n);
788 bool isRoom(
Item *item);
789 bool isObject(
Item *item);
790 bool isPlayer(
Item *item);
792 void itemChildrenChanged(
Item *item);
793 void unlinkItem(
Item *item);
794 void linkItem(
Item *item,
Item *parent);
796 void setItemParent(
Item *item,
Item *parent);
797 void setItemState(
Item *item,
int value);
799 void stopAnimate(uint16 a);
800 void stopAnimateSimon2(uint16 a, uint16 b);
802 void enableBox(uint hitarea);
803 void disableBox(uint hitarea);
804 void moveBox(uint hitarea,
int x,
int y);
805 bool isBoxDead(uint hitarea);
806 void undefineBox(uint hitarea);
807 void defineBox(
int id,
int x,
int y,
int width,
int height,
int flags,
int verb,
Item *itemPtr);
808 void defineBox(uint16
id, uint16 x, uint16 y, uint16 width, uint16 height, uint16 msg1, uint16 msg2, uint16 flags);
812 virtual void resetVerbs();
813 virtual void setVerb(
HitArea * ha);
814 virtual void hitarea_leave(
HitArea * ha,
bool state =
false);
815 void leaveHitAreaById(uint hitarea_id);
817 void sendSync(uint a);
818 void waitForSync(uint a);
820 uint getOffsetOfChild2Param(
SubObject *child, uint prop);
821 void scriptMouseOff();
823 void unfreezeBottom();
829 void setup_cond_c_helper();
831 uint16 getBackExit(
int n);
832 uint16 getDoorState(
Item *item, uint16 d);
833 uint16 getExitOf(
Item *item, uint16 d);
834 void changeDoorState(
SubRoom *r, uint16 d, uint16 n);
835 void setDoorState(
Item *i, uint16 d, uint16 n);
838 Item *getDoorOf(
Item *item, uint16 d);
839 Item *getExitOf_e1(
Item *item, uint16 d);
840 virtual void moveDirn(
Item *i, uint x);
842 virtual int canPlace(
Item *x,
Item *y);
844 int sizeContents(
Item *x);
845 virtual int sizeOfRec(
Item *o,
int d);
846 int sizeRec(
Item *x,
int d);
847 int weighUp(
Item *x);
848 int weightRec(
Item *x,
int d);
849 virtual int weightOf(
Item *x);
853 void drawMenuStrip(uint windowNum, uint menuNum);
854 void lightMenuStrip(
int a);
855 void unlightMenuStrip();
856 void lightMenuBox(uint hitarea);
858 uint menuFor_e2(
Item *item);
859 uint menuFor_ww(
Item *item, uint
id);
860 void clearMenuStrip();
861 void doMenuStrip(uint menuNum);
866 bool loadRoomItems(uint16 item);
868 virtual bool loadTablesIntoMem(uint16 subrId);
869 bool loadXTablesIntoMem(uint16 subrId);
870 void loadTextIntoMem(uint16 stringId);
872 uint loadTextFile(
const char *filename, byte *dst);
876 uint loadTextFile_simon1(
const char *filename, byte *dst);
882 uint loadTextFile_gme(
const char *filename, byte *dst);
886 bool kickoffTimeEvents();
887 void killAllTimers();
890 virtual void runSubroutine101();
895 WindowBlock *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fillColor, uint textColor);
898 void changeWindow(uint a);
899 void closeWindow(uint a);
900 void setTextColor(uint color);
901 virtual void windowPutChar(
WindowBlock *window, byte c, byte b = 0);
904 HitArea *findBox(uint hitarea_id);
905 virtual void boxController(uint x, uint y, uint mode);
906 void handleVerbClicked(uint verb);
907 virtual void clearName();
908 void displayName(
HitArea * ha);
909 void resetNameWindow();
910 void displayBoxStars();
911 void invertBox(
HitArea * ha, byte a, byte b, byte c, byte d);
913 virtual void handleMouseWheelUp();
914 virtual void handleMouseWheelDown();
916 virtual void initMouse();
917 virtual void handleMouseMoved();
918 virtual void drawMousePointer();
920 void drawArrow(uint16 x, uint16 y, int8 dir);
921 virtual void addArrows(
WindowBlock *window, uint8 num);
922 virtual void removeArrows(
WindowBlock *window, uint num);
924 virtual void drawIcon(
WindowBlock *window, uint icon, uint x, uint y);
925 virtual bool hasIcon(
Item *item);
926 virtual uint itemGetIconNumber(
Item *item);
927 virtual uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr);
929 virtual void drawIconArray(uint i,
Item *itemPtr,
int line,
int classMask);
930 void removeIconArray(uint num);
936 virtual bool processSpecialKeys();
937 void hitarea_stuff_helper();
941 uint getFeebleFontSize(byte chr);
943 void justifyOutPut(byte chr);
945 void loadZone(uint16 zoneNum,
bool useError =
true);
947 void animate(uint16 windowNum, uint16 zoneNum, uint16 vgaSpriteId, int16 x, int16 y, uint16 palette,
bool vgaScript =
false);
948 void setImage(uint16 vgaSpriteId,
bool vgaScript =
false);
949 void setWindowImage(uint16 mode, uint16 vgaSpriteId,
bool specialCase =
false);
950 virtual void setWindowImageEx(uint16 mode, uint16 vgaSpriteId);
955 const char *getPixelLength(
const char *
string, uint16 maxWidth, uint16 &pixels);
956 bool printNameOf(
Item *item, uint x, uint y);
957 bool printTextOf(uint a, uint x, uint y);
958 void printVerbOf(uint hitarea_id);
959 void showActionString(
const byte *
string);
961 virtual void printScreenText(uint vgaSpriteId, uint color,
const char *stringPtr, int16 x, int16 y, int16 width);
963 void renderStringAmiga(uint vgaSpriteId, uint color, uint width, uint height,
const char *txt);
964 void renderString(uint vgaSpriteId, uint color, uint width, uint height,
const char *txt);
966 void writeChar(
WindowBlock *window,
int x,
int y,
int offs,
int val);
968 byte *allocBlock(uint32 size);
969 void checkNoOverWrite();
970 void checkRunningAnims();
971 void checkAnims(uint a);
972 void checkZonePtrs();
973 void setZoneBuffers();
978 bool getBitFlag(uint bit);
979 void setBitFlag(uint bit,
bool value);
984 virtual void vc3_loadSprite();
987 void vc6_ifObjectHere();
988 void vc7_ifObjectNotHere();
989 void vc8_ifObjectIsAt();
990 void vc9_ifObjectStateIs();
993 void vc13_addToSpriteX();
994 void vc14_addToSpriteY();
996 void vc16_waitSync();
999 void vc20_setRepeat();
1000 void vc21_endRepeat();
1001 virtual void vc22_setPalette();
1002 void vc23_setPriority();
1003 void vc24_setSpriteXY();
1004 void vc25_halt_sprite();
1005 void vc26_setSubWindow();
1006 void vc27_resetSprite();
1007 void vc28_playSFX();
1008 void vc29_stopAllSounds();
1009 void vc30_setFrameRate();
1010 void vc31_setWindow();
1011 void vc33_setMouseOn();
1012 void vc34_setMouseOff();
1013 void vc35_clearWindow();
1014 virtual void vc36_setWindowImage();
1015 void vc38_ifVarNotZero();
1017 void vc40_scrollRight();
1018 void vc41_scrollLeft();
1019 void vc42_delayIfNotEQ();
1025 void vc44_enableBox();
1026 void vc45_disableBox();
1028 void vc48_specialEffect();
1030 void vc55_scanFlag();
1033 void vc17_waitEnd();
1034 void vc32_saveScreen();
1035 void vc37_pokePalette();
1038 void vc43_ifBitSet();
1039 void vc44_ifBitClear();
1040 void vc45_setWindowPalette();
1041 void vc46_setPaletteSlot1();
1042 void vc47_setPaletteSlot2();
1043 void vc48_setPaletteSlot3();
1045 void vc50_clearBit();
1046 void vc51_enableBox();
1047 void vc52_playSound();
1048 void vc53_dissolveIn();
1049 void vc54_dissolveOut();
1050 void vc55_moveBox();
1051 void vc56_fullScreen();
1052 void vc57_blackPalette();
1053 void vc58_checkCodeWheel();
1054 void vc58_changePriority();
1058 void vc60_stopAnimation();
1060 void vc62_fastFadeOut();
1061 virtual void vc63_fastFadeIn();
1064 void vc11_clearPathFinder();
1065 void vc17_setPathfinderItem();
1066 void vc32_copyVar();
1067 void vc37_addToSpriteY();
1068 void vc45_setSpriteX();
1069 void vc46_setSpriteY();
1070 void vc47_addToVar();
1071 virtual void vc48_setPathFinder();
1072 void vc59_ifSpeech();
1073 void vc61_setMaskImage();
1076 void vc56_delayLong();
1077 void vc59_stopAnimations();
1078 void vc64_ifSpeech();
1079 void vc65_slowFadeIn();
1080 void vc66_ifEqual();
1083 void vc69_playSeq();
1084 void vc70_joinSeq();
1085 void vc71_ifSeqWaiting();
1087 void vc73_setMark();
1088 void vc74_clearMark();
1091 void vc75_setScale();
1092 void vc76_setScaleXOffs();
1093 void vc77_setScaleYOffs();
1094 void vc78_computeXY();
1095 void vc79_computePosNum();
1096 void vc80_setOverlayImage();
1097 void vc81_setRandom();
1098 void vc82_getPathValue();
1099 void vc83_playSoundLoop();
1100 void vc84_stopSoundLoop();
1102 void setScriptCondition(
bool cond);
1103 bool getScriptCondition();
1104 void setScriptReturn(
int ret);
1105 int getScriptReturn();
1112 void o_notCarried();
1165 void o_haltAnimation();
1166 void o_restartAnimation();
1169 void o_getChildren();
1172 void o_killAnimate();
1176 void o_closeWindow();
1180 void o_disableBox();
1185 void o_unsetClass();
1190 void o_doClassIcons();
1192 void o_setAdjNoun();
1193 void o_saveUserGame();
1194 void o_loadUserGame();
1196 void o_restoreIcons();
1197 void o_freezeZones();
1198 void o_placeNoIcons();
1199 void o_clearTimers();
1203 int16 moreText(
Item *i);
1204 void lobjFunc(
Item *i,
const char *f);
1205 uint confirmYesOrNo(uint16 x, uint16 y);
1206 uint continueOrQuit();
1208 virtual void printStats();
1209 void synchChain(
Item *i);
1214 void drawImage_init(int16 image, uint16 palette, int16 x, int16 y, uint16 flags);
1219 void drawVertImageCompressed(
VC10_state *state);
1220 void drawVertImageUncompressed(
VC10_state *state);
1222 void setMoveRect(uint16 x, uint16 y, uint16 width, uint16 height);
1228 void updateBackendSurface(
Common::Rect *area = 0)
const;
1229 virtual void clearHiResTextLayer() {}
1231 int vcReadVarOrWord();
1232 uint vcReadNextWord(
bool forceLERead =
false);
1233 uint vcReadNextByte();
1234 uint vcReadVar(uint var);
1235 void vcWriteVar(uint var, int16 value);
1236 void vcSkipNextInstruction();
1238 int getScale(int16 y, int16 x);
1239 void checkScrollX(int16 x, int16 xpos);
1240 void checkScrollY(int16 y, int16 ypos);
1241 void centerScroll();
1243 virtual void clearVideoWindow(uint16 windowNum, uint16 color);
1244 void clearVideoBackGround(uint16 windowNum, uint16 color);
1246 void setPaletteSlot(uint16 srcOffs, uint8 dstOffs);
1247 void checkOnStopTable();
1248 void checkWaitEndTable();
1250 virtual bool ifObjectHere(uint16 val);
1251 virtual bool ifObjectAt(uint16 a, uint16 b);
1252 virtual bool ifObjectState(uint16 a, int16 b);
1254 bool isVgaQueueEmpty();
1255 void haltAnimation();
1256 void restartAnimation();
1257 void addVgaEvent(uint16 num, uint8 type,
const byte *codePtr, uint16 curSprite, uint16 curZoneNum);
1259 void processVgaEvents();
1260 void animateEvent(
const byte *codePtr, uint16 curZoneNum, uint16 curSprite);
1262 void drawStuff(
const byte *src, uint offs);
1268 bool isSpriteLoaded(uint16
id, uint16 zoneNum);
1271 void freeBox(uint index);
1273 void sendWindow(uint a);
1276 void colorBlock(
WindowBlock *window, uint16 x, uint16 y, uint16 w, uint16 h);
1279 void restoreBlock(uint16 left, uint16 top, uint16 right, uint16 bottom);
1282 byte *getBackGround();
1283 byte *getScaleBuf();
1285 byte *convertAmigaImage(
VC10_state *state,
bool compressed);
1287 bool decrunchFile(byte *src, byte *dst, uint32 size);
1288 void loadVGABeardFile(uint16
id);
1289 void loadVGAVideoFile(uint16
id, uint8 type,
bool useError =
true);
1290 bool loadVGASoundFile(uint16
id, uint8 type);
1292 void openGameFile();
1293 void readGameFile(
void *dst, uint32 offs, uint32 size);
1295 virtual void timerProc();
1297 virtual void animateSprites();
1300 void dirtyClipCheck(int16 x, int16 y, int16 w, int16 h);
1301 void dirtyBackGround();
1302 void restoreBackGround();
1305 void clearSurfaces();
1306 void displayScreen();
1308 void dumpVideoScript(
const byte *src,
bool singeOpcode);
1309 virtual void dumpVgaFile(
const byte *vga);
1310 void dumpVgaScript(
const byte *ptr, uint16 res, uint16
id);
1311 void dumpVgaScriptAlways(
const byte *ptr, uint16 res, uint16
id);
1313 void dumpVgaBitmaps(uint16 zoneNum);
1315 void dumpSingleBitmap(
int file,
int image,
const byte *offs,
int w,
int h, byte base);
1316 void dumpBitmap(
const char *filename,
const byte *offs, uint16 w, uint16 h,
int flags,
const byte *palette, byte base);
1317 void palLoad(byte *pal,
const byte *vga1,
int a,
int b);
1319 void fillBackFromBackGround(uint16 height, uint16 width);
1320 void fillBackFromFront();
1321 void fillBackGroundFromBack();
1322 void fillBackGroundFromFront();
1324 virtual void doOutput(
const byte *src, uint len);
1327 virtual void quickLoadOrSave();
1329 byte *vc10_uncompressFlip(
const byte *src, uint16 w, uint16 h);
1330 byte *vc10_flip(
const byte *src, uint16 w, uint16 h);
1332 Item *getNextItemPtrStrange();
1334 virtual bool loadGame(
const Common::String &filename,
bool restartMode =
false);
1335 virtual bool saveGame(uint slot,
const char *caption);
1337 void openTextWindow();
1338 void tidyIconArray(uint i);
1342 virtual void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr);
1349 void loadMusic(uint16 track,
bool forceSimon2GmData =
false,
bool useSimon2Remapping =
false);
1350 void playModule(uint16 music);
1351 virtual void playMusic(uint16 music, uint16 track);
1354 void delay(uint delay);
1357 void waitForMark(uint i);
1358 void scrollScreen();
1360 void decodeColumn(byte *dst,
const byte *src, uint16 height, uint16 pitch);
1361 void decodeRow(byte *dst,
const byte *src, uint16 width, uint16 pitch);
1362 void hitarea_stuff_helper_2();
1367 virtual void vcStopAnimation(uint16 zone, uint16 sprite);
1369 virtual bool confirmOverWrite(
WindowBlock *window);
1370 int16 matchSaveGame(
const char *name, uint16 max);
1371 void disableFileBoxes();
1372 virtual void userGame(
bool load);
1373 void userGameBackSpace(
WindowBlock *window,
int x, byte b = 0);
1374 void fileError(
WindowBlock *window,
bool saveError);
1376 int countSaveGames();
1379 void enterSaveLoadScreen(
bool entering);
1393 void setupGame()
override;
1394 void setupOpcodes()
override;
1395 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1396 void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr)
override;
1398 void executeOpcode(
int opcode)
override;
1400 int actCallD(
int n);
1402 void opn_opcode00();
1407 void opn_opcode05();
1408 void opn_opcode06();
1409 void opn_opcode07();
1410 void opn_opcode08();
1411 void opn_opcode09();
1412 void opn_opcode10();
1413 void opn_opcode11();
1414 void opn_opcode12();
1415 void opn_opcode13();
1416 void opn_opcode14();
1417 void opn_opcode15();
1418 void opn_opcode16();
1423 void opn_opcode21();
1424 void opn_opcode22();
1425 void opn_opcode23();
1426 void opn_opcode24();
1427 void opn_opcode25();
1428 void opn_opcode26();
1429 void opn_opcode27();
1430 void opn_opcode28();
1431 void opn_opcode29();
1432 void opn_opcode30();
1433 void opn_opcode31();
1434 void opn_opcode32();
1435 void opn_opcode33();
1436 void opn_opcode34();
1437 void opn_opcode35();
1438 void opn_opcode36();
1439 void opn_opcode37();
1440 void opn_opcode38();
1441 void opn_opcode39();
1442 void opn_opcode40();
1443 void opn_opcode41();
1444 void opn_opcode42();
1445 void opn_opcode43();
1446 void opn_opcode44();
1447 void opn_opcode45();
1448 void opn_opcode46();
1449 void opn_opcode47();
1450 void opn_opcode48();
1451 void opn_opcode49();
1452 void opn_opcode50();
1453 void opn_opcode51();
1454 void opn_opcode52();
1455 void opn_opcode53();
1456 void opn_opcode54();
1457 void opn_opcode55();
1458 void opn_opcode56();
1459 void opn_opcode57();
1460 void opn_opcode62();
1461 void opn_opcode63();
1475 StackFrame() { memset(
this, 0,
sizeof(*
this)); }
1482 int _dolineReturnVal;
1484 byte *_dataBase, *_textBase;
1485 uint32 _dataBaseSize, _textBaseSize;
1490 char _inputline[61];
1495 const char *_mouseString, *_mouseString1;
1496 char _objectName1[15], _objectName2[15];
1497 char _inMessage[20];
1498 char _placeMessage[15];
1501 uint16 _intputCounter, _inputMax;
1502 uint16 _mousePrintFG;
1506 uint32 _quickptr[16];
1507 uint16 _quickshort[12];
1510 char _keyboardBuffer[61];
1513 int16 _objectCountS;
1529 bool _keymapEnabled;
1531 uint16 getptr(uint32 pos);
1532 uint32 getlong(uint32 pos);
1534 void loadGamePcFile()
override;
1536 int bitextract(uint32 ptr,
int offs);
1538 int doline(
int needsave);
1539 int setposition(
int process,
int line);
1542 char *getMessage(
char *msg, uint16 num);
1543 void getResponse(uint16 charNum, uint16 objNum, uint16 &msgNum1, uint16 &msgNum2);
1544 void getObjectName(
char *v, uint16 x);
1547 void setbitf(uint32 ptr,
int offs,
int val);
1549 void writeval(uint8 *ptr,
int val);
1551 void addstack(
int type);
1553 void popstack(
int type);
1554 void funccpy(
int *store);
1555 void funcentry(
int *storestore,
int procn);
1559 int gvwrd(uint8 *wptr,
int mask);
1560 int wrdmatch(uint8 *word1,
int mask1, uint8 *word2,
int mask2);
1562 bool testContainer(uint16 a);
1563 bool testObvious(uint16 a);
1564 bool testSeen(uint16 a);
1566 bool ifObjectInInv(uint16 a);
1567 int inventoryOn(
int val);
1570 void execMouseHit(
HitArea *ha);
1582 void drawIconHitBar();
1584 void printIcon(
HitArea *ha, uint8 i, uint8 r);
1585 void windowPutChar(
WindowBlock *window, byte c, byte b = 0)
override;
1587 bool badload(int8 errorNum);
1594 uint32 ftext(uint32 base,
int n);
1595 char *unctok(
char *c,
int n);
1596 void uncomstr(
char *c, uint32 x);
1599 void pcl(
const char *s);
1601 void plocd(
int n,
int m);
1602 void pobjd(
int n,
int m);
1603 void ptext(uint32 tptr);
1605 void clearVideoWindow(uint16 windowNum, uint16 color)
override;
1606 void setWindowImageEx(uint16 mode, uint16 vga_res)
override;
1608 bool ifObjectHere(uint16 val)
override;
1609 bool ifObjectAt(uint16 a, uint16 b)
override;
1610 bool ifObjectState(uint16 a, int16 b)
override;
1612 void boxController(uint x, uint y, uint mode)
override;
1613 void timerProc()
override;
1615 void addChar(uint8 chr);
1617 void clearInputLine();
1618 void handleKeyboard();
1619 void handleMouseMoved()
override;
1620 void interact(
char *buffer, uint8 size);
1622 bool processSpecialKeys()
override;
1639 void setupGame()
override;
1640 void setupOpcodes()
override;
1641 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1643 void executeOpcode(
int opcode)
override;
1646 void oe1_notPresent();
1649 void oe1_notCarried();
1652 void oe1_notSibling();
1655 void oe1_isPlayer();
1663 void oe1_moveDirn();
1670 void oe1_isCalled();
1673 void oe1_setUserItem();
1674 void oe1_getUserItem();
1676 void oe1_doorExit();
1677 void oe1_loadGame();
1678 void oe1_clearUserItem();
1679 void oe1_findMaster();
1680 void oe1_nextMaster();
1682 void oe1_stopAnimate();
1685 void oe1_enableInput();
1688 void oe1_playTune();
1689 void oe1_bitClear();
1692 void oe1_zoneDisk();
1693 void oe1_printStats();
1694 void oe1_stopTune();
1695 void oe1_printPlayerDamage();
1696 void oe1_printMonsterDamage();
1697 void oe1_pauseGame();
1698 void oe1_printPlayerHit();
1699 void oe1_printMonsterHit();
1704 OpcodeProcElvira1 proc;
1710 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1711 void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr)
override;
1713 void clearHiResTextLayer()
override;
1717 Graphics::FontSJIS *_sjisFont;
1719 uint16 _sjisCurChar;
1727 void setupGame()
override;
1728 void setupOpcodes()
override;
1729 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1731 void executeOpcode(
int opcode)
override;
1733 void oe2_moveDirn();
1736 void oe2_isCalled();
1738 void oe2_drawItem();
1740 void oe2_pauseGame();
1741 void oe2_setDoorOpen();
1742 void oe2_setDoorClosed();
1743 void oe2_setDoorLocked();
1744 void oe2_ifDoorOpen();
1745 void oe2_ifDoorClosed();
1746 void oe2_ifDoorLocked();
1747 void oe2_storeItem();
1752 void oe2_bNotZero();
1753 void oe2_getOValue();
1754 void oe2_setOValue();
1756 void oe2_printStats();
1757 void oe2_setSuperRoom();
1758 void oe2_getSuperRoom();
1759 void oe2_setExitOpen();
1760 void oe2_setExitClosed();
1761 void oe2_setExitLocked();
1762 void oe2_ifExitOpen();
1763 void oe2_ifExitClosed();
1764 void oe2_ifExitLocked();
1765 void oe2_playEffect();
1766 void oe2_getDollar2();
1767 void oe2_setSRExit();
1768 void oe2_printPlayerDamage();
1769 void oe2_printMonsterDamage();
1770 void oe2_isAdjNoun();
1774 void oe2_b2NotZero();
1776 void printStats()
override;
1780 OpcodeProcElvira2 proc;
1788 bool loadGame(
const Common::String &filename,
bool restartMode =
false)
override;
1789 bool saveGame(uint slot,
const char *caption)
override;
1791 void addArrows(
WindowBlock *window, uint8 num)
override;
1792 void removeArrows(
WindowBlock *window, uint num)
override;
1794 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1795 bool hasIcon(
Item *item)
override;
1796 uint itemGetIconNumber(
Item *item)
override;
1797 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1799 void moveDirn(
Item *i, uint x)
override;
1800 int canPlace(
Item *x,
Item *y)
override;
1801 int sizeOfRec(
Item *o,
int d)
override;
1802 int weightOf(
Item *x)
override;
1804 int changeExitStates(
SubSuperRoom *sr,
int n,
int d, uint16 s);
1805 uint16 getExitState(
Item *item, uint16 x, uint16 d);
1806 void setExitState(
Item *i, uint16 n, uint16 d, uint16 s);
1807 void setSRExit(
Item *i,
int n,
int d, uint16 s);
1809 void handleMouseWheelUp()
override;
1810 void handleMouseWheelDown()
override;
1812 virtual void listSaveGames();
1813 bool confirmOverWrite(
WindowBlock *window)
override;
1814 void userGame(
bool load)
override;
1815 virtual int userGameGetKey(
bool *b, uint maxChar);
1825 void setupGame()
override;
1826 void setupOpcodes()
override;
1827 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1829 void executeOpcode(
int opcode)
override;
1831 void boxTextMessage(
const char *x);
1832 void boxTextMsg(
const char *x);
1834 uint16 getBoxSize();
1835 uint16 checkFit(
char *Ptr,
int width,
int lines);
1838 void oww_addTextBox();
1839 void oww_setShortText();
1840 void oww_setLongText();
1841 void oww_printLongText();
1843 void oww_textMenu();
1844 void oww_pauseGame();
1845 void oww_boxMessage();
1847 void oww_boxLongText();
1848 void oww_printBox();
1850 void oww_lockZones();
1851 void oww_unlockZones();
1856 OpcodeProcWaxworks proc;
1863 char _boxBuffer[310];
1864 char *_boxBufferPtr;
1869 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1871 void boxController(uint x, uint y, uint mode)
override;
1873 void addArrows(
WindowBlock *window, uint8 num)
override;
1874 void removeArrows(
WindowBlock *window, uint num)
override;
1876 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1878 bool loadTablesIntoMem(uint16 subrId)
override;
1880 void moveDirn(
Item *i, uint x)
override;
1882 bool confirmOverWrite(
WindowBlock *window)
override;
1890 static const int SIMON1_GMF_SIZE[];
1896 void setupGame()
override;
1897 void setupOpcodes()
override;
1898 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1900 void executeOpcode(
int opcode)
override;
1902 void vc22_setPalette()
override;
1906 void os1_pauseGame();
1907 void os1_screenTextBox();
1908 void os1_screenTextMsg();
1909 void os1_playEffect();
1910 void os1_screenTextPObj();
1911 void os1_getPathPosn();
1912 void os1_scnTxtLongText();
1914 void os1_mouseOff();
1915 void os1_loadBeard();
1916 void os1_unloadBeard();
1917 void os1_unloadZone();
1918 void os1_loadStrings();
1919 void os1_unfreezeZones();
1920 void os1_specialFade();
1925 OpcodeProcSimon1 proc;
1935 void dumpVgaFile(
const byte *vga)
override;
1938 bool _simonAcornFloppyDemoPaletteLoaded =
false;
1939 void patchSimonAcornFloppyDemoPalettes();
1941 void clearName()
override;
1943 void handleMouseWheelUp()
override;
1944 void handleMouseWheelDown()
override;
1946 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
1948 void initMouse()
override;
1949 void handleMouseMoved()
override;
1951 void addArrows(
WindowBlock *window, uint8 num)
override;
1952 void removeArrows(
WindowBlock *window, uint num)
override;
1954 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
1956 virtual void playSpeech(uint16 speechId, uint16 vgaSpriteId);
1958 void listSaveGames()
override;
1959 void userGame(
bool load)
override;
1960 int userGameGetKey(
bool *b, uint maxChar)
override;
1962 void playMusic(uint16 music, uint16 track)
override;
1963 void playMidiSfx(uint16 sound)
override;
1965 void vcStopAnimation(uint16 zone, uint16 sprite)
override;
1975 void setupGame()
override;
1976 void setupOpcodes()
override;
1977 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
1979 void executeOpcode(
int opcode)
override;
1981 void os2_printLongText();
1984 void os2_stopAnimate();
1985 void os2_playTune();
1986 void os2_screenTextPObj();
1988 void os2_mouseOff();
1989 void os2_isShortText();
1990 void os2_clearMarks();
1991 void os2_waitMark();
1996 OpcodeProcSimon2 proc;
2002 void clearName()
override;
2004 void drawIcon(
WindowBlock *window, uint icon, uint x, uint y)
override;
2006 void addArrows(
WindowBlock *window, uint8 num)
override;
2007 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
2009 void clearVideoWindow(uint16 windowNum, uint16 color)
override;
2011 void playSpeech(uint16 speechId, uint16 vgaSpriteId)
override;
2015 void playMusic(uint16 music, uint16 track)
override;
2024 ~AGOSEngine_Feeble()
override;
2026 void setupGame()
override;
2027 void setupOpcodes()
override;
2028 void setupVideoOpcodes(VgaOpcodeProc *op)
override;
2030 void executeOpcode(
int opcode)
override;
2032 void vc36_setWindowImage()
override;
2033 void vc48_setPathFinder()
override;
2037 void off_addTextBox();
2038 void off_printLongText();
2040 void off_oracleTextDown();
2041 void off_oracleTextUp();
2044 void off_saveUserGame();
2045 void off_loadUserGame();
2046 void off_listSaveGames();
2048 void off_screenTextBox();
2050 void off_isAdjNoun();
2051 void off_hyperLinkOn();
2052 void off_hyperLinkOff();
2053 void off_checkPaths();
2054 void off_screenTextPObj();
2056 void off_mouseOff();
2057 void off_loadVideo();
2058 void off_playVideo();
2059 void off_centerScroll();
2060 void off_resetPVCount();
2061 void off_setPathValues();
2062 void off_stopClock();
2063 void off_restartClock();
2064 void off_setColor();
2068 void off_b3NotZero();
2071 friend class MoviePlayer;
2072 friend class MoviePlayerDXA;
2073 friend class MoviePlayerSMK;
2075 typedef void (AGOSEngine_Feeble::*OpcodeProcFeeble) ();
2076 struct OpcodeEntryFeeble {
2077 OpcodeProcFeeble proc;
2081 const OpcodeEntryFeeble *_opcodesFeeble;
2083 MoviePlayer *_moviePlayer;
2085 uint8 _interactiveVideo;
2086 uint16 _vgaCurSpritePriority;
2088 uint16 to16Wrapper(uint value)
override;
2089 uint16 readUint16Wrapper(
const void *src)
override;
2090 uint32 readUint32Wrapper(
const void *src)
override;
2092 void setLoyaltyRating(byte rating);
2094 void playVideo(
const char *filename,
bool lastSceneUsed =
false);
2095 void stopInteractiveVideo();
2098 void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
2100 void handleMouseWheelUp()
override;
2101 void handleMouseWheelDown()
override;
2103 void drawMousePart(
int image, byte x, byte y);
2104 void initMouse()
override;
2105 void drawMousePointer()
override;
2107 void animateSprites()
override;
2108 void animateSpritesByY();
2111 void swapCharacterLogo();
2112 void timerProc()
override;
2114 void addArrows(
WindowBlock *window, uint8 num)
override;
2115 uint setupIconHitArea(
WindowBlock *window, uint num, uint x, uint y,
Item *itemPtr)
override;
2117 void resetVerbs()
override;
2118 void setVerb(
HitArea * ha)
override;
2119 void hitarea_leave(
HitArea * ha,
bool state =
false)
override;
2120 void invertBox(
HitArea *ha,
bool state);
2123 void windowDrawChar(
WindowBlock *window, uint x, uint y, byte chr)
override;
2125 void clearName()
override;
2127 void drawIconArray(uint i,
Item *itemPtr,
int line,
int classMask)
override;
2131 void dumpVgaFile(
const byte *vga)
override;
2133 void doOutput(
const byte *src, uint len)
override;
2135 void printScreenText(uint vgaSpriteId, uint color,
const char *stringPtr, int16 x, int16 y, int16 width)
override;
2137 void printInteractText(uint16 num,
const char *
string);
2138 void sendInteractText(uint16 num, MSVC_PRINTF
const char *fmt, ...)
GCC_PRINTF(3, 4);
2140 void checkLinkBox();
2141 void hyperLinkOn(uint16 x);
2142 void hyperLinkOff();
2146 void runSubroutine101()
override;
2153 void oracleTextUp();
2154 void oracleTextDown();
2155 void scrollOracle();
2156 void scrollOracleUp();
2157 void scrollOracleDown();
2159 void listSaveGamesFeeble();
2160 void saveUserGame(
int slot);
2164 void quickLoadOrSave()
override;
2167 class AGOSEngine_FeebleDemo :
public AGOSEngine_Feeble {
2176 void initMouse()
override;
2177 void drawMousePointer()
override;
2182 void handleWobble();
2184 void startInteractiveVideo(
const char *filename);
2185 void waitForSpace();
2188 class AGOSEngine_PuzzlePack :
public AGOSEngine_Feeble {
2193 void setupGame()
override;
2194 void setupOpcodes()
override;
2196 void executeOpcode(
int opcode)
override;
2198 void vc3_loadSprite()
override;
2199 void vc63_fastFadeIn()
override;
2201 void opp_iconifyWindow();
2202 void opp_restoreOopsPosition();
2203 void opp_loadMouseImage();
2205 void opp_setShortText();
2206 void opp_loadHiScores();
2207 void opp_checkHiScores();
2209 void opp_saveUserGame();
2210 void opp_loadUserGame();
2211 void opp_playTune();
2212 void opp_saveOopsPosition();
2213 void opp_resetGameTime();
2214 void opp_resetPVCount();
2215 void opp_setPathValues();
2216 void opp_pauseClock();
2219 typedef void (AGOSEngine_PuzzlePack::*OpcodeProcPuzzlePack) ();
2220 struct OpcodeEntryPuzzlePack {
2221 OpcodeProcPuzzlePack proc;
2225 const OpcodeEntryPuzzlePack *_opcodesPuzzlePack;
2230 void initMouse()
override;
2231 void handleMouseMoved()
override;
2232 void drawMousePointer()
override;
2234 void resetVerbs()
override;
2236 void loadMouseImage();
2238 void startOverlayAnims();
2239 void startAnOverlayAnim();
2241 void printInfoText(
const char *itemText);
2247 class AGOSEngine_DIMP :
public AGOSEngine_PuzzlePack {
2252 void setupOpcodes()
override;
2254 void executeOpcode(
int opcode)
override;
2257 typedef void (AGOSEngine_DIMP::*OpcodeProcDIMP) ();
2258 struct OpcodeEntryDIMP {
2259 OpcodeProcDIMP proc;
2263 const OpcodeEntryDIMP *_opcodesDIMP;
2265 int16 _iconToggleCount, _voiceCount;
2266 uint32 _lastTickCount;
2267 uint32 _startSecondCount, _tSecondCount;
2269 void odp_saveUserGame();
2270 void odp_loadUserGame();
2273 void timerProc()
override;
Definition: elvira_atarist.h:37
EngineFeature
Definition: engine.h:258
ErrorCode getCode() const
Definition: error.h:112
No error occurred.
Definition: error.h:48
int tagOfParentDoline
tag of the doline "instance" to which this StackFrame belongs
Definition: agos.h:1474
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:1481
Common::Error run() override
Definition: agos.h:253
Language
Definition: language.h:45