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

neuromancer noreply at scummvm.org
Tue Jan 21 08:39:30 UTC 2025


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:
bc94b85391 FREESCAPE: select the cga palette using the levelID parity


Commit: bc94b85391718d81c9f6f9eb2a0fdb931e010b3c
    https://github.com/scummvm/scummvm/commit/bc94b85391718d81c9f6f9eb2a0fdb931e010b3c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-01-21T09:40:48+01:00

Commit Message:
FREESCAPE: select the cga palette using the levelID parity

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/games/dark/dos.cpp
    engines/freescape/games/driller/dos.cpp
    engines/freescape/games/eclipse/dos.cpp
    engines/freescape/games/palettes.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 4c53c4cd019..353256fe638 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -174,7 +174,6 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
 	_viewArea = _fullscreenViewArea;
 	_rnd = new Common::RandomSource("freescape");
 	_gfx = nullptr;
-	_rawCGAPaletteByArea = nullptr;
 	_speaker = nullptr;
 	_savedScreen = nullptr;
 
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 3b91f389677..09181333334 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -255,7 +255,6 @@ public:
 	byte *loadPalette(Common::SeekableReadStream *file);
 	void swapPalette(uint16 areaID);
 	virtual byte *findCGAPalette(uint16 levelID);
-	const CGAPaletteEntry *_rawCGAPaletteByArea;
 	Common::HashMap<uint16, byte *> _paletteByArea;
 	void loadColorPalette();
 
diff --git a/engines/freescape/games/dark/dos.cpp b/engines/freescape/games/dark/dos.cpp
index fb3e1fcf256..7fe5acd692d 100644
--- a/engines/freescape/games/dark/dos.cpp
+++ b/engines/freescape/games/dark/dos.cpp
@@ -43,41 +43,6 @@ byte kDarkCGAPaletteRedGreen[4][3] = {
 	{0xaa, 0x55, 0x00},
 };
 
-static const CGAPaletteEntry rawCGAPaletteByArea[] {
-	{1, (byte *)kDarkCGAPaletteRedGreen},
-	{2, (byte *)kDarkCGAPalettePinkBlue},
-	{3, (byte *)kDarkCGAPaletteRedGreen},
-	{4, (byte *)kDarkCGAPalettePinkBlue},
-	{5, (byte *)kDarkCGAPaletteRedGreen},
-	{6, (byte *)kDarkCGAPalettePinkBlue},
-	{7, (byte *)kDarkCGAPaletteRedGreen},
-	{8, (byte *)kDarkCGAPaletteRedGreen}, // Verified
-	{9, (byte *)kDarkCGAPaletteRedGreen},
-	{10, (byte *)kDarkCGAPalettePinkBlue},
-	{11, (byte *)kDarkCGAPaletteRedGreen},
-	{12, (byte *)kDarkCGAPalettePinkBlue},
-	{13, (byte *)kDarkCGAPaletteRedGreen},
-	{14, (byte *)kDarkCGAPalettePinkBlue},
-	{15, (byte *)kDarkCGAPaletteRedGreen}, // Verified
-	{16, (byte *)kDarkCGAPalettePinkBlue},
-	{17, (byte *)kDarkCGAPalettePinkBlue},
-	{18, (byte *)kDarkCGAPaletteRedGreen}, // Verified
-	{19, (byte *)kDarkCGAPaletteRedGreen},
-	{20, (byte *)kDarkCGAPalettePinkBlue},
-	{21, (byte *)kDarkCGAPaletteRedGreen},
-	{22, (byte *)kDarkCGAPalettePinkBlue},
-	{23, (byte *)kDarkCGAPaletteRedGreen},
-	{24, (byte *)kDarkCGAPalettePinkBlue},
-	{25, (byte *)kDarkCGAPalettePinkBlue},
-	{27, (byte *)kDarkCGAPaletteRedGreen},
-	{28, (byte *)kDarkCGAPalettePinkBlue},
-
-	{31, (byte *)kDarkCGAPaletteRedGreen},
-	{32, (byte *)kDarkCGAPalettePinkBlue},
-	{127, (byte *)kDarkCGAPaletteRedGreen},
-	{0, 0}   // This marks the end
-};
-
 void DarkEngine::initDOS() {
 	if (_renderMode == Common::kRenderEGA)
 		_viewArea = Common::Rect(40, 24, 280, 125);
@@ -86,7 +51,6 @@ void DarkEngine::initDOS() {
 	else
 		error("Invalid or unknown render mode");
 
-	_rawCGAPaletteByArea = (const CGAPaletteEntry *)&rawCGAPaletteByArea;
 	_maxEnergy = 79;
 	_maxShield = 79;
 }
diff --git a/engines/freescape/games/driller/dos.cpp b/engines/freescape/games/driller/dos.cpp
index 0e12d31f093..191751d6ab3 100644
--- a/engines/freescape/games/driller/dos.cpp
+++ b/engines/freescape/games/driller/dos.cpp
@@ -27,58 +27,11 @@
 
 namespace Freescape {
 
-extern byte kCGAPalettePinkBlueWhiteData[4][3];
 extern byte kEGADefaultPalette[16][3];
+extern byte kCGAPaletteRedGreen[4][3];
+extern byte kCGAPalettePinkBlue[4][3];
 extern byte kHerculesPaletteGreen[2][3];
 
-byte kDrillerCGAPalettePinkBlue[4][3] = {
-	{0x00, 0x00, 0x00},
-	{0x00, 0xaa, 0xaa},
-	{0xaa, 0x00, 0xaa},
-	{0xaa, 0xaa, 0xaa},
-};
-
-byte kDrillerCGAPaletteRedGreen[4][3] = {
-	{0x00, 0x00, 0x00},
-	{0x00, 0xaa, 0x00},
-	{0xaa, 0x00, 0x00},
-	{0xaa, 0x55, 0x00},
-};
-
-static const CGAPaletteEntry rawCGAPaletteByArea[] {
-	{1, (byte *)kDrillerCGAPaletteRedGreen},
-	{2, (byte *)kDrillerCGAPalettePinkBlue},
-	{3, (byte *)kDrillerCGAPaletteRedGreen},
-	{4, (byte *)kDrillerCGAPalettePinkBlue},
-	{5, (byte *)kDrillerCGAPaletteRedGreen},
-	{6, (byte *)kDrillerCGAPalettePinkBlue},
-	{7, (byte *)kDrillerCGAPaletteRedGreen},
-	{8, (byte *)kDrillerCGAPalettePinkBlue},
-	{9, (byte *)kDrillerCGAPaletteRedGreen},
-	{10, (byte *)kDrillerCGAPalettePinkBlue},
-	{11, (byte *)kDrillerCGAPaletteRedGreen},
-	{12, (byte *)kDrillerCGAPalettePinkBlue},
-	{13, (byte *)kDrillerCGAPaletteRedGreen},
-	{14, (byte *)kDrillerCGAPalettePinkBlue},
-	{15, (byte *)kDrillerCGAPaletteRedGreen},
-	{16, (byte *)kDrillerCGAPalettePinkBlue},
-	{17, (byte *)kDrillerCGAPalettePinkBlue},
-	{18, (byte *)kDrillerCGAPalettePinkBlue},
-	{19, (byte *)kDrillerCGAPaletteRedGreen},
-	{20, (byte *)kDrillerCGAPalettePinkBlue},
-	{21, (byte *)kDrillerCGAPaletteRedGreen},
-	{22, (byte *)kDrillerCGAPalettePinkBlue},
-	{23, (byte *)kDrillerCGAPaletteRedGreen},
-	{25, (byte *)kDrillerCGAPalettePinkBlue},
-	{27, (byte *)kDrillerCGAPaletteRedGreen},
-	{28, (byte *)kDrillerCGAPalettePinkBlue},
-
-	{31, (byte *)kDrillerCGAPaletteRedGreen},
-	{32, (byte *)kDrillerCGAPalettePinkBlue},
-	{127, (byte *)kDrillerCGAPaletteRedGreen},
-	{0, 0}   // This marks the end
-};
-
 void DrillerEngine::initDOS() {
 	if (_renderMode == Common::kRenderEGA)
 		_viewArea = Common::Rect(40, 16, 280, 117);
@@ -89,7 +42,6 @@ void DrillerEngine::initDOS() {
 	else
 		error("Invalid or unknown render mode");
 
-	_rawCGAPaletteByArea = (const CGAPaletteEntry *)&rawCGAPaletteByArea;
 	_moveFowardArea = Common::Rect(73, 144, 101, 152);
 	_moveLeftArea = Common::Rect(73, 150, 86, 159);
 	_moveRightArea = Common::Rect(88, 152, 104, 160);
diff --git a/engines/freescape/games/eclipse/dos.cpp b/engines/freescape/games/eclipse/dos.cpp
index ce0831474d0..53beb5e5279 100644
--- a/engines/freescape/games/eclipse/dos.cpp
+++ b/engines/freescape/games/eclipse/dos.cpp
@@ -29,58 +29,11 @@
 namespace Freescape {
 
 extern byte kEGADefaultPalette[16][3];
-byte kEclipseCGAPaletteRedGreen[4][3] = {
-	{0x00, 0x00, 0x00},
-	{0x55, 0xff, 0x55},
-	{0xff, 0x55, 0x55},
-	{0xff, 0xff, 0x55},
-};
-
-byte kEclipseCGAPalettePinkBlue[4][3] = {
-	{0x00, 0x00, 0x00},
-	{0x55, 0xff, 0xff},
-	{0xff, 0x55, 0xff},
-	{0xff, 0xff, 0xff},
-};
-
-static const CGAPaletteEntry rawCGAPaletteByArea[] {
-	{1, (byte *)kEclipseCGAPalettePinkBlue},
-	{2, (byte *)kEclipseCGAPaletteRedGreen},
-	{3, (byte *)kEclipseCGAPaletteRedGreen},
-	{4, (byte *)kEclipseCGAPaletteRedGreen},
-	{5, (byte *)kEclipseCGAPaletteRedGreen},
-	{6, (byte *)kEclipseCGAPaletteRedGreen},
-	{7, (byte *)kEclipseCGAPaletteRedGreen},
-	{8, (byte *)kEclipseCGAPaletteRedGreen},
-	{9, (byte *)kEclipseCGAPaletteRedGreen},
-	{10, (byte *)kEclipseCGAPaletteRedGreen},
-	{11, (byte *)kEclipseCGAPaletteRedGreen},
-	{12, (byte *)kEclipseCGAPaletteRedGreen},
-	{13, (byte *)kEclipseCGAPaletteRedGreen},
-	{14, (byte *)kEclipseCGAPaletteRedGreen},
-	{15, (byte *)kEclipseCGAPaletteRedGreen},
-	{16, (byte *)kEclipseCGAPaletteRedGreen},
-	{17, (byte *)kEclipseCGAPaletteRedGreen},
-	{18, (byte *)kEclipseCGAPaletteRedGreen},
-	{19, (byte *)kEclipseCGAPaletteRedGreen},
-	{20, (byte *)kEclipseCGAPaletteRedGreen},
-	{21, (byte *)kEclipseCGAPaletteRedGreen},
-	{22, (byte *)kEclipseCGAPaletteRedGreen},
-	{23, (byte *)kEclipseCGAPaletteRedGreen},
-	{24, (byte *)kEclipseCGAPaletteRedGreen},
-	{25, (byte *)kEclipseCGAPaletteRedGreen},
-	{27, (byte *)kEclipseCGAPaletteRedGreen},
-	{28, (byte *)kEclipseCGAPaletteRedGreen},
-	{29, (byte *)kEclipseCGAPaletteRedGreen},
-	{30, (byte *)kEclipseCGAPaletteRedGreen},
-	{31, (byte *)kEclipseCGAPaletteRedGreen},
-	{32, (byte *)kEclipseCGAPaletteRedGreen},
-	{0, 0}   // This marks the end
-};
+extern byte kCGAPaletteRedGreen[4][3];
+extern byte kCGAPalettePinkBlue[4][3];
 
 void EclipseEngine::initDOS() {
 	_viewArea = Common::Rect(40, 33, 280, 133);
-	_rawCGAPaletteByArea = (const CGAPaletteEntry *)&rawCGAPaletteByArea;
 }
 
 void EclipseEngine::loadAssetsDOSFullGame() {
@@ -119,7 +72,7 @@ void EclipseEngine::loadAssetsDOSFullGame() {
 		file.open("SCN1C.DAT");
 		if (file.isOpen()) {
 			_title = load8bitBinImage(&file, 0x0);
-			_title->setPalette((byte *)&kEclipseCGAPaletteRedGreen, 0, 4);
+			_title->setPalette((byte *)&kCGAPaletteRedGreen, 0, 4);
 		}
 		file.close();
 		file.open("TOTEC.EXE");
@@ -137,7 +90,7 @@ void EclipseEngine::loadAssetsDOSFullGame() {
 				it._value->addObjectFromArea(id, _areaMap[255]);
 		}
 		_border = load8bitBinImage(&file, 0x210);
-		_border->setPalette((byte *)&kEclipseCGAPaletteRedGreen, 0, 4);
+		_border->setPalette((byte *)&kCGAPaletteRedGreen, 0, 4);
 		swapPalette(_startArea);
 	} else
 		error("Invalid or unsupported render mode %s for Total Eclipse", Common::getRenderModeDescription(_renderMode));
diff --git a/engines/freescape/games/palettes.cpp b/engines/freescape/games/palettes.cpp
index c9b5a3887ec..94d3f046e70 100644
--- a/engines/freescape/games/palettes.cpp
+++ b/engines/freescape/games/palettes.cpp
@@ -42,6 +42,20 @@ byte kEGADefaultPalette[16][3] = {
 	{0xff, 0xff, 0xff}
 };
 
+byte kCGAPalettePinkBlue[4][3] = {
+	{0x00, 0x00, 0x00},
+	{0x00, 0xaa, 0xaa},
+	{0xaa, 0x00, 0xaa},
+	{0xaa, 0xaa, 0xaa},
+};
+
+byte kCGAPaletteRedGreen[4][3] = {
+	{0x00, 0x00, 0x00},
+	{0x00, 0xaa, 0x00},
+	{0xaa, 0x00, 0x00},
+	{0xaa, 0x55, 0x00},
+};
+
 byte kHerculesPaletteGreen[2][3] = {
 	{0x00, 0x00, 0x00},
 	{0x00, 0xff, 0x00},
@@ -235,17 +249,10 @@ void FreescapeEngine::swapPalette(uint16 levelID) {
 }
 
 byte *FreescapeEngine::findCGAPalette(uint16 levelID) {
-	const CGAPaletteEntry *entry = _rawCGAPaletteByArea;
-	byte *palette = nullptr;
-	while (entry->areaId) {
-		if (entry->areaId == levelID) {
-			palette = entry->palette;
-			break;
-		}
-		entry++;
-	}
-
-	return palette;
+	if (levelID % 2 == 0)
+		return (byte *)&kCGAPalettePinkBlue;
+	else
+		return (byte *)&kCGAPaletteRedGreen;
 }
 
 } // End of namespace Freescape




More information about the Scummvm-git-logs mailing list