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

athrxx noreply at scummvm.org
Sun Jun 30 13:51:16 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:
ade03ca071 SCI: minor cleanup of cga/hercules code


Commit: ade03ca0718ace8cee75bc80d7a6d0589ae54bd4
    https://github.com/scummvm/scummvm/commit/ade03ca0718ace8cee75bc80d7a6d0589ae54bd4
Author: athrxx (athrxx at scummvm.org)
Date: 2024-06-30T15:49:43+02:00

Commit Message:
SCI: minor cleanup of cga/hercules code

(Turn all usages of 'uint8' into 'byte'. I somehow made a wild mix here)

Changed paths:
    engines/sci/graphics/gfxdrivers.cpp
    engines/sci/graphics/gfxdrivers.h


diff --git a/engines/sci/graphics/gfxdrivers.cpp b/engines/sci/graphics/gfxdrivers.cpp
index d83fc9e1bd3..24de7f01b5f 100644
--- a/engines/sci/graphics/gfxdrivers.cpp
+++ b/engines/sci/graphics/gfxdrivers.cpp
@@ -108,7 +108,7 @@ void SCI0_DOSPreVGADriver::setPalette(const byte*, uint, uint) {
 }
 
 SCI0_EGADriver::SCI0_EGADriver() : SCI0_DOSPreVGADriver(16, 320, 200, 1) {
-	static const uint8 egaColors[] = {
+	static const byte egaColors[] = {
 		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,
@@ -134,7 +134,7 @@ void SCI0_EGADriver::replaceCursor(const void *cursor, uint w, uint h, int hotsp
 }
 
 SCI0_CGADriver::SCI0_CGADriver(bool emulateCGAModeOnEGACard) : SCI0_DOSPreVGADriver(4, 320, 200, 1), _cgaPatterns(nullptr), _disableMode5(emulateCGAModeOnEGACard) {
-	static const uint8 cgaColors[48] = {
+	static const byte cgaColors[48] = {
 		/*
 		// Canonical CGA palette
 		0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0x00, 0xAA, 0xAA,
@@ -149,7 +149,7 @@ SCI0_CGADriver::SCI0_CGADriver(bool emulateCGAModeOnEGACard) : SCI0_DOSPreVGADri
 		0xDC, 0x4E, 0x4E, 0xF3, 0x4E, 0xF3, 0xF3, 0xF3, 0x4E, 0xFF, 0xFF, 0xFF
 	};
 
-	static const uint8 modeColorMap[3][4] = {
+	static const byte modeColorMap[3][4] = {
 		{ 0, 2, 4, 6 },
 		{ 0, 3, 5, 7 },
 		{ 0, 3, 4, 7 }
@@ -163,7 +163,7 @@ SCI0_CGADriver::SCI0_CGADriver(bool emulateCGAModeOnEGACard) : SCI0_DOSPreVGADri
 	byte palIntensity = 1;
 	byte mode = 4;
 
-	uint8 colMap[4];
+	byte colMap[4];
 	memset(colMap, 0, sizeof(colMap));
 
 	uint16 eprcOffs = 0;
@@ -247,9 +247,9 @@ void SCI0_CGADriver::copyRectToScreen(const byte *src, int pitch, int x, int y,
 		for (int ii = 0; ii < (w >> 1); ++ii) {
 			uint16 pattern = _cgaPatterns[((src[0] & 0x0f) << 4) | (src[1] & 0x0f)];
 			src += 2;
-			uint8 sh = (ty & 3) << 1;
-			uint8 lo = ((pattern & 0xff) >> sh) | ((pattern & 0xff) << (8 - sh));
-			uint8 hi = (pattern >> (8 + sh)) | ((pattern >> 8) << (8 - sh));
+			byte sh = (ty & 3) << 1;
+			byte lo = ((pattern & 0xff) >> sh) | ((pattern & 0xff) << (8 - sh));
+			byte hi = (pattern >> (8 + sh)) | ((pattern >> 8) << (8 - sh));
 			*dst++ = (lo >> (6 - (tx << 1))) & 3;
 			*dst++ = (hi >> (4 - (tx << 1))) & 3;
 			tx ^= 2;
@@ -266,7 +266,7 @@ void SCI0_CGADriver::replaceCursor(const void *cursor, uint w, uint h, int hotsp
 	// driver class and implemented again for each mode, but I don't see the benefit. Instead,
 	// we simply convert the colors as needed...
 	assert(keycolor == 1);
-	const byte *s = reinterpret_cast<const uint8 *>(cursor);
+	const byte *s = reinterpret_cast<const byte*>(cursor);
 	byte *d = _compositeBuffer;
 	for (uint i = w * h; i; --i)
 		*d++ = *s++ & 3;
@@ -321,7 +321,7 @@ const byte *monochrInit(const char *drvFile, bool &earlyVersion) {
 }
 
 SCI0_CGABWDriver::SCI0_CGABWDriver() : SCI0_DOSPreVGADriver(2, 640, 400, 1), _monochromePatterns(nullptr), _earlyVersion(false) {
-	static const uint8 monochromePalette[6] = {
+	static const byte monochromePalette[6] = {
 		0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF
 	};
 	assignPalette(monochromePalette);
@@ -351,9 +351,9 @@ void SCI0_CGABWDriver::copyRectToScreen(const byte *src, int pitch, int x, int y
 			for (int ii = 0; ii < (w >> 1); ++ii) {
 				uint16 p16 = reinterpret_cast<const uint16*>(_monochromePatterns)[((src[0] & 0x0f) << 4) | (src[1] & 0x0f)];
 				src += 2;
-				uint8 sh = (ty & 3) << 1;
-				uint8 lo = ((p16 & 0xff) >> sh) | ((p16 & 0xff) << (8 - sh));
-				uint8 hi = (p16 >> (8 + sh)) | ((p16 >> 8) << (8 - sh));
+				byte sh = (ty & 3) << 1;
+				byte lo = ((p16 & 0xff) >> sh) | ((p16 & 0xff) << (8 - sh));
+				byte hi = (p16 >> (8 + sh)) | ((p16 >> 8) << (8 - sh));
 				*dst1++ = *dst2++ = ((lo >> (6 - (tx << 1))) >> 1) & 1;
 				*dst1++ = *dst2++ = (lo >> (6 - (tx << 1))) & 1;
 				*dst1++ = *dst2++ = ((hi >> (4 - (tx << 1))) >> 1) & 1;
@@ -362,7 +362,7 @@ void SCI0_CGABWDriver::copyRectToScreen(const byte *src, int pitch, int x, int y
 			}
 		} else {
 			for (int ii = 0; ii < w; ++ii) {
-				uint8 p = _monochromePatterns[((*src++ & 0x0f) << 3) + ty] >> (6 - (tx << 1));
+				byte p = _monochromePatterns[((*src++ & 0x0f) << 3) + ty] >> (6 - (tx << 1));
 				*dst1++ = *dst2++ = (p >> 1) & 1;
 				*dst1++ = *dst2++ = p & 1;
 				tx = (tx + 1) & 3;
@@ -385,7 +385,7 @@ void SCI0_CGABWDriver::replaceCursor(const void *cursor, uint w, uint h, int hot
 	assert(keycolor == 1);
 	keycolor = 0x0f;
 	w <<= 1;
-	const byte *s = reinterpret_cast<const uint8*>(cursor);
+	const byte *s = reinterpret_cast<const byte*>(cursor);
 	byte *d0 = _compositeBuffer;
 	byte *d1 = _compositeBuffer + w;
 
@@ -412,7 +412,7 @@ Common::Point SCI0_CGABWDriver::getMousePos() const {
 const char *SCI0_CGABWDriver::_driverFiles[2] = { "CGA320BW.DRV", "CGA320M.DRV" };
 
 SCI0_HerculesDriver::SCI0_HerculesDriver(int palIndex) : SCI0_DOSPreVGADriver(2, 720, 350, 0), _monochromePatterns(nullptr) {
-	static const uint8 monochromePalettes[3][6] = {
+	static const byte monochromePalettes[3][6] = {
 		{ 0x00, 0x00, 0x00, 0xFF, 0xBF, 0x66 }, // Amber
 		{ 0x00, 0x00, 0x00, 0x66, 0xFF, 0x66 }, // Green
 		{ 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF }  // B/W
@@ -444,7 +444,7 @@ void SCI0_HerculesDriver::copyRectToScreen(const byte *src, int pitch, int x, in
 		const byte *src2 = src;
 		int tx = x & 3;
 		for (int ii = 0; ii < w; ++ii) {
-			uint8 p = _monochromePatterns[((*src2++ & 0x0f) << 3) + ty] >> (6 - (tx << 1));
+			byte p = _monochromePatterns[((*src2++ & 0x0f) << 3) + ty] >> (6 - (tx << 1));
 			*dst++ = (p >> 1) & 1;
 			*dst++ = p & 1;
 			tx = (tx + 1) & 3;
@@ -475,7 +475,7 @@ void SCI0_HerculesDriver::replaceCursor(const void *cursor, uint w, uint h, int
 	assert(keycolor == 1);
 	keycolor = 0x0f;
 	int alt = 0;
-	const byte *s = reinterpret_cast<const uint8 *>(cursor);
+	const byte *s = reinterpret_cast<const byte *>(cursor);
 	byte *d = _compositeBuffer;
 
 	for (uint i = 0; i < h; ++i) {
diff --git a/engines/sci/graphics/gfxdrivers.h b/engines/sci/graphics/gfxdrivers.h
index 8e1a111c5ca..347dbb2c1bf 100644
--- a/engines/sci/graphics/gfxdrivers.h
+++ b/engines/sci/graphics/gfxdrivers.h
@@ -34,7 +34,7 @@ public:
 	uint16 screenWidth() const { return _screenW; }
 	uint16 screenHeight() const { return _screenH; }
 	uint16 numColors() const { return _numColors; }
-	uint8 hAlignment() const { return _hAlign; }
+	byte hAlignment() const { return _hAlign; }
 
 	virtual void setPalette(const byte *colors, uint start, uint num) = 0;
 	virtual void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) = 0;
@@ -45,7 +45,7 @@ protected:
 	const uint16 _screenW;
 	const uint16 _screenH;
 	uint16 _numColors;
-	const uint8 _hAlign;
+	const byte _hAlign;
 };
 
 class GfxDefaultDriver final : public GfxDriver {




More information about the Scummvm-git-logs mailing list