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

neuromancer noreply at scummvm.org
Fri Nov 17 11:58:24 UTC 2023


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

Summary:
ea14ca8893 FREESCAPE: initial implementation of shooting rocks/bullets in OpenGL
81d270b8d0 FREESCAPE: improved support for eclipse demo for cpc and refactored some functions to use across games
313fb457aa FREESCAPE: correctly print fullscreen messages in eclipse demo
d0f17cf4e0 FREESCAPE: correct rendering of eclipse font
e4e3b318a5 FREESCAPE: refactor driller header into a file
de1be20d7c FREESCAPE: initial support for eclipse zx demo
a37699114c FREESCAPE: support for additional eclipse zx demo


Commit: ea14ca889351a955f4415399b766602a2c23ceb6
    https://github.com/scummvm/scummvm/commit/ea14ca889351a955f4415399b766602a2c23ceb6
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-11-17T12:58:08+01:00

Commit Message:
FREESCAPE: initial implementation of shooting rocks/bullets in OpenGL

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/gfx.h
    engines/freescape/gfx_opengl.cpp
    engines/freescape/gfx_opengl.h
    engines/freescape/gfx_opengl_shaders.cpp
    engines/freescape/gfx_opengl_shaders.h
    engines/freescape/gfx_tinygl.cpp
    engines/freescape/gfx_tinygl.h
    engines/freescape/movement.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 6c7455fe60e..8bf377a7e66 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -326,7 +326,11 @@ void FreescapeEngine::drawFrame() {
 
 	if (_shootingFrames > 0) {
 		_gfx->setViewport(_fullscreenViewArea);
-		_gfx->renderPlayerShoot(0, _crossairPosition, _viewArea);
+		if (isDriller() || isDark())
+			_gfx->renderPlayerShootRay(0, _crossairPosition, _viewArea);
+		else
+			_gfx->renderPlayerShootBall(0, _crossairPosition, _shootingFrames, _viewArea);
+
 		_gfx->setViewport(_viewArea);
 		_shootingFrames--;
 	}
diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index 423d126c61e..db2d3b9b1d4 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -33,7 +33,7 @@
 
 namespace Freescape {
 
-#define kVertexArraySize 20
+#define kVertexArraySize 128
 #define kCoordsArraySize 4
 
 typedef Common::Array<byte *> ColorMap;
@@ -83,7 +83,9 @@ public:
 	virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture) = 0;
 
 	virtual void renderSensorShoot(byte color, const Math::Vector3d sensor, const Math::Vector3d player, const Common::Rect viewPort) = 0;
-	virtual void renderPlayerShoot(byte color, const Common::Point position, const Common::Rect viewPort) = 0;
+	virtual void renderPlayerShootBall(byte color, const Common::Point position, int frame, const Common::Rect viewPort) = 0;
+	virtual void renderPlayerShootRay(byte color, const Common::Point position, const Common::Rect viewPort) = 0;
+
 	virtual void renderCrossair(const Common::Point crossairPosition) = 0;
 
 	virtual void renderCube(const Math::Vector3d &position, const Math::Vector3d &size, Common::Array<uint8> *colours);
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index 06f1ec70274..53ba4d9990a 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -234,7 +234,7 @@ void OpenGLRenderer::renderCrossair(const Common::Point crossairPosition) {
 	glDepthMask(GL_TRUE);
 }
 
-void OpenGLRenderer::renderPlayerShoot(byte color, const Common::Point position, const Common::Rect viewArea) {
+void OpenGLRenderer::renderPlayerShootRay(byte color, const Common::Point position, const Common::Rect viewArea) {
 	uint8 r, g, b;
 
 	glMatrixMode(GL_PROJECTION);
@@ -278,6 +278,54 @@ void OpenGLRenderer::renderPlayerShoot(byte color, const Common::Point position,
 	glDepthMask(GL_TRUE);
 }
 
+void OpenGLRenderer::renderPlayerShootBall(byte color, const Common::Point position, int frame, const Common::Rect viewArea) {
+	uint8 r, g, b;
+
+	glMatrixMode(GL_PROJECTION);
+	glLoadIdentity();
+	glOrtho(0, _screenW, _screenH, 0, 0, 1);
+	glMatrixMode(GL_MODELVIEW);
+	glLoadIdentity();
+	if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderZX) {
+		r = g = b = 255;
+	} else {
+		r = g = b = 255;
+		glEnable(GL_BLEND);
+		glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
+	}
+
+	glDisable(GL_DEPTH_TEST);
+	glDepthMask(GL_FALSE);
+
+	glColor3ub(r, g, b);
+	int triangleAmount = 20;
+	float twicePi = 2.0f * 3.1416;
+	float coef = (9 - frame) / 9.0;
+	float radius = (1 - coef) * 4.0;
+
+	Common::Point initial_position(viewArea.left + viewArea.width() / 2 + 2, viewArea.height() + viewArea.top);
+	Common::Point ball_position = coef * position + (1 - coef) * initial_position;
+
+	glEnableClientState(GL_VERTEX_ARRAY);
+	copyToVertexArray(0, Math::Vector3d(ball_position.x, ball_position.y, 0));
+
+	for(int i = 0; i <= triangleAmount; i++) {
+		copyToVertexArray(i + 1,
+			Math::Vector3d(ball_position.x + (radius * cos(i *  twicePi / triangleAmount)),
+						ball_position.y + (radius * sin(i * twicePi / triangleAmount)), 0)
+		);
+	}
+
+	glVertexPointer(3, GL_FLOAT, 0, _verts);
+	glDrawArrays(GL_TRIANGLE_FAN, 0, triangleAmount + 2);
+	glDisableClientState(GL_VERTEX_ARRAY);
+
+	glDisable(GL_BLEND);
+	glEnable(GL_DEPTH_TEST);
+	glDepthMask(GL_TRUE);
+}
+
+
 void OpenGLRenderer::renderFace(const Common::Array<Math::Vector3d> &vertices) {
 	assert(vertices.size() >= 2);
 	const Math::Vector3d &v0 = vertices[0];
diff --git a/engines/freescape/gfx_opengl.h b/engines/freescape/gfx_opengl.h
index 946aedff7cf..0b616a0b96a 100644
--- a/engines/freescape/gfx_opengl.h
+++ b/engines/freescape/gfx_opengl.h
@@ -99,7 +99,8 @@ public:
 	virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture) override;
 
 	virtual void renderSensorShoot(byte color, const Math::Vector3d sensor, const Math::Vector3d player, const Common::Rect viewPort) override;
-	virtual void renderPlayerShoot(byte color, const Common::Point position, const Common::Rect viewPort) override;
+	virtual void renderPlayerShootBall(byte color, const Common::Point position, int frame, const Common::Rect viewPort) override;
+	virtual void renderPlayerShootRay(byte color, const Common::Point position, const Common::Rect viewPort) override;
 	virtual void renderCrossair(const Common::Point crossairPosition) override;
 
 	virtual void renderFace(const Common::Array<Math::Vector3d> &vertices) override;
diff --git a/engines/freescape/gfx_opengl_shaders.cpp b/engines/freescape/gfx_opengl_shaders.cpp
index e621f13b166..b8d91488a49 100644
--- a/engines/freescape/gfx_opengl_shaders.cpp
+++ b/engines/freescape/gfx_opengl_shaders.cpp
@@ -189,7 +189,9 @@ float remap(float f, float s) {
 	return 2. * f / s - 1;
 }
 
-void OpenGLShaderRenderer::renderPlayerShoot(byte color, const Common::Point position, const Common::Rect viewArea) {
+void OpenGLShaderRenderer::renderPlayerShootBall(byte color, const Common::Point position, int frame, const Common::Rect viewArea) {}
+
+void OpenGLShaderRenderer::renderPlayerShootRay(byte color, const Common::Point position, const Common::Rect viewArea) {
 	uint8 r, g, b;
 
 	Math::Matrix4 identity;
diff --git a/engines/freescape/gfx_opengl_shaders.h b/engines/freescape/gfx_opengl_shaders.h
index 5504e274690..599d64a51b6 100644
--- a/engines/freescape/gfx_opengl_shaders.h
+++ b/engines/freescape/gfx_opengl_shaders.h
@@ -81,7 +81,9 @@ public:
 	virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture) override;
 
 	virtual void renderSensorShoot(byte color, const Math::Vector3d sensor, const Math::Vector3d player, const Common::Rect viewPort) override;
-	virtual void renderPlayerShoot(byte color, const Common::Point position, const Common::Rect viewPort) override;
+	virtual void renderPlayerShootBall(byte color, const Common::Point position, int frame, const Common::Rect viewPort) override;
+	virtual void renderPlayerShootRay(byte color, const Common::Point position, const Common::Rect viewPort) override;
+
 	virtual void renderCrossair(const Common::Point crossairPosition) override;
 
 	virtual void renderFace(const Common::Array<Math::Vector3d> &vertices) override;
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index 3b84b2fdcde..5f7c3545fc7 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -129,7 +129,10 @@ void TinyGLRenderer::renderSensorShoot(byte color, const Math::Vector3d sensor,
 	polygonOffset(false);
 }
 
-void TinyGLRenderer::renderPlayerShoot(byte color, const Common::Point position, const Common::Rect viewArea) {
+void TinyGLRenderer::renderPlayerShootBall(byte color, const Common::Point position, int frame, const Common::Rect viewArea) {}
+
+
+void TinyGLRenderer::renderPlayerShootRay(byte color, const Common::Point position, const Common::Rect viewArea) {
 	uint8 r, g, b;
 	readFromPalette(color, r, g, b); // TODO: should use opposite color
 
diff --git a/engines/freescape/gfx_tinygl.h b/engines/freescape/gfx_tinygl.h
index c5a49b7c043..ac7461091cb 100644
--- a/engines/freescape/gfx_tinygl.h
+++ b/engines/freescape/gfx_tinygl.h
@@ -60,7 +60,8 @@ public:
 	virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture) override;
 
 	virtual void renderSensorShoot(byte color, const Math::Vector3d sensor, const Math::Vector3d player, const Common::Rect viewPort) override;
-	virtual void renderPlayerShoot(byte color, const Common::Point position, const Common::Rect viewPort) override;
+	virtual void renderPlayerShootBall(byte color, const Common::Point position, int frame, const Common::Rect viewPort) override;
+	virtual void renderPlayerShootRay(byte color, const Common::Point position, const Common::Rect viewPort) override;
 	virtual void renderCrossair(const Common::Point crossairPosition) override;
 
 	virtual void renderFace(const Common::Array<Math::Vector3d> &vertices) override;
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 5f3ff7bab6e..f8dc10a1f24 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -183,7 +183,7 @@ void FreescapeEngine::activate() {
 void FreescapeEngine::shoot() {
 	playSound(1, false);
 	g_system->delayMillis(2);
-	_shootingFrames = 4;
+	_shootingFrames = 10;
 
 	Common::Point center(_viewArea.left + _viewArea.width() / 2, _viewArea.top + _viewArea.height() / 2);
 	float xoffset = _crossairPosition.x - center.x;


Commit: 81d270b8d0a2141870a01fd7db3585b5525d4fcf
    https://github.com/scummvm/scummvm/commit/81d270b8d0a2141870a01fd7db3585b5525d4fcf
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-11-17T12:58:08+01:00

Commit Message:
FREESCAPE: improved support for eclipse demo for cpc and refactored some functions to use across games

Changed paths:
    engines/freescape/freescape.h
    engines/freescape/games/dark/dark.cpp
    engines/freescape/games/dark/dark.h
    engines/freescape/games/eclipse/cpc.cpp
    engines/freescape/games/eclipse/eclipse.cpp
    engines/freescape/games/eclipse/eclipse.h
    engines/freescape/ui.cpp


diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 7ca0575d34e..77ee4a7b5f9 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -381,6 +381,8 @@ public:
 
 	void loadMessagesFixedSize(Common::SeekableReadStream *file, int offset, int size, int number);
 	virtual void loadMessagesVariableSize(Common::SeekableReadStream *file, int offset, int number);
+	void drawFullscreenMessageAndWait(Common::String message);
+	void drawFullscreenMessage(Common::String message, uint32 front, Graphics::Surface *surface);
 
 	void loadFonts(Common::SeekableReadStream *file, int offset);
 	void loadFonts(byte *font, int charNumber);
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 6a2ad84dcbc..ace1021c4b4 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -603,99 +603,6 @@ void DarkEngine::executePrint(FCLInstruction &instruction) {
 	insertTemporaryMessage(_messagesList[index], _countdown - 2);
 }
 
-void DarkEngine::drawFullscreenMessage(Common::String message, uint32 front, Graphics::Surface *surface) {
-	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
-	uint32 color = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00);
-
-	surface->fillRect(_fullscreenViewArea, color);
-	surface->fillRect(_viewArea, black);
-	int x = 0;
-	int y = 0;
-	int letterPerLine = 0;
-	int numberOfLines = 0;
-
-	if (isDOS()) {
-		x = 50;
-		y = 32;
-		letterPerLine = 28;
-		numberOfLines = 10;
-	} else if (isSpectrum()) {
-		x = 60;
-		y = 35;
-		letterPerLine = 24;
-		numberOfLines = 12;
-	}
-
-	for (int i = 0; i < numberOfLines; i++) {
-		Common::String line = message.substr(letterPerLine * i, letterPerLine);
-		//debug("'%s' %d", line.c_str(), line.size());
-		drawStringInSurface(line, x, y, front, black, surface);
-		y = y + 8;
-	}
-
-	drawFullscreenSurface(surface);
-}
-
-void DarkEngine::drawFullscreenMessageAndWait(Common::String message) {
-	_savedScreen = _gfx->getScreenshot();
-	uint32 color = 0;
-	switch (_renderMode) {
-		case Common::kRenderCGA:
-			color = 1;
-			break;
-		case Common::kRenderZX:
-			color = 6;
-			break;
-		default:
-			color = 14;
-	}
-	uint8 r, g, b;
-	_gfx->readFromPalette(color, r, g, b);
-	uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
-
-	Graphics::Surface *surface = new Graphics::Surface();
-	surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
-
-	Common::Event event;
-	bool cont = true;
-	while (!shouldQuit() && cont) {
-		while (g_system->getEventManager()->pollEvent(event)) {
-
-			// Events
-			switch (event.type) {
-			case Common::EVENT_KEYDOWN:
-				if (event.kbd.keycode == Common::KEYCODE_SPACE) {
-					cont = false;
-				}
-				break;
-			case Common::EVENT_SCREEN_CHANGED:
-				_gfx->computeScreenViewport();
-				break;
-			case Common::EVENT_RBUTTONDOWN:
-				// fallthrough
-			case Common::EVENT_LBUTTONDOWN:
-				if (g_system->hasFeature(OSystem::kFeatureTouchscreen))
-					cont = false;
-				break;
-			default:
-				break;
-			}
-		}
-		drawBorder();
-		if (_currentArea)
-			drawUI();
-		drawFullscreenMessage(message, front, surface);
-		_gfx->flipBuffer();
-		g_system->updateScreen();
-		g_system->delayMillis(15); // try to target ~60 FPS
-	}
-
-	_savedScreen->free();
-	delete _savedScreen;
-	surface->free();
-	delete surface;
-}
-
 void DarkEngine::drawBinaryClock(Graphics::Surface *surface, int xPosition, int yPosition, uint32 front, uint32 back) {
 	int number = _ticks / 2;
 	int bits = 0;
diff --git a/engines/freescape/games/dark/dark.h b/engines/freescape/games/dark/dark.h
index a3e556e8ce5..db6d924198a 100644
--- a/engines/freescape/games/dark/dark.h
+++ b/engines/freescape/games/dark/dark.h
@@ -79,8 +79,6 @@ public:
 
 
 	void drawInfoMenu() override;
-	void drawFullscreenMessageAndWait(Common::String message);
-	void drawFullscreenMessage(Common::String message, uint32 front, Graphics::Surface *surface);
 
 	Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
 	Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
diff --git a/engines/freescape/games/eclipse/cpc.cpp b/engines/freescape/games/eclipse/cpc.cpp
index 86876299267..51b72398e72 100644
--- a/engines/freescape/games/eclipse/cpc.cpp
+++ b/engines/freescape/games/eclipse/cpc.cpp
@@ -54,6 +54,8 @@ void EclipseEngine::loadAssetsCPCDemo() {
 		error("Failed to open TEPROG.BIN");
 
 	loadFonts(&file, 0x63ce);
+	loadMessagesFixedSize(&file, 0x362, 16, 23);
+	loadMessagesFixedSize(&file, 0x570b, 264, 3);
 	load8bitBinary(&file, 0x65c6, 16);
 	for (auto &it : _areaMap) {
 		it._value->_name = "  NOW TRAINING  ";
@@ -61,6 +63,8 @@ void EclipseEngine::loadAssetsCPCDemo() {
 		for (int16 id = 183; id < 207; id++)
 			it._value->addObjectFromArea(id, _areaMap[255]);
 	}
+	loadColorPalette();
+	swapPalette(1);
 	//_indicators.push_back(loadBundledImage("dark_fallen_indicator"));
 	//_indicators.push_back(loadBundledImage("dark_crouch_indicator"));
 	//_indicators.push_back(loadBundledImage("dark_walk_indicator"));
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 88e8b410961..d619863cb9a 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -64,12 +64,14 @@ EclipseEngine::EclipseEngine(OSystem *syst, const ADGameDescription *gd) : Frees
 	_stepUpDistance = 32;
 
 	const char **messagePtr = rawMessagesTable;
-	debugC(1, kFreescapeDebugParser, "String table:");
-	while (*messagePtr) {
-		Common::String message(*messagePtr);
-		_messagesList.push_back(message);
-		debugC(1, kFreescapeDebugParser, "%s", message.c_str());
-		messagePtr++;
+	if (isDOS()) {
+		debugC(1, kFreescapeDebugParser, "String table:");
+		while (*messagePtr) {
+			Common::String message(*messagePtr);
+			_messagesList.push_back(message);
+			debugC(1, kFreescapeDebugParser, "%s", message.c_str());
+			messagePtr++;
+		}
 	}
 
 	_playerStepIndex = 2;
@@ -110,6 +112,19 @@ void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
 	resetInput();
 }
 
+void EclipseEngine::borderScreen() {
+	if (_border) {
+		drawBorder();
+		if (isDemo()) {
+			drawFullscreenMessageAndWait(_messagesList[23]);
+			drawFullscreenMessageAndWait(_messagesList[24]);
+			drawFullscreenMessageAndWait(_messagesList[25]);
+		} else {
+			FreescapeEngine::borderScreen();
+		}
+	}
+}
+
 Common::Error EclipseEngine::saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave) {
 	return Common::kNoError;
 }
diff --git a/engines/freescape/games/eclipse/eclipse.h b/engines/freescape/games/eclipse/eclipse.h
index 498ec3ceec0..8de8976f879 100644
--- a/engines/freescape/games/eclipse/eclipse.h
+++ b/engines/freescape/games/eclipse/eclipse.h
@@ -27,6 +27,8 @@ public:
 
 	void gotoArea(uint16 areaID, int entranceID) override;
 
+	void borderScreen() override;
+
 	void loadAssetsDOSFullGame() override;
 
 	void initDOS();
diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index 792b1972630..78cc38b5c01 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -147,6 +147,102 @@ void FreescapeEngine::borderScreen() {
 	}
 }
 
+void FreescapeEngine::drawFullscreenMessage(Common::String message, uint32 front, Graphics::Surface *surface) {
+	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
+	uint32 color = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00);
+
+	surface->fillRect(_fullscreenViewArea, color);
+	surface->fillRect(_viewArea, black);
+	int x = 0;
+	int y = 0;
+	int letterPerLine = 0;
+	int numberOfLines = 0;
+
+	if (isDOS()) {
+		x = 50;
+		y = 32;
+		letterPerLine = 28;
+		numberOfLines = 10;
+	} else if (isSpectrum() || isCPC()) {
+		x = 60;
+		y = 35;
+		letterPerLine = 24;
+		numberOfLines = 12;
+	}
+
+	for (int i = 0; i < numberOfLines; i++) {
+		Common::String line = message.substr(letterPerLine * i, letterPerLine);
+		debug("'%s' %d", line.c_str(), line.size());
+		drawStringInSurface(line, x, y, front, black, surface);
+		y = y + 8;
+	}
+	drawFullscreenSurface(surface);
+}
+
+void FreescapeEngine::drawFullscreenMessageAndWait(Common::String message) {
+	_savedScreen = _gfx->getScreenshot();
+	uint32 color = 0;
+	switch (_renderMode) {
+		case Common::kRenderCPC:
+			color = 14;
+			break;
+		case Common::kRenderCGA:
+			color = 1;
+			break;
+		case Common::kRenderZX:
+			color = 6;
+			break;
+		default:
+			color = 14;
+	}
+	uint8 r, g, b;
+	_gfx->readFromPalette(color, r, g, b);
+	uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+	Graphics::Surface *surface = new Graphics::Surface();
+	surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
+
+	Common::Event event;
+	bool cont = true;
+	while (!shouldQuit() && cont) {
+		while (g_system->getEventManager()->pollEvent(event)) {
+
+			// Events
+			switch (event.type) {
+			case Common::EVENT_KEYDOWN:
+				if (event.kbd.keycode == Common::KEYCODE_SPACE) {
+					cont = false;
+				}
+				break;
+			case Common::EVENT_SCREEN_CHANGED:
+				_gfx->computeScreenViewport();
+				break;
+			case Common::EVENT_RBUTTONDOWN:
+				// fallthrough
+			case Common::EVENT_LBUTTONDOWN:
+				if (g_system->hasFeature(OSystem::kFeatureTouchscreen))
+					cont = false;
+				break;
+			default:
+				break;
+			}
+		}
+		drawBorder();
+		if (_currentArea)
+			drawUI();
+		drawFullscreenMessage(message, front, surface);
+		_gfx->flipBuffer();
+		g_system->updateScreen();
+		g_system->delayMillis(15); // try to target ~60 FPS
+	}
+
+	_savedScreen->free();
+	delete _savedScreen;
+	surface->free();
+	delete surface;
+}
+
+
 void FreescapeEngine::drawBorderScreenAndWait(Graphics::Surface *surface) {
 	int maxWait = 6 * 60;
 	for (int i = 0; i < maxWait; i++ ) {


Commit: 313fb457aa12023e3b5e97c7f45c2ebacfe99dd5
    https://github.com/scummvm/scummvm/commit/313fb457aa12023e3b5e97c7f45c2ebacfe99dd5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-11-17T12:58:08+01:00

Commit Message:
FREESCAPE: correctly print fullscreen messages in eclipse demo

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


diff --git a/engines/freescape/games/eclipse/cpc.cpp b/engines/freescape/games/eclipse/cpc.cpp
index 51b72398e72..24fc03ee755 100644
--- a/engines/freescape/games/eclipse/cpc.cpp
+++ b/engines/freescape/games/eclipse/cpc.cpp
@@ -55,7 +55,7 @@ void EclipseEngine::loadAssetsCPCDemo() {
 
 	loadFonts(&file, 0x63ce);
 	loadMessagesFixedSize(&file, 0x362, 16, 23);
-	loadMessagesFixedSize(&file, 0x570b, 264, 3);
+	loadMessagesFixedSize(&file, 0x570b, 264, 5);
 	load8bitBinary(&file, 0x65c6, 16);
 	for (auto &it : _areaMap) {
 		it._value->_name = "  NOW TRAINING  ";
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index d619863cb9a..445fb6bb3ba 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -125,6 +125,17 @@ void EclipseEngine::borderScreen() {
 	}
 }
 
+void EclipseEngine::executePrint(FCLInstruction &instruction) {
+	uint16 index = instruction._source - 1;
+	debugC(1, kFreescapeDebugCode, "Printing message %d", index);
+	if (index > 127) {
+		index = _messagesList.size() - (index - 254) - 2;
+		drawFullscreenMessageAndWait(_messagesList[index]);
+		return;
+	}
+	insertTemporaryMessage(_messagesList[index], _countdown - 2);
+}
+
 Common::Error EclipseEngine::saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave) {
 	return Common::kNoError;
 }
diff --git a/engines/freescape/games/eclipse/eclipse.h b/engines/freescape/games/eclipse/eclipse.h
index 8de8976f879..94343436cfe 100644
--- a/engines/freescape/games/eclipse/eclipse.h
+++ b/engines/freescape/games/eclipse/eclipse.h
@@ -34,6 +34,7 @@ public:
 	void initDOS();
 	void initCPC();
 	void loadAssetsCPCDemo() override;
+	void executePrint(FCLInstruction &instruction) override;
 
 	void drawDOSUI(Graphics::Surface *surface) override;
 	void drawCPCUI(Graphics::Surface *surface) override;


Commit: d0f17cf4e0a64f7f53361ddc19ddc7fab57782a4
    https://github.com/scummvm/scummvm/commit/d0f17cf4e0a64f7f53361ddc19ddc7fab57782a4
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-11-17T12:58:08+01:00

Commit Message:
FREESCAPE: correct rendering of eclipse font

Changed paths:
    engines/freescape/freescape.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 8bf377a7e66..f9e57b07fa7 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -745,7 +745,7 @@ void FreescapeEngine::drawStringInSurface(const Common::String &str, int x, int
 	int sizeX = 8;
 	int sizeY = isCastle() ? 8 : 6;
 	int sep = isCastle() ? 9 : 8;
-	int additional = isCastle() ? 0 : 1;
+	int additional = isCastle() || isEclipse() ? 0 : 1;
 
 	if (isDOS() || isSpectrum() || isCPC() || isC64()) {
 		for (uint32 c = 0; c < ustr.size(); c++) {


Commit: e4e3b318a5f07d70e271e478b2fcc6025801f619
    https://github.com/scummvm/scummvm/commit/e4e3b318a5f07d70e271e478b2fcc6025801f619
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-11-17T12:58:08+01:00

Commit Message:
FREESCAPE: refactor driller header into a file

Changed paths:
  A engines/freescape/games/driller/driller.h
    engines/freescape/freescape.h
    engines/freescape/games/driller/amiga.cpp
    engines/freescape/games/driller/atari.cpp
    engines/freescape/games/driller/c64.cpp
    engines/freescape/games/driller/cpc.cpp
    engines/freescape/games/driller/dos.cpp
    engines/freescape/games/driller/driller.cpp
    engines/freescape/games/driller/zx.cpp
    engines/freescape/metaengine.cpp


diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 77ee4a7b5f9..c068ca8ce04 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -460,89 +460,6 @@ enum DrillerReleaseFlags {
 		GF_ATARI_MAGAZINE_DEMO = (1 << 12),
 };
 
-class DrillerEngine : public FreescapeEngine {
-public:
-	DrillerEngine(OSystem *syst, const ADGameDescription *gd);
-	~DrillerEngine();
-
-	uint32 _initialJetEnergy;
-	uint32 _initialJetShield;
-
-	uint32 _initialTankEnergy;
-	uint32 _initialTankShield;
-
-	bool _useAutomaticDrilling;
-
-	Common::HashMap<uint16, uint32> _drillStatusByArea;
-	Common::HashMap<uint16, uint32> _drillMaxScoreByArea;
-	Common::HashMap<uint16, uint32> _drillSuccessByArea;
-
-	void initGameState() override;
-	bool checkIfGameEnded() override;
-
-	void gotoArea(uint16 areaID, int entranceID) override;
-
-	void drawInfoMenu() override;
-	void drawSensorShoot(Sensor *sensor) override;
-
-	void pressedKey(const int keycode) override;
-	Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
-	Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
-
-private:
-	bool drillDeployed(Area *area);
-	GeometricObject *_drillBase;
-	Math::Vector3d drillPosition();
-	void addDrill(const Math::Vector3d position, bool gasFound);
-	bool checkDrill(const Math::Vector3d position);
-	void removeDrill(Area *area);
-	void addSkanner(Area *area);
-
-	void loadAssetsFullGame() override;
-	void loadAssetsAtariFullGame() override;
-	void loadAssetsAtariDemo() override;
-	void loadAssetsAmigaFullGame() override;
-	void loadAssetsAmigaDemo() override;
-	void loadAssetsDOSFullGame() override;
-	void loadAssetsDOSDemo() override;
-	void loadAssetsZXFullGame() override;
-	void loadAssetsCPCFullGame() override;
-	void loadAssetsC64FullGame() override;
-
-	void drawDOSUI(Graphics::Surface *surface) override;
-	void drawZXUI(Graphics::Surface *surface) override;
-	void drawCPCUI(Graphics::Surface *surface) override;
-	void drawC64UI(Graphics::Surface *surface) override;
-	void drawAmigaAtariSTUI(Graphics::Surface *surface) override;
-	bool onScreenControls(Common::Point mouse) override;
-	void initAmigaAtari();
-	void initDOS();
-	void initZX();
-	void initCPC();
-	void initC64();
-
-	void updateTimeVariables() override;
-
-	Common::Rect _moveFowardArea;
-	Common::Rect _moveLeftArea;
-	Common::Rect _moveRightArea;
-	Common::Rect _moveBackArea;
-	Common::Rect _moveUpArea;
-	Common::Rect _moveDownArea;
-	Common::Rect _deployDrillArea;
-	Common::Rect _infoScreenArea;
-	Common::Rect _saveGameArea;
-	Common::Rect _loadGameArea;
-
-	Graphics::ManagedSurface *load8bitTitleImage(Common::SeekableReadStream *file, int offset);
-	Graphics::ManagedSurface *load8bitDemoImage(Common::SeekableReadStream *file, int offset);
-
-	uint32 getPixel8bitTitleImage(int index);
-	void renderPixels8bitTitleImage(Graphics::ManagedSurface *surface, int &i, int &j, int pixels);
-
-	Common::SeekableReadStream *decryptFileAtari(const Common::String filename);
-};
-
 struct ECD {
 	uint16 _area;
 	int _id;
diff --git a/engines/freescape/games/driller/amiga.cpp b/engines/freescape/games/driller/amiga.cpp
index 66906b12ac0..a34608c39ad 100644
--- a/engines/freescape/games/driller/amiga.cpp
+++ b/engines/freescape/games/driller/amiga.cpp
@@ -21,6 +21,7 @@
 #include "common/file.h"
 
 #include "freescape/freescape.h"
+#include "freescape/games/driller/driller.h"
 #include "freescape/language/8bitDetokeniser.h"
 
 namespace Freescape {
diff --git a/engines/freescape/games/driller/atari.cpp b/engines/freescape/games/driller/atari.cpp
index 1e4d2f5c3ff..0c6ca8888fc 100644
--- a/engines/freescape/games/driller/atari.cpp
+++ b/engines/freescape/games/driller/atari.cpp
@@ -22,6 +22,7 @@
 #include "common/memstream.h"
 
 #include "freescape/freescape.h"
+#include "freescape/games/driller/driller.h"
 #include "freescape/language/8bitDetokeniser.h"
 
 namespace Freescape {
diff --git a/engines/freescape/games/driller/c64.cpp b/engines/freescape/games/driller/c64.cpp
index 3f1f7447e51..11b92a14cbe 100644
--- a/engines/freescape/games/driller/c64.cpp
+++ b/engines/freescape/games/driller/c64.cpp
@@ -22,6 +22,7 @@
 #include "common/file.h"
 
 #include "freescape/freescape.h"
+#include "freescape/games/driller/driller.h"
 #include "freescape/language/8bitDetokeniser.h"
 
 namespace Freescape {
diff --git a/engines/freescape/games/driller/cpc.cpp b/engines/freescape/games/driller/cpc.cpp
index 06795c3bef0..47d79e63ed6 100644
--- a/engines/freescape/games/driller/cpc.cpp
+++ b/engines/freescape/games/driller/cpc.cpp
@@ -23,6 +23,7 @@
 #include "common/memstream.h"
 
 #include "freescape/freescape.h"
+#include "freescape/games/driller/driller.h"
 #include "freescape/language/8bitDetokeniser.h"
 
 namespace Freescape {
diff --git a/engines/freescape/games/driller/dos.cpp b/engines/freescape/games/driller/dos.cpp
index 0fc787272f0..f3b30dc5517 100644
--- a/engines/freescape/games/driller/dos.cpp
+++ b/engines/freescape/games/driller/dos.cpp
@@ -22,6 +22,7 @@
 #include "common/file.h"
 
 #include "freescape/freescape.h"
+#include "freescape/games/driller/driller.h"
 #include "freescape/language/8bitDetokeniser.h"
 
 namespace Freescape {
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index 77eb16ca36f..1829afcdd1e 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -25,6 +25,7 @@
 #include "common/random.h"
 
 #include "freescape/freescape.h"
+#include "freescape/games/driller/driller.h"
 #include "freescape/language/8bitDetokeniser.h"
 
 namespace Freescape {
diff --git a/engines/freescape/games/driller/driller.h b/engines/freescape/games/driller/driller.h
new file mode 100644
index 00000000000..617414078b3
--- /dev/null
+++ b/engines/freescape/games/driller/driller.h
@@ -0,0 +1,107 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Freescape {
+
+class DrillerEngine : public FreescapeEngine {
+public:
+	DrillerEngine(OSystem *syst, const ADGameDescription *gd);
+	~DrillerEngine();
+
+	uint32 _initialJetEnergy;
+	uint32 _initialJetShield;
+
+	uint32 _initialTankEnergy;
+	uint32 _initialTankShield;
+
+	bool _useAutomaticDrilling;
+
+	Common::HashMap<uint16, uint32> _drillStatusByArea;
+	Common::HashMap<uint16, uint32> _drillMaxScoreByArea;
+	Common::HashMap<uint16, uint32> _drillSuccessByArea;
+
+	void initGameState() override;
+	bool checkIfGameEnded() override;
+
+	void gotoArea(uint16 areaID, int entranceID) override;
+
+	void drawInfoMenu() override;
+	void drawSensorShoot(Sensor *sensor) override;
+
+	void pressedKey(const int keycode) override;
+	Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
+	Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
+
+private:
+	bool drillDeployed(Area *area);
+	GeometricObject *_drillBase;
+	Math::Vector3d drillPosition();
+	void addDrill(const Math::Vector3d position, bool gasFound);
+	bool checkDrill(const Math::Vector3d position);
+	void removeDrill(Area *area);
+	void addSkanner(Area *area);
+
+	void loadAssetsFullGame() override;
+	void loadAssetsAtariFullGame() override;
+	void loadAssetsAtariDemo() override;
+	void loadAssetsAmigaFullGame() override;
+	void loadAssetsAmigaDemo() override;
+	void loadAssetsDOSFullGame() override;
+	void loadAssetsDOSDemo() override;
+	void loadAssetsZXFullGame() override;
+	void loadAssetsCPCFullGame() override;
+	void loadAssetsC64FullGame() override;
+
+	void drawDOSUI(Graphics::Surface *surface) override;
+	void drawZXUI(Graphics::Surface *surface) override;
+	void drawCPCUI(Graphics::Surface *surface) override;
+	void drawC64UI(Graphics::Surface *surface) override;
+	void drawAmigaAtariSTUI(Graphics::Surface *surface) override;
+	bool onScreenControls(Common::Point mouse) override;
+	void initAmigaAtari();
+	void initDOS();
+	void initZX();
+	void initCPC();
+	void initC64();
+
+	void updateTimeVariables() override;
+
+	Common::Rect _moveFowardArea;
+	Common::Rect _moveLeftArea;
+	Common::Rect _moveRightArea;
+	Common::Rect _moveBackArea;
+	Common::Rect _moveUpArea;
+	Common::Rect _moveDownArea;
+	Common::Rect _deployDrillArea;
+	Common::Rect _infoScreenArea;
+	Common::Rect _saveGameArea;
+	Common::Rect _loadGameArea;
+
+	Graphics::ManagedSurface *load8bitTitleImage(Common::SeekableReadStream *file, int offset);
+	Graphics::ManagedSurface *load8bitDemoImage(Common::SeekableReadStream *file, int offset);
+
+	uint32 getPixel8bitTitleImage(int index);
+	void renderPixels8bitTitleImage(Graphics::ManagedSurface *surface, int &i, int &j, int pixels);
+
+	Common::SeekableReadStream *decryptFileAtari(const Common::String filename);
+};
+
+}
\ No newline at end of file
diff --git a/engines/freescape/games/driller/zx.cpp b/engines/freescape/games/driller/zx.cpp
index 519832b5957..82cf37b975d 100644
--- a/engines/freescape/games/driller/zx.cpp
+++ b/engines/freescape/games/driller/zx.cpp
@@ -21,6 +21,7 @@
 #include "common/file.h"
 
 #include "freescape/freescape.h"
+#include "freescape/games/driller/driller.h"
 #include "freescape/language/8bitDetokeniser.h"
 
 namespace Freescape {
diff --git a/engines/freescape/metaengine.cpp b/engines/freescape/metaengine.cpp
index 1258233690f..8e6147915c0 100644
--- a/engines/freescape/metaengine.cpp
+++ b/engines/freescape/metaengine.cpp
@@ -26,6 +26,7 @@
 
 #include "freescape/freescape.h"
 #include "freescape/games/dark/dark.h"
+#include "freescape/games/driller/driller.h"
 #include "freescape/games/eclipse/eclipse.h"
 #include "freescape/detection.h"
 


Commit: de1be20d7cac11fa31fbe601ad138bf4da0d0513
    https://github.com/scummvm/scummvm/commit/de1be20d7cac11fa31fbe601ad138bf4da0d0513
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-11-17T12:58:08+01:00

Commit Message:
FREESCAPE: initial support for eclipse zx demo

Changed paths:
  A engines/freescape/games/eclipse/zx.cpp
    engines/freescape/detection.cpp
    engines/freescape/games/eclipse/eclipse.cpp
    engines/freescape/games/eclipse/eclipse.h
    engines/freescape/games/palettes.cpp
    engines/freescape/module.mk


diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index 088e9e5ebce..e771c7df89b 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -454,6 +454,20 @@ static const ADGameDescription gameDescriptions[] = {
 		ADGF_UNSTABLE | ADGF_DEMO,
 		GUIO1(GUIO_NOMIDI)
 	},
+	{
+		"totaleclipse",
+		"Demo",
+		{
+			{"totaleclipse.zx.border", 0, "4df153a0c8986d1581b2aa58222c0eb8", 6912},
+			{"totaleclipse.zx.data", 0, "af0b6408fb63082ce2b6cd5985908be1", 28142},
+			{"totaleclipse.zx.title", 0, "1c1ab8a9994c1936e684b2980dba431b", 6912},
+			AD_LISTEND
+		},
+		Common::EN_ANY,
+		Common::kPlatformZX,
+		ADGF_UNSTABLE | ADGF_DEMO,
+		GUIO1(GUIO_NOMIDI)
+	},
 	{
 		"totaleclipse",
 		"",
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 445fb6bb3ba..4231426fb55 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -53,6 +53,8 @@ EclipseEngine::EclipseEngine(OSystem *syst, const ADGameDescription *gd) : Frees
 		initDOS();
 	else if (isCPC())
 		initCPC();
+	else if (isSpectrum())
+		initZX();
 
 	_playerHeightNumber = 1;
 	_playerHeights.push_back(16);
@@ -115,10 +117,12 @@ void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
 void EclipseEngine::borderScreen() {
 	if (_border) {
 		drawBorder();
-		if (isDemo()) {
+		if (isDemo() && isCPC()) {
 			drawFullscreenMessageAndWait(_messagesList[23]);
 			drawFullscreenMessageAndWait(_messagesList[24]);
 			drawFullscreenMessageAndWait(_messagesList[25]);
+		} else if (isDemo() && isSpectrum()) {
+			drawFullscreenMessageAndWait(_messagesList[23]);
 		} else {
 			FreescapeEngine::borderScreen();
 		}
diff --git a/engines/freescape/games/eclipse/eclipse.h b/engines/freescape/games/eclipse/eclipse.h
index 94343436cfe..3a64638c6cc 100644
--- a/engines/freescape/games/eclipse/eclipse.h
+++ b/engines/freescape/games/eclipse/eclipse.h
@@ -33,11 +33,15 @@ public:
 
 	void initDOS();
 	void initCPC();
+	void initZX();
 	void loadAssetsCPCDemo() override;
+	void loadAssetsZXDemo() override;
 	void executePrint(FCLInstruction &instruction) override;
 
 	void drawDOSUI(Graphics::Surface *surface) override;
 	void drawCPCUI(Graphics::Surface *surface) override;
+	void drawZXUI(Graphics::Surface *surface) override;
+
 
 	Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
 	Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
diff --git a/engines/freescape/games/eclipse/zx.cpp b/engines/freescape/games/eclipse/zx.cpp
new file mode 100644
index 00000000000..15616128046
--- /dev/null
+++ b/engines/freescape/games/eclipse/zx.cpp
@@ -0,0 +1,108 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+
+#include "freescape/freescape.h"
+#include "freescape/games/eclipse/eclipse.h"
+#include "freescape/language/8bitDetokeniser.h"
+
+namespace Freescape {
+
+void EclipseEngine::initZX() {
+	_viewArea = Common::Rect(56, 28, 265, 132+6);
+	_maxEnergy = 63;
+	_maxShield = 63;
+}
+
+void EclipseEngine::loadAssetsZXDemo() {
+	Common::File file;
+
+	file.open("totaleclipse.zx.title");
+	if (file.isOpen()) {
+		_title = loadAndCenterScrImage(&file);
+	} else
+		error("Unable to find totaleclipse.zx.title");
+
+	file.close();
+	file.open("totaleclipse.zx.border");
+	if (file.isOpen()) {
+		_border = loadAndCenterScrImage(&file);
+	} else
+		error("Unable to find totaleclipse.zx.border");
+	file.close();
+
+	file.open("totaleclipse.zx.data");
+	if (!file.isOpen())
+		error("Failed to open totaleclipse.zx.data");
+
+	loadMessagesFixedSize(&file, 0x2ac, 16, 23);
+	loadMessagesFixedSize(&file, 0x56e6, 264, 1);
+
+	//loadFonts(&file, 0x5fc2);
+	loadFonts(&file, 0x5f7b);
+	load8bitBinary(&file, 0x6173, 4);
+	for (auto &it : _areaMap) {
+		it._value->_name = "  NOW TRAINING  ";
+		it._value->addStructure(_areaMap[255]);
+		for (int16 id = 183; id < 207; id++)
+			it._value->addObjectFromArea(id, _areaMap[255]);
+	}
+	//loadColorPalette();
+	//swapPalette(1);
+
+	/*_indicators.push_back(loadBundledImage("dark_fallen_indicator"));
+	_indicators.push_back(loadBundledImage("dark_crouch_indicator"));
+	_indicators.push_back(loadBundledImage("dark_walk_indicator"));
+	_indicators.push_back(loadBundledImage("dark_jet_indicator"));
+
+	for (auto &it : _indicators)
+		it->convertToInPlace(_gfx->_texturePixelFormat);*/
+}
+
+void EclipseEngine::drawZXUI(Graphics::Surface *surface) {
+	uint32 color = _currentArea->_underFireBackgroundColor;
+	uint8 r, g, b;
+
+	_gfx->readFromPalette(color, r, g, b);
+	uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+	color = _currentArea->_usualBackgroundColor;
+	if (_gfx->_colorRemaps && _gfx->_colorRemaps->contains(color)) {
+		color = (*_gfx->_colorRemaps)[color];
+	}
+
+	_gfx->readFromPalette(color, r, g, b);
+	uint32 back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+	color = _currentArea->_inkColor;
+
+	_gfx->readFromPalette(color, r, g, b);
+	uint32 other = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+	int score = _gameStateVars[k8bitVariableScore];
+
+	if (!_currentAreaMessages.empty())
+		drawStringInSurface(_currentAreaMessages[0], 102, 141, back, front, surface);
+	//drawStringInSurface(Common::String::format("%08d", score), 136, 6, back, other, surface);
+}
+
+} // End of namespace Freescape
diff --git a/engines/freescape/games/palettes.cpp b/engines/freescape/games/palettes.cpp
index 7fdd7a61591..6c405ebd3a6 100644
--- a/engines/freescape/games/palettes.cpp
+++ b/engines/freescape/games/palettes.cpp
@@ -174,6 +174,9 @@ void FreescapeEngine::swapPalette(uint16 levelID) {
 		_gfx->_paperColor = _areaMap[levelID]->_paperColor;
 		_gfx->_underFireBackgroundColor = _areaMap[levelID]->_underFireBackgroundColor;
 
+		if (isSpectrum() && _gfx->_paperColor >= 9)
+			_gfx->_paperColor = 1;
+
 		if (!_border)
 			return;
 
diff --git a/engines/freescape/module.mk b/engines/freescape/module.mk
index 1822c10043b..c1c7fa3bf49 100644
--- a/engines/freescape/module.mk
+++ b/engines/freescape/module.mk
@@ -21,6 +21,7 @@ MODULE_OBJS := \
 	games/eclipse/dos.o \
 	games/eclipse/eclipse.o \
 	games/eclipse/cpc.o \
+	games/eclipse/zx.o \
 	games/palettes.o \
 	gfx.o \
 	loaders/8bitImage.o \


Commit: a37699114c75549a4a14ed6e892dce70532288dc
    https://github.com/scummvm/scummvm/commit/a37699114c75549a4a14ed6e892dce70532288dc
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-11-17T12:58:08+01:00

Commit Message:
FREESCAPE: support for additional eclipse zx demo

Changed paths:
    engines/freescape/detection.cpp
    engines/freescape/games/eclipse/eclipse.cpp
    engines/freescape/games/eclipse/eclipse.h
    engines/freescape/games/eclipse/zx.cpp


diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index e771c7df89b..37ff1214c26 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -22,6 +22,8 @@
 #include "freescape/freescape.h"
 #include "freescape/detection.h"
 
+#include "freescape/games/eclipse/eclipse.h"
+
 namespace Freescape {
 
 static const PlainGameDescriptor freescapeGames[] = {
@@ -465,7 +467,21 @@ static const ADGameDescription gameDescriptions[] = {
 		},
 		Common::EN_ANY,
 		Common::kPlatformZX,
-		ADGF_UNSTABLE | ADGF_DEMO,
+		ADGF_UNSTABLE | ADGF_DEMO | GF_ZX_DEMO_MICROHOBBY,
+		GUIO1(GUIO_NOMIDI)
+	},
+	{
+		"totaleclipse",
+		"Demo",
+		{
+			{"totaleclipse.zx.border", 0, "4df153a0c8986d1581b2aa58222c0eb8", 6912},
+			{"totaleclipse.zx.data", 0, "13cd96820a65c84e63ca57c86f25881a", 29692},
+			{"totaleclipse.zx.title", 0, "b25897736ffcafee174f525cd1f14b42", 6912},
+			AD_LISTEND
+		},
+		Common::EN_ANY,
+		Common::kPlatformZX,
+		ADGF_UNSTABLE | ADGF_DEMO | GF_ZX_DEMO_CRASH,
 		GUIO1(GUIO_NOMIDI)
 	},
 	{
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 4231426fb55..09d2377ba8a 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -122,7 +122,13 @@ void EclipseEngine::borderScreen() {
 			drawFullscreenMessageAndWait(_messagesList[24]);
 			drawFullscreenMessageAndWait(_messagesList[25]);
 		} else if (isDemo() && isSpectrum()) {
-			drawFullscreenMessageAndWait(_messagesList[23]);
+			if (_variant & GF_ZX_DEMO_MICROHOBBY) {
+				drawFullscreenMessageAndWait(_messagesList[23]);
+			} else if (_variant & GF_ZX_DEMO_CRASH) {
+				drawFullscreenMessageAndWait(_messagesList[9]);
+				drawFullscreenMessageAndWait(_messagesList[10]);
+				drawFullscreenMessageAndWait(_messagesList[11]);
+			}
 		} else {
 			FreescapeEngine::borderScreen();
 		}
diff --git a/engines/freescape/games/eclipse/eclipse.h b/engines/freescape/games/eclipse/eclipse.h
index 3a64638c6cc..10e2426abc8 100644
--- a/engines/freescape/games/eclipse/eclipse.h
+++ b/engines/freescape/games/eclipse/eclipse.h
@@ -21,6 +21,11 @@
 
 namespace Freescape {
 
+enum EclipseReleaseFlags {
+	GF_ZX_DEMO_CRASH = (1 << 0),
+	GF_ZX_DEMO_MICROHOBBY = (1 << 1),
+};
+
 class EclipseEngine : public FreescapeEngine {
 public:
 	EclipseEngine(OSystem *syst, const ADGameDescription *gd);
diff --git a/engines/freescape/games/eclipse/zx.cpp b/engines/freescape/games/eclipse/zx.cpp
index 15616128046..ba287106836 100644
--- a/engines/freescape/games/eclipse/zx.cpp
+++ b/engines/freescape/games/eclipse/zx.cpp
@@ -54,20 +54,25 @@ void EclipseEngine::loadAssetsZXDemo() {
 	if (!file.isOpen())
 		error("Failed to open totaleclipse.zx.data");
 
-	loadMessagesFixedSize(&file, 0x2ac, 16, 23);
-	loadMessagesFixedSize(&file, 0x56e6, 264, 1);
+	if (_variant & GF_ZX_DEMO_MICROHOBBY) {
+		loadMessagesFixedSize(&file, 0x2ac, 16, 23);
+		loadMessagesFixedSize(&file, 0x56e6, 264, 1);
+		loadFonts(&file, 0x5f7b);
+		load8bitBinary(&file, 0x6173, 4);
+	} else if (_variant & GF_ZX_DEMO_CRASH) {
+		loadMessagesFixedSize(&file, 0x364, 16, 9);
+		loadMessagesFixedSize(&file, 0x5901, 264, 5);
+		loadFonts(&file, 0x6589);
+		load8bitBinary(&file, 0x6781, 4);
+	} else
+		error("Unknown ZX Spectrum demo variant");
 
-	//loadFonts(&file, 0x5fc2);
-	loadFonts(&file, 0x5f7b);
-	load8bitBinary(&file, 0x6173, 4);
 	for (auto &it : _areaMap) {
 		it._value->_name = "  NOW TRAINING  ";
 		it._value->addStructure(_areaMap[255]);
 		for (int16 id = 183; id < 207; id++)
 			it._value->addObjectFromArea(id, _areaMap[255]);
 	}
-	//loadColorPalette();
-	//swapPalette(1);
 
 	/*_indicators.push_back(loadBundledImage("dark_fallen_indicator"));
 	_indicators.push_back(loadBundledImage("dark_crouch_indicator"));
@@ -96,9 +101,9 @@ void EclipseEngine::drawZXUI(Graphics::Surface *surface) {
 	color = _currentArea->_inkColor;
 
 	_gfx->readFromPalette(color, r, g, b);
-	uint32 other = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+	//uint32 other = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
 
-	int score = _gameStateVars[k8bitVariableScore];
+	//int score = _gameStateVars[k8bitVariableScore];
 
 	if (!_currentAreaMessages.empty())
 		drawStringInSurface(_currentAreaMessages[0], 102, 141, back, front, surface);




More information about the Scummvm-git-logs mailing list