[Scummvm-git-logs] scummvm master -> 260811106c37dbda60c3c1cd312f790ceead721a

LubomirR lubomirr at lubomirr.eu
Wed Aug 29 19:14:00 CEST 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:
ad73f65a20 MUTATIONOFJB: Fix interaction with certain overlapped statics.
81789162d3 MUTATIONOFJB: Disallow interaction with inactive doors.
260811106c MUTATIONOFJB: Allow script commands to access all objects.


Commit: ad73f65a2023d6b4afd4ddb49e2893104e5e410d
    https://github.com/scummvm/scummvm/commit/ad73f65a2023d6b4afd4ddb49e2893104e5e410d
Author: Miroslav Remák (miroslavr256 at gmail.com)
Date: 2018-08-29T19:13:55+02:00

Commit Message:
MUTATIONOFJB: Fix interaction with certain overlapped statics.

An active static overlapped by an inactive static with lower ID was not interactable. For example, this affected the scene with the sawfish, where the machine in the closet would be blocked by the closet itself.

Changed paths:
    engines/mutationofjb/gamedata.cpp
    engines/mutationofjb/gamedata.h
    engines/mutationofjb/mutationofjb.cpp


diff --git a/engines/mutationofjb/gamedata.cpp b/engines/mutationofjb/gamedata.cpp
index 2026c3e..2c1ee5a 100644
--- a/engines/mutationofjb/gamedata.cpp
+++ b/engines/mutationofjb/gamedata.cpp
@@ -197,10 +197,10 @@ Door *Scene::findDoor(int16 x, int16 y, int *index) {
 	return nullptr;
 }
 
-Static *Scene::findStatic(int16 x, int16 y, int *index) {
+Static *Scene::findStatic(int16 x, int16 y, bool activeOnly, int *index) {
 	for (int i = 0; i < getNoStatics(); ++i) {
 		Static &stat = _statics[i];
-		if ((x >= stat._x) && (x < stat._x + stat._width) && (y >= stat._y) && (y < stat._y + stat._height)) {
+		if ((!activeOnly || stat._active) && (x >= stat._x) && (x < stat._x + stat._width) && (y >= stat._y) && (y < stat._y + stat._height)) {
 			if (index) {
 				*index = i + 1;
 			}
diff --git a/engines/mutationofjb/gamedata.h b/engines/mutationofjb/gamedata.h
index 8088969..8a67db6 100644
--- a/engines/mutationofjb/gamedata.h
+++ b/engines/mutationofjb/gamedata.h
@@ -260,7 +260,16 @@ struct Scene {
 	uint8 getNoStatics(bool ignoreNo = false) const;
 
 	Door *findDoor(int16 x, int16 y, int *index = nullptr);
-	Static *findStatic(int16 x, int16 y, int *index = nullptr);
+	/**
+	 * Finds the static at the given position. By default, only active statics are considered.
+	 *
+	 * @param x X coordinate.
+	 * @param y Y coordinate.
+	 * @param activeOnly If true, consider only active statics; otherwise consider any.
+	 * @param index Output parameter for the found static's ID.
+	 * @return A static if found, nullptr otherwise.
+	 */
+	Static *findStatic(int16 x, int16 y, bool activeOnly = true, int *index = nullptr);
 	Bitmap *findBitmap(int16 x, int16 y, int *index = nullptr);
 
 	void addExhaustedConvItem(uint8 context, uint8 convItemIndex, uint8 convGroupIndex);
diff --git a/engines/mutationofjb/mutationofjb.cpp b/engines/mutationofjb/mutationofjb.cpp
index dec3ab8..4e004f0 100644
--- a/engines/mutationofjb/mutationofjb.cpp
+++ b/engines/mutationofjb/mutationofjb.cpp
@@ -138,9 +138,7 @@ void MutationOfJBEngine::handleNormalScene(const Common::Event &event) {
 				_game->changeScene(door->_destSceneId, _game->getGameData()._partB);
 			}
 		} else if (Static *const stat = scene->findStatic(x, y)) {
-			if (stat->_active == 1) {
-				_game->startActionSection(_game->getCurrentAction(), stat->_name);
-			}
+			_game->startActionSection(_game->getCurrentAction(), stat->_name);
 		}
 		break;
 	}
@@ -224,9 +222,7 @@ void MutationOfJBEngine::updateCursorHitTest(int16 x, int16 y) {
 			entityHit = true;
 		}
 	} else if (Static *const stat = scene->findStatic(x, y)) {
-		if (stat->_active == 1) {
-			entityHit = true;
-		}
+		entityHit = true;
 	}
 	bool cursorPaletteChange = false;
 	if ((_cursorState == CURSOR_ACTIVE && !entityHit) || (_cursorState == CURSOR_IDLE && entityHit)) {


Commit: 81789162d3f76ef827eeff7e042ab79206b7b92f
    https://github.com/scummvm/scummvm/commit/81789162d3f76ef827eeff7e042ab79206b7b92f
Author: Miroslav Remák (miroslavr256 at gmail.com)
Date: 2018-08-29T19:13:55+02:00

Commit Message:
MUTATIONOFJB: Disallow interaction with inactive doors.

Changed paths:
    engines/mutationofjb/gamedata.cpp
    engines/mutationofjb/gamedata.h


diff --git a/engines/mutationofjb/gamedata.cpp b/engines/mutationofjb/gamedata.cpp
index 2c1ee5a..a669fcf 100644
--- a/engines/mutationofjb/gamedata.cpp
+++ b/engines/mutationofjb/gamedata.cpp
@@ -39,6 +39,10 @@ static bool readString(Common::ReadStream &stream, char *str) {
 	return true;
 }
 
+bool Door::isActive() {
+	return *_name != '\0';
+}
+
 bool Door::loadFromStream(Common::ReadStream &stream) {
 	readString(stream, _name);
 
@@ -183,10 +187,10 @@ uint8 Scene::getNoStatics(bool ignoreNo) const {
 	return (!ignoreNo ? MIN(_noStatics, static_cast<uint8>(ARRAYSIZE(_statics))) : ARRAYSIZE(_statics));
 }
 
-Door *Scene::findDoor(int16 x, int16 y, int *index) {
+Door *Scene::findDoor(int16 x, int16 y, bool activeOnly, int *index) {
 	for (int i = 0; i < getNoDoors(); ++i) {
 		Door &door = _doors[i];
-		if ((x >= door._x) && (x < door._x + door._width) && (y >= door._y) && (y < door._y + door._height)) {
+		if ((!activeOnly || door.isActive()) && (x >= door._x) && (x < door._x + door._width) && (y >= door._y) && (y < door._y + door._height)) {
 			if (index) {
 				*index = i + 1;
 			}
diff --git a/engines/mutationofjb/gamedata.h b/engines/mutationofjb/gamedata.h
index 8a67db6..5d7dea1 100644
--- a/engines/mutationofjb/gamedata.h
+++ b/engines/mutationofjb/gamedata.h
@@ -83,6 +83,12 @@ struct Door {
 	/* Unknown for now - likely not even used. */
 	uint8  _SP;
 
+	/**
+	 * Check if this door can be interacted with.
+	 * @return True if this door can be interacted with, false otherwise.
+	 */
+	bool isActive();
+
 	bool loadFromStream(Common::ReadStream &stream);
 };
 
@@ -259,7 +265,16 @@ struct Scene {
 	uint8 getNoObjects(bool ignoreNo = false) const;
 	uint8 getNoStatics(bool ignoreNo = false) const;
 
-	Door *findDoor(int16 x, int16 y, int *index = nullptr);
+	/**
+	 * Finds the door at the given position. By default, only active doors are considered.
+	 *
+	 * @param x X coordinate.
+	 * @param y Y coordinate.
+	 * @param activeOnly If true, consider only active doors; otherwise consider any.
+	 * @param index Output parameter for the found door's ID.
+	 * @return A door if found, nullptr otherwise.
+	 */
+	Door *findDoor(int16 x, int16 y, bool activeOnly = true, int *index = nullptr);
 	/**
 	 * Finds the static at the given position. By default, only active statics are considered.
 	 *


Commit: 260811106c37dbda60c3c1cd312f790ceead721a
    https://github.com/scummvm/scummvm/commit/260811106c37dbda60c3c1cd312f790ceead721a
Author: Miroslav Remák (miroslavr256 at gmail.com)
Date: 2018-08-29T19:13:55+02:00

Commit Message:
MUTATIONOFJB: Allow script commands to access all objects.

Previously objects with IDs beyond the defined number of objects were not accessible to IfCommand and ChangeObjectCommand. For example, this would cause script errors inside Fisher's house.

Changed paths:
    engines/mutationofjb/commands/changecommand.cpp
    engines/mutationofjb/commands/ifcommand.cpp


diff --git a/engines/mutationofjb/commands/changecommand.cpp b/engines/mutationofjb/commands/changecommand.cpp
index 9051e8e..c97fe72 100644
--- a/engines/mutationofjb/commands/changecommand.cpp
+++ b/engines/mutationofjb/commands/changecommand.cpp
@@ -405,7 +405,7 @@ Command::ExecuteResult ChangeObjectCommand::execute(ScriptExecutionContext &scri
 		return Finished;
 	}
 
-	Object *const object = scene->getObject(_entityId);
+	Object *const object = scene->getObject(_entityId, true);
 	if (!object) {
 		return Finished;
 	}
diff --git a/engines/mutationofjb/commands/ifcommand.cpp b/engines/mutationofjb/commands/ifcommand.cpp
index 47e06f3..fb48787 100644
--- a/engines/mutationofjb/commands/ifcommand.cpp
+++ b/engines/mutationofjb/commands/ifcommand.cpp
@@ -89,7 +89,7 @@ Command::ExecuteResult IfCommand::execute(ScriptExecutionContext &scriptExecCtx)
 		return Finished;
 	}
 
-	Object *const object = scene->getObject(_objectId);
+	Object *const object = scene->getObject(_objectId, true);
 	if (!object) {
 		return Finished;
 	}





More information about the Scummvm-git-logs mailing list