[Scummvm-git-logs] scummvm master -> 709cde094ac5f33d2a49f37a7ff81e70b01121d4
bluegr
noreply at scummvm.org
Sat Oct 24 07:48:49 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
b8c5982734 NANCY: NANCY17: Show the items of the new character after a switch
709cde094a NANCY: Keep the inventory buttons out of the saved UI state
Commit: b8c598273430c08143847e2f3e81b5b79d340a3b
https://github.com/scummvm/scummvm/commit/b8c598273430c08143847e2f3e81b5b79d340a3b
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-10-24T10:48:36+03:00
Commit Message:
NANCY: NANCY17: Show the items of the new character after a switch
The inventory panel was filled in before the inventories were
swapped, so it showed the items of the outgoing character
Changed paths:
engines/nancy/state/scene.cpp
engines/nancy/state/scene.h
diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index cc4dde4befe..1f1c68107fa 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -1436,9 +1436,33 @@ bool Scene::changePlayerCharacter(uint characterIndex) {
loadCharacterInventory(characterIndex);
loadCharacterResources(characterIndex);
+ // The inventory panel was filled in before the swap, with the items of the
+ // outgoing character
+ auto *playerChar = (PlayerCharacterData *)getPuzzleData(PlayerCharacterData::getTag());
+ if (_ndui && playerChar) {
+ const Common::Array<byte> &previousItems = playerChar->getInventory(previousCharacter).items;
+ for (uint i = 0; i < previousItems.size(); ++i) {
+ if (previousItems[i] == g_nancy->_true) {
+ _ndui->showInventoryItem(i, false);
+ }
+ }
+
+ showInventoryButtons();
+ }
+
return true;
}
+void Scene::showInventoryButtons() {
+ // The most recent items come first
+ const Common::Array<int16> &order = _inventoryBox.getOrder();
+ for (int i = (int)order.size() - 1; i >= 0; --i) {
+ if (order[i] != -1 && _flags.items[order[i]] == g_nancy->_true) {
+ _ndui->showInventoryItem(order[i], true);
+ }
+ }
+}
+
void Scene::inheritBrotherProgress(uint characterIndex) {
if (characterIndex != kPlayerCharacterFrank && characterIndex != kPlayerCharacterJoe) {
return;
@@ -3132,13 +3156,7 @@ void Scene::initUI() {
_ndui->createPhoneBook();
}
- // The most recent items come first
- const Common::Array<int16> &order = _inventoryBox.getOrder();
- for (int i = (int)order.size() - 1; i >= 0; --i) {
- if (order[i] != -1 && _flags.items[order[i]] == g_nancy->_true) {
- _ndui->showInventoryItem(order[i], true);
- }
- }
+ showInventoryButtons();
// Nancy17 has no prep records; the script that runs when a character takes
// over starts the streams that fill the journal and the task list
@@ -3187,13 +3205,7 @@ void Scene::onScriptedUILoaded() {
_ndui->createItemButtons();
Script::showPlayerEntries();
- // The most recent items come first
- const Common::Array<int16> &order = _inventoryBox.getOrder();
- for (int i = (int)order.size() - 1; i >= 0; --i) {
- if (order[i] != -1 && _flags.items[order[i]] == g_nancy->_true) {
- _ndui->showInventoryItem(order[i], true);
- }
- }
+ showInventoryButtons();
_ndui->restoreState(((UIStateData *)getPuzzleData(UIStateData::getTag()))->changes);
_ndui->applyMatteColor();
diff --git a/engines/nancy/state/scene.h b/engines/nancy/state/scene.h
index 4a0444268ce..3c687fb78b1 100644
--- a/engines/nancy/state/scene.h
+++ b/engines/nancy/state/scene.h
@@ -436,6 +436,7 @@ private:
// character's are the live ones (_flags plus the inventory box order, and
// UIResourceData::values); the others are parked in the same puzzle data.
void storeCharacterInventory(uint characterIndex);
+ void showInventoryButtons();
void loadCharacterInventory(uint characterIndex);
void storeCharacterResources(uint characterIndex);
void loadCharacterResources(uint characterIndex);
Commit: 709cde094ac5f33d2a49f37a7ff81e70b01121d4
https://github.com/scummvm/scummvm/commit/709cde094ac5f33d2a49f37a7ff81e70b01121d4
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-10-24T10:48:37+03:00
Commit Message:
NANCY: Keep the inventory buttons out of the saved UI state
Which ones are shown follows from the items of the character; older
saved games could restore buttons that didn't match them
Changed paths:
engines/nancy/ui/ndui/manager.cpp
engines/nancy/ui/ndui/manager.h
engines/nancy/ui/ndui/panel.cpp
engines/nancy/ui/ndui/panel.h
diff --git a/engines/nancy/ui/ndui/manager.cpp b/engines/nancy/ui/ndui/manager.cpp
index 5c0af900fc2..f6672e1861e 100644
--- a/engines/nancy/ui/ndui/manager.cpp
+++ b/engines/nancy/ui/ndui/manager.cpp
@@ -205,6 +205,12 @@ void Manager::saveState(Common::Array<UIStateData::Change> &changes) const {
void Manager::restoreState(const Common::Array<UIStateData::Change> &changes) {
for (const UIStateData::Change &change : changes) {
+ // Older saved games have the inventory buttons too, which may not match
+ // the items: those are shown from the inventory itself
+ if (isItemButton(change.name)) {
+ continue;
+ }
+
takeAction(change.action, change.name, 0.0);
}
@@ -254,6 +260,16 @@ void Manager::destroyObject(const Common::String &name) {
}
}
+bool Manager::isItemButton(const Common::String &name) const {
+ for (const Panel *panel : _panels) {
+ if (panel->isItemButton(name)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
Panel *Manager::findPanel(const Common::String &name) const {
for (Panel *panel : _panels) {
if (panel->getName().equalsIgnoreCase(name)) {
diff --git a/engines/nancy/ui/ndui/manager.h b/engines/nancy/ui/ndui/manager.h
index 3a69858a490..298ad80ca75 100644
--- a/engines/nancy/ui/ndui/manager.h
+++ b/engines/nancy/ui/ndui/manager.h
@@ -200,6 +200,7 @@ private:
void setSaveScreenshot(const Graphics::ManagedSurface &image, const Common::Rect &src);
Panel *findPanel(const Common::String &name) const;
+ bool isItemButton(const Common::String &name) const;
InvButton *findItemButton(int16 itemID) const;
Common::Array<Panel *> _panels;
diff --git a/engines/nancy/ui/ndui/panel.cpp b/engines/nancy/ui/ndui/panel.cpp
index d90600664bd..c3c6527e27a 100644
--- a/engines/nancy/ui/ndui/panel.cpp
+++ b/engines/nancy/ui/ndui/panel.cpp
@@ -540,8 +540,11 @@ void Panel::saveState(Common::Array<UIStateData::Change> &changes) const {
return;
}
- for (const Control *control : _controls) {
- addStateChanges(changes, control->getName(), control->getInitialState(), control->isVisible(), control->isEnabled());
+ // Which inventory buttons are shown follows from the items of the character
+ if (_kind != kObjectInvPanel) {
+ for (const Control *control : _controls) {
+ addStateChanges(changes, control->getName(), control->getInitialState(), control->isVisible(), control->isEnabled());
+ }
}
addStateChanges(changes, getName(), _initialState, isVisible(), _enabled);
@@ -671,6 +674,20 @@ EditBox *Panel::getKeyboardFocus() const {
return nullptr;
}
+bool Panel::isItemButton(const Common::String &name) const {
+ if (_kind != kObjectInvPanel) {
+ return false;
+ }
+
+ for (const Control *control : _controls) {
+ if (control->getName().equalsIgnoreCase(name)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
InvButton *Panel::findItemButton(int16 itemID) const {
if (_kind != kObjectInvPanel) {
return nullptr;
diff --git a/engines/nancy/ui/ndui/panel.h b/engines/nancy/ui/ndui/panel.h
index d4e31f4aade..0a6c2226b2c 100644
--- a/engines/nancy/ui/ndui/panel.h
+++ b/engines/nancy/ui/ndui/panel.h
@@ -121,6 +121,7 @@ public:
Control *addNewControl(int32 type, Common::SeekableReadStream &stream);
bool removeControl(const Common::String &name);
InvButton *findItemButton(int16 itemID) const;
+ bool isItemButton(const Common::String &name) const;
// The edit box that gets typed into, when the panel is up
EditBox *getKeyboardFocus() const;
More information about the Scummvm-git-logs
mailing list