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

bluegr noreply at scummvm.org
Tue Aug 5 05:39:43 UTC 2025


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

Summary:
bbbee39dcd GRAPHICS: Create macros to convert to/from 6-bit and 8-bit colors
548ab90017 ACCESS: Use PALETTE_6BIT_TO_8BIT macro
c728f8008e AGS: Use PALETTE_6BIT_TO_8BIT macro, and use palette constants
f59c92f7fa CHEWY: Use PALETTE_6BIT_TO_8BIT macro
e602ce625a MADS: Use PALETTE_6BIT_TO_8BIT macro
07dab384d7 SHERLOCK: Use PALETTE_6BIT_TO_8BIT macro
a3f9f1d332 ULTIMA: Use PALETTE_6BIT_TO_8BIT macro


Commit: bbbee39dcde64d8e8dd782b8d897354ec0060739
    https://github.com/scummvm/scummvm/commit/bbbee39dcde64d8e8dd782b8d897354ec0060739
Author: Ori Avtalion (ori at avtalion.name)
Date: 2025-08-05T08:39:37+03:00

Commit Message:
GRAPHICS: Create macros to convert to/from 6-bit and 8-bit colors

Changed paths:
    graphics/palette.h


diff --git a/graphics/palette.h b/graphics/palette.h
index 90946032c15..d219091551f 100644
--- a/graphics/palette.h
+++ b/graphics/palette.h
@@ -25,6 +25,9 @@
 #include "common/hashmap.h"
 #include "common/types.h"
 
+#define PALETTE_6BIT_TO_8BIT(x) ((x) * 255 / 63)
+#define PALETTE_8BIT_TO_6BIT(x) ((x) * 63 / 255)
+
 namespace Graphics {
 
 enum ColorDistanceMethod {


Commit: 548ab900170508849b0c659a3da43e5b42b2b5d5
    https://github.com/scummvm/scummvm/commit/548ab900170508849b0c659a3da43e5b42b2b5d5
Author: Ori Avtalion (ori at avtalion.name)
Date: 2025-08-05T08:39:37+03:00

Commit Message:
ACCESS: Use PALETTE_6BIT_TO_8BIT macro

Changed paths:
    engines/access/screen.cpp


diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index 876ec9bce51..f1d11647498 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -25,6 +25,7 @@
 #include "common/textconsole.h"
 #include "common/system.h"
 #include "graphics/paletteman.h"
+#include "graphics/palette.h"
 #include "access/access.h"
 #include "access/screen.h"
 #include "access/resources.h"
@@ -32,8 +33,6 @@
 
 namespace Access {
 
-#define VGA_COLOR_TRANS(x) ((x) * 255 / 63)
-
 ScreenSave::ScreenSave(){
 	_clipWidth = _clipHeight = 0;
 	_windowXAdd = _windowYAdd = 0;
@@ -120,14 +119,14 @@ void Screen::setInitialPalettte() {
 
 void Screen::setManPalette() {
 	for (int i = 0; i < 0x42; i++) {
-		_rawPalette[672 + i] = VGA_COLOR_TRANS(_manPal[i]);
+		_rawPalette[672 + i] = PALETTE_6BIT_TO_8BIT(_manPal[i]);
 	}
 }
 
 void Screen::setIconPalette() {
 	if (_vm->getGameID() == GType_MartianMemorandum) {
 		for (int i = 0; i < 0x1B; i++) {
-			_rawPalette[741 + i] = VGA_COLOR_TRANS(Martian::ICON_PALETTE[i]);
+			_rawPalette[741 + i] = PALETTE_6BIT_TO_8BIT(Martian::ICON_PALETTE[i]);
 		}
 	}
 }
@@ -146,7 +145,7 @@ void Screen::setPalette() {
 void Screen::loadRawPalette(Common::SeekableReadStream *stream) {
 	stream->read(&_rawPalette[0], Graphics::PALETTE_SIZE);
 	for (byte *p = &_rawPalette[0]; p < &_rawPalette[Graphics::PALETTE_SIZE]; ++p)
-		*p = VGA_COLOR_TRANS(*p);
+		*p = PALETTE_6BIT_TO_8BIT(*p);
 }
 
 void Screen::updatePalette() {


Commit: c728f8008eeb66fdf4ab989300d7f17b64f42cae
    https://github.com/scummvm/scummvm/commit/c728f8008eeb66fdf4ab989300d7f17b64f42cae
Author: Ori Avtalion (ori at avtalion.name)
Date: 2025-08-05T08:39:37+03:00

Commit Message:
AGS: Use PALETTE_6BIT_TO_8BIT macro, and use palette constants

Changed paths:
    engines/ags/console.cpp


diff --git a/engines/ags/console.cpp b/engines/ags/console.cpp
index 87c74be2372..0fc477a1559 100644
--- a/engines/ags/console.cpp
+++ b/engines/ags/console.cpp
@@ -25,6 +25,7 @@
 #include "ags/shared/ac/sprite_cache.h"
 #include "ags/shared/gfx/allegro_bitmap.h"
 #include "ags/shared/script/cc_common.h"
+#include "graphics/palette.h"
 #include "image/png.h"
 
 namespace AGS {
@@ -230,11 +231,11 @@ bool AGSConsole::Cmd_dumpSprite(int argc, const char **argv) {
 	if (df.open(pngFile)) {
 		byte *palette = nullptr;
 		if (sprite->GetColorDepth() == 8) {
-			palette = new byte[256 * 3];
-			for (int c = 0, i = 0 ; c < 256 ; ++c, i += 3) {
-				palette[i] = _G(current_palette)[c].r * 255 / 63;
-				palette[i + 1] = _G(current_palette)[c].g * 255 / 63;
-				palette[i + 2] = _G(current_palette)[c].b * 255 / 63;
+			palette = new byte[Graphics::PALETTE_SIZE];
+			for (int c = 0, i = 0 ; c < Graphics::PALETTE_COUNT ; ++c, i += 3) {
+				palette[i] = PALETTE_6BIT_TO_8BIT(_G(current_palette)[c].r);
+				palette[i + 1] = PALETTE_6BIT_TO_8BIT(_G(current_palette)[c].g);
+				palette[i + 2] = PALETTE_6BIT_TO_8BIT(_G(current_palette)[c].b);
 			}
 		}
 		Image::writePNG(df, sprite->GetAllegroBitmap()->getSurface().rawSurface(), palette);


Commit: f59c92f7fa1f3eb9003b2a617ffd9595ef32a266
    https://github.com/scummvm/scummvm/commit/f59c92f7fa1f3eb9003b2a617ffd9595ef32a266
Author: Ori Avtalion (ori at avtalion.name)
Date: 2025-08-05T08:39:37+03:00

Commit Message:
CHEWY: Use PALETTE_6BIT_TO_8BIT macro

Changed paths:
    engines/chewy/mcga_graphics.cpp


diff --git a/engines/chewy/mcga_graphics.cpp b/engines/chewy/mcga_graphics.cpp
index c898feb3972..a8ff32b37e3 100644
--- a/engines/chewy/mcga_graphics.cpp
+++ b/engines/chewy/mcga_graphics.cpp
@@ -21,6 +21,7 @@
 
 #include "common/memstream.h"
 #include "common/system.h"
+#include "graphics/palette.h"
 #include "graphics/paletteman.h"
 #include "chewy/chewy.h"
 #include "chewy/events.h"
@@ -30,8 +31,6 @@
 
 namespace Chewy {
 
-#define VGA_COLOR_TRANS(x) ((x)*255 / 63)
-
 McgaGraphics::McgaGraphics() {
 }
 
@@ -48,7 +47,7 @@ void setScummVMPalette(const byte *palette, uint start, uint count) {
 	byte *dest = &tempPal[0];
 
 	for (uint i = 0; i < count * 3; ++i, ++palette, ++dest)
-		*dest = VGA_COLOR_TRANS(*palette);
+		*dest = PALETTE_6BIT_TO_8BIT(*palette);
 
 	g_system->getPaletteManager()->setPalette(tempPal, start, count);
 }


Commit: e602ce625a9210347be2b13aa5b54f732d00a0a7
    https://github.com/scummvm/scummvm/commit/e602ce625a9210347be2b13aa5b54f732d00a0a7
Author: Ori Avtalion (ori at avtalion.name)
Date: 2025-08-05T08:39:37+03:00

Commit Message:
MADS: Use PALETTE_6BIT_TO_8BIT macro

Changed paths:
    engines/mads/palette.cpp


diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp
index 90ddbed5ce4..1f22fe1206e 100644
--- a/engines/mads/palette.cpp
+++ b/engines/mads/palette.cpp
@@ -21,6 +21,7 @@
 
 #include "common/scummsys.h"
 #include "engines/util.h"
+#include "graphics/palette.h"
 #include "graphics/paletteman.h"
 #include "mads/mads.h"
 #include "mads/msurface.h"
@@ -28,12 +29,10 @@
 
 namespace MADS {
 
-#define VGA_COLOR_TRANS(x) ((x) * 255 / 63)
-
 void RGB6::load(Common::SeekableReadStream *f) {
-	r = VGA_COLOR_TRANS(f->readByte());
-	g = VGA_COLOR_TRANS(f->readByte());
-	b = VGA_COLOR_TRANS(f->readByte());
+	r = PALETTE_6BIT_TO_8BIT(f->readByte());
+	g = PALETTE_6BIT_TO_8BIT(f->readByte());
+	b = PALETTE_6BIT_TO_8BIT(f->readByte());
 	_palIndex = f->readByte();
 	_u2 = f->readByte();
 	_flags = f->readByte();
@@ -408,7 +407,7 @@ Fader::Fader(MADSEngine *vm)
 	// to work directly with 8-bit RGB values rather than 6-bit RGB values
 	Common::fill(&_rgb64Map[0], &_rgb64Map[PALETTE_COUNT], 0);
 	for (int i = 0; i < 64; ++i)
-		_rgb64Map[VGA_COLOR_TRANS(i)] = i;
+		_rgb64Map[PALETTE_6BIT_TO_8BIT(i)] = i;
 	byte v = 0;
 	for (int i = 0; i < PALETTE_COUNT; ++i) {
 		if (_rgb64Map[i])
@@ -475,7 +474,7 @@ void Fader::fadeOut(byte palette[PALETTE_SIZE], byte *paletteMap,
 
 					byte rgb63 = _rgb64Map[palette[palCtr * 3 + colorCtr]] +
 						signs[palCtr][colorCtr];
-					palette[palCtr * 3 + colorCtr] = VGA_COLOR_TRANS(rgb63);
+					palette[palCtr * 3 + colorCtr] = PALETTE_6BIT_TO_8BIT(rgb63);
 				}
 			}
 		}
@@ -535,7 +534,7 @@ void Fader::fadeIn(byte palette[PALETTE_SIZE], byte destPalette[PALETTE_SIZE],
 
 					byte rgb63 = _rgb64Map[palette[palCtr * 3 + colorCtr]] +
 						signs[palCtr][colorCtr];
-					palette[palCtr * 3 + colorCtr] = VGA_COLOR_TRANS(rgb63);
+					palette[palCtr * 3 + colorCtr] = PALETTE_6BIT_TO_8BIT(rgb63);
 				}
 			}
 		}
@@ -616,7 +615,7 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo
 			} else {
 				intensity = _colorValues[color];
 			}
-			*palP++ = VGA_COLOR_TRANS(intensity);
+			*palP++ = PALETTE_6BIT_TO_8BIT(intensity);
 		}
 	}
 }
@@ -711,9 +710,9 @@ Palette::Palette(MADSEngine *vm) : Fader(vm), _paletteUsage(vm) {
 }
 
 void Palette::setEntry(byte palIndex, byte r, byte g, byte b) {
-	_mainPalette[palIndex * 3] = VGA_COLOR_TRANS(r);
-	_mainPalette[palIndex * 3 + 1] = VGA_COLOR_TRANS(g);
-	_mainPalette[palIndex * 3 + 2] = VGA_COLOR_TRANS(b);
+	_mainPalette[palIndex * 3] = PALETTE_6BIT_TO_8BIT(r);
+	_mainPalette[palIndex * 3 + 1] = PALETTE_6BIT_TO_8BIT(g);
+	_mainPalette[palIndex * 3 + 2] = PALETTE_6BIT_TO_8BIT(b);
 
 	setPalette((const byte *)&_mainPalette[palIndex * 3], palIndex, 1);
 }
@@ -841,10 +840,10 @@ void Palette::initVGAPalette(byte *palette) {
 }
 
 void Palette::setLowRange() {
-	_mainPalette[0] = _mainPalette[1] = _mainPalette[2] = VGA_COLOR_TRANS(0);
-	_mainPalette[3] = _mainPalette[4] = _mainPalette[5] = VGA_COLOR_TRANS(0x15);
-	_mainPalette[6] = _mainPalette[7] = _mainPalette[8] = VGA_COLOR_TRANS(0x2A);
-	_mainPalette[9] = _mainPalette[10] = _mainPalette[11] = VGA_COLOR_TRANS(0x3F);
+	_mainPalette[0] = _mainPalette[1] = _mainPalette[2] = PALETTE_6BIT_TO_8BIT(0);
+	_mainPalette[3] = _mainPalette[4] = _mainPalette[5] = PALETTE_6BIT_TO_8BIT(0x15);
+	_mainPalette[6] = _mainPalette[7] = _mainPalette[8] = PALETTE_6BIT_TO_8BIT(0x2A);
+	_mainPalette[9] = _mainPalette[10] = _mainPalette[11] = PALETTE_6BIT_TO_8BIT(0x3F);
 	_vm->_palette->setPalette(_mainPalette, 0, 4);
 }
 


Commit: 07dab384d7144d3b170aa2a39aa0553b1e9fba0d
    https://github.com/scummvm/scummvm/commit/07dab384d7144d3b170aa2a39aa0553b1e9fba0d
Author: Ori Avtalion (ori at avtalion.name)
Date: 2025-08-05T08:39:37+03:00

Commit Message:
SHERLOCK: Use PALETTE_6BIT_TO_8BIT macro

Changed paths:
    engines/sherlock/image_file.cpp
    engines/sherlock/scalpel/scalpel_journal.cpp
    engines/sherlock/screen.cpp
    engines/sherlock/screen.h


diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp
index 8ceb020dd7b..fe15564ea96 100644
--- a/engines/sherlock/image_file.cpp
+++ b/engines/sherlock/image_file.cpp
@@ -24,6 +24,7 @@
 #include "sherlock/sherlock.h"
 #include "common/debug.h"
 #include "common/memstream.h"
+#include "graphics/palette.h"
 
 namespace Sherlock {
 
@@ -192,7 +193,7 @@ void ImageFile::loadPalette(Common::SeekableReadStream &stream) {
 		// Found palette, so read it in
 		stream.seek(8, SEEK_CUR); // Skip over the rest of the signature text "VGA palette"
 		for (int idx = 0; idx < Graphics::PALETTE_SIZE; ++idx)
-			_palette[idx] = VGA_COLOR_TRANS(stream.readByte());
+			_palette[idx] = PALETTE_6BIT_TO_8BIT(stream.readByte());
 	} else {
 		// Not a palette, so rewind to start of frame data for normal frame processing
 		stream.seek(-8, SEEK_CUR);
diff --git a/engines/sherlock/scalpel/scalpel_journal.cpp b/engines/sherlock/scalpel/scalpel_journal.cpp
index 4525c88a689..df26c088645 100644
--- a/engines/sherlock/scalpel/scalpel_journal.cpp
+++ b/engines/sherlock/scalpel/scalpel_journal.cpp
@@ -26,6 +26,7 @@
 #include "sherlock/scalpel/scalpel_screen.h"
 #include "sherlock/scalpel/scalpel.h"
 #include "sherlock/tattoo/tattoo_journal.h"
+#include "graphics/palette.h"
 
 namespace Sherlock {
 
@@ -241,7 +242,7 @@ void ScalpelJournal::drawFrame() {
 
 	// Translate the palette for display
 	for (int idx = 0; idx < Graphics::PALETTE_SIZE; ++idx)
-		palette[idx] = VGA_COLOR_TRANS(palette[idx]);
+		palette[idx] = PALETTE_6BIT_TO_8BIT(palette[idx]);
 
 	// Set the palette and print the title
 	screen.setPalette(palette);
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index 02062f4589b..8fc20f09c38 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -26,6 +26,7 @@
 #include "sherlock/tattoo/tattoo_screen.h"
 #include "common/system.h"
 #include "common/util.h"
+#include "graphics/palette.h"
 
 namespace Sherlock {
 
@@ -368,7 +369,7 @@ int Screen::fadeRead(Common::SeekableReadStream &stream, byte *buf, int totalSiz
 
 void Screen::translatePalette(byte palette[Graphics::PALETTE_SIZE]) {
 	for (int idx = 0; idx < Graphics::PALETTE_SIZE; ++idx)
-		palette[idx] = VGA_COLOR_TRANS(palette[idx]);
+		palette[idx] = PALETTE_6BIT_TO_8BIT(palette[idx]);
 }
 
 } // End of namespace Sherlock
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index a84472e66f0..922efd18160 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -31,7 +31,6 @@
 
 namespace Sherlock {
 
-#define VGA_COLOR_TRANS(x) ((x) * 255 / 63)
 #define BG_GREYSCALE_RANGE_END 229
 #define BLACK 0
 


Commit: a3f9f1d332305e7c94f146c1764bc6751d874cb2
    https://github.com/scummvm/scummvm/commit/a3f9f1d332305e7c94f146c1764bc6751d874cb2
Author: Ori Avtalion (ori at avtalion.name)
Date: 2025-08-05T08:39:37+03:00

Commit Message:
ULTIMA: Use PALETTE_6BIT_TO_8BIT macro

Changed paths:
    engines/ultima/shared/early/game.cpp
    engines/ultima/shared/gfx/screen.h
    engines/ultima/ultima4/gfx/imageloader_u4.cpp


diff --git a/engines/ultima/shared/early/game.cpp b/engines/ultima/shared/early/game.cpp
index c394a531548..32b9f718c42 100644
--- a/engines/ultima/shared/early/game.cpp
+++ b/engines/ultima/shared/early/game.cpp
@@ -25,6 +25,7 @@
 #include "ultima/shared/early/ultima_early.h"
 #include "ultima/shared/gfx/font.h"
 #include "ultima/shared/gfx/screen.h"
+#include "graphics/palette.h"
 
 namespace Ultima {
 namespace Shared {
@@ -104,7 +105,7 @@ void Game::loadU6Palette() {
 
 	// Adjust the palette values from 0-63 to 0-255, and set the palette
 	for (int idx = 0; idx < Graphics::PALETTE_SIZE; ++idx)
-		palette[idx] = VGA_COLOR_TRANS(palette[idx]);
+		palette[idx] = PALETTE_6BIT_TO_8BIT(palette[idx]);
 	g_vm->_screen->setPalette(&palette[0], 0, Graphics::PALETTE_COUNT);
 
 	// TODO: Set appropriate indexes
diff --git a/engines/ultima/shared/gfx/screen.h b/engines/ultima/shared/gfx/screen.h
index 5d609af5753..a842596d9d8 100644
--- a/engines/ultima/shared/gfx/screen.h
+++ b/engines/ultima/shared/gfx/screen.h
@@ -33,8 +33,6 @@ namespace Shared {
 
 namespace Gfx {
 
-#define VGA_COLOR_TRANS(x) ((x) * 255 / 63)
-
 
 /**
  * Base class for an on-screen cursor. Currently used for text cursor display
diff --git a/engines/ultima/ultima4/gfx/imageloader_u4.cpp b/engines/ultima/ultima4/gfx/imageloader_u4.cpp
index 457d8ddcd64..30540d98342 100644
--- a/engines/ultima/ultima4/gfx/imageloader_u4.cpp
+++ b/engines/ultima/ultima4/gfx/imageloader_u4.cpp
@@ -27,6 +27,7 @@
 
 #include "common/file.h"
 #include "graphics/surface.h"
+#include "graphics/palette.h"
 
 namespace Ultima {
 namespace Ultima4 {
@@ -218,7 +219,7 @@ const byte *U4PaletteLoader::loadVgaPalette() {
 		pal.read(_vgaPalette, 256 * 3);
 
 		for (int i = 0; i < 256 * 3; i++) {
-			_vgaPalette[i] = _vgaPalette[i] * 255 / 63;
+			_vgaPalette[i] = PALETTE_6BIT_TO_8BIT(_vgaPalette[i]);
 		}
 	}
 




More information about the Scummvm-git-logs mailing list