[Scummvm-git-logs] scummvm master -> 676bdc6d2f821963bcd7398347255cd35466b1b0

AndywinXp noreply at scummvm.org
Wed Jun 18 10:40:11 UTC 2025


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

Summary:
676bdc6d2f LASTEXPRESS: Greatly improve CPU usage and smooth timings on non-navigation sections


Commit: 676bdc6d2f821963bcd7398347255cd35466b1b0
    https://github.com/scummvm/scummvm/commit/676bdc6d2f821963bcd7398347255cd35466b1b0
Author: AndywinXp (andywinxp at gmail.com)
Date: 2025-06-18T12:40:04+02:00

Commit Message:
LASTEXPRESS: Greatly improve CPU usage and smooth timings on non-navigation sections

Changed paths:
    engines/lastexpress/fight/fight.cpp
    engines/lastexpress/game/credits.cpp
    engines/lastexpress/game/nis.cpp


diff --git a/engines/lastexpress/fight/fight.cpp b/engines/lastexpress/fight/fight.cpp
index a7a8d44773e..57ca2ec3a70 100644
--- a/engines/lastexpress/fight/fight.cpp
+++ b/engines/lastexpress/fight/fight.cpp
@@ -208,8 +208,11 @@ int CFight::process() {
 	setOutcome(1);
 
 	while (_fightIsHappening) {
-		_engine->getMessageManager()->process();
-		_engine->getSoundManager()->soundThread();
+		do {
+			_engine->getSoundManager()->soundThread();
+		} while (_engine->getMessageManager()->process());
+
+		// Only wait and handle events if we've processed all messages, unlike the original which had a separate thread for input...
 		_engine->waitForTimer(5);
 	}
 
diff --git a/engines/lastexpress/game/credits.cpp b/engines/lastexpress/game/credits.cpp
index 98b522cd7de..a62b87e89d6 100644
--- a/engines/lastexpress/game/credits.cpp
+++ b/engines/lastexpress/game/credits.cpp
@@ -530,10 +530,13 @@ bool LastExpressEngine::demoEnding(bool wonGame) {
 			}
 
 			if (!exitFlag) {
-				getMessageManager()->process();
+				bool haveMoreMessages = getMessageManager()->process();
 				getSoundManager()->soundThread();
 				getSubtitleManager()->subThread();
-				waitForTimer(5);
+
+				// Only wait and handle events if we've processed all messages, unlike the original which had a separate thread for input...
+				if (!haveMoreMessages)
+					waitForTimer(5);
 			}
 		}
 
diff --git a/engines/lastexpress/game/nis.cpp b/engines/lastexpress/game/nis.cpp
index 06d9882e9e6..12c4e88799f 100644
--- a/engines/lastexpress/game/nis.cpp
+++ b/engines/lastexpress/game/nis.cpp
@@ -614,8 +614,10 @@ bool NISManager::doNIS(const char *name, int32 flags) {
 
 				_engine->getSoundManager()->soundThread();
 				_engine->getSubtitleManager()->subThread();
-				_engine->getMessageManager()->process();
-				_engine->waitForTimer(5);
+				if (!_engine->getMessageManager()->process()) {
+					// Only wait and handle events if we've processed all messages, unlike the original which had a separate thread for input...
+					_engine->waitForTimer(5);
+				}
 
 				for (slot = _engine->getSoundManager()->_soundCache; slot; slot = slot->getNext()) {
 					if (slot->hasTag(kSoundTagNIS))
@@ -642,7 +644,7 @@ bool NISManager::doNIS(const char *name, int32 flags) {
 					if (!_engine->getMessageManager()->process())
 						break;
 
-					_engine->waitForTimer(5);
+					_engine->handleEvents();
 					_engine->getSubtitleManager()->subThread();
 					_engine->getSoundManager()->soundThread();
 




More information about the Scummvm-git-logs mailing list