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

neuromancer noreply at scummvm.org
Thu Dec 29 13:53:26 UTC 2022


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

Summary:
d216a87d0a FREESCAPE: added more entries into the CGAPalettteEntry table
38a417d5b9 FREESCAPE: improved movement to better match original implementation
90d97edd63 COMMON: added a render mode for Amstrad CPC
cd5dffdce8 FREESCAPE: added basic loading of Driller Amstrad CPC release (but without correct palette)
b327ebf4eb FREESCAPE: read data from Driller Amstrad CPC release directly from a edsk file


Commit: d216a87d0a87d30e8a5771b2269ef26279d4bc43
    https://github.com/scummvm/scummvm/commit/d216a87d0a87d30e8a5771b2269ef26279d4bc43
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-29T10:52:57-03:00

Commit Message:
FREESCAPE: added more entries into the CGAPalettteEntry table

Changed paths:
    engines/freescape/games/driller.cpp


diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index 783f726f3b7..d5fd2def83e 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -55,6 +55,7 @@ static const struct CGAPalettteEntry {
 
 	{16, kDrillerCGAPalettePinkBlue},
 
+	{19, kDrillerCGAPaletteRedGreen},
 	{20, kDrillerCGAPalettePinkBlue},
 	{21, kDrillerCGAPaletteRedGreen},
 	{22, kDrillerCGAPalettePinkBlue},


Commit: 38a417d5b911b4560f358f9b168b4953e2500f8f
    https://github.com/scummvm/scummvm/commit/38a417d5b911b4560f358f9b168b4953e2500f8f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-29T10:52:57-03:00

Commit Message:
FREESCAPE: improved movement to better match original implementation

Changed paths:
    engines/freescape/games/driller.cpp
    engines/freescape/movement.cpp


diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index d5fd2def83e..0b3b336cf9a 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -596,9 +596,9 @@ void DrillerEngine::drawDOSUI(Graphics::Surface *surface) {
 
 	int score = _gameStateVars[k8bitVariableScore];
 	drawStringInSurface(_currentArea->_name, 196, 185, front, back, surface);
-	drawStringInSurface(Common::String::format("%04d", 2 * int(_position.x())), 150, 145, front, back, surface);
-	drawStringInSurface(Common::String::format("%04d", 2 * int(_position.z())), 150, 153, front, back, surface);
-	drawStringInSurface(Common::String::format("%04d", 2 * int(_position.y())), 150, 161, front, back, surface);
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.x())), 150, 145, front, back, surface);
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.z())), 150, 153, front, back, surface);
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.y())), 150, 161, front, back, surface);
 	if (_playerHeightNumber >= 0)
 		drawStringInSurface(Common::String::format("%d", _playerHeightNumber), 57, 161, front, back, surface);
 	else
@@ -671,9 +671,9 @@ void DrillerEngine::drawZXUI(Graphics::Surface *surface) {
 
 	int score = _gameStateVars[k8bitVariableScore];
 	drawStringInSurface(_currentArea->_name, 176, 188, front, back, surface);
-	drawStringInSurface(Common::String::format("%04d", 2 * int(_position.x())), 152, 149, front, back, surface);
-	drawStringInSurface(Common::String::format("%04d", 2 * int(_position.z())), 152, 157, front, back, surface);
-	drawStringInSurface(Common::String::format("%04d", 2 * int(_position.y())), 152, 165, front, back, surface);
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.x())), 152, 149, front, back, surface);
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.z())), 152, 157, front, back, surface);
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.y())), 152, 165, front, back, surface);
 	if (_playerHeightNumber >= 0)
 		drawStringInSurface(Common::String::format("%d", _playerHeightNumber), 74, 165, front, back, surface);
 	else
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 513dbd4de5b..f437f26af47 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -36,6 +36,15 @@ void FreescapeEngine::traverseEntrance(uint16 entranceID) {
 
 	Math::Vector3d rotation = entrance->getRotation();
 	_position = entrance->getOrigin();
+
+	if (scale == 1) {
+		_position.x() = _position.x() + 16;
+		_position.z() = _position.z() + 16;
+	} else if (scale == 5) {
+		_position.x() = _position.x() + 4;
+		_position.z() = _position.z() + 4;
+	}
+
 	_pitch = rotation.x();
 	if (ABS(_objExecutingCodeSize.x()) <= ABS(_objExecutingCodeSize.z()))
 		_yaw = rotation.y() - 90;
@@ -172,8 +181,11 @@ void FreescapeEngine::move(CameraMovement direction, uint8 scale, float deltaTim
 	debugC(1, kFreescapeDebugMove, "old player position: %f, %f, %f", _position.x(), _position.y(), _position.z());
 	int previousAreaID = _currentArea->getAreaID();
 
-	Math::Vector3d stepFront = _cameraFront * (_playerSteps[_playerStepIndex] * 0.5 / _cameraFront.length());
-	Math::Vector3d stepRight = _cameraRight * (_playerSteps[_playerStepIndex] * 0.5 / _cameraRight.length());
+	Math::Vector3d stepFront = _cameraFront * (float(_playerSteps[_playerStepIndex]) / 2 / _cameraFront.length());
+	Math::Vector3d stepRight = _cameraRight * (float(_playerSteps[_playerStepIndex]) / 2 / _cameraRight.length());
+
+	stepFront.x() = floor(stepFront.x()) + 0.5;
+	stepFront.z() = floor(stepFront.z()) + 0.5;
 
 	float positionY = _position.y();
 	switch (direction) {


Commit: 90d97edd637c317d55ed544cf63fa85638ee8ba4
    https://github.com/scummvm/scummvm/commit/90d97edd637c317d55ed544cf63fa85638ee8ba4
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-29T10:52:57-03:00

Commit Message:
COMMON: added a render mode for Amstrad CPC

Changed paths:
    common/rendermode.cpp
    common/rendermode.h


diff --git a/common/rendermode.cpp b/common/rendermode.cpp
index 95eabc9b00c..a4ab61f1a05 100644
--- a/common/rendermode.cpp
+++ b/common/rendermode.cpp
@@ -48,6 +48,7 @@ const RenderModeDescription g_renderModes[] = {
 	{ "macintosh", "Macintosh", kRenderMacintosh },
 	// I18N: Macintosh black-and-white
 	{ "macintoshbw", _s("Macintosh b/w"), kRenderMacintoshBW },
+	{ "cpc", "Amstrad CPC", kRenderCPC },
 	{ "zx", "ZX Spectrum", kRenderZX },
 	{nullptr, nullptr, kRenderDefault}
 };
diff --git a/common/rendermode.h b/common/rendermode.h
index fd7d131404a..753411c0556 100644
--- a/common/rendermode.h
+++ b/common/rendermode.h
@@ -60,7 +60,8 @@ enum RenderMode {
 	kRenderMacintoshBW = 13,
 	kRenderCGAComp = 14,
 	kRenderCGA_BW = 15,
-	kRenderZX = 16,
+	kRenderCPC = 16,
+	kRenderZX = 17,
 };
 
 struct RenderModeDescription {


Commit: cd5dffdce86412e0e371feb35b8d6da89940599d
    https://github.com/scummvm/scummvm/commit/cd5dffdce86412e0e371feb35b8d6da89940599d
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-29T10:52:57-03:00

Commit Message:
FREESCAPE: added basic loading of Driller Amstrad CPC release (but without correct palette)

Changed paths:
    engines/freescape/detection.cpp
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/games/driller.cpp
    engines/freescape/games/palettes.cpp
    engines/freescape/gfx.cpp
    engines/freescape/gfx.h
    engines/freescape/gfx_opengl.cpp


diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index 17f0b1598e9..1a3f489e2b1 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -59,6 +59,18 @@ static const ADGameDescription gameDescriptions[] = {
 		ADGF_ZX_MUSICAL | ADGF_TESTING,
 		GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
 	},
+	{
+		"driller",
+		"",
+		{
+			{"DRILLER.CPC.EXTRACTED", 0, "4e4b2fa20f96cea9c19ea3940ae76956", 204032},
+			AD_LISTEND
+		},
+		Common::EN_ANY,
+		Common::kPlatformAmstradCPC,
+		ADGF_TESTING,
+		GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
+	},
 	{
 		"driller",
 		"",
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 24ab12f7076..8db205f8300 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -49,6 +49,8 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
 		_renderMode = Common::kRenderAmiga;
 	} else if (isAtariST()) {
 		_renderMode = Common::kRenderAtariST;
+	} else if (isCPC()) {
+		_renderMode = Common::kRenderCPC;
 	} else if (isSpectrum()) {
 		_renderMode = Common::kRenderZX;
 	}
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 13a2cd211fd..58e337f859b 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -97,6 +97,7 @@ public:
 	bool isAtariST() { return _gameDescription->platform == Common::kPlatformAtariST; }
 	bool isDOS() { return _gameDescription->platform == Common::kPlatformDOS; }
 	bool isSpectrum() { return _gameDescription->platform == Common::kPlatformZX; }
+	bool isCPC() { return _gameDescription->platform == Common::kPlatformAmstradCPC; }
 
 	Common::Error run() override;
 
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index 0b3b336cf9a..67a1de4afde 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -452,7 +452,18 @@ void DrillerEngine::loadAssetsFullGame() {
 			load8bitBinary(&file, 0x5c0a, 4);
 		else
 			error("Unknown ZX spectrum variant");
+	} else if (isCPC()) {
+		file.open("driller.cpc.extracted");
 
+		if (!file.isOpen())
+			error("Failed to open driller.cpc.extracted");
+
+		//loadMessagesFixedSize(&file, 0x20e4, 14, 20);
+
+		//loadFonts(&file, 0x62ca);
+		//loadGlobalObjects(&file, 0x1c93);
+
+		load8bitBinary(&file, 0xec76, 4);
 	} else if (_renderMode == Common::kRenderEGA) {
 		loadBundledImages();
 		file.open("DRILLE.EXE");
diff --git a/engines/freescape/games/palettes.cpp b/engines/freescape/games/palettes.cpp
index 822c44a3b53..7fcdc792323 100644
--- a/engines/freescape/games/palettes.cpp
+++ b/engines/freescape/games/palettes.cpp
@@ -53,11 +53,43 @@ byte kDrillerZXPalette[9][3] = {
 	{0x00, 0x00, 0x00},
 };
 
+byte kDrillerCPCPalette[27][3] = {
+	{0x00, 0x00, 0x00},
+	{0x00, 0x00, 0x80},
+	{0x00, 0x00, 0xff},
+	{0x80, 0x00, 0x00},
+	{0x80, 0x00, 0x80},
+	{0x80, 0x00, 0xff},
+	{0xff, 0x00, 0x00},
+	{0xff, 0x00, 0x80},
+	{0xff, 0x00, 0xff},
+	{0x00, 0x80, 0x00},
+	{0x00, 0x80, 0x80},
+	{0x00, 0x88, 0xff},
+	{0x80, 0x80, 0x00},
+	{0x80, 0x80, 0x80},
+	{0x80, 0x80, 0xff},
+	{0xff, 0x80, 0x00},
+	{0xff, 0x80, 0x80},
+	{0xff, 0x80, 0xff},
+	{0x00, 0xff, 0x00},
+	{0x00, 0xff, 0x80},
+	{0x00, 0xff, 0xff},
+	{0x80, 0xff, 0x00},
+	{0x80, 0xff, 0x80},
+	{0x80, 0xff, 0xff},
+	{0xff, 0xff, 0x00},
+	{0xff, 0xff, 0x80},
+	{0xff, 0xff, 0xff},
+};
+
 void FreescapeEngine::loadColorPalette() {
 	if (_renderMode == Common::kRenderEGA) {
 		_gfx->_palette = (byte *)&dos_EGA_palette;
 	} else if (_renderMode == Common::kRenderZX) {
 		_gfx->_palette = (byte *)kDrillerZXPalette;
+	} else if (_renderMode == Common::kRenderCPC) {
+		_gfx->_palette = (byte *)kDrillerCPCPalette;
 	} else if (_renderMode == Common::kRenderCGA) {
 		_gfx->_palette = nullptr; // palette depends on the area
 	} else if (_renderMode == Common::kRenderAmiga || _renderMode == Common::kRenderAtariST) {
diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index 11fc4fd5ef5..30e92e2ae16 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -121,6 +121,28 @@ bool Renderer::getRGBAtZX(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r
 	return true;
 }
 
+bool Renderer::getRGBAtCPC(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2) {
+	if (index == _keyColor)
+		return false;
+
+	assert (_renderMode == Common::kRenderCPC);
+	if (index == 4) { // Solid colors 
+		readFromPalette(index - 1, r1, g1, b1);
+		r2 = r1;
+		g2 = g1;
+		b2 = b1;
+		return true;
+	}
+
+	byte *entry = (*_colorMap)[index - 1];
+	byte be = *(entry);
+	readFromPalette((be >> 4), r1, g1, b1);
+	entry++;
+	be = *(entry);
+	readFromPalette((be >> 4), r2, g2, b2);
+	return true;
+}
+
 bool Renderer::getRGBAtEGA(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2) {
  	// assert(index-1 < _colorMap->size());
 	byte *entry = (*_colorMap)[index - 1];
@@ -175,6 +197,8 @@ bool Renderer::getRGBAt(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2,
 		return getRGBAtEGA(index, r1, g1, b1, r2, g2, b2);
 	else if (_renderMode == Common::kRenderCGA)
 		return getRGBAtCGA(index, r1, g1, b1, r2, g2, b2);
+	else if (_renderMode == Common::kRenderCPC)
+		return getRGBAtCPC(index, r1, g1, b1, r2, g2, b2);
 	else if (_renderMode == Common::kRenderZX)
 		return getRGBAtZX(index, r1, g1, b1, r2, g2, b2, stipple);
 
diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index 3d2730654d7..1a337a2d81b 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -100,6 +100,7 @@ public:
 	uint8 indexFromColor(uint8 r, uint8 g, uint8 b);
 	bool getRGBAt(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2, byte *stipple);
 	bool getRGBAtCGA(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2);
+	bool getRGBAtCPC(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2);
 	bool getRGBAtEGA(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2);
 	bool getRGBAtZX(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2, byte *stipple);
 
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index 63b3444ca95..db8c9ba1a8b 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -285,7 +285,7 @@ void OpenGLRenderer::useStipple(bool enabled) {
 		glEnable(GL_POLYGON_OFFSET_FILL);
 		glPolygonOffset(-5.0f, 1.0f);
 		glEnable(GL_POLYGON_STIPPLE);
-		glPolygonStipple(_renderMode == Common::kRenderCGA ? _defaultStippleArray : _variableStippleArray);
+		glPolygonStipple(_renderMode == Common::kRenderZX ? _variableStippleArray : _defaultStippleArray);
 	} else {
 		glPolygonOffset(0, 0);
 		glDisable(GL_POLYGON_OFFSET_FILL);


Commit: b327ebf4eb36d99f2636254e8dda4e5bbe0bd46d
    https://github.com/scummvm/scummvm/commit/b327ebf4eb36d99f2636254e8dda4e5bbe0bd46d
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-29T10:52:57-03:00

Commit Message:
FREESCAPE: read data from Driller Amstrad CPC release directly from a edsk file

Changed paths:
    engines/freescape/detection.cpp
    engines/freescape/games/driller.cpp


diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index 1a3f489e2b1..44a17c3ed8f 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -63,7 +63,7 @@ static const ADGameDescription gameDescriptions[] = {
 		"driller",
 		"",
 		{
-			{"DRILLER.CPC.EXTRACTED", 0, "4e4b2fa20f96cea9c19ea3940ae76956", 204032},
+			{"DRILLER.CPC.EDSK", 0, "05df84207b5373e145ef90a3e4b98ae0", 215073},
 			AD_LISTEND
 		},
 		Common::EN_ANY,
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index 67a1de4afde..d782e11ae84 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -22,6 +22,7 @@
 #include "common/config-manager.h"
 #include "common/events.h"
 #include "common/file.h"
+#include "common/memstream.h"
 #include "common/random.h"
 
 #include "freescape/freescape.h"
@@ -351,6 +352,53 @@ void DrillerEngine::loadAssetsDemo() {
 	_angleRotationIndex = 0;
 }
 
+
+Common::SeekableReadStream *parseEDSK(const Common::String filename) {
+	debugC(1, kFreescapeDebugParser, "Trying to parse edsk file: %s", filename.c_str());
+	Common::File file;
+	file.open(filename);
+	if (!file.isOpen())
+		error("Failed to open %s", filename.c_str());
+
+	int size = file.size();
+	byte *edskBuffer = (byte *)malloc(size);
+	file.read(edskBuffer, size);
+	file.close();
+
+	// We don't know the final size, but we allocate enough
+	byte *memBuffer = (byte *)malloc(size); 
+
+	byte ntracks = edskBuffer[48] - 2;
+	byte nsides = edskBuffer[49];
+	assert(nsides == 1);
+	int i = 256;
+	int j = 0;
+	while (ntracks > 0) {
+		ntracks--;
+
+		byte ssize = edskBuffer[i + 0x14];
+		int start = i + 0x100;
+
+		if (ssize == 2) {
+			i = i + 9 * 512 + 256;
+		} else if (ssize == 5) {
+			i = i + 8 * 512 + 256;
+		} else if (ssize == 0) {
+			i = i + 0x8400;
+		} else {
+			assert(ntracks == 0);
+		}
+		int osize = i - start;
+		debugC(1, kFreescapeDebugParser, "copying start: %x size: %x", start, osize);
+		memcpy(memBuffer + j, edskBuffer + start, osize);
+		j = j + osize;
+
+	}
+	free(edskBuffer);
+	return (new Common::MemoryReadStream(memBuffer, size));
+}
+
+
 void DrillerEngine::loadAssetsFullGame() {
 	Common::File file;
 	if (isAmiga()) {
@@ -453,17 +501,13 @@ void DrillerEngine::loadAssetsFullGame() {
 		else
 			error("Unknown ZX spectrum variant");
 	} else if (isCPC()) {
-		file.open("driller.cpc.extracted");
-
-		if (!file.isOpen())
-			error("Failed to open driller.cpc.extracted");
-
+		Common::SeekableReadStream *stream = parseEDSK("driller.cpc.edsk");
 		//loadMessagesFixedSize(&file, 0x20e4, 14, 20);
 
 		//loadFonts(&file, 0x62ca);
 		//loadGlobalObjects(&file, 0x1c93);
 
-		load8bitBinary(&file, 0xec76, 4);
+		load8bitBinary(stream, 0xec76, 4);
 	} else if (_renderMode == Common::kRenderEGA) {
 		loadBundledImages();
 		file.open("DRILLE.EXE");




More information about the Scummvm-git-logs mailing list