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

athrxx noreply at scummvm.org
Sat Jul 20 21:00:49 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:
f1bab933b5 SCUMM: (V1/2) - fix snail cursor for CGA, Hercules


Commit: f1bab933b52fc7dacbd699269dc339c1e244c7a9
    https://github.com/scummvm/scummvm/commit/f1bab933b52fc7dacbd699269dc339c1e244c7a9
Author: athrxx (athrxx at scummvm.org)
Date: 2024-07-20T22:59:55+02:00

Commit Message:
SCUMM: (V1/2) - fix snail cursor for CGA, Hercules

Changed paths:
    engines/scumm/cursor.cpp
    engines/scumm/scumm_v2.h


diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp
index f50c0cc32fd..b82ebb1d07b 100644
--- a/engines/scumm/cursor.cpp
+++ b/engines/scumm/cursor.cpp
@@ -897,35 +897,22 @@ void ScummEngine_v2::setBuiltinCursor(int idx) {
 		*(hotspot + (_cursor.width * 5) - 1) = color;
 		*(hotspot + (_cursor.width * 5) + 1) = color;
 
-		if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG || _renderMode == Common::kRenderCGA_BW) {
-			const byte *src = &_grabbedCursor[_cursor.width * _cursor.height - 1];
-
-			_cursor.width <<= 1;
-			_cursor.height <<= 1;
-			_cursor.hotspotX <<= 1;
-			_cursor.hotspotY <<= 1;
-
-			byte *dst1 = &_grabbedCursor[_cursor.width * _cursor.height - 1];
-			byte *dst2 = dst1 - _cursor.width;
-
-			while (dst2 >= _grabbedCursor) {
-				for (i = _cursor.width >> 1; i; --i) {
-					uint8 col2 = (_renderMode == Common::kRenderCGA_BW) ? *src : 0xFF;
-					*dst1-- = col2;
-					*dst1-- = col2;
-					*dst2-- = *src;
-					*dst2-- = *src--;
-				}
-				dst1 -= _cursor.width;
-				dst2 -= _cursor.width;
-			}
-		}
+		adaptCursorToVideoMode();
 	}
 
 	updateCursor();
 }
 
 void ScummEngine_v2::setSnailCursor() {
+	byte color;
+	if (_game.platform == Common::kPlatformC64)
+		color = default_v0_cursor_colors[1];
+	else if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderCGAComp)
+		color = 3;
+	else if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG || _renderMode == Common::kRenderCGA_BW)
+		color = 1;
+	else
+		color = default_cursor_colors[1];
 
 	if (_game.platform == Common::kPlatformAmiga) {
 		memcpy(_grabbedCursor, amiga_snail_cursor, sizeof(amiga_snail_cursor));
@@ -945,12 +932,9 @@ void ScummEngine_v2::setSnailCursor() {
 
 	} else {
 		memcpy(_grabbedCursor, c64_dos_snail_cursor, sizeof(c64_dos_snail_cursor));
-
-		if (_game.platform == Common::kPlatformC64) {
-			for (uint i = 0; i < sizeof(c64_dos_snail_cursor); i++) {
-				if (_grabbedCursor[i] == 0x0F)
-					_grabbedCursor[i] = 0x01;
-			}
+		for (uint i = 0; i < sizeof(c64_dos_snail_cursor); i++) {
+			if (_grabbedCursor[i] == 0x0F)
+				_grabbedCursor[i] = color;
 		}
 
 		_cursor.width = 24;
@@ -959,9 +943,37 @@ void ScummEngine_v2::setSnailCursor() {
 		_cursor.hotspotY = 10;
 	}
 
+	adaptCursorToVideoMode();
 	updateCursor();
 }
 
+void ScummEngine_v2::adaptCursorToVideoMode() {
+	if (_renderMode != Common::kRenderHercA && _renderMode != Common::kRenderHercG && _renderMode != Common::kRenderCGA_BW)
+		return;
+
+	const byte *src = &_grabbedCursor[_cursor.width * _cursor.height - 1];
+
+	_cursor.width <<= 1;
+	_cursor.height <<= 1;
+	_cursor.hotspotX <<= 1;
+	_cursor.hotspotY <<= 1;
+
+	byte *dst1 = &_grabbedCursor[_cursor.width * _cursor.height - 1];
+	byte *dst2 = dst1 - _cursor.width;
+
+	while (dst2 >= _grabbedCursor) {
+		for (int i = _cursor.width >> 1; i; --i) {
+			uint8 col2 = (_renderMode == Common::kRenderCGA_BW) ? *src : 0xFF;
+			*dst1-- = col2;
+			*dst1-- = col2;
+			*dst2-- = *src;
+			*dst2-- = *src--;
+		}
+		dst1 -= _cursor.width;
+		dst2 -= _cursor.width;
+	}
+}
+
 void ScummEngine_v5::resetCursors() {
 	static const uint16 default_cursor_images[4][16] = {
 		/* cross-hair */
diff --git a/engines/scumm/scumm_v2.h b/engines/scumm/scumm_v2.h
index d65b48b198f..c1509243c06 100644
--- a/engines/scumm/scumm_v2.h
+++ b/engines/scumm/scumm_v2.h
@@ -107,6 +107,7 @@ protected:
 
 	void setBuiltinCursor(int index) override;
 	void setSnailCursor() override;
+	void adaptCursorToVideoMode();
 
 	void drawPreposition(int index);
 




More information about the Scummvm-git-logs mailing list