[Scummvm-cvs-logs] scummvm master -> e273a387a71944fb6c9ec735114c5c5774109761

wjp wjp at usecode.org
Fri Apr 19 23:52:02 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e273a387a7 SCI: Replace workaround for bug #3605269 by script patch


Commit: e273a387a71944fb6c9ec735114c5c5774109761
    https://github.com/scummvm/scummvm/commit/e273a387a71944fb6c9ec735114c5c5774109761
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2013-04-19T14:50:04-07:00

Commit Message:
SCI: Replace workaround for bug #3605269 by script patch

Changed paths:
    engines/sci/engine/script_patches.cpp
    engines/sci/sound/soundcmd.cpp



diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index c928cf3..5273ed3 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -23,6 +23,7 @@
 #include "sci/sci.h"
 #include "sci/engine/script.h"
 #include "sci/engine/state.h"
+#include "sci/engine/features.h"
 
 #include "common/util.h"
 
@@ -590,6 +591,34 @@ const uint16 kq5PatchWitchCageInit[] = {
 	PATCH_END
 };
 
+
+// In the final battle, the DOS version uses signals in the music to handle
+// timing, while in the Windows version another method is used and the GM
+// tracks do not contain these signals.
+// The original kq5 interpreter used global 400 to distinguish between
+// Windows (1) and DOS (0) versions.
+// We replace the 4 relevant checks for global 400 by a fixed true when
+// we use these GM tracks.
+//
+// Instead, we could have set global 400, but this has the possibly unwanted
+// side effects of switching to black&white cursors (which also needs complex
+// changes to GameFeatures::detectsetCursorType() ) and breaking savegame
+// compatibilty between the DOS and Windows CD versions of KQ5.
+// TODO: Investigate these side effects more closely.
+const byte kq5SignatureWinGMSignals[] = {
+	9,
+	0x80, 0x90, 0x01, // lag 0x190
+	0x18,             // not
+	0x30, 0x1b, 0x00, // bnt +0x001B
+	0x89, 0x57,       // lsg 0x57
+	0
+};
+
+const uint16 kq5PatchWinGMSignals[] = {
+	0x34, 0x01, 0x00, // ldi 0x0001
+	PATCH_END
+};
+
 //    script, description,                                      magic DWORD,                                 adjust
 const SciScriptSignature kq5Signatures[] = {
 	{      0, "CD: harpy volume change",                     1, PATCH_MAGICDWORD(0x80, 0x91, 0x01, 0x18),     0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume },
@@ -597,6 +626,13 @@ const SciScriptSignature kq5Signatures[] = {
 	SCI_SIGNATUREENTRY_TERMINATOR
 };
 
+const SciScriptSignature kq5WinGMSignatures[] = {
+	{      0, "CD: harpy volume change",                     1, PATCH_MAGICDWORD(0x80, 0x91, 0x01, 0x18),     0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume },
+	{    200, "CD: witch cage init",                         1, PATCH_MAGICDWORD(0x7a, 0x00, 0xc8, 0x00),   -10, kq5SignatureWitchCageInit, kq5PatchWitchCageInit },
+	{    124, "Win: GM Music signal checks",                 4, PATCH_MAGICDWORD(0x80, 0x90, 0x01, 0x18),     0, kq5SignatureWinGMSignals, kq5PatchWinGMSignals },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
 // ===========================================================================
 // When giving the milk bottle to one of the babies in the garden in KQ6 (room
 // 480), script 481 starts a looping baby cry sound. However, that particular
@@ -1317,7 +1353,11 @@ void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uin
 		signatureTable = gk1Signatures;
 		break;
 	case GID_KQ5:
-		signatureTable = kq5Signatures;
+		// See the explanation in the kq5SignatureWinGMSignals comment
+		if (g_sci->_features->useAltWinGMSound())
+			signatureTable = kq5WinGMSignatures;
+		else
+			signatureTable = kq5Signatures;
 		break;
 	case GID_KQ6:
 		signatureTable = kq6Signatures;
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 873a16c..6b00f8b 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -177,18 +177,6 @@ void SoundCommandParser::processPlaySound(reg_t obj) {
 		writeSelectorValue(_segMan, obj, SELECTOR(state), kSoundPlaying);
 	}
 
-	// WORKAROUND: Songs 1840, 1843 and 1849 in the Windows version of KQ5CD
-	// are all missing their channel 15 (all played during its ending
-	// sequences, when fighting with Mordack). This makes the game scripts
-	// wait indefinitely for the missing signals in these songs. In the
-	// original interpreter, this bug manifests as an "Out of heap" error. We
-	// signal the game scripts to stop waiting forever by setting the song's
-	// dataInc selector to something other than 0. This causes Mordack's
-	// appearing animation to occur a bit earlier than expected, but at least
-	// the game doesn't freeze at that point. Fixes bug #3605269.
-	if (g_sci->getGameId() == GID_KQ5 && (resourceId == 1840 || resourceId == 1843 || resourceId == 1849))
-		musicSlot->dataInc = 1;
-
 	musicSlot->loop = readSelectorValue(_segMan, obj, SELECTOR(loop));
 	musicSlot->priority = readSelectorValue(_segMan, obj, SELECTOR(priority));
 	// Reset hold when starting a new song. kDoSoundSetHold is always called after






More information about the Scummvm-git-logs mailing list