[Scummvm-git-logs] scummvm master -> 94be426c6a4d1e9ddf141b2ef9032958cb6e6953
mduggan
noreply at scummvm.org
Mon Oct 21 05:48:15 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:
94be426c6a DGDS: Support EGA palette data
Commit: 94be426c6a4d1e9ddf141b2ef9032958cb6e6953
https://github.com/scummvm/scummvm/commit/94be426c6a4d1e9ddf141b2ef9032958cb6e6953
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-10-21T16:46:32+11:00
Commit Message:
DGDS: Support EGA palette data
Changed paths:
engines/dgds/game_palettes.cpp
engines/dgds/includes.h
diff --git a/engines/dgds/game_palettes.cpp b/engines/dgds/game_palettes.cpp
index ccac5323bc5..eb64f937458 100644
--- a/engines/dgds/game_palettes.cpp
+++ b/engines/dgds/game_palettes.cpp
@@ -28,6 +28,25 @@
namespace Dgds {
+static const byte EGA_COLORS[16][3] = {
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0xAA },
+ { 0x00, 0xAA, 0x00 },
+ { 0x00, 0xAA, 0xAA },
+ { 0xAA, 0x00, 0x00 },
+ { 0xAA, 0x00, 0xAA },
+ { 0xAA, 0x55, 0x00 },
+ { 0xAA, 0xAA, 0xAA },
+ { 0x55, 0x55, 0x55 },
+ { 0x55, 0x55, 0xFF },
+ { 0x55, 0xFF, 0x55 },
+ { 0x55, 0xFF, 0xFF },
+ { 0xFF, 0x55, 0x55 },
+ { 0xFF, 0x55, 0xFF },
+ { 0xFF, 0xFF, 0x55 },
+ { 0xFF, 0xFF, 0xFF },
+};
+
DgdsPal::DgdsPal() : Palette(256) {
}
@@ -56,13 +75,29 @@ int GamePalettes::loadPalette(const Common::String &filename) {
while (chunk.readNextHeader(EX_PAL, filename)) {
chunk.readContent(_decompressor);
Common::SeekableReadStream *chunkStream = chunk.getContent();
- if (chunk.isSection(ID_VGA)) {
+ if (chunk.isSection(ID_PAL)) {
+ assert(chunk.isContainer());
+ } else if (chunk.isSection(ID_VGA)) {
for (uint k = 0; k < 256; k++) {
byte r = chunkStream->readByte() << 2;
byte g = chunkStream->readByte() << 2;
byte b = chunkStream->readByte() << 2;
pal.set(k, r, g, b);
}
+ break;
+ } else if (chunk.isSection(ID_EGA)) {
+ for (uint k = 0; k < chunk.getSize() / 2; k++) {
+ byte egaCol = (chunkStream->readUint16LE() & 0xF);
+ byte r = EGA_COLORS[egaCol][0];
+ byte g = EGA_COLORS[egaCol][1];
+ byte b = EGA_COLORS[egaCol][2];
+ pal.set(k, r, g, b);
+ }
+ break;
+ } else if (chunk.isSection(ID_CGA)) {
+ warning("Skipping CGA palette data");
+ } else {
+ error("Unknown Palette chunk in %s: %s size %d", filename.c_str(), chunk.getIdStr(), chunk.getSize());
}
}
pal.setName(filename);
diff --git a/engines/dgds/includes.h b/engines/dgds/includes.h
index b8606047912..3d766236fa0 100644
--- a/engines/dgds/includes.h
+++ b/engines/dgds/includes.h
@@ -27,7 +27,9 @@ namespace Dgds {
#define MKTAG24(a0, a1, a2) ((uint32)((a2) | (a1) << 8 | ((a0) << 16)))
#define ID_BIN MKTAG24('B', 'I', 'N')
+#define ID_CGA MKTAG24('C', 'G', 'A')
#define ID_DAT MKTAG24('D', 'A', 'T')
+#define ID_EGA MKTAG24('E', 'G', 'A')
#define ID_FNM MKTAG24('F', 'N', 'M')
#define ID_FNT MKTAG24('F', 'N', 'T')
#define ID_GAD MKTAG24('G', 'A', 'D')
@@ -36,6 +38,7 @@ namespace Dgds {
#define ID_MTX MKTAG24('M', 'T', 'X')
#define ID_OFF MKTAG24('O', 'F', 'F')
#define ID_PAG MKTAG24('P', 'A', 'G')
+#define ID_PAL MKTAG24('P', 'A', 'L')
#define ID_RAW MKTAG24('R', 'A', 'W')
#define ID_REQ MKTAG24('R', 'E', 'Q')
#define ID_RES MKTAG24('R', 'E', 'S')
More information about the Scummvm-git-logs
mailing list