[Scummvm-git-logs] scummvm master -> 0cdeebe0cd7206f43cf46a62ce7dd63f7ca539fd

neuromancer noreply at scummvm.org
Sat Jun 1 14:15:33 UTC 2024


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

Summary:
e1a849406c FREESCAPE: define SETFLAGS opcode
b9879e4014 FREESCAPE: refactor drawStringInSurface
dd78b25358 FREESCAPE: improved drawStringInSurface for amiga/atari
0cdeebe0cd FREESCAPE: enable polygon stipple usage for software renderer


Commit: e1a849406c6f6fd42006c574a36bea145783e7e8
    https://github.com/scummvm/scummvm/commit/e1a849406c6f6fd42006c574a36bea145783e7e8
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-06-01T15:35:29+02:00

Commit Message:
FREESCAPE: define SETFLAGS opcode

Changed paths:
    engines/freescape/language/8bitDetokeniser.cpp
    engines/freescape/language/token.h


diff --git a/engines/freescape/language/8bitDetokeniser.cpp b/engines/freescape/language/8bitDetokeniser.cpp
index a946ae7090d..3112b7f5939 100644
--- a/engines/freescape/language/8bitDetokeniser.cpp
+++ b/engines/freescape/language/8bitDetokeniser.cpp
@@ -308,9 +308,9 @@ Common::String detokenise8bitCondition(Common::Array<uint16> &tokenisedCondition
 			currentInstruction = FCLInstruction(Token::SCREEN);
 			break;
 
-		case 36: // Not sure about this one
+		case 36: // Only used in Dark Side to keep track of cristals and letters collected
 			detokenisedStream += "SETFLAGS (";
-			currentInstruction = FCLInstruction(Token::MODE);
+			currentInstruction = FCLInstruction(Token::SETFLAGS);
 			break;
 
 		case 37:
diff --git a/engines/freescape/language/token.h b/engines/freescape/language/token.h
index a99d777b8bd..4a1f63f6c87 100644
--- a/engines/freescape/language/token.h
+++ b/engines/freescape/language/token.h
@@ -66,6 +66,7 @@ public:
 		SCREEN,
 		SOUND,
 		SETVAR,
+		SETFLAGS,
 		START,
 		STARTANIM,
 		STOPANIM,


Commit: b9879e40143e3339f79d0f5d56399c0b38b251e5
    https://github.com/scummvm/scummvm/commit/b9879e40143e3339f79d0f5d56399c0b38b251e5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-06-01T15:35:29+02:00

Commit Message:
FREESCAPE: refactor drawStringInSurface

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/games/driller/amiga.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 55092698199..2e5e7619008 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -896,33 +896,40 @@ void FreescapeEngine::drawStringInSurface(const Common::String &str, int x, int
 	int sep = isCastle() ? 9 : 8;
 	int additional = isCastle() || isEclipse() ? 0 : 1;
 
-	if (isDOS() || isSpectrum() || isCPC() || isC64()) {
-		for (uint32 c = 0; c < ustr.size(); c++) {
-			assert(ustr[c] >= 32);
-			int position = sizeX * sizeY * (offset + ustr[c] - 32);
-			for (int j = 0; j < sizeY; j++) {
-				for (int i = 0; i < sizeX; i++) {
-					if (_font.get(position + additional + j * 8 + i))
-						surface->setPixel(x + 8 - i + sep * c, y + j, fontColor);
-					else
-						surface->setPixel(x + 8 - i + sep * c, y + j, backColor);
-				}
+	for (uint32 c = 0; c < ustr.size(); c++) {
+		assert(ustr[c] >= 32);
+		int position = sizeX * sizeY * (offset + ustr[c] - 32);
+		for (int j = 0; j < sizeY; j++) {
+			for (int i = 0; i < sizeX; i++) {
+				if (_font.get(position + additional + j * 8 + i))
+					surface->setPixel(x + 8 - i + sep * c, y + j, fontColor);
+				else
+					surface->setPixel(x + 8 - i + sep * c, y + j, backColor);
 			}
 		}
-	} else if (isAmiga() || isAtariST()) {
-		int multiplier1 = isDriller() ? 33 : 16;
-		int multiplier2 = isDriller() ? 32 : 16;
-
-		for (uint32 c = 0; c < ustr.size(); c++) {
-			assert(ustr[c] >= 32);
-			int position = 8 * (multiplier1*(offset + ustr[c] - 32) + 1);
-			for (int j = 0; j < 8; j++) {
-				for (int i = 0; i < 8; i++) {
-					if (_font.get(position + j * multiplier2 + i))
-						surface->setPixel(x + 8 - i + 8 * c, y + j, fontColor);
-					else
-						surface->setPixel(x + 8 - i + 8 * c, y + j, backColor);
-				}
+	}
+}
+
+void FreescapeEngine::drawStringInSurface(const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface, int offset) {
+	if (!_fontLoaded)
+		return;
+	Common::String ustr = str;
+	ustr.toUppercase();
+
+	int multiplier1 = isDriller() ? 33 : 16;
+	int multiplier2 = isDriller() ? 32 : 16;
+
+	for (uint32 c = 0; c < ustr.size(); c++) {
+		assert(ustr[c] >= 32);
+		int position = 8 * (multiplier1*(offset + ustr[c] - 32) + 1);
+		for (int j = 0; j < 8; j++) {
+			for (int i = 0; i < 8; i++) {
+				if (_font.get(position + j * multiplier2 + i)) {
+					surface->setPixel(x + 8 - i + 8 * c, y + j, primaryColor);
+				} else if (_font.get(position + j * (multiplier2 / 2) + i)) {
+					surface->setPixel(x + 8 - i + 8 * c, y + j, secondaryColor);
+				} else
+					surface->setPixel(x + 8 - i + 8 * c, y + j, backColor);
 			}
 		}
 	}
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 5e811aae3b5..d034e8407e2 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -433,6 +433,7 @@ public:
 	void drawFullscreenMessageAndWait(Common::String message);
 	void drawFullscreenMessage(Common::String message, uint32 front, Graphics::Surface *surface);
 
+	// Font loading and rendering
 	void loadFonts(Common::SeekableReadStream *file, int offset);
 	void loadFonts(byte *font, int charNumber);
 	Common::StringArray _currentAreaMessages;
@@ -440,6 +441,7 @@ public:
 	Common::BitArray _font;
 	bool _fontLoaded;
 	void drawStringInSurface(const Common::String &str, int x, int y, uint32 fontColor, uint32 backColor, Graphics::Surface *surface, int offset = 0);
+	void drawStringInSurface(const Common::String &str, int x, int y, uint32 primaryFontColor, uint32 secondaryFontColor, uint32 backColor, Graphics::Surface *surface, int offset = 0);
 	Graphics::Surface *drawStringsInSurface(const Common::Array<Common::String> &lines);
 
 	// Game state
diff --git a/engines/freescape/games/driller/amiga.cpp b/engines/freescape/games/driller/amiga.cpp
index a34608c39ad..881c7d1fa76 100644
--- a/engines/freescape/games/driller/amiga.cpp
+++ b/engines/freescape/games/driller/amiga.cpp
@@ -147,6 +147,8 @@ void DrillerEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
 	uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0x55);
 	uint32 brownish = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x9E, 0x80, 0x20);
 	uint32 brown = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x7E, 0x60, 0x19);
+	uint32 primaryFontColor = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xA0, 0x80, 0x00);
+	uint32 secondaryFontColor = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x60, 0x40, 0x00);
 	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
 	uint32 transparent = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00);
 
@@ -155,36 +157,36 @@ void DrillerEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
 
 	// It seems that some demos will not include the complete font
 	if (!isDemo() || (_variant & GF_AMIGA_MAGAZINE_DEMO) || (_variant & GF_ATARI_MAGAZINE_DEMO)) {
-		drawStringInSurface("x", 37, 18, white, transparent, surface, 82);
+		drawStringInSurface("x", 37, 18, white, transparent, transparent, surface, 82);
 		coords = Common::String::format("%04d", 2 * int(_position.x()));
 		for (int i = 0; i < 4; i++)
-			drawStringInSurface(Common::String(coords[i]), 47 + 6*i, 18, white, transparent, surface, 112);
+			drawStringInSurface(Common::String(coords[i]), 47 + 6*i, 18, white, transparent, transparent, surface, 112);
 
-		drawStringInSurface("y", 37, 26, white, transparent, surface, 82);
+		drawStringInSurface("y", 37, 26, white, transparent, transparent, surface, 82);
 		coords = Common::String::format("%04d", 2 * int(_position.z())); // Coords y and z are swapped!
 		for (int i = 0; i < 4; i++)
-			drawStringInSurface(Common::String(coords[i]), 47 + 6*i, 26, white, transparent, surface, 112);
+			drawStringInSurface(Common::String(coords[i]), 47 + 6*i, 26, white, transparent, transparent, surface, 112);
 
-		drawStringInSurface("z", 37, 34, white, transparent, surface, 82);
+		drawStringInSurface("z", 37, 34, white, transparent, transparent, surface, 82);
 		coords = Common::String::format("%04d", 2 * int(_position.y())); // Coords y and z are swapped!
 		for (int i = 0; i < 4; i++)
-			drawStringInSurface(Common::String(coords[i]), 47 + 6*i, 34, white, transparent, surface, 112);
+			drawStringInSurface(Common::String(coords[i]), 47 + 6*i, 34, white, transparent, transparent, surface, 112);
 	}
 
-	drawStringInSurface(_currentArea->_name, 188, 185, yellow, black, surface);
-	drawStringInSurface(Common::String::format("%07d", score), 240, 129, yellow, black, surface);
+	drawStringInSurface(_currentArea->_name, 188, 185, primaryFontColor, secondaryFontColor, black, surface);
+	drawStringInSurface(Common::String::format("%07d", score), 240, 129, primaryFontColor, secondaryFontColor, black, surface);
 
 	int seconds, minutes, hours;
 	getTimeFromCountdown(seconds, minutes, hours);
-	drawStringInSurface(Common::String::format("%02d:", hours), 208, 7, yellow, black, surface);
-	drawStringInSurface(Common::String::format("%02d:", minutes), 230, 7, yellow, black, surface);
-	drawStringInSurface(Common::String::format("%02d", seconds), 254, 7, yellow, black, surface);
+	drawStringInSurface(Common::String::format("%02d:", hours), 208, 7, primaryFontColor, secondaryFontColor, black, surface);
+	drawStringInSurface(Common::String::format("%02d:", minutes), 230, 7, primaryFontColor, secondaryFontColor, black, surface);
+	drawStringInSurface(Common::String::format("%02d", seconds), 254, 7, primaryFontColor, secondaryFontColor, black, surface);
 
 	Common::String message;
 	int deadline;
 	getLatestMessages(message, deadline);
 	if (deadline <= _countdown) {
-		drawStringInSurface(message, 188, 177, black, yellow, surface);
+		drawStringInSurface(message, 188, 177, yellow, secondaryFontColor, black, surface);
 		_temporaryMessages.push_back(message);
 		_temporaryMessageDeadlines.push_back(deadline);
 	} else {
@@ -195,7 +197,7 @@ void DrillerEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
 		else
 			message = _messagesList[1];
 
-		drawStringInSurface(message, 188, 177, yellow, black, surface);
+		drawStringInSurface(message, 188, 177, primaryFontColor, secondaryFontColor, black, surface);
 	}
 
 	int energy = _gameStateVars[k8bitVariableEnergy];


Commit: dd78b253589393561c4d232e29593ffde84d2286
    https://github.com/scummvm/scummvm/commit/dd78b253589393561c4d232e29593ffde84d2286
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-06-01T15:35:29+02:00

Commit Message:
FREESCAPE: improved drawStringInSurface for amiga/atari

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/games/dark/amiga.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 2e5e7619008..96dd5cbbc53 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -924,12 +924,13 @@ void FreescapeEngine::drawStringInSurface(const Common::String &str, int x, int
 		int position = 8 * (multiplier1*(offset + ustr[c] - 32) + 1);
 		for (int j = 0; j < 8; j++) {
 			for (int i = 0; i < 8; i++) {
-				if (_font.get(position + j * multiplier2 + i)) {
-					surface->setPixel(x + 8 - i + 8 * c, y + j, primaryColor);
-				} else if (_font.get(position + j * (multiplier2 / 2) + i)) {
+				if (_font.get(position + j * multiplier2 + i + 8)) {
 					surface->setPixel(x + 8 - i + 8 * c, y + j, secondaryColor);
-				} else
+				} else if (_font.get(position + j * multiplier2 + i)) {
+					surface->setPixel(x + 8 - i + 8 * c, y + j, primaryColor);
+				} else {
 					surface->setPixel(x + 8 - i + 8 * c, y + j, backColor);
+				}
 			}
 		}
 	}
diff --git a/engines/freescape/games/dark/amiga.cpp b/engines/freescape/games/dark/amiga.cpp
index 13f192f6816..e29c252a8fa 100644
--- a/engines/freescape/games/dark/amiga.cpp
+++ b/engines/freescape/games/dark/amiga.cpp
@@ -126,6 +126,7 @@ void DarkEngine::loadAssetsAmigaFullGame() {
 void DarkEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
 	uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0xFF);
 	uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xEE, 0xCC, 0x00);
+	uint32 orange = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xEE, 0x88, 0x00);
 	uint32 red = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xEE, 0x00, 0x00);
 	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
 	uint32 grey = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x60, 0x60, 0x60);
@@ -138,8 +139,8 @@ void DarkEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
 
 	drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 73, 178, red, black, surface);
 	drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 73, 186, red, black, surface);
-	drawStringInSurface(Common::String::format("%07d", score), 93, 16, yellow, black, surface);
-	drawStringInSurface(Common::String::format("%3d%%", ecds), 181, 16, yellow, black, surface);
+	drawStringInSurface(Common::String::format("%07d", score), 93, 16, yellow, orange, black, surface);
+	drawStringInSurface(Common::String::format("%3d%%", ecds), 181, 16, yellow, orange, black, surface);
 
 	Common::String message;
 	int deadline;


Commit: 0cdeebe0cd7206f43cf46a62ce7dd63f7ca539fd
    https://github.com/scummvm/scummvm/commit/0cdeebe0cd7206f43cf46a62ce7dd63f7ca539fd
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-06-01T16:16:42+02:00

Commit Message:
FREESCAPE: enable polygon stipple usage for software renderer

Changed paths:
    engines/freescape/gfx_tinygl.cpp


diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index 372ecd17b62..a38c6e95bf4 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -228,7 +228,7 @@ void TinyGLRenderer::useStipple(bool enabled) {
 		if (_renderMode == Common::kRenderZX  ||
 			_renderMode == Common::kRenderCPC ||
 			_renderMode == Common::kRenderCGA)
-			;//tglPolygonStipple(_variableStippleArray);
+			tglPolygonStipple(_variableStippleArray);
 		/*else
 			tglPolygonStipple(_defaultStippleArray);*/
 	} else {




More information about the Scummvm-git-logs mailing list