[Scummvm-git-logs] scummvm master -> bba8eadfaef76365429249368ca8e6d1385dc3e8

bluegr bluegr at gmail.com
Fri Dec 28 10:55:37 CET 2018


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

Summary:
4b6e0e0e7d SCI32: Add feature detection for plane id base
ff7e490593 SCI32: Display plane id base in version console command
bba8eadfae SCI32: Remove obsolete script patches


Commit: 4b6e0e0e7de7589f7e4ce09b7f4c77da45e4477a
    https://github.com/scummvm/scummvm/commit/4b6e0e0e7de7589f7e4ce09b7f4c77da45e4477a
Author: Lars Skovlund (lskovlun at sprogklog.dk)
Date: 2018-12-28T11:55:32+02:00

Commit Message:
SCI32: Add feature detection for plane id base

This provides a generic fix for AddScreenItem crashes in early SCI32
floppy games that have previously required individual script patches.

Changed paths:
    engines/sci/engine/features.cpp
    engines/sci/engine/features.h
    engines/sci/graphics/plane32.cpp


diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index 06fa046..df57655 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -628,6 +628,14 @@ MessageTypeSyncStrategy GameFeatures::getMessageTypeSyncStrategy() const {
 	return kMessageTypeSyncStrategyNone;
 }
 
+int GameFeatures::detectPlaneIdBase() {
+	if (getSciVersion() == SCI_VERSION_2 &&
+	    g_sci->getGameId() != GID_PQ4)
+		return 0;
+	else
+		return 20000;
+}
+	
 bool GameFeatures::autoDetectMoveCountType() {
 	// Look up the script address
 	reg_t addr = getDetectionAddr("Motion", SELECTOR(doit));
diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h
index 7a1c6f5..d776495 100644
--- a/engines/sci/engine/features.h
+++ b/engines/sci/engine/features.h
@@ -228,6 +228,8 @@ public:
 	 */
 	MoveCountType detectMoveCountType();
 
+	int detectPlaneIdBase();
+	
 	bool handleMoveCount() { return detectMoveCountType() == kIncrementMoveCount; }
 
 	bool usesCdTrack() { return _usesCdTrack; }
diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp
index 46a8aed..c85965e 100644
--- a/engines/sci/graphics/plane32.cpp
+++ b/engines/sci/graphics/plane32.cpp
@@ -44,8 +44,8 @@ void DrawList::add(ScreenItem *screenItem, const Common::Rect &rect) {
 
 #pragma mark -
 #pragma mark Plane
-uint16 Plane::_nextObjectId = 20000;
-uint32 Plane::_nextCreationId = 0;
+uint16 Plane::_nextObjectId; // Will be initialized in Plane::init()
+uint32 Plane::_nextCreationId; // ditto
 
 Plane::Plane(const Common::Rect &gameRect, PlanePictureCodes pictureId) :
 _creationId(_nextCreationId++),
@@ -132,7 +132,7 @@ void Plane::operator=(const Plane &other) {
 }
 
 void Plane::init() {
-	_nextObjectId = 20000;
+	_nextObjectId = g_sci->_features->detectPlaneIdBase();
 	_nextCreationId = 0;
 }
 


Commit: ff7e490593d05b4613f68f7a2cf2de4e28e921c6
    https://github.com/scummvm/scummvm/commit/ff7e490593d05b4613f68f7a2cf2de4e28e921c6
Author: Lars Skovlund (lskovlun at sprogklog.dk)
Date: 2018-12-28T11:55:32+02:00

Commit Message:
SCI32: Display plane id base in version console command

Changed paths:
    engines/sci/console.cpp


diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 91c5d01..99fae41 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -488,6 +488,9 @@ bool Console::cmdGetVersion(int argc, const char **argv) {
 	debugPrintf("Resource map version: %s\n", g_sci->getResMan()->getMapVersionDesc());
 	debugPrintf("Contains selector vocabulary (vocab.997): %s\n", hasVocab997 ? "yes" : "no");
 	debugPrintf("Has CantBeHere selector: %s\n", g_sci->getKernel()->_selectorCache.cantBeHere != -1 ? "yes" : "no");
+	if (getSciVersion() >= SCI_VERSION_2) {
+		debugPrintf("Plane id base: %d\n", g_sci->_features->detectPlaneIdBase());
+	}
 	debugPrintf("Game version (VERSION file): %s\n", gameVersion.c_str());
 	debugPrintf("\n");
 


Commit: bba8eadfaef76365429249368ca8e6d1385dc3e8
    https://github.com/scummvm/scummvm/commit/bba8eadfaef76365429249368ca8e6d1385dc3e8
Author: Lars Skovlund (lskovlun at sprogklog.dk)
Date: 2018-12-28T11:55:32+02:00

Commit Message:
SCI32: Remove obsolete script patches

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


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 930c9dc..f12b6f5 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -8406,31 +8406,6 @@ static const uint16 qfg4SetScalerPatch[] = {
 	PATCH_END
 };
 
-// When the fortune teller's wagon room is disposed, it attempts to call
-// hero::show(), hero has a null "plane" property, and ScummVM crashes.
-//
-// The problematic line was removed in the CD edition. We remove it, too.
-//
-// Note: This patch is a workaround. The floppy edition SSCI did not crash, and
-// its implementation of AddScreenItem() should be checked to find out why.
-//
-// Applies to at least: English floppy, German floppy
-// Responsible method: rm470::dispose()
-// Fixes bug: #10778
-static const uint16 qfg4MagdaDisposalSignature[] = {
-	0x38, SIG_SELECTOR16(posn),         // posn
-	SIG_ADDTOOFFSET(+8),                // ...
-	SIG_MAGICDWORD,
-	0x81, 0x00,                         // lag global[0] (hero)
-	0x4a, SIG_UINT16(0x000c),           // send 12d (posn: 1000 1000 show:)
-	SIG_END
-};
-
-static const uint16 qfg4MagdaDisposalPatch[] = {
-	0x33, 0x0e,                         // jmp 14d (skip the entire hero send)
-	PATCH_END
-};
-
 // The castle's crest-operated bookshelf has an unconditional HAND message
 // which always says, "you haven't found the trigger yet," even after it's
 // open.
@@ -8621,47 +8596,6 @@ static const uint16 qfg4ConditionalVoidPatch[] = {
 	PATCH_END
 };
 
-// The copy protection in floppy versions has a script bug which attempts to add
-//  views with no planes to the screen. Our interpreter does not allow this and
-//  treats it as an error. This appears to work in Sierra's interpreter, which
-//  presumably ignores it, although the script bug was fixed in the CD version.
-//
-// When asking Dr. Cranium in room 370 about certain potions the game switches
-//  to a copy protection screen and then back to the conversation. Before the
-//  switch, craniumTalker is disposed, which in turn disposes craniumThumbs and
-//  craniumBrow. Disposing these views clears their planes. After returning from
-//  the protection screen craniumTalker:showAgain is called even though it has
-//  been disposed. This causes kAddScreenItem to be called on views without
-//  planes, which is treated as an error by our interpreter.
-//
-// We work around this by reinitializing craniumTalker after the copy protection
-//  so that showAgain can be safely called. craniumTalker is reinitialized when
-//  navigating through the conversation menus so this is normal behavior.
-//
-// Applies to: English PC Floppy, German PC Floppy
-// Responsible method: delayMsg:changeState(0)
-// Fixes bug: #10773
-static const uint16 qfg4CopyProtectionSignature[] = {
-	0x31, 0x06,                         // bnt 06
-	SIG_MAGICDWORD,
-	0x35, 0x01,                         // ldi 01
-	0x65, 0x24,                         // aTop register
-	SIG_ADDTOOFFSET(+6),
-	0x38, SIG_UINT16(0x0300),           // pushi 0300 [ showAgain, hard-coded for floppy ]
-	SIG_ADDTOOFFSET(+11),
-	0x4a, SIG_UINT16(0x0004),           // send 04 [ craniumTalker: showAgain ]
-	SIG_END
-};
-
-static const uint16 qfg4CopyProtectionPatch[] = {
-	0x65, 0x24,                         // aTop register
-	0x38, PATCH_SELECTOR16(init),       // pushi init
-	0x76,                               // push0
-	PATCH_ADDTOOFFSET(+20),
-	0x4a, PATCH_UINT16(0x0008),         // send 08 [ craniumTalker: init, showAgain ]
-	PATCH_END
-};
-
 // In the graveyard rescuing Igor, ropes are briefly obscured by crypt pillars
 // in the background Pic. The Pic assigns a priority to the pillars for depth.
 // Ropes are initialized without priority. Then there's a setPri() call.
@@ -9300,9 +9234,7 @@ static const SciScriptPatcherEntry qfg4Signatures[] = {
 	{  true,   270, "fix town gate after a staff dream",           1, qfg4DreamGateSignature,        qfg4DreamGatePatch },
 	{  true,   320, "fix pathfinding at the inn",                  1, qg4InnPathfindingSignature,    qg4InnPathfindingPatch },
 	{  true,   320, "fix talking to absent innkeeper",             1, qfg4AbsentInnkeeperSignature,  qfg4AbsentInnkeeperPatch },
-	{  true,   370, "Floppy: fix copy protection",                 1, qfg4CopyProtectionSignature,   qfg4CopyProtectionPatch },
 	{  true,   440, "fix setLooper calls (1/2)",                   1, qg4SetLooperSignature1,        qg4SetLooperPatch1 },
-	{  true,   470, "fix Magda room disposal",                     1, qfg4MagdaDisposalSignature,    qfg4MagdaDisposalPatch },
 	{  true,   475, "fix tarot 3 queen card",                      1, qfg4Tarot3QueenSignature,      qfg4Tarot3QueenPatch },
 	{  true,   475, "fix tarot 3 death card",                      1, qfg4Tarot3DeathSignature,      qfg4Tarot3DeathPatch },
 	{  true,   475, "fix tarot 3 two of cups placement",           1, qfg4Tarot3TwoOfCupsSignature,  qfg4Tarot3TwoOfCupsPatch },





More information about the Scummvm-git-logs mailing list