[Scummvm-git-logs] scummvm master -> 28504ebba89b3ce4448c7b7758d622f59259fb6e

neuromancer noreply at scummvm.org
Tue Dec 2 15:38:38 UTC 2025


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

Summary:
2074147dab PRIVATE: Combine cursor tables
d74dceef3c PRIVATE: Reduce global usage
6982a8d1b0 PRIVATE: Remove `inBox` method
85707c6e31 PRIVATE: Rename debug channel to match enum
89af219c27 PRIVATE: Reduce string creation in `restartGame()`
cecd15b27c PRIVATE: Implement timer in main thread
28504ebba8 PRIVATE: Implement skipping timer


Commit: 2074147dabfe4043e1406faf5d28803e40616059
    https://github.com/scummvm/scummvm/commit/2074147dabfe4043e1406faf5d28803e40616059
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-12-02T16:38:31+01:00

Commit Message:
PRIVATE: Combine cursor tables

Changed paths:
    engines/private/cursors.cpp


diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index 7d739d2a407..93f80ae26cb 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -41,25 +41,25 @@ namespace Private {
 struct CursorEntry {
 	const char *name;
  	const char *aname;
-	uint id;
-	uint japaneseId;
+	uint windowsId;
+	uint japaneseWindowsId;
+	uint macId;
 };
 
 void PrivateEngine::loadCursors() {
+	const CursorEntry cursorIDReference[] = {
+		{ "kTurnLeft",  "k1", 23, 17, 133 },
+		{ "kTurnRight", "k2", 9,  3,  132 },
+		{ "kZoomIn",    "k3", 17, 11, 138 },
+		{ "kZoomOut",   "k4", 11, 5,  135 },
+		{ "kExit",      "k5", 7,  1,  130 },
+		{ "kPhone",     "k6", 25, 19, 141 },
+		{ "kInventory", "k7", 19, 13, 139 }
+	};
+
 	_defaultCursor = Graphics::makeDefaultWinCursor();
 
 	if (_platform == Common::kPlatformWindows) {
-		const CursorEntry cursorIDReference[] = {
-			{ "kTurnLeft",  "k1", 23, 17 },
-			{ "kTurnRight", "k2", 9,  3  },
-			{ "kZoomIn",    "k3", 17, 11 },
-			{ "kZoomOut",   "k4", 11, 5  },
-			{ "kExit",      "k5", 7,  1  },
-			{ "kPhone",     "k6", 25, 19 },
-			{ "kInventory", "k7", 19, 13 },
-			{ nullptr, nullptr,   0,  0  }
-		};
-
 		Common::WinResources *exe = nullptr;
 		Common::SeekableReadStream *exeStream = nullptr;
 		Common::ArchiveMemberList members;
@@ -97,34 +97,22 @@ void PrivateEngine::loadCursors() {
 			_cursors[i].winCursorGroup = Graphics::WinCursorGroup::createCursorGroup(exe, cursorIDs[i]);
 			_cursors[i].cursor = _cursors[i].winCursorGroup->cursors[0].cursor;
 
-			const CursorEntry *entry = cursorIDReference;
-			while (entry->name != nullptr) {
-				uint entryId = (_language == Common::JA_JPN) ? entry->japaneseId : entry->id;
+			for (uint j = 0; j < ARRAYSIZE(cursorIDReference); j++) {
+				const CursorEntry &entry = cursorIDReference[j];
+
+				uint entryId = (_language == Common::JA_JPN) ? entry.japaneseWindowsId : entry.windowsId;
 				if (entryId == _cursors[i].winCursorGroup->cursors[0].id.getID()) {
-					_cursors[i].name = entry->name;
-					_cursors[i].aname = entry->aname;
+					_cursors[i].name = entry.name;
+					_cursors[i].aname = entry.aname;
 					break;
 				}
-				entry++;
 			}
 		}
 
 		delete exe;
 		delete exeStream;
 	} else {
-		const CursorEntry cursorIDReference[] = {
-			{ "kTurnLeft",  "k1", 133, 0 },
-			{ "kTurnRight", "k2", 132, 0 },
-			{ "kZoomIn",    "k3", 138, 0 },
-			{ "kZoomOut",   "k4", 135, 0 },
-			{ "kExit",      "k5", 130, 0 },
-			{ "kPhone",     "k6", 141, 0 },
-			{ "kInventory", "k7", 139, 0 },
-			{ nullptr, nullptr,   0,   0 }
-		};
-
 		Common::MacResManager resMan;
-
 		const char *executableFilePath = isDemo() ? "SUPPORT/Private Eye Demo" : "SUPPORT/Private Eye";
 		const char *executableInstallerPath = isDemo() ? "Private Eye Demo" : "Private Eye";
 		Common::ScopedPtr<Common::Archive> macInstaller(loadMacInstaller());
@@ -139,14 +127,14 @@ void PrivateEngine::loadCursors() {
 				_cursors[i].cursor = cursor;
 				_cursors[i].winCursorGroup = nullptr;
 
-				const CursorEntry *entry = cursorIDReference;
-				while (entry->name != nullptr) {
-					if (entry->id == cursorResIDs[i]) {
-						_cursors[i].name = entry->name;
-						_cursors[i].aname = entry->aname;
+				for (uint j = 0; j < ARRAYSIZE(cursorIDReference); j++) {
+					const CursorEntry &entry = cursorIDReference[j];
+
+					if (entry.macId == cursorResIDs[i]) {
+						_cursors[i].name = entry.name;
+						_cursors[i].aname = entry.aname;
 						break;
 					}
-					entry++;
 				}
 			}
 		}


Commit: d74dceef3c7f973b6d23eef816b932f1e49fe05f
    https://github.com/scummvm/scummvm/commit/d74dceef3c7f973b6d23eef816b932f1e49fe05f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-12-02T16:38:31+01:00

Commit Message:
PRIVATE: Reduce global usage

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index f6fe302f4fe..7130182c291 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -356,8 +356,8 @@ Common::Error PrivateEngine::run() {
 		bool mouseMoved = false;
 		checkPhoneCall();
 
-		while (g_system->getEventManager()->pollEvent(event)) {
-			mousePos = g_system->getEventManager()->getMousePos();
+		while (_system->getEventManager()->pollEvent(event)) {
+			mousePos = _system->getEventManager()->getMousePos();
 			// Events
 			switch (event.type) {
 			case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
@@ -442,15 +442,15 @@ Common::Error PrivateEngine::run() {
 				if (_subtitles != nullptr) {
 					delete _subtitles;
 					_subtitles = nullptr;
-					g_system->hideOverlay();
+					_system->hideOverlay();
 				}
 				_currentMovie = "";
 			} else if (!_videoDecoder->needsUpdate() && mouseMoved) {
-				g_system->updateScreen();
+				_system->updateScreen();
 			} else if (_videoDecoder->needsUpdate()) {
 				drawScreen();
 			}
-			g_system->delayMillis(5); // Yield to the system
+			_system->delayMillis(5); // Yield to the system
 			continue;
 		}
 
@@ -479,15 +479,15 @@ Common::Error PrivateEngine::run() {
 			}
 		}
 
-		g_system->updateScreen();
-		g_system->delayMillis(10);
+		_system->updateScreen();
+		_system->delayMillis(10);
 		if (_subtitles != nullptr) {
 			if (_mixer->isSoundHandleActive(_fgSoundHandle)) {
 				_subtitles->drawSubtitle(_mixer->getElapsedTime(_fgSoundHandle).msecs(), false, _sfxSubtitles);
 			} else {
 				delete _subtitles;
 				_subtitles = nullptr;
-				g_system->hideOverlay();
+				_system->hideOverlay();
 			}
 		}
 	}
@@ -497,9 +497,9 @@ Common::Error PrivateEngine::run() {
 
 void PrivateEngine::ignoreEvents() {
 	Common::Event event;
-	g_system->getEventManager()->pollEvent(event);
-	g_system->updateScreen();
-	g_system->delayMillis(10);
+	_system->getEventManager()->pollEvent(event);
+	_system->updateScreen();
+	_system->delayMillis(10);
 }
 
 void PrivateEngine::initFuncs() {
@@ -1906,8 +1906,8 @@ void PrivateEngine::adjustSubtitleSize() {
 		const int MIN_FONT_SIZE = 8;
 		const float BASE_FONT_SIZE_PERCENT = 0.023f;  // ~50px at 2160p
 
-		int16 h = g_system->getOverlayHeight();
-		int16 w = g_system->getOverlayWidth();
+		int16 h = _system->getOverlayHeight();
+		int16 w = _system->getOverlayWidth();
 
 		int bottomMargin = int(h * BOTTOM_MARGIN_PERCENT);
 
@@ -1959,7 +1959,7 @@ void PrivateEngine::loadSubtitles(const Common::Path &path) {
 	if (_subtitles != nullptr) {
 		delete _subtitles;
 		_subtitles = nullptr;
-		g_system->hideOverlay();
+		_system->hideOverlay();
 	}
 
 	_subtitles = new Video::Subtitles();
@@ -1970,8 +1970,8 @@ void PrivateEngine::loadSubtitles(const Common::Path &path) {
 		return;
 	}
 
-	g_system->showOverlay(false);
-	g_system->clearOverlay();
+	_system->showOverlay(false);
+	_system->clearOverlay();
 	adjustSubtitleSize();
 }
 void PrivateEngine::playVideo(const Common::String &name) {
@@ -2053,7 +2053,7 @@ void PrivateEngine::skipVideo() {
 	if (_subtitles != nullptr) {
 		delete _subtitles;
 		_subtitles = nullptr;
-		g_system->hideOverlay();
+		_system->hideOverlay();
 	}
 	_currentMovie = "";
 }
@@ -2068,7 +2068,7 @@ void PrivateEngine::destroyVideo() {
 	if (_subtitles != nullptr) {
 		delete _subtitles;
 		_subtitles = nullptr;
-		g_system->hideOverlay();
+		_system->hideOverlay();
 	}
 }
 
@@ -2101,7 +2101,7 @@ Graphics::Surface *PrivateEngine::decodeImage(const Common::String &name, byte *
 	if (ncolors < 256 || path.toString('/').hasPrefix("intro")) { // For some reason, requires color remapping
 		currentPalette = (byte *) malloc(3*256);
 		drawScreen();
-		g_system->getPaletteManager()->grabPalette(currentPalette, 0, 256);
+		_system->getPaletteManager()->grabPalette(currentPalette, 0, 256);
 		newImage = oldImage->convertTo(_pixelFormat, currentPalette);
 		remapImage(ncolors, oldImage, oldPalette, newImage, currentPalette);
 		*palette = currentPalette;
@@ -2235,7 +2235,7 @@ void PrivateEngine::fillRect(uint32 color, Common::Rect rect) {
 void PrivateEngine::drawScreenFrame(const byte *newPalette) {
 	debugC(1, kPrivateDebugFunction, "%s(..)", __FUNCTION__);
 	remapImage(256, _frameImage, _framePalette, _mframeImage, newPalette);
-	g_system->copyRectToScreen(_mframeImage->getPixels(), _mframeImage->pitch, 0, 0, _screenW, _screenH);
+	_system->copyRectToScreen(_mframeImage->getPixels(), _mframeImage->pitch, 0, 0, _screenW, _screenH);
 }
 
 void PrivateEngine::loadMaskAndInfo(MaskInfo *m, const Common::String &name, int x, int y, bool drawn) {
@@ -2330,12 +2330,12 @@ void PrivateEngine::drawScreen() {
 
 		if (_needToDrawScreenFrame && _videoDecoder->getCurFrame() >= 0) {
 			const byte *videoPalette = _videoDecoder->getPalette();
-			g_system->getPaletteManager()->setPalette(videoPalette, 0, 256);
+			_system->getPaletteManager()->setPalette(videoPalette, 0, 256);
 			drawScreenFrame(videoPalette);
 			_needToDrawScreenFrame = false;
 		} else if (_videoDecoder->hasDirtyPalette()) {
 			const byte *videoPalette = _videoDecoder->getPalette();
-			g_system->getPaletteManager()->setPalette(videoPalette, 0, 256);
+			_system->getPaletteManager()->setPalette(videoPalette, 0, 256);
 
 			if (_mode == 1) {
 				drawScreenFrame(videoPalette);
@@ -2343,15 +2343,15 @@ void PrivateEngine::drawScreen() {
 		}
 
 		// No use of _compositeSurface, we write the frame directly to the screen in the expected position
-		g_system->copyRectToScreen(frame->getPixels(), frame->pitch, center.x, center.y, frame->w, frame->h);
+		_system->copyRectToScreen(frame->getPixels(), frame->pitch, center.x, center.y, frame->w, frame->h);
 	} else {
 		byte newPalette[256 * 3];
 		_compositeSurface->grabPalette(newPalette, 0, 256);
-		g_system->getPaletteManager()->setPalette(newPalette, 0, 256);
+		_system->getPaletteManager()->setPalette(newPalette, 0, 256);
 
 		if (_mode == 1) {
 			// We can reuse newPalette
-			g_system->getPaletteManager()->grabPalette((byte *) &newPalette, 0, 256);
+			_system->getPaletteManager()->grabPalette((byte *) &newPalette, 0, 256);
 			drawScreenFrame((byte *) &newPalette);
 		}
 
@@ -2398,12 +2398,12 @@ void PrivateEngine::drawScreen() {
 
 		Common::Rect w(_origin.x, _origin.y, _screenW - _origin.x, _screenH - _origin.y);
 		Graphics::Surface sa = _compositeSurface->getSubArea(w);
-		g_system->copyRectToScreen(sa.getPixels(), sa.pitch, _origin.x, _origin.y, sa.w, sa.h);
+		_system->copyRectToScreen(sa.getPixels(), sa.pitch, _origin.x, _origin.y, sa.w, sa.h);
 	}
 
 	if (_subtitles && _videoDecoder && !_videoDecoder->isPaused())
 		_subtitles->drawSubtitle(_videoDecoder->getTime(), false, _sfxSubtitles);
-	g_system->updateScreen();
+	_system->updateScreen();
 }
 
 bool PrivateEngine::getRandomBool(uint p) {
@@ -2474,11 +2474,11 @@ static void timerCallback(void *refCon) {
 }
 
 bool PrivateEngine::installTimer(uint32 delay, Common::String *ns) {
-	return g_system->getTimerManager()->installTimerProc(&timerCallback, delay, ns, "timerCallback");
+	return _system->getTimerManager()->installTimerProc(&timerCallback, delay, ns, "timerCallback");
 }
 
 void PrivateEngine::removeTimer() {
-	g_system->getTimerManager()->removeTimerProc(&timerCallback);
+	_system->getTimerManager()->removeTimerProc(&timerCallback);
 }
 
 // Diary


Commit: 6982a8d1b0f066c1419557b600ec6c9ea1ddc448
    https://github.com/scummvm/scummvm/commit/6982a8d1b0f066c1419557b600ec6c9ea1ddc448
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-12-02T16:38:31+01:00

Commit Message:
PRIVATE: Remove `inBox` method

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 7130182c291..31779eb3c89 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -752,10 +752,6 @@ bool PrivateEngine::inMask(Graphics::Surface *surf, Common::Point mousePos) {
 	return (surf->getPixel(mousePos.x, mousePos.y) != _transparentColor);
 }
 
-bool PrivateEngine::inBox(const Common::Rect &box, Common::Point mousePos) {
-	return box.contains(mousePos);
-}
-
 bool PrivateEngine::cursorMask(Common::Point mousePos) {
 	bool inside = false;
 	for (MaskList::const_iterator it = _masks.begin(); it != _masks.end(); ++it) {
@@ -994,7 +990,7 @@ bool PrivateEngine::selectLocation(const Common::Point &mousePos) {
 	for (auto &it : maps.locationList) {
 		const Private::Symbol *sym = maps.locations.getVal(it);
 		if (sym->u.val) {
-			if (inBox(_locationMasks[i].box, mousePos)) {
+			if (_locationMasks[i].box.contains(mousePos)) {
 				bool diaryPageSet = false;
 				for (uint j = 0; j < _diaryPages.size(); j++) {
 					if (_diaryPages[j].locationID == totalLocations + 1) {
diff --git a/engines/private/private.h b/engines/private/private.h
index deb6908d080..97105a0ba87 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -284,7 +284,6 @@ public:
 	void drawMask(Graphics::Surface *);
 	void fillRect(uint32, Common::Rect);
 	bool inMask(Graphics::Surface *, Common::Point);
-	bool inBox(const Common::Rect &box, Common::Point mousePos);
 	uint32 _transparentColor;
 	Common::Rect _screenRect;
 	Common::String _framePath;


Commit: 85707c6e31f4685840ffb0eb327b835fdcdd3680
    https://github.com/scummvm/scummvm/commit/85707c6e31f4685840ffb0eb327b835fdcdd3680
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-12-02T16:38:31+01:00

Commit Message:
PRIVATE: Rename debug channel to match enum

Changed paths:
    engines/private/detection.cpp


diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index ef504bacc9e..29334ed0885 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -27,7 +27,7 @@
 #include "private/detection.h"
 
 static const DebugChannelDef debugFlagList[] = {
-	{Private::kPrivateDebugFunction, "functions", "Function execution debug channel"},
+	{Private::kPrivateDebugFunction, "function", "Function execution debug channel"},
 	{Private::kPrivateDebugCode, "code", "Code execution debug channel"},
 	{Private::kPrivateDebugScript, "script", "Script execution debug channel"},
 	DEBUG_CHANNEL_END


Commit: 89af219c272bdcfd2cecc72f5a8224e43532dba1
    https://github.com/scummvm/scummvm/commit/89af219c272bdcfd2cecc72f5a8224e43532dba1
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-12-02T16:38:31+01:00

Commit Message:
PRIVATE: Reduce string creation in `restartGame()`

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 31779eb3c89..a81e3b30dc6 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -1508,9 +1508,10 @@ bool PrivateEngine::hasFeature(EngineFeature f) const {
 void PrivateEngine::restartGame() {
 	debugC(1, kPrivateDebugFunction, "restartGame");
 
+	Common::String alternateGameVariableName = getAlternateGameVariable();
 	for (NameList::iterator it = maps.variableList.begin(); it != maps.variableList.end(); ++it) {
 		Private::Symbol *sym = maps.variables.getVal(*it);
-		if (*(sym->name) != getAlternateGameVariable())
+		if (*(sym->name) != alternateGameVariableName)
 			sym->u.val = 0;
 	}
 


Commit: cecd15b27ca9bf3480b6c855745b570790c59adb
    https://github.com/scummvm/scummvm/commit/cecd15b27ca9bf3480b6c855745b570790c59adb
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-12-02T16:38:31+01:00

Commit Message:
PRIVATE: Implement timer in main thread

Fixes unsychronized access to engine data

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 20078fa1031..10e456527ad 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -786,10 +786,9 @@ static void fTimer(ArgArray args) {
 	else
 		debugC(1, kPrivateDebugScript, "Timer(%d, %s)", args[0].u.val, args[1].u.str);
 
-	int32 delay = 1000000 * args[0].u.val;
+	int32 delay = args[0].u.val * 1000; // seconds => milliseconds
 	if (delay > 0) {
-		if (!g_private->installTimer(delay, args[1].u.sym->name))
-			error("Timer installation failed!");
+		g_private->setTimer(delay, *(args[1].u.sym->name));
 	} else if (delay == 0) {
 		g_private->_nextSetting = *(args[1].u.sym->name);
 	} else {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index a81e3b30dc6..5c795a0211a 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -122,6 +122,9 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
 		_safeDigitArea[d].clear();
 		_safeDigitRect[d] = Common::Rect(0, 0);
 	}
+
+	// Timer
+	clearTimer();
 }
 
 PrivateEngine::~PrivateEngine() {
@@ -354,6 +357,7 @@ Common::Error PrivateEngine::run() {
 
 	while (!shouldQuit()) {
 		bool mouseMoved = false;
+		checkTimer();
 		checkPhoneCall();
 
 		while (_system->getEventManager()->pollEvent(event)) {
@@ -423,7 +427,7 @@ Common::Error PrivateEngine::run() {
 
 		// Movies
 		if (!_nextMovie.empty()) {
-			removeTimer();
+			clearTimer();
 			_videoDecoder = new Video::SmackerDecoder();
 			playVideo(_nextMovie);
 			_currentMovie = _nextMovie;
@@ -455,7 +459,7 @@ Common::Error PrivateEngine::run() {
 		}
 
 		if (!_nextSetting.empty()) {
-			removeTimer();
+			clearTimer();
 			debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting.c_str());
 			clearAreas();
 			_currentSetting = _nextSetting;
@@ -491,7 +495,6 @@ Common::Error PrivateEngine::run() {
 			}
 		}
 	}
-	removeTimer();
 	return Common::kNoError;
 }
 
@@ -1548,6 +1551,9 @@ void PrivateEngine::restartGame() {
 
 	// Wall Safe
 	initializeWallSafeValue();
+
+	// Timer
+	clearTimer();
 }
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
@@ -2464,18 +2470,30 @@ Common::String PrivateEngine::getRandomPhoneClip(const char *clip, int i, int j)
 	return Common::String::format("%s%02d", clip, r);
 }
 
-// Timers
-static void timerCallback(void *refCon) {
-	g_private->removeTimer();
-	g_private->_nextSetting = *(Common::String *)refCon;
+// Timer
+
+void PrivateEngine::setTimer(uint32 delay, const Common::String &setting) {
+	_timerSetting = setting;
+	_timerStartTime = _system->getMillis();
+	_timerDelay = delay;
 }
 
-bool PrivateEngine::installTimer(uint32 delay, Common::String *ns) {
-	return _system->getTimerManager()->installTimerProc(&timerCallback, delay, ns, "timerCallback");
+void PrivateEngine::clearTimer() {
+	_timerSetting.clear();
+	_timerStartTime = 0;
+	_timerDelay = 0;
 }
 
-void PrivateEngine::removeTimer() {
-	_system->getTimerManager()->removeTimerProc(&timerCallback);
+void PrivateEngine::checkTimer() {
+	if (_timerSetting.empty()) {
+		return;
+	}
+	
+	uint32 now = _system->getMillis();
+	if (now - _timerStartTime >= _timerDelay) {
+		_nextSetting = _timerSetting;
+		clearTimer();
+	}
 }
 
 // Diary
diff --git a/engines/private/private.h b/engines/private/private.h
index 97105a0ba87..4b6a01695a4 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -440,9 +440,13 @@ public:
 	// Random values
 	bool getRandomBool(uint);
 
-	// Timers
-	bool installTimer(uint32, Common::String *);
-	void removeTimer();
+	// Timer
+	Common::String _timerSetting;
+	uint32 _timerStartTime;
+	uint32 _timerDelay;
+	void setTimer(uint32 duration, const Common::String &setting);
+	void clearTimer();
+	void checkTimer();
 
 	// VM objects
 	RectList _rects; // created by fCRect


Commit: 28504ebba89b3ce4448c7b7758d622f59259fb6e
    https://github.com/scummvm/scummvm/commit/28504ebba89b3ce4448c7b7758d622f59259fb6e
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-12-02T16:38:31+01:00

Commit Message:
PRIVATE: Implement skipping timer

Escape can now skip delays during introduction, as in the original

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 10e456527ad..20d643a0cd9 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -788,7 +788,11 @@ static void fTimer(ArgArray args) {
 
 	int32 delay = args[0].u.val * 1000; // seconds => milliseconds
 	if (delay > 0) {
-		g_private->setTimer(delay, *(args[1].u.sym->name));
+		Common::String skipSetting;
+		if (args.size() == 3) {
+			skipSetting = *(args[2].u.sym->name);
+		}
+		g_private->setTimer(delay, *(args[1].u.sym->name), skipSetting);
 	} else if (delay == 0) {
 		g_private->_nextSetting = *(args[1].u.sym->name);
 	} else {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 5c795a0211a..32827c2e764 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -366,7 +366,11 @@ Common::Error PrivateEngine::run() {
 			switch (event.type) {
 			case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
 				if (event.customType == kActionSkip) {
-					skipVideo();
+					if (!_timerSkipSetting.empty()) {
+						skipTimer();
+					} else {
+						skipVideo();
+					}
 				}
 				break;
 
@@ -2472,18 +2476,25 @@ Common::String PrivateEngine::getRandomPhoneClip(const char *clip, int i, int j)
 
 // Timer
 
-void PrivateEngine::setTimer(uint32 delay, const Common::String &setting) {
+void PrivateEngine::setTimer(uint32 delay, const Common::String &setting, const Common::String &skipSetting) {
 	_timerSetting = setting;
+	_timerSkipSetting = skipSetting;
 	_timerStartTime = _system->getMillis();
 	_timerDelay = delay;
 }
 
 void PrivateEngine::clearTimer() {
 	_timerSetting.clear();
+	_timerSkipSetting.clear();
 	_timerStartTime = 0;
 	_timerDelay = 0;
 }
 
+void PrivateEngine::skipTimer() {
+	_nextSetting = _timerSkipSetting;
+	clearTimer();
+}
+
 void PrivateEngine::checkTimer() {
 	if (_timerSetting.empty()) {
 		return;
diff --git a/engines/private/private.h b/engines/private/private.h
index 4b6a01695a4..f0b00a9e7fc 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -442,10 +442,12 @@ public:
 
 	// Timer
 	Common::String _timerSetting;
+	Common::String _timerSkipSetting;
 	uint32 _timerStartTime;
 	uint32 _timerDelay;
-	void setTimer(uint32 duration, const Common::String &setting);
+	void setTimer(uint32 duration, const Common::String &setting, const Common::String &skipSetting);
 	void clearTimer();
+	void skipTimer();
 	void checkTimer();
 
 	// VM objects




More information about the Scummvm-git-logs mailing list