diff options
author | Martin Kiewitz | 2010-07-18 13:08:47 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-07-18 13:08:47 +0000 |
commit | 4595b8818a862649d244687e57f15d0cce7d48c0 (patch) | |
tree | ec99a7f1c83c9349bb5fbf20cd752e285cde6a9b | |
parent | 70dfcdfb54707b95b115fbb60e86cd841cc42ffe (diff) | |
download | scummvm-rg350-4595b8818a862649d244687e57f15d0cce7d48c0.tar.gz scummvm-rg350-4595b8818a862649d244687e57f15d0cce7d48c0.tar.bz2 scummvm-rg350-4595b8818a862649d244687e57f15d0cce7d48c0.zip |
SCI: adding room numbers to all workarounds
svn-id: r50990
-rw-r--r-- | engines/sci/engine/kernel.cpp | 50 | ||||
-rw-r--r-- | engines/sci/engine/kernel.h | 3 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 80 |
3 files changed, 68 insertions, 65 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index fd98f9c34d..1b4eca1edd 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -221,65 +221,65 @@ reg_t kDummy(EngineState *s, int argc, reg_t *argv) { // i* -> optional multiple integers // .* -> any parameters afterwards (or none) -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry kAbs_workarounds[] = { - { GID_HOYLE1, 1, 0, "room1", "doit", -1, 0, { 2, 0x3e9 } }, // crazy eights - called with objects instead of integers - { GID_HOYLE1, 2, 0, "room2", "doit", -1, 0, { 2, 0x3e9 } }, // old maid - called with objects instead of integers - { GID_HOYLE1, 3, 0, "room3", "doit", -1, 0, { 2, 0x3e9 } }, // hearts - called with objects instead of integers + { GID_HOYLE1, 1, 1, 0, "room1", "doit", -1, 0, { 2, 0x3e9 } }, // crazy eights - called with objects instead of integers + { GID_HOYLE1, 2, 2, 0, "room2", "doit", -1, 0, { 2, 0x3e9 } }, // old maid - called with objects instead of integers + { GID_HOYLE1, 3, 3, 0, "room3", "doit", -1, 0, { 2, 0x3e9 } }, // hearts - called with objects instead of integers SCI_WORKAROUNDENTRY_TERMINATOR }; -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry kDisposeScript_workarounds[] = { - { GID_QFG1, 64, 0, "rm64", "dispose", -1, 0, { 1, 0 } }, // when leaving graveyard, parameter 0 is an object + { GID_QFG1, 64, 64, 0, "rm64", "dispose", -1, 0, { 1, 0 } }, // when leaving graveyard, parameter 0 is an object SCI_WORKAROUNDENTRY_TERMINATOR }; -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry kDoSoundFade_workarounds[] = { - { GID_KQ6, 989, 0, "globalSound", "fade", -1, 0, { 0, 0 } }, // during intro, parameter 4 is an object + { GID_KQ6, 105, 989, 0, "globalSound", "fade", -1, 0, { 0, 0 } }, // floppy: during intro, parameter 4 is an object SCI_WORKAROUNDENTRY_TERMINATOR }; -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry kGraphRestoreBox_workarounds[] = { - { GID_LSL6, 85, 0, "rScroller", "hide", -1, 0, { 0, 0 } }, // happens when restoring (sometimes), same as the one below - { GID_LSL6, 85, 0, "lScroller", "hide", -1, 0, { 0, 0 } }, // happens when restoring (sometimes), same as the one below - { GID_LSL6, 86, 0, "LL6Inv", "show", -1, 0, { 0, 0 } }, // happens when restoring, is called with hunk segment, but hunk is not allocated at that time + { GID_LSL6, -1, 85, 0, "rScroller", "hide", -1, 0, { 0, 0 } }, // happens when restoring (sometimes), same as the one below + { GID_LSL6, -1, 85, 0, "lScroller", "hide", -1, 0, { 0, 0 } }, // happens when restoring (sometimes), same as the one below + { GID_LSL6, -1, 86, 0, "LL6Inv", "show", -1, 0, { 0, 0 } }, // happens when restoring, is called with hunk segment, but hunk is not allocated at that time // ^^ TODO: check, if this is really a script error or an issue with our restore code - { GID_LSL6, 86, 0, "LL6Inv", "hide", -1, 0, { 0, 0 } }, // happens during the game, gets called with 1 extra parameter + { GID_LSL6, -1, 86, 0, "LL6Inv", "hide", -1, 0, { 0, 0 } }, // happens during the game, gets called with 1 extra parameter SCI_WORKAROUNDENTRY_TERMINATOR }; -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry kGraphFillBoxForeground_workarounds[] = { - { GID_LSL6, 0, 0, "LSL6", "hideControls", -1, 0, { 0, 0 } }, // happens when giving the bungee key to merrily - gets called with additional 5th parameter + { GID_LSL6, 240, 0, 0, "LSL6", "hideControls", -1, 0, { 0, 0 } }, // happens when giving the bungee key to merrily - gets called with additional 5th parameter SCI_WORKAROUNDENTRY_TERMINATOR }; -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry kGraphFillBoxAny_workarounds[] = { - { GID_SQ4, 818, 0, "iconTextSwitch", "show", -1, 0, { 0, 0 } }, // game menu "text/speech" display - parameter 5 is missing, but the right color number is on the stack + { GID_SQ4, -1, 818, 0, "iconTextSwitch", "show", -1, 0, { 0, 0 } }, // game menu "text/speech" display - parameter 5 is missing, but the right color number is on the stack SCI_WORKAROUNDENTRY_TERMINATOR }; -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry kSetPort_workarounds[] = { - { GID_LSL6, 740, 0, "rm740", "drawPic", -1, 0, { 1, 0 } }, // ending scene, is called with additional 3 (!) parameters + { GID_LSL6, 740, 740, 0, "rm740", "drawPic", -1, 0, { 1, 0 } }, // ending scene, is called with additional 3 (!) parameters SCI_WORKAROUNDENTRY_TERMINATOR }; -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry kUnLoad_workarounds[] = { - { GID_LSL6, 130, 0, "recruitLarryScr", "changeState", -1, 0, { 1, 0 } }, // during intro, a 3rd parameter is passed by accident - { GID_LSL6, 740, 0, "showCartoon", "changeState", -1, 0, { 1, 0 } }, // during ending, 4 additional parameters are passed by accident - { GID_SQ1, 303, 0, "slotGuy", "dispose", -1, 0, { 1, 0 } }, // when leaving ulence flats bar, parameter 1 is not passed - script error + { GID_LSL6, 130, 130, 0, "recruitLarryScr", "changeState", -1, 0, { 1, 0 } }, // during intro, a 3rd parameter is passed by accident + { GID_LSL6, 740, 740, 0, "showCartoon", "changeState", -1, 0, { 1, 0 } }, // during ending, 4 additional parameters are passed by accident + { GID_SQ1, 43, 303, 0, "slotGuy", "dispose", -1, 0, { 1, 0 } }, // when leaving ulence flats bar, parameter 1 is not passed - script error SCI_WORKAROUNDENTRY_TERMINATOR }; -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry kStrCpy_workarounds[] = { - { GID_ISLANDBRAIN, 45, 0, "aWord", "addOn", -1, 0, { 0, 0 } }, // Hominy Homonym puzzle, room 260 + { GID_ISLANDBRAIN, 260, 45, 0, "aWord", "addOn", -1, 0, { 0, 0 } }, // Hominy Homonym puzzle SCI_WORKAROUNDENTRY_TERMINATOR }; diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index aab7a9bd26..81106625bf 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -122,6 +122,7 @@ typedef reg_t KernelFunctionCall(EngineState *s, int argc, reg_t *argv); struct SciWorkaroundEntry { SciGameId gameId; + int roomNr; int scriptNr; int16 inheritanceLevel; const char *objectName; @@ -131,7 +132,7 @@ struct SciWorkaroundEntry { reg_t newValue; }; -#define SCI_WORKAROUNDENTRY_TERMINATOR { (SciGameId)0, -1, 0, NULL, NULL, -1, 0, { 0, 0 } } +#define SCI_WORKAROUNDENTRY_TERMINATOR { (SciGameId)0, -1, -1, 0, NULL, NULL, -1, 0, { 0, 0 } } struct KernelSubFunction { KernelFunctionCall *function; diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 9d72562d03..83c204bbfa 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -292,6 +292,7 @@ static reg_t trackOriginAndFindWorkaround(int index, const SciWorkaroundEntry *w Common::String curObjectName = state->_segMan->getObjectName(lastCall->sendp); Common::String curMethodName; const SciGameId gameId = g_sci->getGameId(); + const int curRoomNumber = state->currentRoomNumber(); if (lastCall->type == EXEC_STACK_TYPE_CALL) { if (lastCall->debugSelector != -1) { @@ -312,6 +313,7 @@ static reg_t trackOriginAndFindWorkaround(int index, const SciWorkaroundEntry *w workaround = workaroundList; while (workaround->objectName) { if (workaround->gameId == gameId && workaround->scriptNr == curScriptNr + && ((workaround->roomNr == -1) || (workaround->roomNr == curRoomNumber)) && ((workaround->inheritanceLevel == -1) || (workaround->inheritanceLevel == inheritanceLevel)) && (workaround->objectName == searchObjectName) && workaround->methodName == curMethodName && workaround->localCallOffset == lastCall->debugLocalCallOffset @@ -352,15 +354,15 @@ static bool validate_signedInteger(reg_t reg, int16 &integer) { return true; } -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry opcodeDivWorkarounds[] = { - { GID_QFG1VGA, 928, 0, "Blink", "init", -1, 0, { 0, 0 } }, // when entering inn, gets called with 1 parameter, but 2nd parameter is used for div which happens to be an object + { GID_QFG1VGA, 301, 928, 0, "Blink", "init", -1, 0, { 0, 0 } }, // when entering inn, gets called with 1 parameter, but 2nd parameter is used for div which happens to be an object SCI_WORKAROUNDENTRY_TERMINATOR }; -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry opcodeDptoaWorkarounds[] = { - { GID_LSL6, 938, 0, "ROsc", "cycleDone", -1, 0, { 0, 1 } }, // when looking through tile in the shower room initial cycles get set to an object instead of 2, we fix this by setting 1 after decrease + { GID_LSL6, 360, 938, 0, "ROsc", "cycleDone", -1, 0, { 0, 1 } }, // when looking through tile in the shower room initial cycles get set to an object instead of 2, we fix this by setting 1 after decrease SCI_WORKAROUNDENTRY_TERMINATOR }; @@ -374,42 +376,42 @@ static reg_t arithmetic_lookForWorkaround(const byte opcode, const SciWorkaround return workaroundValue; } -// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +// gameID, room,script,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry uninitializedReadWorkarounds[] = { - { GID_FREDDYPHARKAS, 24, 0, "gcWin", "open", -1, 5, { 0, 0xf } }, // is used as priority for game menu - { GID_FREDDYPHARKAS, 31, 0, "quitWin", "open", -1, 5, { 0, 0xf } }, // is used as priority for game menu - { GID_GK1, 64950, 1, "Feature", "handleEvent", -1, 0, { 0, 0 } }, // sometimes when walk-clicking - { GID_GK2, 11, 0, "", "export 10", -1, 3, { 0, 0 } }, // called when the game starts - { GID_HOYLE3, 0, 1, "Character", "say", -1, 504, { 0, 0 } }, // when starting checkers, first time a character says something - { GID_HOYLE3, 0, 1, "Character", "say", -1, 505, { 0, 0 } }, // when starting checkers, first time a character says something - { GID_HOYLE3, 700, 0, "gcWindow", "open", -1, -1, { 0, 0 } }, // when entering control menu - { GID_ISLANDBRAIN, 140, 0, "piece", "init", -1, 3, { 0, 1 } }, // first puzzle right at the start, some initialization variable. bnt is done on it, and it should be non-0 - { GID_ISLANDBRAIN, 268, 0, "anElement", "select", -1, 0, { 0, 0 } }, // elements puzzle, gets used before super TextIcon - { GID_JONES, 232, 0, "weekendText", "draw", 0x3d3, 0, { 0, 0 } }, // jones/cd only - gets called during the game - { GID_JONES, 255, 0, "", "export 0", -1, 13, { 0, 0 } }, // jones/ega&vga only - called when the game starts - { GID_JONES, 255, 0, "", "export 0", -1, 14, { 0, 0 } }, // jones/ega&vga only - called when the game starts - { GID_KQ5, 0, 0, "", "export 29", -1, 3, { 0, 0 } }, // called when playing harp for the harpies, is used for kDoAudio - { GID_KQ5, 25, 0, "rm025", "doit", -1, 0, { 0, 0 } }, // inside witch forest, where the walking rock is - { GID_KQ6, 30, 0, "rats", "changeState", -1, 0, { 0, 0 } }, // rats in the catacombs - { GID_KQ6, 500, 0, "rm500", "init", -1, 0, { 0, 0 } }, // going to island of the beast - { GID_KQ6, 520, 0, "rm520", "init", -1, 0, { 0, 0 } }, // going to boiling water trap on beast isle - { GID_KQ6, 903, 0, "controlWin", "open", -1, 4, { 0, 0 } }, // when opening the controls window (save, load etc) - { GID_LAURABOW2, 24, 0, "gcWin", "open", -1, 5, { 0, 0xf } }, // is used as priority for game menu - { GID_LSL1, 250, 0, "increase", "handleEvent", -1, 2, { 0, 0 } }, // casino, playing game, increasing bet - { GID_LSL1, 720, 0, "rm720", "init", -1, 0, { 0, 0 } }, // age check room - { GID_LSL3, 340, 0, "ComicScript", "changeState", -1, 200, { 0, 0 } }, // right after entering the 3 ethnic groups inside comedy club - { GID_LSL3, 340, 0, "ComicScript", "changeState", -1, 201, { 0, 0 } }, // see above - { GID_LSL3, 340, 0, "ComicScript", "changeState", -1, 202, { 0, 0 } }, // see above - { GID_LSL3, 340, 0, "ComicScript", "changeState", -1, 203, { 0, 0 } }, // see above - { GID_LSL3, 997, 0, "TheMenuBar", "handleEvent", -1, 1, { 0, 0xf } }, // when setting volume the first time, this temp is used to set volume on entry (normally it would have been initialized to 's') - { GID_LSL6, 85, 0, "washcloth", "doVerb", -1, 0, { 0, 0 } }, // washcloth in inventory - { GID_LSL6, 928, -1, "Narrator", "startText", -1, 0, { 0, 0 } }, // used by various objects that are even translated in foreign versions, that's why we use the base-class - { GID_QFG2, 71, 0, "theInvSheet", "doit", -1, 1, { 0, 0 } }, // accessing the inventory - { GID_SQ1, 703, 0, "", "export 1", -1, 0, { 0, 0 } }, // sub that's called from several objects while on sarien battle cruiser - { GID_SQ1, 703, 0, "firePulsar", "changeState", 0x18a, 0, { 0, 0 } }, // export 1, but called locally (when shooting at aliens) - { GID_SQ4, 928, 0, "Narrator", "startText", -1, 1000, { 0, 1 } }, // sq4cd: method returns this to the caller - { GID_SQ6, 0, 0, "SQ6", "init", -1, 2, { 0, 0 } }, // called when the game starts - { GID_SQ6, 64950, 0, "View", "handleEvent", -1, 0, { 0, 0 } }, // called when pressing "Start game" in the main menu + { GID_FREDDYPHARKAS, -1, 24, 0, "gcWin", "open", -1, 5, { 0, 0xf } }, // is used as priority for game menu + { GID_FREDDYPHARKAS, -1, 31, 0, "quitWin", "open", -1, 5, { 0, 0xf } }, // is used as priority for game menu + { GID_GK1, -1, 64950, 1, "Feature", "handleEvent", -1, 0, { 0, 0 } }, // sometimes when walk-clicking + { GID_GK2, 34, 11, 0, "", "export 10", -1, 3, { 0, 0 } }, // called when the game starts + { GID_HOYLE3, 200, 0, 1, "Character", "say", -1, 504, { 0, 0 } }, // when starting checkers, first time a character says something + { GID_HOYLE3, 200, 0, 1, "Character", "say", -1, 505, { 0, 0 } }, // when starting checkers, first time a character says something + { GID_HOYLE3, -1, 700, 0, "gcWindow", "open", -1, -1, { 0, 0 } }, // when entering control menu + { GID_ISLANDBRAIN, 140, 140, 0, "piece", "init", -1, 3, { 0, 1 } }, // first puzzle right at the start, some initialization variable. bnt is done on it, and it should be non-0 + { GID_ISLANDBRAIN, 200, 268, 0, "anElement", "select", -1, 0, { 0, 0 } }, // elements puzzle, gets used before super TextIcon + { GID_JONES, 1, 232, 0, "weekendText", "draw", 0x3d3, 0, { 0, 0 } }, // jones/cd only - gets called during the game + { GID_JONES, 764, 255, 0, "", "export 0", -1, 13, { 0, 0 } }, // jones/ega&vga only - called when the game starts + { GID_JONES, 764, 255, 0, "", "export 0", -1, 14, { 0, 0 } }, // jones/ega&vga only - called when the game starts + { GID_KQ5, 90, 0, 0, "", "export 29", -1, 3, { 0, 0 } }, // called when playing harp for the harpies, is used for kDoAudio + { GID_KQ5, 25, 25, 0, "rm025", "doit", -1, 0, { 0, 0 } }, // inside witch forest, when going to the room where the walking rock is + { GID_KQ6, 30, 30, 0, "rats", "changeState", -1, 0, { 0, 0 } }, // rats in the catacombs + { GID_KQ6, 500, 500, 0, "rm500", "init", -1, 0, { 0, 0 } }, // going to island of the beast + { GID_KQ6, 520, 520, 0, "rm520", "init", -1, 0, { 0, 0 } }, // going to boiling water trap on beast isle + { GID_KQ6, -1, 903, 0, "controlWin", "open", -1, 4, { 0, 0 } }, // when opening the controls window (save, load etc) + { GID_LAURABOW2, -1, 24, 0, "gcWin", "open", -1, 5, { 0, 0xf } }, // is used as priority for game menu + { GID_LSL1, 250, 250, 0, "increase", "handleEvent", -1, 2, { 0, 0 } }, // casino, playing game, increasing bet + { GID_LSL1, 720, 720, 0, "rm720", "init", -1, 0, { 0, 0 } }, // age check room + { GID_LSL3, 340, 340, 0, "ComicScript", "changeState", -1, 200, { 0, 0 } }, // right after entering the 3 ethnic groups inside comedy club + { GID_LSL3, 340, 340, 0, "ComicScript", "changeState", -1, 201, { 0, 0 } }, // see above + { GID_LSL3, 340, 340, 0, "ComicScript", "changeState", -1, 202, { 0, 0 } }, // see above + { GID_LSL3, 340, 340, 0, "ComicScript", "changeState", -1, 203, { 0, 0 } }, // see above + { GID_LSL3, -1, 997, 0, "TheMenuBar", "handleEvent", -1, 1, { 0, 0xf } }, // when setting volume the first time, this temp is used to set volume on entry (normally it would have been initialized to 's') + { GID_LSL6, -1, 85, 0, "washcloth", "doVerb", -1, 0, { 0, 0 } }, // washcloth in inventory + { GID_LSL6, -1, 928, -1, "Narrator", "startText", -1, 0, { 0, 0 } }, // used by various objects that are even translated in foreign versions, that's why we use the base-class + { GID_QFG2, -1, 71, 0, "theInvSheet", "doit", -1, 1, { 0, 0 } }, // accessing the inventory + { GID_SQ1, -1, 703, 0, "", "export 1", -1, 0, { 0, 0 } }, // sub that's called from several objects while on sarien battle cruiser + { GID_SQ1, -1, 703, 0, "firePulsar", "changeState", 0x18a, 0, { 0, 0 } }, // export 1, but called locally (when shooting at aliens) + { GID_SQ4, -1, 928, 0, "Narrator", "startText", -1, 1000, { 0, 1 } }, // sq4cd: method returns this to the caller + { GID_SQ6, 100, 0, 0, "SQ6", "init", -1, 2, { 0, 0 } }, // called when the game starts + { GID_SQ6, 100, 64950, 0, "View", "handleEvent", -1, 0, { 0, 0 } }, // called when pressing "Start game" in the main menu SCI_WORKAROUNDENTRY_TERMINATOR }; |