[Scummvm-git-logs] scummvm branch-3-0 -> 99e769b8077fe3f88596657f54fc06d7ba1c3713
Helco
noreply at scummvm.org
Fri Nov 21 12:57:47 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
99e769b807 ALCACHOFA: Fix room transitions when examining items
Commit: 99e769b8077fe3f88596657f54fc06d7ba1c3713
https://github.com/scummvm/scummvm/commit/99e769b8077fe3f88596657f54fc06d7ba1c3713
Author: Helco (hermann.noll at hotmail.com)
Date: 2025-11-21T13:57:24+01:00
Commit Message:
ALCACHOFA: Fix room transitions when examining items
Changed paths:
engines/alcachofa/player.cpp
engines/alcachofa/player.h
engines/alcachofa/rooms.cpp
engines/alcachofa/script.cpp
diff --git a/engines/alcachofa/player.cpp b/engines/alcachofa/player.cpp
index 9f6bdb16c6b..12829f98579 100644
--- a/engines/alcachofa/player.cpp
+++ b/engines/alcachofa/player.cpp
@@ -106,7 +106,7 @@ void Player::drawCursor(bool forceDefaultCursor) {
}
}
-void Player::changeRoom(const Common::String &targetRoomName, bool resetCamera) {
+void Player::changeRoom(const Common::String &targetRoomName, bool resetCamera, bool isTemporary) {
debugC(1, kDebugGameplay, "Change room to %s", targetRoomName.c_str());
// original would be to always free all resources from globalRoom, inventory, GlobalUI
@@ -118,7 +118,6 @@ void Player::changeRoom(const Common::String &targetRoomName, bool resetCamera)
return; // exiting game entirely
}
- _roomBeforeInventory = nullptr;
if (_currentRoom != nullptr) {
g_engine->scheduler().killProcessByName("ACTUALIZAR_" + _currentRoom->name());
@@ -127,12 +126,18 @@ void Player::changeRoom(const Common::String &targetRoomName, bool resetCamera)
_currentRoom->name().equalsIgnoreCase("inventario");
if (targetRoomName.equalsIgnoreCase("inventario")) {
keepResources = true;
- _roomBeforeInventory = _currentRoom;
+ if (!_isInTemporaryRoom)
+ _roomBeforeInventory = _currentRoom;
}
if (!keepResources)
_currentRoom->freeResources();
}
+ // this fixes a bug with all original games where changing the room in the inventory (e.g. iFOTO in aventura de cine)
+ // would overwrite the actual game room thus returning from the inventory one would be stuck in the temporary room
+ // If we know that a transition is temporary we prevent that and only remember the real game room
+ _isInTemporaryRoom = isTemporary;
+
_currentRoom = g_engine->world().getRoomByName(targetRoomName.c_str());
if (_currentRoom == nullptr) // no good way to recover, leaving-the-room actions might already prevent further progress
error("Invalid room name: %s", targetRoomName.c_str());
@@ -344,7 +349,8 @@ bool Player::isAllowedToOpenMenu() {
isGameLoaded() &&
!g_engine->menu().isOpen() &&
g_engine->sounds().musicSemaphore().isReleased() &&
- !g_engine->script().variable("prohibirESC");
+ !g_engine->script().variable("prohibirESC") &&
+ !_isInTemporaryRoom; // we cannot reliably store this state across multiple room changes
}
void Player::syncGame(Serializer &s) {
@@ -379,6 +385,7 @@ void Player::syncGame(Serializer &s) {
_nextLastDialogCharacter = 0;
_isGameLoaded = true;
_roomBeforeInventory = nullptr;
+ _isInTemporaryRoom = false;
fill(_lastDialogCharacters, _lastDialogCharacters + kMaxLastDialogCharacters, nullptr);
changeRoom(roomName, true);
}
diff --git a/engines/alcachofa/player.h b/engines/alcachofa/player.h
index 72651ff016d..99fc0476857 100644
--- a/engines/alcachofa/player.h
+++ b/engines/alcachofa/player.h
@@ -50,7 +50,7 @@ public:
void updateCursor();
void drawCursor(bool forceDefaultCursor = false);
void resetCursor();
- void changeRoom(const Common::String &targetRoomName, bool resetCamera);
+ void changeRoom(const Common::String &targetRoomName, bool resetCamera, bool isTemporary = false);
void changeRoomToBeforeInventory();
void triggerObject(ObjectBase *object, const char *action);
void triggerDoor(const Door *door);
@@ -74,7 +74,8 @@ private:
int32 _cursorFrameI = 0;
bool
_isGameLoaded = true,
- _didLoadGlobalRooms = false;
+ _didLoadGlobalRooms = false,
+ _isInTemporaryRoom = false;
Character *_lastDialogCharacters[kMaxLastDialogCharacters] = { nullptr };
int _nextLastDialogCharacter = 0;
};
diff --git a/engines/alcachofa/rooms.cpp b/engines/alcachofa/rooms.cpp
index b20dc6ab5ba..c9c8372506a 100644
--- a/engines/alcachofa/rooms.cpp
+++ b/engines/alcachofa/rooms.cpp
@@ -395,8 +395,10 @@ bool Inventory::updateInput() {
input.wasMenuKeyPressed() ||
input.wasInventoryKeyPressed();
if (!player.activeCharacter()->isBusy() &&
- userWantsToCloseInventory)
+ userWantsToCloseInventory) {
+ player.changeRoomToBeforeInventory();
close();
+ }
if (!player.activeCharacter()->isBusy() &&
hoveredItem == nullptr &&
@@ -473,7 +475,6 @@ void Inventory::open() {
}
void Inventory::close() {
- g_engine->player().changeRoomToBeforeInventory();
g_engine->camera().restore(1);
g_engine->globalUI().startClosingInventory();
}
diff --git a/engines/alcachofa/script.cpp b/engines/alcachofa/script.cpp
index 54516675cdd..c7665435cef 100644
--- a/engines/alcachofa/script.cpp
+++ b/engines/alcachofa/script.cpp
@@ -627,12 +627,16 @@ private:
error("Invalid room name: %s\n", getStringArg(0));
if (process().isActiveForPlayer()) {
g_engine->player().heldItem() = nullptr;
- if (g_engine->player().currentRoom() == &g_engine->world().inventory())
+ bool isTemporaryRoom = false;
+ if (g_engine->player().currentRoom() == &g_engine->world().inventory()) {
+ isTemporaryRoom = true; // see changeRoom, this fixes a bug on looking at items in the inventory
+ // this is also why we do not exit the inventory room here (like when the user closes the inventory)
g_engine->world().inventory().close();
+ }
if (targetRoom == &g_engine->world().inventory())
g_engine->world().inventory().open();
else
- g_engine->player().changeRoom(targetRoom->name(), true);
+ g_engine->player().changeRoom(targetRoom->name(), true, isTemporaryRoom);
g_engine->sounds().setMusicToRoom(targetRoom->musicID());
}
g_engine->script().createProcess(process().character(), "ENTRAR_" + targetRoom->name(), ScriptFlags::AllowMissing);
More information about the Scummvm-git-logs
mailing list