aboutsummaryrefslogtreecommitdiff
path: root/engines/mutationofjb
diff options
context:
space:
mode:
authorMiroslav Remák2018-08-29 18:10:44 +0200
committerĽubomír Remák2018-08-29 19:13:55 +0200
commitad73f65a2023d6b4afd4ddb49e2893104e5e410d (patch)
tree7e33aae4d115acc417a4aa1b11b843cd671add8e /engines/mutationofjb
parent8033f62f931190eababa654e425570eb55e49c02 (diff)
downloadscummvm-rg350-ad73f65a2023d6b4afd4ddb49e2893104e5e410d.tar.gz
scummvm-rg350-ad73f65a2023d6b4afd4ddb49e2893104e5e410d.tar.bz2
scummvm-rg350-ad73f65a2023d6b4afd4ddb49e2893104e5e410d.zip
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.
Diffstat (limited to 'engines/mutationofjb')
-rw-r--r--engines/mutationofjb/gamedata.cpp4
-rw-r--r--engines/mutationofjb/gamedata.h11
-rw-r--r--engines/mutationofjb/mutationofjb.cpp8
3 files changed, 14 insertions, 9 deletions
diff --git a/engines/mutationofjb/gamedata.cpp b/engines/mutationofjb/gamedata.cpp
index 2026c3e428..2c1ee5ab52 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 8088969c9d..8a67db61e7 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 dec3ab8f97..4e004f0868 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)) {