[Scummvm-git-logs] scummvm master -> 231ebb5d9e263bdffaf362f7701f24804f97f33f

neuromancer noreply at scummvm.org
Thu Nov 20 07:54:33 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:
231ebb5d9e FREESCAPE: better rendering of score in all the eclipse releases


Commit: 231ebb5d9e263bdffaf362f7701f24804f97f33f
    https://github.com/scummvm/scummvm/commit/231ebb5d9e263bdffaf362f7701f24804f97f33f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-11-20T08:54:17+01:00

Commit Message:
FREESCAPE: better rendering of score in all the eclipse releases

Changed paths:
    engines/freescape/games/eclipse/c64.cpp
    engines/freescape/games/eclipse/cpc.cpp
    engines/freescape/games/eclipse/dos.cpp
    engines/freescape/games/eclipse/eclipse.cpp
    engines/freescape/games/eclipse/eclipse.h
    engines/freescape/games/eclipse/zx.cpp


diff --git a/engines/freescape/games/eclipse/c64.cpp b/engines/freescape/games/eclipse/c64.cpp
index 0842eca2ac6..e9e670585f5 100644
--- a/engines/freescape/games/eclipse/c64.cpp
+++ b/engines/freescape/games/eclipse/c64.cpp
@@ -134,8 +134,7 @@ void EclipseEngine::drawC64UI(Graphics::Surface *surface) {
 	} else if (!_currentAreaMessages.empty())
 		drawStringInSurface(_currentArea->_name, 104, 138, back, yellow, surface);
 
-	Common::String encodedScoreStr = getScoreString(score);
-	drawStringInSurface(encodedScoreStr, 128, 7, black, white, surface);
+	drawScoreString(score, 128, 7, black, white, surface);
 
 	Common::String shieldStr = Common::String::format("%d", shield);
 
diff --git a/engines/freescape/games/eclipse/cpc.cpp b/engines/freescape/games/eclipse/cpc.cpp
index b3182388137..0428bdb884c 100644
--- a/engines/freescape/games/eclipse/cpc.cpp
+++ b/engines/freescape/games/eclipse/cpc.cpp
@@ -166,8 +166,7 @@ void EclipseEngine::drawCPCUI(Graphics::Surface *surface) {
 	} else if (!_currentAreaMessages.empty())
 		drawStringInSurface(_currentArea->_name, 102, 135, back, front, surface);
 
-	Common::String encodedScoreStr = getScoreString(score);
-	drawStringInSurface(encodedScoreStr, 136, 6, back, other, surface);
+	drawScoreString(score, 136, 6, back, other, surface);
 
 	int x = 171;
 	if (shield < 10)
diff --git a/engines/freescape/games/eclipse/dos.cpp b/engines/freescape/games/eclipse/dos.cpp
index 91e0c2b3c8f..c77c05a58e9 100644
--- a/engines/freescape/games/eclipse/dos.cpp
+++ b/engines/freescape/games/eclipse/dos.cpp
@@ -117,8 +117,7 @@ void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
 	} else if (!_currentAreaMessages.empty())
 		drawStringInSurface(_currentArea->_name, 102, 135, black, yellow, surface);
 
-	Common::String encodedScoreStr = getScoreString(score);
-	drawStringInSurface(encodedScoreStr, 136, 6, black, white, surface);
+	drawScoreString(score, 136, 6, black, white, surface);
 
 	int x = 171;
 	if (shield < 10)
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 54e71fa788a..c1ce1017846 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -723,24 +723,31 @@ void EclipseEngine::drawSensorShoot(Sensor *sensor) {
 	}
 }
 
-Common::String EclipseEngine::getScoreString(int score) {
+void EclipseEngine::drawScoreString(int score, int x, int y, uint32 front, uint32 back, Graphics::Surface *surface) {
 	Common::String scoreStr = Common::String::format("%07d", score);
 
 	if (isDOS() || isCPC() || isSpectrum()) {
 		scoreStr = shiftStr(scoreStr, 'Z' - '0' + 1);
-		if (_renderMode == Common::RenderMode::kRenderEGA || isSpectrum())
-			return scoreStr;
+		if (_renderMode == Common::RenderMode::kRenderEGA || isSpectrum()) {
+			drawStringInSurface(scoreStr, x, y, front, back, surface);
+			return;
+		}
+
 	}
-	Common::String encodedScoreStr;
+
+	// Start in x,y and draw each digit, from left to right, adding a gap every 3 digits
+	int gapSize = isC64() ? 8 : 4;
 
 	for (int i = 0; i < int(scoreStr.size()); i++) {
-		encodedScoreStr.insertChar(scoreStr[int(scoreStr.size()) - i - 1], 0);
-		if ((i + 1) % 3 == 0 && i > 0)
-		encodedScoreStr.insertChar(',', 0);
+		drawStringInSurface(Common::String(scoreStr[i]), x, y, front, back, surface);
+		x += 8;
+		if ((i - scoreStr.size() + 1) % 3 == 1)
+			x += gapSize;
 	}
-	return encodedScoreStr;
+
 }
 
+
 void EclipseEngine::updateTimeVariables() {
 	if (isEclipse2() && _gameStateControl == kFreescapeGameStateStart) {
 		executeLocalGlobalConditions(false, true, false);
diff --git a/engines/freescape/games/eclipse/eclipse.h b/engines/freescape/games/eclipse/eclipse.h
index 795cb57dd07..0532dea216e 100644
--- a/engines/freescape/games/eclipse/eclipse.h
+++ b/engines/freescape/games/eclipse/eclipse.h
@@ -92,6 +92,7 @@ public:
 	void drawCompass(Graphics::Surface *surface, int x, int y, double degrees, double magnitude, uint32 color);
 	void drawEclipseIndicator(Graphics::Surface *surface, int x, int y, uint32 color1, uint32 color2);
 	Common::String getScoreString(int score);
+	void drawScoreString(int score, int x, int y, uint32 front, uint32 back, Graphics::Surface *surface);
 
 	soundFx *load1bPCM(Common::SeekableReadStream *file, int offset);
 
diff --git a/engines/freescape/games/eclipse/zx.cpp b/engines/freescape/games/eclipse/zx.cpp
index d793c4d0110..ae33ab9dadf 100644
--- a/engines/freescape/games/eclipse/zx.cpp
+++ b/engines/freescape/games/eclipse/zx.cpp
@@ -179,8 +179,7 @@ void EclipseEngine::drawZXUI(Graphics::Surface *surface) {
 	} else if (!_currentAreaMessages.empty())
 		drawStringInSurface(_currentArea->_name, 102, 141, back, yellow, surface);
 
-	Common::String encodedScoreStr = getScoreString(score);
-	drawStringInSurface(encodedScoreStr, 135, 11, back, gray, surface);
+	drawScoreString(score, 135, 11, back, gray, surface);
 
 	Common::String shieldStr = Common::String::format("%d", shield);
 




More information about the Scummvm-git-logs mailing list