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

neuromancer noreply at scummvm.org
Wed Jan 10 12:02:07 UTC 2024


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

Summary:
b13929be85 FREESCAPE: implemented analog clock for eclipse ui


Commit: b13929be85f7694dda9a083e081274bca6a27e52
    https://github.com/scummvm/scummvm/commit/b13929be85f7694dda9a083e081274bca6a27e52
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-01-10T13:02:11+01:00

Commit Message:
FREESCAPE: implemented analog clock for eclipse ui

Changed paths:
    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/cpc.cpp b/engines/freescape/games/eclipse/cpc.cpp
index a2be29c8aba..403fda3b08d 100644
--- a/engines/freescape/games/eclipse/cpc.cpp
+++ b/engines/freescape/games/eclipse/cpc.cpp
@@ -110,6 +110,7 @@ void EclipseEngine::drawCPCUI(Graphics::Surface *surface) {
 		drawStringInSurface("4", 232, 135, back, front, surface, 'Z' - '$' + 1);
 		drawStringInSurface("<", 240, 135, back, front, surface, 'Z' - '$' + 1);
 	}
+	drawAnalogClock(surface, 90, 172, back, other, front);
 }
 
 } // End of namespace Freescape
diff --git a/engines/freescape/games/eclipse/dos.cpp b/engines/freescape/games/eclipse/dos.cpp
index b8d6b9c9902..0c37e9892fb 100644
--- a/engines/freescape/games/eclipse/dos.cpp
+++ b/engines/freescape/games/eclipse/dos.cpp
@@ -71,6 +71,7 @@ void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
 	uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0x55);
 	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
 	uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0xFF);
+	uint32 red = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0x00, 0x00);
 
 	Common::String message;
 	int deadline;
@@ -93,6 +94,7 @@ void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
 		drawStringInSurface("4", 232, 135, black, yellow, surface, 'Z' - '$' + 1);
 		drawStringInSurface("<", 240, 135, black, yellow, surface, 'Z' - '$' + 1);
 	}
+	drawAnalogClock(surface, 90, 172, black, red, white);
 }
 
 } // End of namespace Freescape
\ No newline at end of file
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 4e480feb56b..fbbbf5a5cf1 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -167,6 +167,31 @@ void EclipseEngine::borderScreen() {
 	}
 }
 
+void EclipseEngine::drawAnalogClock(Graphics::Surface *surface, int x, int y, uint32 colorHand1, uint32 colorHand2, uint32 colorBack) {
+	// These calls will cover the pixels of the hardcoded clock image
+	drawAnalogClockHand(surface, x, y, 6 * 6 - 90, 12, colorBack);
+	drawAnalogClockHand(surface, x, y, 7 * 6 - 90, 12, colorBack);
+	drawAnalogClockHand(surface, x, y, 41 * 6 - 90, 11, colorBack);
+	drawAnalogClockHand(surface, x, y, 42 * 6 - 90, 11, colorBack);
+	drawAnalogClockHand(surface, x, y, 0 * 6 - 90, 11, colorBack);
+
+	int seconds, minutes, hours;
+	getTimeFromCountdown(seconds, minutes, hours);
+	hours = 7 + 2 - hours; // It's 7 o-clock when the game starts
+	minutes = 59 - minutes;
+	seconds = 59 - seconds;
+	drawAnalogClockHand(surface, x, y, hours * 30 - 90, 11, colorHand1);
+	drawAnalogClockHand(surface, x, y, minutes * 6 - 90, 11, colorHand1);
+	drawAnalogClockHand(surface, x, y, seconds * 6 - 90, 11, colorHand2);
+}
+
+void EclipseEngine::drawAnalogClockHand(Graphics::Surface *surface, int x, int y, float degrees, float magnitude, uint32 color) {
+	const float degtorad = (M_PI * 2) / 360;
+	float w = magnitude * cos(degrees * degtorad);
+	float h = magnitude * sin(degrees * degtorad);
+	surface->drawLine(x, y, x+(int)w, y+(int)h, color);
+}
+
 void EclipseEngine::executePrint(FCLInstruction &instruction) {
 	uint16 index = instruction._source - 1;
 	debugC(1, kFreescapeDebugCode, "Printing message %d", index);
diff --git a/engines/freescape/games/eclipse/eclipse.h b/engines/freescape/games/eclipse/eclipse.h
index 7fbd6255654..2105274140f 100644
--- a/engines/freescape/games/eclipse/eclipse.h
+++ b/engines/freescape/games/eclipse/eclipse.h
@@ -48,6 +48,8 @@ public:
 	void drawDOSUI(Graphics::Surface *surface) override;
 	void drawCPCUI(Graphics::Surface *surface) override;
 	void drawZXUI(Graphics::Surface *surface) override;
+	void drawAnalogClock(Graphics::Surface *surface, int x, int y, uint32 colorHand1, uint32 colorHand2, uint32 colorBack);
+	void drawAnalogClockHand(Graphics::Surface *surface, int x, int y, float degrees, float magnitude, uint32 color);
 
 
 	Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
diff --git a/engines/freescape/games/eclipse/zx.cpp b/engines/freescape/games/eclipse/zx.cpp
index c3a50af2d51..97066863aec 100644
--- a/engines/freescape/games/eclipse/zx.cpp
+++ b/engines/freescape/games/eclipse/zx.cpp
@@ -117,6 +117,7 @@ void EclipseEngine::drawZXUI(Graphics::Surface *surface) {
 		drawStringInSurface("4", 232, 141, back, front, surface, 'Z' - '$' + 1);
 		drawStringInSurface("<", 240, 141, back, front, surface, 'Z' - '$' + 1);
 	}
+	drawAnalogClock(surface, 89, 172, back, back, gray);
 }
 
 } // End of namespace Freescape




More information about the Scummvm-git-logs mailing list