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

fracturehill noreply at scummvm.org
Sat Sep 30 14:56:47 UTC 2023


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

Summary:
e9d63bca07 NANCY: Fix PasswordPuzzle reading in nancy6
d6bd820352 NANCY: Fix reading of nancy6 Raycast chunks
16bfcd08e4 NANCY: Fix nancy6 alarm clock sound
6ab03d5733 NANCY: Fix sound delay in TurningPuzzle
3db0bcbbde NANCY: Implement TwoDialPuzzle
f3fe8f251f NANCY: Increment scene counts on scene exit


Commit: e9d63bca07aebdac142911add1e1ffbe14377196
    https://github.com/scummvm/scummvm/commit/e9d63bca07aebdac142911add1e1ffbe14377196
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-09-30T17:56:27+03:00

Commit Message:
NANCY: Fix PasswordPuzzle reading in nancy6

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


diff --git a/engines/nancy/action/puzzle/passwordpuzzle.cpp b/engines/nancy/action/puzzle/passwordpuzzle.cpp
index 835c954fff3..d49da545240 100644
--- a/engines/nancy/action/puzzle/passwordpuzzle.cpp
+++ b/engines/nancy/action/puzzle/passwordpuzzle.cpp
@@ -53,29 +53,30 @@ void PasswordPuzzle::readData(Common::SeekableReadStream &stream) {
 
 	uint numNames = 1;
 	uint numPasswords = 1;
-	char buf[20];
+	char buf[33];
+	uint fieldSize = s.getVersion() <= kGameTypeNancy5 ? 20 : 33; // nancy6 changed the size of text fields to 33
 
 	s.syncAsUint16LE(numNames, kGameTypeNancy4);
 	_names.resize(numNames);
 	for (uint i = 0; i < numNames; ++i) {
-		stream.read(buf, 20);
-		buf[19] = '\0';
+		stream.read(buf, fieldSize);
+		buf[fieldSize - 1] = '\0';
 		_names[i] = buf;
 
 		_maxNameLength = MAX(_maxNameLength, _names[i].size());
 	}
-	s.skip((5 - numNames) * 20, kGameTypeNancy4);
+	s.skip((5 - numNames) * fieldSize, kGameTypeNancy4);
 
 	s.syncAsUint16LE(numPasswords, kGameTypeNancy4);
 	_passwords.resize(numPasswords);
 	for (uint i = 0; i < numPasswords; ++i) {
-		stream.read(buf, 20);
+		stream.read(buf, fieldSize);
 		buf[19] = '\0';
 		_passwords[i] = buf;
 
 		_maxPasswordLength = MAX(_maxPasswordLength, _passwords[i].size());
 	}
-	s.skip((5 - numPasswords) * 20, kGameTypeNancy4);
+	s.skip((5 - numPasswords) * fieldSize, kGameTypeNancy4);
 
 	_solveExitScene.readData(stream);
 	_solveSound.readNormal(stream);


Commit: d6bd8203520f8431bc2e0322298a7f52d5184abd
    https://github.com/scummvm/scummvm/commit/d6bd8203520f8431bc2e0322298a7f52d5184abd
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-09-30T17:56:27+03:00

Commit Message:
NANCY: Fix reading of nancy6 Raycast chunks

Changed paths:
    engines/nancy/enginedata.cpp


diff --git a/engines/nancy/enginedata.cpp b/engines/nancy/enginedata.cpp
index 07c4ca6949b..5060974d897 100644
--- a/engines/nancy/enginedata.cpp
+++ b/engines/nancy/enginedata.cpp
@@ -688,13 +688,13 @@ RCPR::RCPR(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
 	Common::String tmp;
 	while (chunkStream->pos() < chunkStream->size()) {
 		readFilename(*chunkStream, tmp);
-		if (tmp.hasPrefix("Wall")) {
+		if (tmp.hasPrefixIgnoreCase("Wall")) {
 			wallNames.push_back(tmp);
-		} else if (tmp.hasPrefix("SpW")) {
+		} else if (tmp.hasPrefixIgnoreCase("SpW")) {
 			specialWallNames.push_back(tmp);
-		} else if (tmp.hasPrefix("Ceil")) {
+		} else if (tmp.hasPrefixIgnoreCase("Ceil")) {
 			ceilingNames.push_back(tmp);
-		} else if (tmp.hasPrefix("Floor")) {
+		} else if (tmp.hasPrefixIgnoreCase("Floor")) {
 			floorNames.push_back(tmp);
 		}
 	}


Commit: 16bfcd08e4cc522c52160f94f9bda642f6d48d3d
    https://github.com/scummvm/scummvm/commit/16bfcd08e4cc522c52160f94f9bda642f6d48d3d
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-09-30T17:56:27+03:00

Commit Message:
NANCY: Fix nancy6 alarm clock sound

Fixed an issue where the alarm clock's buttons sounds
wouldn't play in nancy6, since they were using the same
channel as the sound that should play when the alarm has
been set. Also, the alarm setting sound now actually plays.

Changed paths:
    engines/nancy/action/puzzle/setplayerclock.cpp
    engines/nancy/action/puzzle/setplayerclock.h


diff --git a/engines/nancy/action/puzzle/setplayerclock.cpp b/engines/nancy/action/puzzle/setplayerclock.cpp
index ea3c4a3c9c1..33fb892cea2 100644
--- a/engines/nancy/action/puzzle/setplayerclock.cpp
+++ b/engines/nancy/action/puzzle/setplayerclock.cpp
@@ -85,7 +85,7 @@ void SetPlayerClock::readData(Common::SeekableReadStream &stream) {
 	_buttonSound.readNormal(stream);
 	_alarmSetScene.readData(stream);
 	_alarmSoundDelay = stream.readUint16LE();
-	_alarmRingSound.readNormal(stream);
+	_alarmSetSound.readNormal(stream);
 	_exitScene.readData(stream);
 }
 
@@ -96,7 +96,6 @@ void SetPlayerClock::execute() {
 		registerGraphics();
 
 		g_nancy->_sound->loadSound(_buttonSound);
-		g_nancy->_sound->loadSound(_alarmRingSound);
 
 		_alarmHours = NancySceneState.getPlayerTime().getHours();
 
@@ -153,14 +152,27 @@ void SetPlayerClock::execute() {
 		}
 
 		if (_alarmState == kWait) {
-			// Alarm has been set, wait for timer
-			if (g_system->getMillis() > _sceneChangeTime) {
-				NancySceneState.setPlayerTime(_alarmHours * 3600000, false);
-				_alarmSetScene.execute();
-				finishExecution();
+			if (_sceneChangeTime != 0) {
+				// Alarm has been set, wait for timer
+				if (g_system->getMillis() > _sceneChangeTime) {
+					_sceneChangeTime = 0;
+					g_nancy->_sound->loadSound(_alarmSetSound);
+					g_nancy->_sound->playSound(_alarmSetSound);
+				}
 			}
+			if (_sceneChangeTime == 0) {
+				if (!g_nancy->_sound->isSoundPlaying(_alarmSetSound)) {
+					g_nancy->_sound->stopSound(_buttonSound);
+					g_nancy->_sound->stopSound(_alarmSetSound);;
+					NancySceneState.setPlayerTime(_alarmHours * 3600000, false);
+					_alarmSetScene.execute();
+					finishExecution();
+				}
+			}
+			
 		} else {
 			// Cancel button pressed, go to exit scene
+			g_nancy->_sound->stopSound(_buttonSound);
 			_exitScene.execute();
 			finishExecution();
 		}
diff --git a/engines/nancy/action/puzzle/setplayerclock.h b/engines/nancy/action/puzzle/setplayerclock.h
index b5afa712119..d9273b77d5f 100644
--- a/engines/nancy/action/puzzle/setplayerclock.h
+++ b/engines/nancy/action/puzzle/setplayerclock.h
@@ -75,7 +75,7 @@ protected:
 	SoundDescription _buttonSound;
 	SceneChangeWithFlag _alarmSetScene;
 	uint16 _alarmSoundDelay = 0;
-	SoundDescription _alarmRingSound; // NO SOUND in MHM
+	SoundDescription _alarmSetSound; // NO SOUND in MHM
 	SceneChangeWithFlag _exitScene;
 
 	Graphics::ManagedSurface _image;


Commit: 6ab03d5733f0fb373b941d6425968c1946a0415e
    https://github.com/scummvm/scummvm/commit/6ab03d5733f0fb373b941d6425968c1946a0415e
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-09-30T17:56:27+03:00

Commit Message:
NANCY: Fix sound delay in TurningPuzzle

Changed paths:
    engines/nancy/action/puzzle/turningpuzzle.cpp
    engines/nancy/action/puzzle/turningpuzzle.h


diff --git a/engines/nancy/action/puzzle/turningpuzzle.cpp b/engines/nancy/action/puzzle/turningpuzzle.cpp
index 22a8387dedb..0d6da0013ef 100644
--- a/engines/nancy/action/puzzle/turningpuzzle.cpp
+++ b/engines/nancy/action/puzzle/turningpuzzle.cpp
@@ -180,7 +180,7 @@ void TurningPuzzle::readData(Common::SeekableReadStream &stream) {
 	stream.skip((16 - numSpindles) * 2);
 
 	_solveScene.readData(stream);
-	_solveSoundDelayTime = stream.readUint16LE();
+	_solveSoundDelay = stream.readUint16LE();
 	_solveSound.readNormal(stream);
 
 	_exitScene.readData(stream);
@@ -223,9 +223,9 @@ void TurningPuzzle::execute() {
 			}
 			return;
 		case kWaitBeforeSound :
-			if (_soundDelayTime == 0) {
-				_soundDelayTime = g_nancy->getTotalPlayTime() + (_soundDelayTime * 1000);
-			} else if (g_nancy->getTotalPlayTime() > _soundDelayTime) {
+			if (_solveSoundDelayTime == 0) {
+				_solveSoundDelayTime = g_nancy->getTotalPlayTime() + (_solveSoundDelay * 1000);
+			} else if (g_nancy->getTotalPlayTime() > _solveSoundDelayTime) {
 				g_nancy->_sound->loadSound(_solveSound);
 				g_nancy->_sound->playSound(_solveSound);
 				NancySceneState.setEventFlag(_solveScene._flag);
diff --git a/engines/nancy/action/puzzle/turningpuzzle.h b/engines/nancy/action/puzzle/turningpuzzle.h
index 72dd3c19149..0665b2f2125 100644
--- a/engines/nancy/action/puzzle/turningpuzzle.h
+++ b/engines/nancy/action/puzzle/turningpuzzle.h
@@ -76,7 +76,7 @@ protected:
 	Common::Array<uint16> _correctOrder;
 
 	SceneChangeWithFlag _solveScene;
-	uint16 _soundDelayTime = 0;
+	uint16 _solveSoundDelay = 0;
 	SoundDescription _solveSound;
 
 	SceneChangeWithFlag _exitScene;


Commit: 3db0bcbbde41d1454575b217a60745dee5d9c61d
    https://github.com/scummvm/scummvm/commit/3db0bcbbde41d1454575b217a60745dee5d9c61d
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-09-30T17:56:27+03:00

Commit Message:
NANCY: Implement TwoDialPuzzle

Added support for the TwoDialPuzzle action record, which
is an incredibly simple puzzle with two dials that need to
be rotated in the correct position.

Changed paths:
  A engines/nancy/action/puzzle/twodialpuzzle.cpp
  A engines/nancy/action/puzzle/twodialpuzzle.h
    engines/nancy/action/arfactory.cpp
    engines/nancy/module.mk


diff --git a/engines/nancy/action/arfactory.cpp b/engines/nancy/action/arfactory.cpp
index 05b5b3814f6..719c19fb397 100644
--- a/engines/nancy/action/arfactory.cpp
+++ b/engines/nancy/action/arfactory.cpp
@@ -49,6 +49,7 @@
 #include "engines/nancy/action/puzzle/telephone.h"
 #include "engines/nancy/action/puzzle/towerpuzzle.h"
 #include "engines/nancy/action/puzzle/turningpuzzle.h"
+#include "engines/nancy/action/puzzle/twodialpuzzle.h"
 
 #include "engines/nancy/state/scene.h"
 
@@ -255,6 +256,8 @@ ActionRecord *ActionManager::createActionRecord(uint16 type) {
 		return new MazeChasePuzzle();
 	case 216:
 		return new PeepholePuzzle();
+	case 220:
+		return new TwoDialPuzzle();
 	default:
 		return nullptr;
 	}
diff --git a/engines/nancy/action/puzzle/twodialpuzzle.cpp b/engines/nancy/action/puzzle/twodialpuzzle.cpp
new file mode 100644
index 00000000000..759ea77942e
--- /dev/null
+++ b/engines/nancy/action/puzzle/twodialpuzzle.cpp
@@ -0,0 +1,181 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "engines/nancy/util.h"
+#include "engines/nancy/nancy.h"
+#include "engines/nancy/graphics.h"
+#include "engines/nancy/resource.h"
+#include "engines/nancy/sound.h"
+#include "engines/nancy/input.h"
+#include "engines/nancy/puzzledata.h"
+#include "engines/nancy/state/scene.h"
+
+#include "engines/nancy/action/puzzle/twodialpuzzle.h"
+
+namespace Nancy {
+namespace Action {
+
+void TwoDialPuzzle::init() {
+	Common::Rect screenBounds = NancySceneState.getViewport().getBounds();
+	_drawSurface.create(screenBounds.width(), screenBounds.height(), g_nancy->_graphicsManager->getInputPixelFormat());
+	_drawSurface.clear(g_nancy->_graphicsManager->getTransColor());
+	setTransparent(true);
+	setVisible(true);
+	moveTo(screenBounds);
+
+	g_nancy->_resource->loadImage(_imageName, _image);
+	registerGraphics();
+}
+
+void TwoDialPuzzle::readData(Common::SeekableReadStream &stream) {
+	readFilename(stream, _imageName);
+
+	uint16 num1 = stream.readUint16LE();
+	uint16 num2 = stream.readUint16LE();
+
+	_isClockwise[0] = stream.readByte();
+	_isClockwise[1] = stream.readByte();
+
+	_startPositions[0] = stream.readUint16LE();
+	_startPositions[1] = stream.readUint16LE();
+
+	readRect(stream, _hotspots[0]);
+	readRect(stream, _hotspots[1]);
+	readRect(stream, _dests[0]);
+	readRect(stream, _dests[1]);
+	readRectArray(stream, _srcs[0], num1, 20);
+	readRectArray(stream, _srcs[1], num2, 20);
+
+	_correctPositions[0] = stream.readUint16LE();
+	_correctPositions[1] = stream.readUint16LE();
+
+	_rotateSounds[0].readNormal(stream);
+	_rotateSounds[1].readNormal(stream);
+
+	_solveScene.readData(stream);
+	_solveSoundDelay = stream.readUint16LE();
+	_solveSound.readNormal(stream);
+
+	_exitScene.readData(stream);
+	readRect(stream, _exitHotspot);
+}
+
+void TwoDialPuzzle::execute() {
+	switch(_state) {
+	case kBegin:
+		init();
+		g_nancy->_sound->loadSound(_rotateSounds[0]);
+		g_nancy->_sound->loadSound(_rotateSounds[1]);
+		_currentPositions[0] = _startPositions[0];
+		_currentPositions[1] = _startPositions[1];
+
+		_drawSurface.blitFrom(_image, _srcs[0][_currentPositions[0]], _dests[0]);
+		_drawSurface.blitFrom(_image, _srcs[1][_currentPositions[1]], _dests[1]);
+		_needsRedraw = true;
+
+		NancySceneState.setNoHeldItem();
+
+		_state = kRun;
+		// fall through
+	case kRun:
+		if (g_nancy->_sound->isSoundPlaying(_rotateSounds[0]) || g_nancy->_sound->isSoundPlaying(_rotateSounds[1])) {
+			return;
+		}
+		
+		if ((uint)_currentPositions[0] == _correctPositions[0] && (uint)_currentPositions[1] == _correctPositions[1]) {
+			_state = kActionTrigger;
+			_isSolved = true;
+			_solveSoundDelayTime = g_nancy->getTotalPlayTime() + (_solveSoundDelay * 1000);
+		}
+
+		break;
+	case kActionTrigger:
+		if (_isSolved) {
+			if (_solveSoundDelayTime != 0) {
+				if (g_nancy->getTotalPlayTime() < _solveSoundDelayTime) {
+					return;
+				}
+
+				_solveSoundDelayTime = 0;
+				g_nancy->_sound->loadSound(_solveSound);
+				g_nancy->_sound->playSound(_solveSound);
+				NancySceneState.setEventFlag(_solveScene._flag);
+				return;
+			} else {
+				if (g_nancy->_sound->isSoundPlaying(_solveSound)) {
+					return;
+				}
+
+				g_nancy->_sound->stopSound(_solveSound);
+				NancySceneState.changeScene(_solveScene._sceneChange);
+			}
+		} else {
+			_exitScene.execute();
+		}
+
+		g_nancy->_sound->stopSound(_rotateSounds[0]);
+		g_nancy->_sound->stopSound(_rotateSounds[1]);
+		finishExecution();
+	}
+}
+
+void TwoDialPuzzle::handleInput(NancyInput &input) {
+	bool canClick = (_state == kRun) && !g_nancy->_sound->isSoundPlaying(_rotateSounds[0]) && !g_nancy->_sound->isSoundPlaying(_rotateSounds[1]);
+
+	if (NancySceneState.getViewport().convertViewportToScreen(_exitHotspot).contains(input.mousePos)) {
+		g_nancy->_cursorManager->setCursorType(g_nancy->_cursorManager->_puzzleExitCursor);
+
+		if (canClick && input.input & NancyInput::kLeftMouseButtonUp) {
+			_state = kActionTrigger;
+		}
+
+		return;
+	}
+
+	for (uint i = 0; i <= 1; ++i) {
+		if (NancySceneState.getViewport().convertViewportToScreen(_hotspots[i]).contains(input.mousePos)) {
+			g_nancy->_cursorManager->setCursorType(_isClockwise[i] ? CursorManager::kRotateCW : CursorManager::kRotateCCW);
+
+			if (canClick && input.input & NancyInput::kLeftMouseButtonUp) {
+				_currentPositions[i] += _isClockwise[i] ? -1 : 1;
+				
+				if (_currentPositions[i] < 0) {
+					_currentPositions[i] = _srcs[i].size() - 1;
+				} else if ((uint)_currentPositions[i] >= _srcs[i].size()) {
+					_currentPositions[i] = 0;
+				}
+
+				g_nancy->_sound->playSound(_rotateSounds[i]);
+				_drawSurface.fillRect(_dests[0].findIntersectingRect(_dests[1]), _drawSurface.getTransparentColor());
+
+				// Blit both dials just in case
+				_drawSurface.blitFrom(_image, _srcs[0][_currentPositions[0]], _dests[0]);
+				_drawSurface.blitFrom(_image, _srcs[1][_currentPositions[1]], _dests[1]);
+				_needsRedraw = true;
+			}
+
+			return;
+		}
+	}
+}
+
+} // End of namespace Action
+} // End of namespace Nancy
diff --git a/engines/nancy/action/puzzle/twodialpuzzle.h b/engines/nancy/action/puzzle/twodialpuzzle.h
new file mode 100644
index 00000000000..42accaa8711
--- /dev/null
+++ b/engines/nancy/action/puzzle/twodialpuzzle.h
@@ -0,0 +1,78 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NANCY_ACTION_TWODIALPUZZLE_H
+#define NANCY_ACTION_TWODIALPUZZLE_H
+
+#include "engines/nancy/action/actionrecord.h"
+
+namespace Nancy {
+namespace Action {
+
+// Puzzle with two circular dials overlaid on top of each other. Each dial has one correct
+// position, and can only be rotated in one direction.
+class TwoDialPuzzle : public RenderActionRecord {
+public:
+	TwoDialPuzzle() : RenderActionRecord(7) {}
+	virtual ~TwoDialPuzzle() {}
+
+	void init() override;
+
+	void readData(Common::SeekableReadStream &stream) override;
+	void execute() override;
+	void handleInput(NancyInput &input) override;
+
+protected:
+	Common::String getRecordTypeName() const override { return "TwoDialPuzzle"; }
+	bool isViewportRelative() const override { return true; }
+
+	Common::String _imageName;
+
+	bool _isClockwise[2] = { false, false };
+	uint16 _startPositions[2] = { 0, 0 };
+
+	Common::Rect _hotspots[2];
+	Common::Rect _dests[2];
+	Common::Array<Common::Rect> _srcs[2];
+
+	uint16 _correctPositions[2] = { 0, 0 };
+
+	SoundDescription _rotateSounds[2];
+
+	SceneChangeWithFlag _solveScene;
+	uint16 _solveSoundDelay = 0;
+	SoundDescription _solveSound;
+
+	SceneChangeWithFlag _exitScene;
+	Common::Rect _exitHotspot;
+
+	Graphics::ManagedSurface _image;
+
+	int16 _currentPositions[2] = { 0, 0 };
+
+	bool _isSolved = false;
+	uint32 _solveSoundDelayTime = 0;
+};
+
+} // End of namespace Action
+} // End of namespace Nancy
+
+#endif // NANCY_ACTION_TWODIALPUZZLE_H
diff --git a/engines/nancy/module.mk b/engines/nancy/module.mk
index b6afef44619..23ed810caaf 100644
--- a/engines/nancy/module.mk
+++ b/engines/nancy/module.mk
@@ -32,6 +32,7 @@ MODULE_OBJS = \
   action/puzzle/telephone.o \
   action/puzzle/towerpuzzle.o \
   action/puzzle/turningpuzzle.o \
+  action/puzzle/twodialpuzzle.o \
   ui/fullscreenimage.o \
   ui/animatedbutton.o \
   ui/button.o \


Commit: f3fe8f251fd00d2128ce6b8d3f7ac99d40bb2b56
    https://github.com/scummvm/scummvm/commit/f3fe8f251fd00d2128ce6b8d3f7ac99d40bb2b56
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-09-30T17:56:27+03:00

Commit Message:
NANCY: Increment scene counts on scene exit

The counters for how many times a scene has been
visited now get incremented only when we exit it. This
makes sure the counter is not incremented when loading a
save, and makes sure dependencies that require the
sceneCount to be equal to 0 can actually execute
(e.g. nancy6 scene 2319)

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


diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index ffacc9df2b3..cd0ae17ace3 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -223,6 +223,11 @@ void Scene::changeScene(const SceneChangeDescription &sceneDescription) {
 		return;
 	}
 
+	// Increment scene count on scene exit in order to:
+	// - keep values needed for the kSceneCount dependency correct
+	// - make sure we don't increment when loading a save
+	_flags.sceneCounts.getOrCreateVal(_sceneState.currentScene.sceneID)++;
+
 	_sceneState.nextScene = sceneDescription;
 	_state = kLoad;
 }
@@ -857,9 +862,6 @@ void Scene::load() {
 	_inventorySoundOverrides.clear();
 
 	_timers.sceneTime = 0;
-
-	_flags.sceneCounts.getOrCreateVal(_sceneState.currentScene.sceneID)++;
-
 	g_nancy->_sound->recalculateSoundEffects();
 
 	_state = kStartSound;




More information about the Scummvm-git-logs mailing list