[Scummvm-git-logs] scummvm master -> 55ec2b42275dfec7fae6bdb4b19e8750db42bd6a

athrxx noreply at scummvm.org
Wed Jul 24 16:55:11 UTC 2024


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:
35ee6d6dfb SCUMM: (MM/V1) - add special handling for getActorFromPos()
769fa3c878 SCUMM: (MM) - fix another v1/v2 diff
55ec2b4227 SCUMM: (MM) -  fix bug no. 15278


Commit: 35ee6d6dfbd07cd61a19a99f40042de850b2d504
    https://github.com/scummvm/scummvm/commit/35ee6d6dfbd07cd61a19a99f40042de850b2d504
Author: athrxx (athrxx at scummvm.org)
Date: 2024-07-24T18:53:00+02:00

Commit Message:
SCUMM: (MM/V1) - add special handling for getActorFromPos()

Something I found when fixing this for other v1/v2 games. Not clear if it
makes a difference, but better fix it now...

Changed paths:
    engines/scumm/actor.cpp


diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 71ed6b27c03..b1370d245d4 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -2124,10 +2124,20 @@ int ScummEngine::getActorFromPos(int x, int y) {
 				continue;
 			y2 = _actors[i]->getPos().y;
 			y1 = _actors[i]->getPos().y - 40 * V12_Y_MULTIPLIER;
-			// Yes, it's really like this in the original code. And it works as intended for
-			// e. g. bug #15277 ("MANIAC: Man-Eating Plant should not be selectable as actor")
-			if ((uint16)y1 > 128)
-				y1 = 1;
+
+			if (_game.version < 2 && _game.id == GID_MANIAC) {
+				// I have found this only in MMv1. The other v1/v2 games have leftovers of this
+				// (they read the elevation value from the array, but then don't use that value).
+				// I have no way to check MMv0 (which also uses this opcode), but I assume it's
+				// more likely that it also has this.
+				y2 = (byte)(y2 - _actors[i]->getElevation());
+				y1 = (byte)(y1 - _actors[i]->getElevation());
+			} else {
+				// Yes, it's really like this in the original code. And it works as intended for
+				// e. g. bug #15277 ("MANIAC: Man-Eating Plant should not be selectable as actor")
+				if ((uint16)y1 > 128)
+					y1 = 1;
+			}
 		}
 
 		if (testGfxUsageBit(x / 8, i) && !getClass(i, kObjectClassUntouchable) && y >= y1 && y <= y2)


Commit: 769fa3c8782a1f0de9aa22e903782225bdc7fa88
    https://github.com/scummvm/scummvm/commit/769fa3c8782a1f0de9aa22e903782225bdc7fa88
Author: athrxx (athrxx at scummvm.org)
Date: 2024-07-24T18:53:05+02:00

Commit Message:
SCUMM: (MM) - fix another v1/v2 diff

Changed paths:
    engines/scumm/script_v2.cpp


diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp
index c74f5dcc2cf..ddddd0d6e7c 100644
--- a/engines/scumm/script_v2.cpp
+++ b/engines/scumm/script_v2.cpp
@@ -1550,7 +1550,7 @@ void ScummEngine_v2::o2_endCutscene() {
 	// Reset user state to values before cutscene
 	setUserState(vm.cutSceneData[0] | USERSTATE_SET_IFACE | USERSTATE_SET_CURSOR | USERSTATE_SET_FREEZE);
 
-	if ((_game.id == GID_MANIAC) && !(_game.platform == Common::kPlatformNES)) {
+	if (_game.id == GID_MANIAC && _game.version < 2 && _game.platform != Common::kPlatformNES) {
 		camera._mode = (byte) vm.cutSceneData[3];
 		if (camera._mode == kFollowActorCameraMode) {
 			actorFollowCamera(VAR(VAR_EGO));


Commit: 55ec2b42275dfec7fae6bdb4b19e8750db42bd6a
    https://github.com/scummvm/scummvm/commit/55ec2b42275dfec7fae6bdb4b19e8750db42bd6a
Author: athrxx (athrxx at scummvm.org)
Date: 2024-07-24T18:53:10+02:00

Commit Message:
SCUMM: (MM) -  fix bug no. 15278

("MANIAC: Sentence line empty at start")

Changed paths:
    engines/scumm/camera.cpp
    engines/scumm/script.cpp
    engines/scumm/script_v2.cpp
    engines/scumm/scumm.h
    engines/scumm/scumm_v2.h


diff --git a/engines/scumm/camera.cpp b/engines/scumm/camera.cpp
index 494b5ac4715..d8227e16fbb 100644
--- a/engines/scumm/camera.cpp
+++ b/engines/scumm/camera.cpp
@@ -82,7 +82,7 @@ void ScummEngine::setCameraFollows(Actor *a, bool setCamera) {
 		if (_actors[i]->isInCurrentRoom())
 			_actors[i]->_needRedraw = true;
 	}
-	runInventoryScript(0);
+	runInventoryScriptEx(0);
 }
 
 void ScummEngine::clampCameraPos(Common::Point *pt) {
@@ -205,7 +205,7 @@ void ScummEngine::actorFollowCamera(int act) {
 		old = camera._follows;
 		setCameraFollows(derefActor(act, "actorFollowCamera"));
 		if (camera._follows != old)
-			runInventoryScript(0);
+			runInventoryScriptEx(0);
 
 		camera._movingToActor = false;
 	}
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index 97bdca0fb94..7671e8f306c 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -865,6 +865,10 @@ void ScummEngine::runInventoryScript(int i) {
 	}
 }
 
+void ScummEngine::runInventoryScriptEx(int i) {
+	runInventoryScript(i);
+}
+
 void ScummEngine::freezeScripts(int flag) {
 	int i;
 
diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp
index ddddd0d6e7c..9174cad9b39 100644
--- a/engines/scumm/script_v2.cpp
+++ b/engines/scumm/script_v2.cpp
@@ -1654,7 +1654,7 @@ void ScummEngine_v2::setUserState(byte state) {
 
 	// Draw all verbs and inventory
 	redrawVerbs();
-	runInventoryScript(1);
+	runInventoryScriptEx(1);
 }
 
 void ScummEngine_v2::o2_getActorWalkBox() {
@@ -1688,8 +1688,14 @@ void ScummEngine_v2::resetSentence() {
 	VAR(VAR_SENTENCE_PREPOSITION) = 0;
 }
 
-void ScummEngine_v2::runInventoryScript(int i) {
+void ScummEngine_v2::runInventoryScript(int) {
+	redrawV2Inventory();
+}
+
+void ScummEngine_v2::runInventoryScriptEx(int) {
 	redrawV2Inventory();
+	if (_game.version > 0)
+		drawSentence();
 }
 
 } // End of namespace Scumm
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 1368deaeec5..ceeac4b88f8 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1006,6 +1006,7 @@ protected:
 	void executeScript();
 	void updateScriptPtr();
 	virtual void runInventoryScript(int i);
+	virtual void runInventoryScriptEx(int i);
 	virtual void checkAndRunSentenceScript();
 	void runExitScript();
 	void runEntryScript();
diff --git a/engines/scumm/scumm_v2.h b/engines/scumm/scumm_v2.h
index c1509243c06..25a6f297b31 100644
--- a/engines/scumm/scumm_v2.h
+++ b/engines/scumm/scumm_v2.h
@@ -75,7 +75,8 @@ protected:
 	void loadCharset(int no) override;
 
 	void runInputScript(int clickArea, int val, int mode) override;
-	void runInventoryScript(int i) override;
+	void runInventoryScript(int) override;
+	void runInventoryScriptEx(int) override;
 
 	int getVar() override;
 




More information about the Scummvm-git-logs mailing list