[Scummvm-git-logs] scummvm master -> 3f53cb0cd8529018819565e05af1d7ac6758ea1c

neuromancer noreply at scummvm.org
Fri Apr 21 11:47:24 UTC 2023


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:
3f53cb0cd8 FREESCAPE: initial support for Dark Side ZX demo


Commit: 3f53cb0cd8529018819565e05af1d7ac6758ea1c
    https://github.com/scummvm/scummvm/commit/3f53cb0cd8529018819565e05af1d7ac6758ea1c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-04-21T13:45:18+02:00

Commit Message:
FREESCAPE: initial support for Dark Side ZX demo

Changed paths:
  A engines/freescape/games/dark/zx.cpp
    engines/freescape/assets.cpp
    engines/freescape/detection.cpp
    engines/freescape/freescape.h
    engines/freescape/games/dark/dark.cpp
    engines/freescape/games/dark/dos.cpp
    engines/freescape/loaders/8bitBinaryLoader.cpp
    engines/freescape/module.mk


diff --git a/engines/freescape/assets.cpp b/engines/freescape/assets.cpp
index d9e6e16931e..03369a113be 100644
--- a/engines/freescape/assets.cpp
+++ b/engines/freescape/assets.cpp
@@ -50,7 +50,7 @@ void FreescapeEngine::loadAssetsFullGame() {
 	} else if (isDOS()) {
 		loadAssetsDOSFullGame();
 	} else
-		error("Invalid or unsupported render mode %s for Driller", Common::getRenderModeDescription(_renderMode));
+		error("Invalid or unsupported render mode %s", Common::getRenderModeDescription(_renderMode));
 }
 
 void FreescapeEngine::loadAssetsDemo() {
@@ -61,8 +61,10 @@ void FreescapeEngine::loadAssetsDemo() {
 		loadAssetsAtariDemo();
 	} else if (isDOS()) {
 		loadAssetsDOSDemo();
+	} else if (isSpectrum()) {
+		loadAssetsZXDemo();
 	} else
-		error("Unsupported demo for Driller");
+		error("Unsupported demo");
 }
 
 void FreescapeEngine::loadAssetsAtariDemo() {
diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index 8f9d8c06ddf..032e9bf425d 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -284,14 +284,14 @@ static const ADGameDescription gameDescriptions[] = {
 	},
 	{
 		"darkside",
-		"Not implemented yet",
+		"Demo",
 		{
 			{"DARKSIDE.ZX.DATA", 0, "0e4d9b6e64ff24801272ff0b18a3caab", 29182},
 			AD_LISTEND
 		},
 		Common::EN_ANY,
 		Common::kPlatformZX,
-		ADGF_UNSUPPORTED | ADGF_DEMO,
+		ADGF_UNSTABLE | ADGF_DEMO,
 		GUIO1(GUIO_NOMIDI)
 	},
 	{
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index ca41cd9b7c9..0d81cb0a5d0 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -519,13 +519,20 @@ public:
 	void pressedKey(const int keycode) override;
 	void executePrint(FCLInstruction &instruction) override;
 
+	void initDOS();
+	void initZX();
+
 	void loadAssetsDOSFullGame() override;
 	void loadAssetsDOSDemo() override;
 
+	void loadAssetsZXDemo() override;
+
 	int _lastTenSeconds;
 	void updateTimeVariables() override;
 
 	void drawDOSUI(Graphics::Surface *surface) override;
+	void drawZXUI(Graphics::Surface *surface) override;
+
 	void drawFullscreenMessage(Common::String message);
 	Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
 	Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 55484da32d3..d0a36c145d0 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -29,7 +29,11 @@
 namespace Freescape {
 
 DarkEngine::DarkEngine(OSystem *syst, const ADGameDescription *gd) : FreescapeEngine(syst, gd) {
-	_viewArea = Common::Rect(40, 24, 279, 124);
+	if (isDOS())
+		initDOS();
+	else if (isSpectrum())
+		initZX();
+
 	_playerHeightNumber = 1;
 	_playerHeights.push_back(16);
 	_playerHeights.push_back(48);
@@ -251,7 +255,7 @@ void DarkEngine::updateTimeVariables() {
 void DarkEngine::borderScreen() {
 	if (_border) {
 		drawBorder();
-		if (isDemo()) {
+		if (isDemo() && isDOS()) {
 			drawFullscreenMessage(_messagesList[27]);
 			drawFullscreenMessage(_messagesList[28]);
 			drawFullscreenMessage(_messagesList[29]);
diff --git a/engines/freescape/games/dark/dos.cpp b/engines/freescape/games/dark/dos.cpp
index 12881e46e46..28b5304478e 100644
--- a/engines/freescape/games/dark/dos.cpp
+++ b/engines/freescape/games/dark/dos.cpp
@@ -28,6 +28,13 @@ namespace Freescape {
 
 extern byte kEGADefaultPaletteData[16][3];
 
+void DarkEngine::initDOS() {
+	if (_renderMode == Common::kRenderEGA)
+		_viewArea = Common::Rect(40, 24, 279, 124);
+	else
+		error("Invalid or unknown render mode");
+}
+
 void DarkEngine::loadAssetsDOSDemo() {
 	Common::File file;
 	if (_renderMode == Common::kRenderEGA) {
diff --git a/engines/freescape/games/dark/zx.cpp b/engines/freescape/games/dark/zx.cpp
new file mode 100644
index 00000000000..e2f5211b146
--- /dev/null
+++ b/engines/freescape/games/dark/zx.cpp
@@ -0,0 +1,131 @@
+/* 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/language/8bitDetokeniser.h"
+
+namespace Freescape {
+
+void DarkEngine::initZX() {
+	_viewArea = Common::Rect(56, 28, 265, 132);
+}
+
+void DarkEngine::loadAssetsZXDemo() {
+	Common::File file;
+
+	file.open("darkside.zx.title");
+	if (file.isOpen()) {
+		_title = loadAndCenterScrImage(&file);
+	} else
+		error("Unable to find darkside.zx.title");
+
+	file.close();
+	file.open("darkside.zx.border");
+	if (file.isOpen()) {
+		_border = loadAndCenterScrImage(&file);
+	} else
+		error("Unable to find driller.zx.border");
+	file.close();
+
+
+	file.open("darkside.zx.data");
+
+	if (!file.isOpen())
+		error("Failed to open darksize.zx.data");
+
+	loadMessagesFixedSize(&file, 0x56c, 19, 24);
+	loadMessagesFixedSize(&file, 0x5761, 264, 5);
+
+	loadFonts(&file, 0x6164);
+	//loadGlobalObjects(&file, 0x1d13, 8);
+	load8bitBinary(&file, 0x62c6, 4);
+	/*for (auto &it : _areaMap) {
+		addWalls(it._value);
+		addECDs(it._value);
+	}*/
+}
+
+void DarkEngine::drawZXUI(Graphics::Surface *surface) {
+	/*uint32 color = 1;
+	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);
+
+	int score = _gameStateVars[k8bitVariableScore];
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.x())), 199, 137, front, back, surface);
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.z())), 199, 145, front, back, surface);
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.y())), 199, 153, front, back, surface);
+
+	drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 71, 168, front, back, surface);
+	drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 71, 177, front, back, surface);
+	drawStringInSurface(Common::String::format("%07d", score), 95, 8, front, back, surface);
+
+	int seconds, minutes, hours;
+	getTimeFromCountdown(seconds, minutes, hours);
+	// TODO: implement binary clock
+
+	Common::String message;
+	int deadline;
+	getLatestMessages(message, deadline);
+	if (deadline <= _countdown) {
+		drawStringInSurface(message, 112, 177, back, front, surface);
+		_temporaryMessages.push_back(message);
+		_temporaryMessageDeadlines.push_back(deadline);
+	} else
+		drawStringInSurface(_currentArea->_name, 112, 177, front, back, surface);
+
+	int energy = _gameStateVars[k8bitVariableEnergy]; // called fuel in this game
+	int shield = _gameStateVars[k8bitVariableShield];
+
+	_gfx->readFromPalette(9, r, g, b);
+	uint32 blue = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+	if (shield >= 0) {
+		Common::Rect shieldBar;
+		shieldBar = Common::Rect(72, 139, 151 - (k8bitMaxShield - shield), 146);
+		surface->fillRect(shieldBar, front);
+
+		shieldBar = Common::Rect(72, 140, 151 - (k8bitMaxShield - shield), 145);
+		surface->fillRect(shieldBar, blue);
+	}
+
+	if (energy >= 0) {
+		Common::Rect energyBar;
+		energyBar = Common::Rect(72, 147, 151 - (k8bitMaxEnergy - energy), 154);
+		surface->fillRect(energyBar, front);
+
+		energyBar = Common::Rect(72, 148, 151 - (k8bitMaxEnergy - energy), 153);
+		surface->fillRect(energyBar, blue);
+	}*/
+}
+
+} // End of namespace Freescape
\ No newline at end of file
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index 64fe016df02..47bce668a63 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -757,7 +757,7 @@ void FreescapeEngine::loadMessagesFixedSize(Common::SeekableReadStream *file, in
 		file->read(buffer, size);
 		Common::String message = (const char *)buffer;
 		_messagesList.push_back(message);
-		debugC(1, kFreescapeDebugParser, "%s", _messagesList[_messagesList.size() - 1].c_str());
+		debugC(1, kFreescapeDebugParser, "'%s'", _messagesList[_messagesList.size() - 1].c_str());
 	}
 	free(buffer);
 }
diff --git a/engines/freescape/module.mk b/engines/freescape/module.mk
index fe3a2a95cda..cf02372b576 100644
--- a/engines/freescape/module.mk
+++ b/engines/freescape/module.mk
@@ -8,6 +8,7 @@ MODULE_OBJS := \
 	games/castle.o \
 	games/dark/dark.o \
 	games/dark/dos.o \
+	games/dark/zx.o \
 	games/driller/amiga.o \
 	games/driller/atari.o \
 	games/driller/c64.o \




More information about the Scummvm-git-logs mailing list