[Scummvm-git-logs] scummvm master -> 5f023d8849462edfd22401c18da78fcbe14f7702

bluegr noreply at scummvm.org
Wed Nov 4 00:17:41 UTC 2026


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

Summary:
b8827942ac NANCY: NANCY16: Don't wrap the lines of scrolling text
053da619aa NANCY: NANCY16: Fixes for text drawing in QuizPuzzle
3c73d79a84 NANCY: NANCY14: Hide movies that should be hidden once they're done
22960cc793 NANCY: NANCY17: Set the flags of hotspot records on the click
0bf3786e79 NANCY: NANCY17: Run all of a scene's records before changing the scene
5f023d8849 NANCY: Don't cast Timer objects to integers


Commit: b8827942acae352d8bd1e9b32055da9f885d86fb
    https://github.com/scummvm/scummvm/commit/b8827942acae352d8bd1e9b32055da9f885d86fb
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-04T02:17:18+02:00

Commit Message:
NANCY: NANCY16: Don't wrap the lines of scrolling text

Like the original, a line too long for its rect runs past its right
edge instead of wrapping. Fixes name entry in Nancy17's grave quiz

Changed paths:
    engines/nancy/action/autotextscroll.cpp
    engines/nancy/misc/hypertext.cpp
    engines/nancy/misc/hypertext.h


diff --git a/engines/nancy/action/autotextscroll.cpp b/engines/nancy/action/autotextscroll.cpp
index 9e463e10962..0c1eeb2dbf4 100644
--- a/engines/nancy/action/autotextscroll.cpp
+++ b/engines/nancy/action/autotextscroll.cpp
@@ -39,22 +39,29 @@ static const float kTicksPerSecond = 50.0f;
 // Upper limit for the height of a single rendered entry
 static const uint kMaxTextHeight = 8000;
 
+// How far past the right of the rect a line can go
+static const uint kMaxLineWidth = 1024;
+
 class AutotextScrollRenderer : public Misc::HypertextParser {
 public:
 	void render(const Common::String &text, uint width, uint fontID, uint colorID, Graphics::ManagedSurface &image);
 };
 
+// The lines of the text aren't wrapped; one that is too long goes past the right
+// of the rect, and is aligned in the rect otherwise
 void AutotextScrollRenderer::render(const Common::String &text, uint width, uint fontID, uint colorID, Graphics::ManagedSurface &image) {
-	_fullSurface.create(width, kMaxTextHeight, g_nancy->_graphics->getInputPixelFormat());
+	const uint surfaceWidth = MAX(width, kMaxLineWidth);
+	_fullSurface.create(surfaceWidth, kMaxTextHeight, g_nancy->_graphics->getInputPixelFormat());
 	_fullSurface.clear(g_nancy->_graphics->getTransColor());
 	_defaultTextColor = colorID;
+	_wrapsLines = false;
 
 	addTextLine(text);
-	drawAllText(_fullSurface.getBounds(), 0, fontID, fontID);
+	drawAllText(Common::Rect(width, kMaxTextHeight), 0, fontID, fontID);
 
 	uint height = CLIP<uint>(_drawnTextHeight, 1, kMaxTextHeight);
-	image.create(width, height, _fullSurface.format);
-	image.blitFrom(_fullSurface, Common::Rect(width, height), Common::Point());
+	image.create(surfaceWidth, height, _fullSurface.format);
+	image.blitFrom(_fullSurface, Common::Rect(surfaceWidth, height), Common::Point());
 	image.setTransparentColor(g_nancy->_graphics->getTransColor());
 }
 
@@ -160,11 +167,12 @@ void AutotextScroll::updateGraphics() {
 void AutotextScroll::redraw() {
 	_drawSurface.clear(_drawSurface.getTransparentColor());
 
-	// A line is drawn only when all of it fits in the rect, whose bottom edge it
-	// can't use; e.g. the name in scene 4580 of Nancy17 is in a rect too small
-	// for it, and doesn't show
+	// A line is drawn only when it fits in the height of the rect, whose bottom edge
+	// it can't use; e.g. the name in scene 4580 of Nancy17 is in a rect too small
+	// for it, and doesn't show. A line that is too long still shows whole.
 	const Font *font = g_nancy->_graphics->getFont(_fontID);
 	const Common::Rect clip(_bounds.left, _bounds.top, _bounds.right, _bounds.bottom - 1);
+	const Common::Rect surfaceBounds(_drawSurface.w, _drawSurface.h);
 
 	for (const ScrollingText *text : _texts) {
 		const int lineHeight = font ? MAX<int>(font->getFontHeight(), 1) : text->image.h;
@@ -177,7 +185,7 @@ void AutotextScroll::redraw() {
 
 			Common::Rect line(_bounds.left, top + y, _bounds.left + text->image.w, top + MIN<int>(y + lineHeight, text->image.h));
 
-			Common::Rect visible = line.findIntersectingRect(clip);
+			Common::Rect visible = line.findIntersectingRect(surfaceBounds);
 			if (visible.isEmpty()) {
 				continue;
 			}
diff --git a/engines/nancy/misc/hypertext.cpp b/engines/nancy/misc/hypertext.cpp
index 059a60a5b83..5a8f8222682 100644
--- a/engines/nancy/misc/hypertext.cpp
+++ b/engines/nancy/misc/hypertext.cpp
@@ -321,7 +321,7 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 		// Do word wrapping on the text, sans tokens. This assumes
 		// all text uses fonts of the same width
 		Array<Common::String> wrappedLines;
-		int maxWidth = textBounds.width();
+		int maxWidth = _wrapsLines ? textBounds.width() : _fullSurface.w;
 		if (hasMark) {
 			auto *mark = GetEngineData(MARK);
 			assert(mark);
@@ -524,7 +524,7 @@ void HypertextParser::drawAllText(const Common::Rect &textBounds, uint leftOffse
 				// Draw the normal text
 				const int drawX = textBounds.left + horizontalOffset + (newLineStart ? 0 : leftOffsetNonNewline);
 				const int drawY = textBounds.top + _numDrawnLines * lineStep(font) + _imageVerticalOffset;
-				drawTextRun(_fullSurface, font, stringToDraw, drawX, drawY, textBounds.width(), colorID);
+				drawTextRun(_fullSurface, font, stringToDraw, drawX, drawY, _wrapsLines ? textBounds.width() : _fullSurface.w - drawX, colorID);
 
 				// Underline the segment (the <u> markup toggle) in the text color.
 				if (underline && !stringToDraw.empty()) {
diff --git a/engines/nancy/misc/hypertext.h b/engines/nancy/misc/hypertext.h
index 72d69341871..fcfbf697dc5 100644
--- a/engines/nancy/misc/hypertext.h
+++ b/engines/nancy/misc/hypertext.h
@@ -99,6 +99,9 @@ protected:
 	uint16 _drawnTextHeight;
 	bool _needsTextRedraw;
 
+	// Otherwise a line is as long as its text, and may run past the right of the bounds
+	bool _wrapsLines = true;
+
 private:
 	// Color IDs are font color IDs, or this for the color given to setDefaultTextRGB()
 	static const int kDefaultRGB = -1;


Commit: 053da619aaf5a7b27ba000fa239532358e578139
    https://github.com/scummvm/scummvm/commit/053da619aaf5a7b27ba000fa239532358e578139
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-04T02:17:19+02:00

Commit Message:
NANCY: NANCY16: Fixes for text drawing in QuizPuzzle

- It goes at the left of its box, centered in its height
- It's drawn over the scene's overlays; on the last pages of Nancy17's
  grave quiz an overlay hid it
- The text surface sits where the viewport is, so a box at the bottom
  of the viewport doesn't lose its text

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


diff --git a/engines/nancy/action/puzzle/quizpuzzle.cpp b/engines/nancy/action/puzzle/quizpuzzle.cpp
index d067c88bcb7..3e8fac844ae 100644
--- a/engines/nancy/action/puzzle/quizpuzzle.cpp
+++ b/engines/nancy/action/puzzle/quizpuzzle.cpp
@@ -46,7 +46,8 @@ QuizPuzzle::~QuizPuzzle() {
 }
 
 void QuizPuzzle::init() {
-	Common::Rect screenClip = NancySceneState.getViewport().getBounds();
+	// The text goes where the viewport is on the screen
+	Common::Rect screenClip = NancySceneState.getViewport().getScreenPosition();
 	const uint16 sceneId = NancySceneState.getSceneInfo().sceneID;
 	if (g_nancy->getGameType() == kGameTypeNancy9 && (sceneId == 6441 || sceneId == 6443))
 		screenClip.right += 20; // WORKAROUND for chess puzzle in Nancy 9: the rightmost answer box is partially off-screen
@@ -311,6 +312,10 @@ void QuizPuzzle::readDataNancy15(Common::SeekableReadStream &stream) {
 // length limit, and the allowed characters moved out after it. The two captions
 // are gone, and the flag-setting hotspots share one cursor.
 void QuizPuzzle::readDataNancy16(Common::SeekableReadStream &stream) {
+	// The typed text is drawn by the UI, over the overlays of the scene; e.g. the
+	// lines of Nancy17's grave quiz are overlays, which come in as it gets solved
+	_z = kTextZ;
+
 	stream.skip(33);	// the record's name
 	_textColor = stream.readUint32BE();
 
@@ -1041,7 +1046,8 @@ void QuizPuzzle::drawTextNancy16() {
 		bounds = NancySceneState.getViewport().convertViewportToScreen(bounds);
 		bounds = convertToLocal(bounds);
 
-		int y = bounds.bottom - systemFont->getFontHeight();
+		// On a single line, at the left of the box and centered in its height
+		int y = bounds.top + (bounds.height() - systemFont->getFontHeight()) / 2;
 		systemFont->drawString(_drawSurface.surfacePtr(), text, bounds.left, y, bounds.width(), color);
 	}
 
diff --git a/engines/nancy/action/puzzle/quizpuzzle.h b/engines/nancy/action/puzzle/quizpuzzle.h
index cb713b55af7..f7bee7cc185 100644
--- a/engines/nancy/action/puzzle/quizpuzzle.h
+++ b/engines/nancy/action/puzzle/quizpuzzle.h
@@ -52,6 +52,7 @@ private:
 	// Sanity cap. Nancy 8 and Nancy 9 store a fixed five boxes; Nancy 15 keeps
 	// 30 slots of 27 bytes per save slot, so 30 is the engine's own maximum.
 	static const uint kMaxBoxes = 30;
+	static const uint16 kTextZ = 15;		// Nancy16+: the layer of the typed text, over the scene's overlays
 	// Nancy 15 rejects a keystroke once the typed text no longer fits a save
 	// slot's 27-byte text buffer, with room left for the cursor character.
 	static const uint kMaxTypedLengthNancy15 = 24;


Commit: 3c73d79a84f2dad1841ab4ca76d91fc8ef7dcc86
    https://github.com/scummvm/scummvm/commit/3c73d79a84f2dad1841ab4ca76d91fc8ef7dcc86
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-04T02:17:21+02:00

Commit Message:
NANCY: NANCY14: Hide movies that should be hidden once they're done

The movie records have a flag that hides them once they finish, instead
of keeping their last frame on screen. It was read but unused. Fixes
the hot sauce bottle in Nancy17 scene 3008, which was cut off by the
last frame of the pouring movie

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


diff --git a/engines/nancy/action/secondarymovie.cpp b/engines/nancy/action/secondarymovie.cpp
index 099d0d76768..cadd8538fc5 100644
--- a/engines/nancy/action/secondarymovie.cpp
+++ b/engines/nancy/action/secondarymovie.cpp
@@ -1101,7 +1101,7 @@ void PlaySecondaryMovie::updateGraphics() {
 	// anymore. Neither follows the viewport through execute(), so keep them
 	// attached to their background frame here. Records that never got to show a
 	// frame, or random movies that were stopped, have nothing to keep on screen.
-	if (_fullFrame.empty() || _randomStopRequested) {
+	if (_fullFrame.empty() || _randomStopRequested || (_isFinished && _hideOnFinish)) {
 		return;
 	}
 
@@ -1449,11 +1449,21 @@ void PlaySecondaryMovie::execute() {
 				_isFinished = false;
 				_decoder.seekToFrame(_playDirection == kPlayMovieReverse ? _lastFrame : _firstFrame);
 				_decoder.pauseVideo(false);
-			} else if (!g_nancy->_sound->isSoundPlaying(_sound)) {
-				// Stop the video and block it from starting again, but also wait for
-				// sound to end before changing state
-				g_nancy->_sound->stopSound(_sound);
-				_state = kActionTrigger;
+			} 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) {
+					setVisible(false);
+					_mask.setVisible(false);
+				}
+
+				if (!g_nancy->_sound->isSoundPlaying(_sound)) {
+					// Stop the video and block it from starting again, but also wait for
+					// sound to end before changing state
+					g_nancy->_sound->stopSound(_sound);
+					_state = kActionTrigger;
+				}
 			}
 		}
 
diff --git a/engines/nancy/action/secondarymovie.h b/engines/nancy/action/secondarymovie.h
index 93e8db5ce6f..6141b8819ec 100644
--- a/engines/nancy/action/secondarymovie.h
+++ b/engines/nancy/action/secondarymovie.h
@@ -140,7 +140,8 @@ public:
 	byte _playDirection = kPlayMovieForward;
 	uint16 _firstFrame = 0;
 	uint16 _lastFrame = 0;
-	// Nancy14-only: when non-zero, hide the movie once it reaches its last frame.
+	// Nancy14+: when non-zero, the movie is hidden once it's done, instead of
+	// keeping its last frame on screen
 	uint16 _hideOnFinish = 0;
 	// Nancy15 AR 44: a "play style" selector (1 or 3). Read but currently
 	// unused by playback.


Commit: 22960cc793e1970ba1c7d9929d4f358ca4f6200c
    https://github.com/scummvm/scummvm/commit/22960cc793e1970ba1c7d9929d4f358ca4f6200c
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-04T02:17:23+02:00

Commit Message:
NANCY: NANCY17: Set the flags of hotspot records on the click

- Like the original, the flags are set as soon as the hotspot is clicked,
  instead of in the next pass over the scene's records
- The records before the hotspot then see them before a later record
  changes the scene. In scene 2075, the costume icon wasn't shown when
  Bess put the costume on

Changed paths:
    engines/nancy/action/actionmanager.cpp
    engines/nancy/action/actionrecord.h
    engines/nancy/action/datarecords.cpp
    engines/nancy/action/datarecords.h


diff --git a/engines/nancy/action/actionmanager.cpp b/engines/nancy/action/actionmanager.cpp
index 4c656595ed8..250ed9e0d7f 100644
--- a/engines/nancy/action/actionmanager.cpp
+++ b/engines/nancy/action/actionmanager.cpp
@@ -86,6 +86,9 @@ void ActionManager::handleInput(NancyInput &input) {
 					}
 				} else {
 					rec->_state = ActionRecord::ExecutionState::kActionTrigger;
+					if (rec->runsOnClick()) {
+						rec->execute();
+					}
 
 					input.eatMouseInput();
 
diff --git a/engines/nancy/action/actionrecord.h b/engines/nancy/action/actionrecord.h
index b81595a1326..2e29a4425da 100644
--- a/engines/nancy/action/actionrecord.h
+++ b/engines/nancy/action/actionrecord.h
@@ -133,6 +133,10 @@ public:
 	// Used for handling kCursorType dependency
 	virtual bool canHaveHotspot() const { return false; }
 
+	// Records returning true run as soon as their hotspot is clicked, instead of
+	// waiting for their turn in the next pass over the records
+	virtual bool runsOnClick() const { return false; }
+
 	// Records returning true survive the upcoming scene change (i.e. are not
 	// deleted by Scene::clearSceneData / ActionManager::clearActionRecords).
 	// `nextSceneIsNoArt` is true when the incoming scene is a "NO_ART_SCENE": a
diff --git a/engines/nancy/action/datarecords.cpp b/engines/nancy/action/datarecords.cpp
index 4026e1ec304..799aa9d32bf 100644
--- a/engines/nancy/action/datarecords.cpp
+++ b/engines/nancy/action/datarecords.cpp
@@ -482,6 +482,10 @@ CursorManager::CursorType EventFlagsMultiHS::getHoverCursor() const {
 	return _hoverCursor;
 }
 
+bool EventFlagsMultiHS::runsOnClick() const {
+	return g_nancy->getGameType() >= kGameTypeNancy17;
+}
+
 void EventFlagsMultiHS::execute() {
 	switch (_state) {
 	case kBegin:
diff --git a/engines/nancy/action/datarecords.h b/engines/nancy/action/datarecords.h
index 0331e781194..e668f3806ab 100644
--- a/engines/nancy/action/datarecords.h
+++ b/engines/nancy/action/datarecords.h
@@ -157,6 +157,11 @@ public:
 
 	bool canHaveHotspot() const override { return true; }
 
+	// Nancy17 sets the flags on the click itself, so the records before this one
+	// see them in the next pass, even when a record after it changes the scene
+	// then (scene 2075, where Bess puts on the costume)
+	bool runsOnClick() const override;
+
 protected:
 	Common::String getRecordTypeName() const override {
 		switch (_hotspotType) {


Commit: 0bf3786e7912911d662e9862bb5522b19c374764
    https://github.com/scummvm/scummvm/commit/0bf3786e7912911d662e9862bb5522b19c374764
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-04T02:17:24+02:00

Commit Message:
NANCY: NANCY17: Run all of a scene's records before changing the scene

- Like the original, a scene change from a record takes effect in the next
  frame, and the rest of the scene's records still run in the current one
- In scene 2075, the record marking that Bess wears the costume comes after
  the scene change, so the guard in scene 2910 sent her away

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


diff --git a/engines/nancy/action/actionmanager.cpp b/engines/nancy/action/actionmanager.cpp
index 250ed9e0d7f..aed294acf72 100644
--- a/engines/nancy/action/actionmanager.cpp
+++ b/engines/nancy/action/actionmanager.cpp
@@ -314,9 +314,13 @@ void ActionManager::processActionRecords() {
 			record->execute();
 		}
 
-		if (g_nancy->getGameType() >= kGameTypeNancy4 && NancySceneState.getState() == State::Scene::kLoad) {
-			// changeScene() must have been called, abort any further processing.
-			// Both old and new behavior is needed (nancy3 intro narration, nancy4 garden gate)
+		// changeScene() must have been called, abort any further processing.
+		// Both old and new behavior is needed (nancy3 intro narration, nancy4 garden gate).
+		// Nancy17 runs the rest of the records first, and changes the scene in the
+		// next frame (scene 2075, where Bess puts on the costume and a record after
+		// the scene change marks that she's wearing it)
+		if (g_nancy->getGameType() >= kGameTypeNancy4 && g_nancy->getGameType() < kGameTypeNancy17 &&
+				NancySceneState.getState() == State::Scene::kLoad) {
 			return;
 		}
 	}


Commit: 5f023d8849462edfd22401c18da78fcbe14f7702
    https://github.com/scummvm/scummvm/commit/5f023d8849462edfd22401c18da78fcbe14f7702
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-11-04T02:17:26+02:00

Commit Message:
NANCY: Don't cast Timer objects to integers

Changed paths:
    engines/nancy/console.cpp
    engines/nancy/script/gameapi.cpp
    engines/nancy/state/scene.cpp
    engines/nancy/time.h
    engines/nancy/ui/clock.cpp


diff --git a/engines/nancy/console.cpp b/engines/nancy/console.cpp
index 97c78232bf1..bc0342058bf 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -1631,7 +1631,7 @@ bool NancyConsole::Cmd_getPlayerTime(int argc, const char **argv) {
 		time.getDays(),
 		time.getHours(),
 		time.getMinutes(),
-		(uint32)time);
+		time.getTotalMilliseconds());
 
 	auto *bootSummary = GetEngineData(BSUM);
 	if (bootSummary && bootSummary->endOfDayFlag != kEvNoEvent) {
@@ -1674,7 +1674,7 @@ bool NancyConsole::Cmd_setPlayerTime(int argc, const char **argv) {
 		time.getDays(),
 		time.getHours(),
 		time.getMinutes(),
-		(uint32)time);
+		time.getTotalMilliseconds());
 
 	return cmdExit(0, nullptr);
 }
diff --git a/engines/nancy/script/gameapi.cpp b/engines/nancy/script/gameapi.cpp
index a9879c8e195..87645310bf7 100644
--- a/engines/nancy/script/gameapi.cpp
+++ b/engines/nancy/script/gameapi.cpp
@@ -485,17 +485,17 @@ static int gameIndex(lua_State *L) {
 	// How long the game has been played, as { days, hours, minutes, seconds,
 	// totalSeconds }; the seconds have fractions
 	if (key == "time") {
-		const uint32 time = (uint32)NancySceneState._timers.lastTotalTime;
+		const Time &time = NancySceneState._timers.lastTotalTime;
 		lua_createtable(L, 0, 5);
-		lua_pushinteger(L, time / 86400000);
+		lua_pushinteger(L, time.getDays());
 		lua_setfield(L, -2, "days");
-		lua_pushinteger(L, time / 3600000 % 24);
+		lua_pushinteger(L, time.getHours());
 		lua_setfield(L, -2, "hours");
-		lua_pushinteger(L, time / 60000 % 60);
+		lua_pushinteger(L, time.getMinutes());
 		lua_setfield(L, -2, "minutes");
-		lua_pushnumber(L, (time % 60000) / 1000.0);
+		lua_pushnumber(L, (time.getTotalMilliseconds() % 60000) / 1000.0);
 		lua_setfield(L, -2, "seconds");
-		lua_pushnumber(L, time / 1000.0);
+		lua_pushnumber(L, time.getTotalMilliseconds() / 1000.0);
 		lua_setfield(L, -2, "totalSeconds");
 		return 1;
 	}
diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index d7733095545..3a7f3dbf8b9 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -99,8 +99,8 @@ void Scene::SceneSummary::read(Common::SeekableReadStream &stream) {
 	ser.syncAsUint16LE(verticalScrollDelta);
 	ser.syncAsUint16LE(horizontalEdgeSize);
 	ser.syncAsUint16LE(verticalEdgeSize);
-	ser.syncAsUint16LE((uint32 &)slowMoveTimeDelta);
-	ser.syncAsUint16LE((uint32 &)fastMoveTimeDelta);
+	slowMoveTimeDelta.syncAsUint16LE(ser);
+	fastMoveTimeDelta.syncAsUint16LE(ser);
 	ser.skip(1); // CD required for scene
 
 	auto *bootSummary = GetEngineData(BSUM);
@@ -233,7 +233,7 @@ void Scene::onStateEnter(const NancyState::NancyState prevState) {
 		registerGraphics();
 
 		if (prevState != NancyState::kPause) {
-			g_nancy->setTotalPlayTime((uint32)_timers.pushedPlayTime);
+			g_nancy->setTotalPlayTime(_timers.pushedPlayTime.getTotalMilliseconds());
 		}
 
 		_actionManager.onPause(false);
@@ -442,7 +442,7 @@ void Scene::setPlayerTime(Time time, byte relative) {
 	if (relative == kRelativeClockBump) {
 		// Relative, add the specified time to current playerTime. The originals wrap
 		// a negative time around to the previous day, which no game script needs.
-		if ((int64)(uint32)_timers.playerTime + (int32)(uint32)time < 0) {
+		if ((int64)_timers.playerTime.getTotalMilliseconds() + (int32)time.getTotalMilliseconds() < 0) {
 			warning("Moving the player time back past 00:00 is not supported");
 			return;
 		}
@@ -1789,7 +1789,7 @@ void Scene::synchronize(Common::Serializer &ser) {
 	}
 
 	for (uint i = 0; i < 30; ++i) {
-		ser.syncAsUint32LE((uint32 &)_flags.logicConditions[i].timestamp);
+		_flags.logicConditions[i].timestamp.syncAsUint32LE(ser);
 	}
 
 	const uint numItems = g_nancy->getStaticData().numItems;
@@ -1833,9 +1833,9 @@ void Scene::synchronize(Common::Serializer &ser) {
 		_flags.disabledItems.resize(numItems);
 	}
 
-	ser.syncAsUint32LE((uint32 &)_timers.lastTotalTime);
-	ser.syncAsUint32LE((uint32 &)_timers.sceneTime);
-	ser.syncAsUint32LE((uint32 &)_timers.playerTime);
+	_timers.lastTotalTime.syncAsUint32LE(ser);
+	_timers.sceneTime.syncAsUint32LE(ser);
+	_timers.playerTime.syncAsUint32LE(ser);
 	ser.syncAsSint16LE(_timers.playerDay, 11);
 
 	if (ser.isLoading() && ser.getVersion() < 11) {
@@ -1846,12 +1846,12 @@ void Scene::synchronize(Common::Serializer &ser) {
 			_timers.playerTime = _timers.playerTime.getHours() * 3600000 + _timers.playerTime.getMinutes() * 60000;
 		}
 	}
-	ser.syncAsUint32LE((uint32 &)_timers.pushedPlayTime);
-	ser.syncAsUint32LE((uint32 &)_timers.timerTime);
+	_timers.pushedPlayTime.syncAsUint32LE(ser);
+	_timers.timerTime.syncAsUint32LE(ser);
 	ser.syncAsByte(_timers.timerIsActive);
 	ser.skip(1, 0, 2);
 
-	g_nancy->setTotalPlayTime((uint32)_timers.lastTotalTime);
+	g_nancy->setTotalPlayTime(_timers.lastTotalTime.getTotalMilliseconds());
 
 	uint numSavedEventFlags = g_nancy->getStaticData().numEventFlags;
 	if (ser.getVersion() < 7 && g_nancy->getGameType() == kGameTypeNancy10) {
@@ -2418,11 +2418,11 @@ void Scene::run() {
 	}
 
 	_timers.sceneTime += deltaTime;
-	_frameSeconds = (uint32)deltaTime / 1000.0;
+	_frameSeconds = deltaTime.getTotalMilliseconds() / 1000.0;
 
 	// Advance the Nancy 11+ software timers before processing action records,
 	// so any flags they fire this frame are visible to record dependencies
-	tickSoftwareTimers((uint32)deltaTime);
+	tickSoftwareTimers(deltaTime.getTotalMilliseconds());
 
 	// Calculate the in-game time (playerTime)
 	if (currentPlayTime > _timers.playerTimeNextMinute) {
diff --git a/engines/nancy/time.h b/engines/nancy/time.h
index 8edbff5e845..7b0614d890f 100644
--- a/engines/nancy/time.h
+++ b/engines/nancy/time.h
@@ -23,6 +23,7 @@
 #define NANCY_TIME_H
 
 #include "common/scummsys.h"
+#include "common/serializer.h"
 
 namespace Nancy {
 
@@ -67,6 +68,12 @@ public:
 	friend bool operator>= (const Time &l, const uint32 &r)	{ return !(l < r); }
 	friend bool operator>= (const uint32 &l, const Time &r)	{ return !(l < r); }
 
+	uint32 getTotalMilliseconds() const	{ return _milliseconds; }
+
+	// Reads or writes the milliseconds, as 32 or 16 bits
+	void syncAsUint32LE(Common::Serializer &ser)			{ ser.syncAsUint32LE(_milliseconds); }
+	void syncAsUint16LE(Common::Serializer &ser)			{ ser.syncAsUint16LE(_milliseconds); }
+
 	uint16 getSeconds() const		{ return (_milliseconds / 1000) % 60; }
 	uint16 getMinutes() const		{ return (_milliseconds / 60000) % 60; }
 	uint16 getTotalHours() const	{ return _milliseconds / 3600000; }
diff --git a/engines/nancy/ui/clock.cpp b/engines/nancy/ui/clock.cpp
index b1cc21eb955..9f82008c500 100644
--- a/engines/nancy/ui/clock.cpp
+++ b/engines/nancy/ui/clock.cpp
@@ -221,7 +221,7 @@ void Nancy5Clock::updateGraphics() {
 	if (NancySceneState.getEventFlag(320, true)) {
 		_currentDay = 3;
 		Time timerTime = NancySceneState.getTimerTime();
-		int32 countdownFrameID = MIN<int32>((uint32)timerTime / (_clockData->countdownTime / 12), 13);
+		int32 countdownFrameID = MIN<int32>(timerTime.getTotalMilliseconds() / (_clockData->countdownTime / 12), 13);
 		if (countdownFrameID != _countdownProgress) {
 			_countdownProgress = countdownFrameID;
 




More information about the Scummvm-git-logs mailing list