[Scummvm-git-logs] scummvm master -> ecbaa859f88308033e8d077703020da1a37836f6

bluegr noreply at scummvm.org
Sat Nov 7 01:44:50 UTC 2026


This automated email contains information about 12 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
69d94b5317 NANCY: NANCY18: Fix rollovers being one pixel too large
d6a35c0746 NANCY: NANCY18: Keep the cursor in scenes with animated characters
b2a441d5b3 NANCY: NANCY17: Don't hold the mouse in place during conversations
ea8721c0ea NANCY: Keep movies on screen until the scene they change to
ad5538aad7 NANCY: NANCY18: Use the lower bar's PDA button for the PDA item
65359cd912 NANCY: Fix conditional expressions. PVS-Studio V560
16d2160d2a NANCY: Init member variables in class Decompressor. PVS-Studio V730
f39009889d NANCY: Remove superfluous assignment. PVS-Studio V1048
2eeb6baab9 NANCY: Fix always true expression for stream. PVS-Studio V547
5c12c4252e NANCY: Plug memory leak
651435bb59 NANCY: NANCY24: Move the task completions array inside the Scene class
ecbaa859f8 NANCY: Add counter increment in RaycastLevelBuilder. PVS-Studio V1044


Commit: 69d94b531753ebc816cb23ac19fa5696da43d153
    https://github.com/scummvm/scummvm/commit/69d94b531753ebc816cb23ac19fa5696da43d153
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:05+02:00

Commit Message:
NANCY: NANCY18: Fix rollovers being one pixel too large

In Nancy18 the right and bottom edges of a rollover's rectangles
are no longer part of it, which drew a green line next to the
topics of the Venice guide in scene 3565

Changed paths:
    engines/nancy/action/overlay.cpp


diff --git a/engines/nancy/action/overlay.cpp b/engines/nancy/action/overlay.cpp
index 7b1823b81ec..430a83e34cd 100644
--- a/engines/nancy/action/overlay.cpp
+++ b/engines/nancy/action/overlay.cpp
@@ -781,9 +781,16 @@ void RolloverOverlay::readDataNancy16(Common::SeekableReadStream &stream) {
 	_z = stream.readUint32LE();
 	_hoverCursor = stream.readUint16LE();
 
-	readRect(stream, _hotspotRect);
-	readRect(stream, _srcRect);
-	readRect(stream, _destRect);
+	// The right and bottom edges of a Nancy18 rect are no longer a part of it
+	if (g_nancy->getGameType() >= kGameTypeNancy18) {
+		readExclusiveRect(stream, _hotspotRect);
+		readExclusiveRect(stream, _srcRect);
+		readExclusiveRect(stream, _destRect);
+	} else {
+		readRect(stream, _hotspotRect);
+		readRect(stream, _srcRect);
+		readRect(stream, _destRect);
+	}
 
 	_flagOnHover.label = stream.readSint16LE();
 	_flagOnHover.flag = stream.readByte();


Commit: d6a35c0746daf8117f5fbe7b8d576f27b46be847
    https://github.com/scummvm/scummvm/commit/d6a35c0746daf8117f5fbe7b8d576f27b46be847
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:09+02:00

Commit Message:
NANCY: NANCY18: Keep the cursor in scenes with animated characters

Some Nancy18 character animations, like the one in scene 3210, are
set to switch off the player's input while they play. In the
original game this only stops the taskbar and other UI panels from
reacting to the mouse, while the scene itself stays usable. Instead,
the cursor was hidden and the whole scene was blocked for as long as
the animation looped, which is forever.

Changed paths:
    engines/nancy/action/secondarymovie.cpp
    engines/nancy/action/secondarymovie.h
    engines/nancy/ui/ndui/manager.cpp
    engines/nancy/ui/ndui/manager.h


diff --git a/engines/nancy/action/secondarymovie.cpp b/engines/nancy/action/secondarymovie.cpp
index cadd8538fc5..67c0b5a2953 100644
--- a/engines/nancy/action/secondarymovie.cpp
+++ b/engines/nancy/action/secondarymovie.cpp
@@ -30,6 +30,7 @@
 
 #include "engines/nancy/action/secondarymovie.h"
 #include "engines/nancy/state/scene.h"
+#include "engines/nancy/ui/ndui/manager.h"
 
 #include "common/random.h"
 #include "common/serializer.h"
@@ -56,6 +57,10 @@ PlaySecondaryMovie::~PlaySecondaryMovie() {
 	if (_playerCursorAllowed == kNoPlayerCursorAllowed) {
 		g_nancy->setMouseEnabled(true);
 	}
+
+	if (_hasLockedUIMouse && NancySceneState.getNDUI()) {
+		NancySceneState.getNDUI()->unlockMouseInput();
+	}
 }
 
 bool PlaySecondaryMovie::survivesSceneChange(bool nextSceneIsNoArt) const {
@@ -371,7 +376,14 @@ void PlaySecondaryMovie::applyStartingRandomSequence() {
 			_lastFrame = src.lastFrame;
 			_videoFormat = kLargeVideoFormat;
 			_videoSceneChange = kMovieNoSceneChange;
-			_playerCursorAllowed = (byte)_randomPlayerCursorAllowed;
+			// In Nancy18 a random movie doesn't take the cursor away from the scene,
+			// only from the panels of the UI
+			if (g_nancy->getGameType() >= kGameTypeNancy18) {
+				_playerCursorAllowed = kPlayerCursorAllowed;
+				_locksUIMouse = _randomPlayerCursorAllowed == kNoPlayerCursorAllowed;
+			} else {
+				_playerCursorAllowed = (byte)_randomPlayerCursorAllowed;
+			}
 			_playDirection = kPlayMovieForward;
 		}
 	}
@@ -1277,6 +1289,11 @@ void PlaySecondaryMovie::execute() {
 			g_nancy->setMouseEnabled(false);
 		}
 
+		if (_locksUIMouse && !_hasLockedUIMouse && NancySceneState.getNDUI()) {
+			NancySceneState.getNDUI()->lockMouseInput();
+			_hasLockedUIMouse = true;
+		}
+
 		NancySceneState.setActiveMovie(this);
 
 		if (g_nancy->getGameType() >= kGameTypeNancy10)
diff --git a/engines/nancy/action/secondarymovie.h b/engines/nancy/action/secondarymovie.h
index 6141b8819ec..b048a1f9ef7 100644
--- a/engines/nancy/action/secondarymovie.h
+++ b/engines/nancy/action/secondarymovie.h
@@ -250,6 +250,8 @@ public:
 	bool _randomStopRequested = false;
 	bool _randomPaused = false;
 	bool _isHiddenByDependencies = false;	// Nancy18: taken off screen until the dependencies hold again
+	bool _locksUIMouse = false;			// Nancy18: the panels get no mouse input while the movie plays
+	bool _hasLockedUIMouse = false;
 
 	// Whether the mouse is over the movie (which drives both the hover-based
 	// sequence chain and the click that opens a character's conversation), and
diff --git a/engines/nancy/ui/ndui/manager.cpp b/engines/nancy/ui/ndui/manager.cpp
index 275b6d42445..59664a0e750 100644
--- a/engines/nancy/ui/ndui/manager.cpp
+++ b/engines/nancy/ui/ndui/manager.cpp
@@ -336,6 +336,10 @@ void Manager::handleInput(NancyInput &input) {
 
 	_hoveredControl = nullptr;
 
+	if (_mouseInputLocks > 0) {
+		return;
+	}
+
 	// The panels drawn on top get the mouse first
 	bool isOverUI = false;
 	bool isOverControl = false;
diff --git a/engines/nancy/ui/ndui/manager.h b/engines/nancy/ui/ndui/manager.h
index 8813745f1fd..77e86bef441 100644
--- a/engines/nancy/ui/ndui/manager.h
+++ b/engines/nancy/ui/ndui/manager.h
@@ -130,6 +130,10 @@ public:
 	// Nancy17: the control under the mouse that has a tooltip, and the panel's control that shows it
 	void setHoveredTooltip(const Control *control, Tooltip *tooltip);
 
+	// Nancy18 movies can keep the mouse away from the panels for as long as they play
+	void lockMouseInput() { ++_mouseInputLocks; }
+	void unlockMouseInput() { if (_mouseInputLocks > 0) --_mouseInputLocks; }
+
 	const Graphics::ManagedSurface *getTexture(const Common::String &name);
 
 	// Creates a control from a template, as the last one of a panel
@@ -224,6 +228,7 @@ private:
 	// Nancy17 tooltips are drawn on top of every panel
 	RenderObject _tooltipWindow{kTooltipZ};
 	const Control *_hoveredControl = nullptr;
+	uint _mouseInputLocks = 0;
 	uint16 _heldArrowKeys = 0;	// the input of the last frame, to tell when an arrow key goes down
 	Tooltip *_hoveredTooltip = nullptr;
 	const Control *_tooltipControl = nullptr;


Commit: b2a441d5b31691627260662cb3e0a3973abce79d
    https://github.com/scummvm/scummvm/commit/b2a441d5b31691627260662cb3e0a3973abce79d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:13+02:00

Commit Message:
NANCY: NANCY17: Don't hold the mouse in place during conversations

>From Nancy17 on the games no longer move or confine the mouse while
a character talks. Keeping it below the conversation area left the
player stuck when a taskbar button opened a dialog, like saving
during the conversation in Nancy18 scene 1201.

Changed paths:
    engines/nancy/action/conversation.cpp
    engines/nancy/state/scene.cpp


diff --git a/engines/nancy/action/conversation.cpp b/engines/nancy/action/conversation.cpp
index 3f513f78b7b..d457bdc2042 100644
--- a/engines/nancy/action/conversation.cpp
+++ b/engines/nancy/action/conversation.cpp
@@ -354,7 +354,7 @@ void ConversationSound::execute() {
 		Common::Point adjustedMousePos = g_nancy->_input->getInput().mousePos;
 		adjustedMousePos.x -= cursorHotspot.x;
 		adjustedMousePos.y -= cursorHotspot.y - 1;
-		if (g_nancy->_cursor->getPrimaryVideoInactiveZone().bottom > adjustedMousePos.y) {
+		if (g_nancy->getGameType() <= kGameTypeNancy16 && g_nancy->_cursor->getPrimaryVideoInactiveZone().bottom > adjustedMousePos.y) {
 			g_nancy->_cursor->warpCursor(Common::Point(initialMousePos.x + cursorHotspot.x, initialMousePos.y + cursorHotspot.y));
 			g_nancy->_cursor->setCursorType(CursorManager::kNormalArrow);
 		}
diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index ea961a9a796..078ff7861bb 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -2813,8 +2813,9 @@ void Scene::handleInput() {
 	}
 #endif
 
-	// Warp the mouse below the inactive zone during dialogue scenes
-	if (_activeConversation != nullptr) {
+	// Warp the mouse below the inactive zone during dialogue scenes. From Nancy17 on
+	// the mouse stays where the player puts it.
+	if (_activeConversation != nullptr && g_nancy->getGameType() <= kGameTypeNancy16) {
 		const Common::Rect &inactiveZone = g_nancy->_cursor->getPrimaryVideoInactiveZone();
 
 		if (g_nancy->getGameType() == kGameTypeVampire) {


Commit: ea8721c0eabe1e604f4328f80df8347b3ec091fd
    https://github.com/scummvm/scummvm/commit/ea8721c0eabe1e604f4328f80df8347b3ec091fd
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:15+02:00

Commit Message:
NANCY: Keep movies on screen until the scene they change to

A movie that hides when it ends and then changes the scene was
hidden right away, while the scene change only happened a moment
later. The scene showed without it in between, like Helena on the
stairs in Nancy18 scene 2320 after Nancy bumps into her.

Changed paths:
    engines/nancy/action/secondarymovie.cpp


diff --git a/engines/nancy/action/secondarymovie.cpp b/engines/nancy/action/secondarymovie.cpp
index 67c0b5a2953..917829b3f31 100644
--- a/engines/nancy/action/secondarymovie.cpp
+++ b/engines/nancy/action/secondarymovie.cpp
@@ -1469,8 +1469,10 @@ void PlaySecondaryMovie::execute() {
 			} else {
 				// Hide it right away, as the flags of its last frame may stop the
 				// record from running; e.g. pouring the hot sauce in Nancy17 scene
-				// 3008, where the bottle overlay takes over
-				if (_hideOnFinish) {
+				// 3008, where the bottle overlay takes over. A movie that changes
+				// the scene stays until the next one replaces it, or the scene would
+				// show without it for a moment, like Helena in Nancy18 scene 2320.
+				if (_hideOnFinish && _videoSceneChange != kMovieSceneChange) {
 					setVisible(false);
 					_mask.setVisible(false);
 				}


Commit: ad5538aad731ad1518c0ff9513fb3674afefdbc8
    https://github.com/scummvm/scummvm/commit/ad5538aad731ad1518c0ff9513fb3674afefdbc8
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:18+02:00

Commit Message:
NANCY: NANCY18: Use the lower bar's PDA button for the PDA item

The PDA is an item whose name is also the name of the PDA button on
the lower bar. A second, hidden button was made for it in the
inventory, which the scenes then showed instead of the real one, so
the PDA button disappeared after leaving the PDA. Items named like
a button in the UI will now use that button.

Changed paths:
    engines/nancy/ui/ndui/button.cpp
    engines/nancy/ui/ndui/button.h
    engines/nancy/ui/ndui/enginehandlers.cpp
    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/button.cpp b/engines/nancy/ui/ndui/button.cpp
index 5b0df891b8a..1d31157bde8 100644
--- a/engines/nancy/ui/ndui/button.cpp
+++ b/engines/nancy/ui/ndui/button.cpp
@@ -138,6 +138,11 @@ void InvButton::readExtra(Common::SeekableReadStream &stream) {
 
 void InvButton::setItem(const INVD::Item &item) {
 	_name = item.name;
+	attachItem(item);
+	_elements[1].setTexture(_elements[1]._textureName, item.sourceRect);
+}
+
+void InvButton::attachItem(const INVD::Item &item) {
 	_itemID = item.id;
 	_kind = item.kind;
 	_valueIndex = item.valueIndex;
@@ -147,8 +152,6 @@ void InvButton::setItem(const INVD::Item &item) {
 	_sceneName = item.sceneName.toString();
 	uint16 sceneID = 0;
 	_scene = parseSceneName(_sceneName, sceneID) ? sceneID : 0;
-
-	_elements[1].setTexture(_elements[1]._textureName, item.sourceRect);
 }
 
 bool InvButton::doAction(const Action &action) {
diff --git a/engines/nancy/ui/ndui/button.h b/engines/nancy/ui/ndui/button.h
index 3a8d5517dc9..ab3a966ef58 100644
--- a/engines/nancy/ui/ndui/button.h
+++ b/engines/nancy/ui/ndui/button.h
@@ -69,6 +69,8 @@ public:
 
 	// Nancy17 buttons are made from a template, and get their item afterwards
 	void setItem(const INVD::Item &item);
+	// Makes the button act as the item, without changing its name or look
+	void attachItem(const INVD::Item &item);
 
 	int16 getItemID() const { return _itemID; }
 	int32 getKind() const { return _kind; }
diff --git a/engines/nancy/ui/ndui/enginehandlers.cpp b/engines/nancy/ui/ndui/enginehandlers.cpp
index 6e5b605b6b3..c1545959689 100644
--- a/engines/nancy/ui/ndui/enginehandlers.cpp
+++ b/engines/nancy/ui/ndui/enginehandlers.cpp
@@ -336,9 +336,31 @@ void Manager::createItemButtons() {
 		return;
 	}
 
-	if (panel && _templates.contains("InvButton")) {
-		panel->addItemButtons(_templates["InvButton"]);
+	if (!panel || !_templates.contains("InvButton")) {
+		return;
+	}
+
+	// Names are unique in the UI. An item named like a button the UI data places
+	// elsewhere uses that button, like the PDA of Nancy18 on the lower bar.
+	const INVD *items = GetEngineData(INVD);
+	Common::Array<int16> attachedItems;
+	_attachedItemButtons.clear();
+
+	for (uint i = 0; items && i < items->items.size(); ++i) {
+		const INVD::Item &item = items->items[i];
+
+		for (Panel *other : _panels) {
+			InvButton *button = other != panel ? other->findInvButton(item.name) : nullptr;
+			if (button) {
+				button->attachItem(item);
+				_attachedItemButtons.push_back(button);
+				attachedItems.push_back(item.id);
+				break;
+			}
+		}
 	}
+
+	panel->addItemButtons(_templates["InvButton"], attachedItems);
 }
 
 void Manager::showInventoryItem(int16 itemID, bool show) {
diff --git a/engines/nancy/ui/ndui/manager.cpp b/engines/nancy/ui/ndui/manager.cpp
index 59664a0e750..3cc89ab9582 100644
--- a/engines/nancy/ui/ndui/manager.cpp
+++ b/engines/nancy/ui/ndui/manager.cpp
@@ -285,6 +285,12 @@ Panel *Manager::findPanel(const Common::String &name) const {
 }
 
 InvButton *Manager::findItemButton(int16 itemID) const {
+	for (InvButton *button : _attachedItemButtons) {
+		if (button->getItemID() == itemID) {
+			return button;
+		}
+	}
+
 	for (Panel *panel : _panels) {
 		InvButton *button = panel->findItemButton(itemID);
 		if (button) {
diff --git a/engines/nancy/ui/ndui/manager.h b/engines/nancy/ui/ndui/manager.h
index 77e86bef441..2f1fc289aeb 100644
--- a/engines/nancy/ui/ndui/manager.h
+++ b/engines/nancy/ui/ndui/manager.h
@@ -218,6 +218,7 @@ private:
 	InvButton *findItemButton(int16 itemID) const;
 
 	Common::Array<Panel *> _panels;
+	Common::Array<InvButton *> _attachedItemButtons;	// Buttons placed by the UI data that act as an item, like the PDA
 	Common::String _eventSender;
 	Common::String _caption;
 	Common::HashMap<Common::String, Graphics::ManagedSurface *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _textures;
diff --git a/engines/nancy/ui/ndui/panel.cpp b/engines/nancy/ui/ndui/panel.cpp
index 31e25c32f6e..074db14784b 100644
--- a/engines/nancy/ui/ndui/panel.cpp
+++ b/engines/nancy/ui/ndui/panel.cpp
@@ -24,6 +24,7 @@
 #include "engines/nancy/input.h"
 #include "engines/nancy/util.h"
 
+#include "common/algorithm.h"
 #include "common/memstream.h"
 
 #include "engines/nancy/ui/ndui/panel.h"
@@ -302,9 +303,12 @@ Control *Panel::addNewControl(int32 type, Common::SeekableReadStream &stream) {
 	case kControlCheckBox:
 		control = new CheckBox(this);
 		break;
-	case kControlInvButton:
-		control = new InvButton(this);
+	case kControlInvButton: {
+		InvButton *button = new InvButton(this);
+		_invButtons.push_back(button);
+		control = button;
 		break;
+	}
 	case kControlVarStatic:
 		control = new VarStatic(this);
 		break;
@@ -323,7 +327,7 @@ Control *Panel::addNewControl(int32 type, Common::SeekableReadStream &stream) {
 	return control;
 }
 
-void Panel::addItemButtons(const Common::Array<byte> &buttonTemplate) {
+void Panel::addItemButtons(const Common::Array<byte> &buttonTemplate, const Common::Array<int16> &skippedItems) {
 	const INVD *items = GetEngineData(INVD);
 	if (!items) {
 		return;
@@ -332,6 +336,10 @@ void Panel::addItemButtons(const Common::Array<byte> &buttonTemplate) {
 	_kind = kObjectInvPanel;
 
 	for (const INVD::Item &item : items->items) {
+		if (Common::find(skippedItems.begin(), skippedItems.end(), item.id) != skippedItems.end()) {
+			continue;
+		}
+
 		Common::MemoryReadStream stream(buttonTemplate.data(), buttonTemplate.size());
 		stream.skip(33 + 4); // version and control type
 
@@ -662,6 +670,13 @@ bool Panel::removeControl(const Common::String &name) {
 			}
 		}
 
+		for (uint j = 0; j < _invButtons.size(); ++j) {
+			if (_invButtons[j] == control) {
+				_invButtons.remove_at(j);
+				break;
+			}
+		}
+
 		if (_focus == control) {
 			_focus = nullptr;
 		}
@@ -731,6 +746,16 @@ bool Panel::isItemButton(const Common::String &name) const {
 	return false;
 }
 
+InvButton *Panel::findInvButton(const Common::String &name) const {
+	for (InvButton *button : _invButtons) {
+		if (button->getName().equalsIgnoreCase(name)) {
+			return button;
+		}
+	}
+
+	return nullptr;
+}
+
 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 197f552fb0e..7b79fdf5e21 100644
--- a/engines/nancy/ui/ndui/panel.h
+++ b/engines/nancy/ui/ndui/panel.h
@@ -91,7 +91,8 @@ public:
 
 	// Nancy17 keeps the items apart from the panel that shows them, which comes
 	// with nothing but a template for their buttons
-	void addItemButtons(const Common::Array<byte> &buttonTemplate);
+	void addItemButtons(const Common::Array<byte> &buttonTemplate, const Common::Array<int16> &skippedItems);
+	InvButton *findInvButton(const Common::String &name) const;
 	Tooltip *getTooltip() const { return _tooltip; }
 
 	void updateGraphics() override;
@@ -166,6 +167,7 @@ private:
 	Common::Array<Control *> _arrangeOrder;
 	Common::Array<RadioButton *> _radioButtons;
 	Common::Array<EditBox *> _editBoxes;
+	Common::Array<InvButton *> _invButtons;	// Item buttons placed by the UI data, not made for the inventory
 	EditBox *_focus = nullptr;
 	int _nextID = 1;
 


Commit: 65359cd912e1151a8f4db155d934a91c773ba69e
    https://github.com/scummvm/scummvm/commit/65359cd912e1151a8f4db155d934a91c773ba69e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:21+02:00

Commit Message:
NANCY: Fix conditional expressions. PVS-Studio V560

Changed paths:
    engines/nancy/ui/taskbar/taskbar.cpp


diff --git a/engines/nancy/ui/taskbar/taskbar.cpp b/engines/nancy/ui/taskbar/taskbar.cpp
index f47a600f779..d2a47a0d7e1 100644
--- a/engines/nancy/ui/taskbar/taskbar.cpp
+++ b/engines/nancy/ui/taskbar/taskbar.cpp
@@ -315,8 +315,11 @@ void Taskbar::setClickSoundMode(uint buttonIndex, uint mode) {
 	persistOverride(buttonIndex);
 }
 
+// The saved overrides and notifications mirror the TASK buttons one to one
+static_assert(TaskbarData::kNumButtons == TASK::kNumButtons, "TaskbarData and TASK button counts differ");
+
 void Taskbar::persistOverride(uint index) {
-	if (index >= TASK::kNumButtons || index >= TaskbarData::kNumButtons) {
+	if (index >= TaskbarData::kNumButtons) {
 		return;
 	}
 	TaskbarData *data = (TaskbarData *)NancySceneState.getPuzzleData(TaskbarData::getTag());
@@ -330,7 +333,7 @@ void Taskbar::persistOverride(uint index) {
 }
 
 void Taskbar::persistNotifications(uint index) {
-	if (index >= TASK::kNumButtons || index >= TaskbarData::kNumButtons) {
+	if (index >= TaskbarData::kNumButtons) {
 		return;
 	}
 	TaskbarData *data = (TaskbarData *)NancySceneState.getPuzzleData(TaskbarData::getTag());
@@ -347,7 +350,7 @@ void Taskbar::syncFromPuzzleData() {
 	if (!data) {
 		return;
 	}
-	for (uint i = 0; i < TASK::kNumButtons && i < TaskbarData::kNumButtons; ++i) {
+	for (uint i = 0; i < TaskbarData::kNumButtons; ++i) {
 		_overrides[i].active = data->overrides[i].active;
 		_overrides[i].startScene = data->overrides[i].startScene;
 		_overrides[i].endScene = data->overrides[i].endScene;


Commit: 16d2160d2a9befcc412f2b7e10dd1e3e15a08130
    https://github.com/scummvm/scummvm/commit/16d2160d2a9befcc412f2b7e10dd1e3e15a08130
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:23+02:00

Commit Message:
NANCY: Init member variables in class Decompressor. PVS-Studio V730

Changed paths:
    engines/nancy/resource/decompress.h


diff --git a/engines/nancy/resource/decompress.h b/engines/nancy/resource/decompress.h
index f03ebfffde3..ae60e62cede 100644
--- a/engines/nancy/resource/decompress.h
+++ b/engines/nancy/resource/decompress.h
@@ -51,7 +51,7 @@ private:
 	bool readByte(byte &b);
 	bool writeByte(byte b);
 
-	byte _buf[kBufSize];
+	byte _buf[kBufSize] = {};
 	uint _bufpos;
 	bool _err;
 	byte _val;


Commit: f39009889d6a0888c1ad64dc8c8ef58a112d1c1d
    https://github.com/scummvm/scummvm/commit/f39009889d6a0888c1ad64dc8c8ef58a112d1c1d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:24+02:00

Commit Message:
NANCY: Remove superfluous assignment. PVS-Studio V1048

Changed paths:
    engines/nancy/font.cpp


diff --git a/engines/nancy/font.cpp b/engines/nancy/font.cpp
index e8cfb607a91..154eee55c59 100644
--- a/engines/nancy/font.cpp
+++ b/engines/nancy/font.cpp
@@ -594,7 +594,6 @@ Common::Rect Font::getCharacterSourceRect(char chr) const {
 			offset = _atSignOffset;
 			break;
 		default:
-			offset = -1;
 			break;
 		}
 	}


Commit: 2eeb6baab9199856eb592ba62199359658f47350
    https://github.com/scummvm/scummvm/commit/2eeb6baab9199856eb592ba62199359658f47350
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:25+02:00

Commit Message:
NANCY: Fix always true expression for stream. PVS-Studio V547

Changed paths:
    engines/nancy/resource/resource.cpp


diff --git a/engines/nancy/resource/resource.cpp b/engines/nancy/resource/resource.cpp
index 4bb0d5021b6..c37745c4de6 100644
--- a/engines/nancy/resource/resource.cpp
+++ b/engines/nancy/resource/resource.cpp
@@ -89,14 +89,12 @@ bool ResourceManager::loadImage(const Common::Path &name, Graphics::ManagedSurfa
 	}
 
 	// Check for loose .cif images. This bypasses tree search even with a provided treeName
-	if (!stream) {
-		stream = SearchMan.createReadStreamForMember(name.append(".cif"));
-		if (stream) {
-			// .cifs are compressed, so we need to extract
-			CifFile cifFile(stream, name); // cifFile takes ownership of the current stream
-			stream = cifFile.createReadStream();
-			info = cifFile.getInfo();
-		}
+	stream = SearchMan.createReadStreamForMember(name.append(".cif"));
+	if (stream) {
+		// .cifs are compressed, so we need to extract
+		CifFile cifFile(stream, name); // cifFile takes ownership of the current stream
+		stream = cifFile.createReadStream();
+		info = cifFile.getInfo();
 	}
 
 	// Search inside the ciftrees


Commit: 5c12c4252e3ef8e412303d099f4a91f9ae8c1a42
    https://github.com/scummvm/scummvm/commit/5c12c4252e3ef8e412303d099f4a91f9ae8c1a42
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:31+02:00

Commit Message:
NANCY: Plug memory leak

Changed paths:
    engines/nancy/resource/resource.cpp


diff --git a/engines/nancy/resource/resource.cpp b/engines/nancy/resource/resource.cpp
index c37745c4de6..cffa2792d98 100644
--- a/engines/nancy/resource/resource.cpp
+++ b/engines/nancy/resource/resource.cpp
@@ -79,6 +79,7 @@ bool ResourceManager::loadImage(const Common::Path &name, Graphics::ManagedSurfa
 			bmpDec.loadStream(*stream);
 			surf.copyFrom(*bmpDec.getSurface());
 			surf.setPalette(bmpDec.getPalette().data(), 0, MIN<uint>(256, bmpDec.getPalette().size())); // LOGO.BMP reports 257 colors
+			delete stream;
 			return true;
 		}
 	}


Commit: 651435bb59261ac7be216e1f95dc301faa604636
    https://github.com/scummvm/scummvm/commit/651435bb59261ac7be216e1f95dc301faa604636
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:33+02:00

Commit Message:
NANCY: NANCY24: Move the task completions array inside the Scene class

Allows us to move the static global array inside the class, thus
silencing a warning regarding the usage of a global destructor

Changed paths:
    engines/nancy/script/gameapi.cpp
    engines/nancy/state/scene.h


diff --git a/engines/nancy/script/gameapi.cpp b/engines/nancy/script/gameapi.cpp
index 09ef5cc76ad..229eea2abb2 100644
--- a/engines/nancy/script/gameapi.cpp
+++ b/engines/nancy/script/gameapi.cpp
@@ -1868,46 +1868,34 @@ static int playerAddJournalEntry(lua_State *L) {
 	return 0;
 }
 
-// Nancy24 tells whether a task is done with a completion function of the
-// scripts, in place of a flag. The functions belong to the Lua state of the
-// scene that gave them, which is the scene of the task list stream, and are
-// dropped when that scene goes away.
-struct TaskCompletion {
-	SceneContext *context;
-	uint character;
-	Common::String text;
-	int ref;
-};
-
-static Common::Array<TaskCompletion> s_taskCompletions;
-
 static void setTaskCompletion(lua_State *L, int index, uint character, const Common::String &text) {
 	SceneContext *context = LuaState::getContext(L);
 	if (!context) {
 		return;
 	}
 
-	for (uint i = 0; i < s_taskCompletions.size(); ++i) {
-		const TaskCompletion &completion = s_taskCompletions[i];
+	Common::Array<State::Scene::TaskCompletion> &completions = NancySceneState.getTaskCompletions();
+	for (uint i = 0; i < completions.size(); ++i) {
+		const State::Scene::TaskCompletion &completion = completions[i];
 		if (completion.character == character && completion.text.equalsIgnoreCase(text)) {
 			luaL_unref(completion.context->getLua(), LUA_REGISTRYINDEX, completion.ref);
-			s_taskCompletions.remove_at(i);
+			completions.remove_at(i);
 			break;
 		}
 	}
 
-	TaskCompletion completion;
+	State::Scene::TaskCompletion completion;
 	completion.context = context;
 	completion.character = character;
 	completion.text = text;
 	lua_pushvalue(L, index);
 	completion.ref = luaL_ref(L, LUA_REGISTRYINDEX);
-	s_taskCompletions.push_back(completion);
+	completions.push_back(completion);
 }
 
 bool isTaskComplete(const Common::String &text) {
 	const uint character = g_nancy->getPlayerCharacter();
-	for (const TaskCompletion &completion : s_taskCompletions) {
+	for (const State::Scene::TaskCompletion &completion : NancySceneState.getTaskCompletions()) {
 		if (completion.character != character || !completion.text.equalsIgnoreCase(text)) {
 			continue;
 		}
@@ -1927,9 +1915,10 @@ bool isTaskComplete(const Common::String &text) {
 }
 
 void forgetTaskCompletions(SceneContext *context) {
-	for (uint i = 0; i < s_taskCompletions.size();) {
-		if (s_taskCompletions[i].context == context) {
-			s_taskCompletions.remove_at(i);
+	Common::Array<State::Scene::TaskCompletion> &completions = NancySceneState.getTaskCompletions();
+	for (uint i = 0; i < completions.size();) {
+		if (completions[i].context == context) {
+			completions.remove_at(i);
 		} else {
 			++i;
 		}
diff --git a/engines/nancy/state/scene.h b/engines/nancy/state/scene.h
index 53a04e21d2c..d0e2364b18d 100644
--- a/engines/nancy/state/scene.h
+++ b/engines/nancy/state/scene.h
@@ -159,6 +159,19 @@ public:
 #ifdef ENABLE_NANCY_V4
 	// Nancy19: the script of the main scene; null while there is none
 	Script::SceneContext *getScriptScene() const { return _scriptScene; }
+
+	// Nancy24 tells whether a task is done with a completion function of the
+	// scripts, in place of a flag. The functions belong to the Lua state of the
+	// scene that gave them, which is the scene of the task list stream, and are
+	// dropped when that scene goes away.
+	struct TaskCompletion {
+		Script::SceneContext *context;
+		uint character;
+		Common::String text;
+		int ref;
+	};
+
+	Common::Array<TaskCompletion> &getTaskCompletions() { return _taskCompletions; }
 #endif
 	void addSceneVisit(uint16 sceneID) { _flags.sceneCounts.getOrCreateVal(sceneID)++; }
 	void pushScene(int16 itemID = -1);
@@ -558,6 +571,7 @@ private:
 	// Nancy19: the script of the scene, which takes the place of the action records
 	Script::SceneContext *_scriptScene = nullptr;
 	bool _isScriptedUIReady = false;
+	Common::Array<TaskCompletion> _taskCompletions;
 
 	// Nancy20: the main stream can also be in a scene that has a name instead of
 	// a number, like "s1002a_SC". These hold the name of the scene it is in and


Commit: ecbaa859f88308033e8d077703020da1a37836f6
    https://github.com/scummvm/scummvm/commit/ecbaa859f88308033e8d077703020da1a37836f6
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-07T03:44:34+02:00

Commit Message:
NANCY: Add counter increment in RaycastLevelBuilder. PVS-Studio V1044

Tested with both 3D mazes that use this puzzle:
- Nancy3 scene 8499
- Nancy6 scene 4150

Changed paths:
    engines/nancy/action/puzzle/raycastpuzzle.cpp


diff --git a/engines/nancy/action/puzzle/raycastpuzzle.cpp b/engines/nancy/action/puzzle/raycastpuzzle.cpp
index 26ef10d370a..2d97ad43f60 100644
--- a/engines/nancy/action/puzzle/raycastpuzzle.cpp
+++ b/engines/nancy/action/puzzle/raycastpuzzle.cpp
@@ -347,7 +347,7 @@ void RaycastLevelBuilder::writeTransparentWalls(uint startX, uint startY, uint t
 	const RCLB::Theme &theme = _themeData->themes[themeID];
 	uint numWallsToWrite = (int)((float)theme.objectWallDensity * _objectsBaseDensity);
 
-	for (uint numWrittenWalls = 0; numWrittenWalls < numWallsToWrite;) {
+	for (uint numWrittenWalls = 0; numWrittenWalls < numWallsToWrite; ++numWrittenWalls) {
 		bool vertical = g_nancy->_randomSource->getRandomBit();
 		bool foundWallLocation = false;
 
@@ -444,8 +444,6 @@ void RaycastLevelBuilder::writeTransparentWalls(uint startX, uint startY, uint t
 
 		_wallMap[y * _fullWidth + x] = selectedTransparentWallIDs;
 		_wallMap[otherY * _fullWidth + otherX] = selectedTransparentWallIDs;
-
-		++numWrittenWalls;
 	}
 }
 
@@ -455,7 +453,7 @@ void RaycastLevelBuilder::writeObjectWalls(uint startX, uint startY, uint themeI
 
 	uint textureVerticalHeight = _verticalHeight * 128; // 128 is a constant inside RayCast
 
-	for (uint numWrittenWalls = 0; numWrittenWalls < numWallsToWrite;) {
+	for (uint numWrittenWalls = 0; numWrittenWalls < numWallsToWrite; ++numWrittenWalls) {
 		bool vertical = g_nancy->_randomSource->getRandomBit();
 		bool foundWallLocation = false;
 
@@ -569,8 +567,6 @@ void RaycastLevelBuilder::writeObjectWalls(uint startX, uint startY, uint themeI
 		ceiling = (int)ceiling - 2 < 0 ? 0 : ceiling - 2;
 
 		_floorCeilingLightMap[y * _fullWidth + x] = (lightmapValue & 0xF000) | (ceiling << 4) | floor;
-
-		++numWrittenWalls;
 	}
 }
 
@@ -578,7 +574,7 @@ void RaycastLevelBuilder::writeDoors(uint startX, uint startY, uint themeID) {
 	const RCLB::Theme &theme = _themeData->themes[themeID];
 	uint numDoorsToWrite = (int)((float)theme.doorDensity * _objectsBaseDensity);
 
-	for (uint numWrittenWalls = 0; numWrittenWalls < numDoorsToWrite;) {
+	for (uint numWrittenWalls = 0; numWrittenWalls < numDoorsToWrite; ++numWrittenWalls) {
 		bool vertical = g_nancy->_randomSource->getRandomBit();
 		bool foundDoorLocation = false;
 




More information about the Scummvm-git-logs mailing list