aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel/pcode.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2012-07-15 20:58:14 +1000
committerPaul Gilbert2012-07-15 20:58:14 +1000
commit212551fe4e98ac7d16cdac317b5c87be3190ab18 (patch)
tree75cc8ab07e8a9bf56b545473514bf1299ca51350 /engines/tinsel/pcode.cpp
parent2f08f95e117dbeb3d4b0e431e73a1a49c9809f23 (diff)
downloadscummvm-rg350-212551fe4e98ac7d16cdac317b5c87be3190ab18.tar.gz
scummvm-rg350-212551fe4e98ac7d16cdac317b5c87be3190ab18.tar.bz2
scummvm-rg350-212551fe4e98ac7d16cdac317b5c87be3190ab18.zip
TINSEL: Added script workaround for #3543624 - DW1 PSX demo idle animation
Diffstat (limited to 'engines/tinsel/pcode.cpp')
-rw-r--r--engines/tinsel/pcode.cpp43
1 files changed, 28 insertions, 15 deletions
diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp
index 60f04b47fd..6ea18c8268 100644
--- a/engines/tinsel/pcode.cpp
+++ b/engines/tinsel/pcode.cpp
@@ -122,6 +122,8 @@ static uint32 g_hMasterScript;
struct WorkaroundEntry {
TinselEngineVersion version; ///< Engine version this workaround applies to
bool scnFlag; ///< Only applicable for Tinsel 1 (DW 1)
+ bool isDemo; ///< Flags whether it's for a demo
+ Common::Platform platform; ///< Platform filter
SCNHANDLE hCode; ///< Script to apply fragment to
int ip; ///< Script offset to run this fragment before
int numBytes; ///< Number of bytes in the script
@@ -129,6 +131,7 @@ struct WorkaroundEntry {
};
#define FRAGMENT_WORD(x) (byte)(x & 0xFF), (byte)(x >> 8)
+#define FRAGMENT_DWORD(x) (byte)(x & 0xFF), (byte)(x >> 8), (byte)(x >> 16), (byte)(x >> 24)
static const byte fragment1[] = {OP_ZERO, OP_GSTORE | OPSIZE16, 206, 0};
static const byte fragment2[] = {OP_LIBCALL | OPSIZE8, 110};
@@ -149,6 +152,10 @@ static const byte fragment12[] = {OP_JMPTRUE | OPSIZE16, FRAGMENT_WORD(1491),
OP_IMM | OPSIZE16, FRAGMENT_WORD(322), OP_LIBCALL | OPSIZE8, 46, // Give back the whistle
OP_JUMP | OPSIZE16, FRAGMENT_WORD(1568)};
static const byte fragment13[] = {OP_ZERO, OP_GSTORE | OPSIZE16, FRAGMENT_WORD(306)};
+static const byte fragment14[] = {OP_LIBCALL | OPSIZE8, 58,
+ OP_IMM, FRAGMENT_DWORD((42 << 23)), OP_ONE, OP_ZERO, OP_LIBCALL | OPSIZE8, 44,
+ OP_LIBCALL | OPSIZE8, 97, OP_JUMP | OPSIZE16, FRAGMENT_WORD(2220)
+};
#undef FRAGMENT_WORD
@@ -157,7 +164,7 @@ const WorkaroundEntry workaroundList[] = {
// book back to the present. In the GRA version, it was global 373,
// and was reset when he is returned to the past, but was forgotten
// in the SCN version, so this ensures the flag is properly reset.
- {TINSEL_V1, true, 427942095, 1, sizeof(fragment1), fragment1},
+ {TINSEL_V1, true, false, Common::kPlatformUnknown, 427942095, 1, sizeof(fragment1), fragment1},
// DW1-GRA: Rincewind exiting the Inn is blocked by the luggage.
// Whilst you can then move into walkable areas, saving and
@@ -165,26 +172,26 @@ const WorkaroundEntry workaroundList[] = {
// fragment turns off NPC blocking for the Outside Inn rooms so that
// the luggage won't block Past Outside Inn.
// See bug report #2525010.
- {TINSEL_V1, false, 444622076, 0, sizeof(fragment2), fragment2},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 444622076, 0, sizeof(fragment2), fragment2},
// Present Outside Inn
- {TINSEL_V1, false, 352600876, 0, sizeof(fragment2), fragment2},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 352600876, 0, sizeof(fragment2), fragment2},
// DW1-GRA: Talking to palace guards in Act 2 gives !!!HIGH
// STRING||| - this happens if you initiate dialog with one of the
// guards, but not the other. So these fragments provide the correct
// talk parameters where needed.
// See bug report #2831159.
- {TINSEL_V1, false, 310506872, 463, sizeof(fragment4), fragment4},
- {TINSEL_V1, false, 310506872, 485, sizeof(fragment5), fragment5},
- {TINSEL_V1, false, 310506872, 513, sizeof(fragment6), fragment6},
- {TINSEL_V1, false, 310506872, 613, sizeof(fragment7), fragment7},
- {TINSEL_V1, false, 310506872, 641, sizeof(fragment8), fragment8},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 463, sizeof(fragment4), fragment4},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 485, sizeof(fragment5), fragment5},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 513, sizeof(fragment6), fragment6},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 613, sizeof(fragment7), fragment7},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 310506872, 641, sizeof(fragment8), fragment8},
// DW1-SCN: The script for the lovable street-Starfish does a
// 'StopSample' after flicking the coin to ensure it's sound is
// stopped, but which also accidentally can stop any active
// conversation with the Amazon.
- {TINSEL_V1, true, 394640351, 121, sizeof(fragment9), fragment9},
+ {TINSEL_V1, true, false, Common::kPlatformUnknown, 394640351, 121, sizeof(fragment9), fragment9},
// DW2: In the garden, global #490 is set when the bees begin their
// 'out of hive' animation, and reset when done. But if the game is
@@ -197,25 +204,29 @@ const WorkaroundEntry workaroundList[] = {
// * Stealing the mallets from the wizards (bug #2820788).
// This fix ensures that the global is reset when the Garden scene
// is loaded (both entering and restoring a game).
- {TINSEL_V2, true, 2888147476U, 0, sizeof(fragment3), fragment3},
+ {TINSEL_V2, true, false, Common::kPlatformUnknown, 2888147476U, 0, sizeof(fragment3), fragment3},
// DW1-GRA: Corrects text being drawn partially off-screen during
// the blackboard description of the Librarian.
- {TINSEL_V1, false, 293831402, 133, sizeof(fragment10), fragment10},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 293831402, 133, sizeof(fragment10), fragment10},
// DW1-GRA/SCN: Corrects the dead-end of being able to give the
// whistle back to the pirate before giving him the parrot.
// See bug report #2934211.
- {TINSEL_V1, true, 352601285, 1569, sizeof(fragment11), fragment11},
- {TINSEL_V1, false, 352602304, 1488, sizeof(fragment12), fragment12},
+ {TINSEL_V1, true, false, Common::kPlatformUnknown, 352601285, 1569, sizeof(fragment11), fragment11},
+ {TINSEL_V1, false, false, Common::kPlatformUnknown, 352602304, 1488, sizeof(fragment12), fragment12},
// DW2: Corrects a bug with global 306 not being cleared if you leave
// the marketplace scene whilst D'Blah is talking (even if it's not
// actually audible); returning to the scene and clicking on him multiple
// times would cause the game to crash
- {TINSEL_V2, true, 1109294728, 0, sizeof(fragment13), fragment13},
+ {TINSEL_V2, true, false, Common::kPlatformUnknown, 1109294728, 0, sizeof(fragment13), fragment13},
+
+ // DW1 PSX DEMO: Alters a script in the PSX DW1 demo to show the Idle animation scene rather than
+ // quitting the game when no user input happens for a while
+ {TINSEL_V1, true, true, Common::kPlatformPSX, 0, 2186, sizeof(fragment14), fragment14},
- {TINSEL_V0, false, 0, 0, 0, NULL}
+ {TINSEL_V0, false, false, Common::kPlatformUnknown, 0, 0, 0, NULL}
};
//----------------- LOCAL GLOBAL DATA --------------------
@@ -582,6 +593,8 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
if ((wkEntry->version == TinselVersion) &&
(wkEntry->hCode == ic->hCode) &&
(wkEntry->ip == ip) &&
+ (wkEntry->isDemo == _vm->getIsADGFDemo()) &&
+ ((wkEntry->platform == Common::kPlatformUnknown) || (wkEntry->platform == _vm->getPlatform())) &&
(!TinselV1 || (wkEntry->scnFlag == ((_vm->getFeatures() & GF_SCNFILES) != 0)))) {
// Point to start of workaround fragment
ip = 0;