aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-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)) {