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

neuromancer noreply at scummvm.org
Mon Nov 21 21:30:36 UTC 2022


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

Summary:
093142f8b6 FREESCAPE: basic amiga font parsing in driller
a786d9fe8e FREESCAPE: improved ui for amiga/atari driller


Commit: 093142f8b605a0d3f137c94634c0846a71e1f7a3
    https://github.com/scummvm/scummvm/commit/093142f8b605a0d3f137c94634c0846a71e1f7a3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-21T22:23:47+01:00

Commit Message:
FREESCAPE: basic amiga font parsing in driller

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/games/driller.cpp
    engines/freescape/loaders/8bitBinaryLoader.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 8be09bd1b03..e6132435a47 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -602,13 +602,30 @@ void FreescapeEngine::drawStringInSurface(const Common::String &str, int x, int
 		return;
 	Common::String ustr = str;
 	ustr.toUppercase();
-	for (uint32 c = 0; c < ustr.size(); c++) {
-		for (int j = 0; j < 6; j++) {
-			for (int i = 0; i < 8; i++) {
-				if (_font.get(48 * (ustr[c] - 32) + 1 + j * 8 + i))
-					surface->setPixel(x + 8 - i + 8 * c, y + j, fontColor);
-				else
-					surface->setPixel(x + 8 - i + 8 * c, y + j, backColor);
+
+	if (isDOS()) {
+		for (uint32 c = 0; c < ustr.size(); c++) {
+			assert(ustr[c] >= 32);
+			for (int j = 0; j < 6; j++) {
+				for (int i = 0; i < 8; i++) {
+					if (_font.get(48 * (ustr[c] - 32) + 1 + j * 8 + i))
+						surface->setPixel(x + 8 - i + 8 * c, y + j, fontColor);
+					else
+						surface->setPixel(x + 8 - i + 8 * c, y + j, backColor);
+				}
+			}
+		}
+	} else if (isAmiga()) {
+		for (uint32 c = 0; c < ustr.size(); c++) {
+			assert(ustr[c] >= 32);
+			int position = 8 * (33*(ustr[c] - 32) + 1);
+			for (int j = 0; j < 8; j++) {
+				for (int i = 0; i < 8; i++) {
+					if (_font.get(position + j * 32 + i))
+						surface->setPixel(x + 8 - i + 8 * c, y + j, fontColor);
+					else
+						surface->setPixel(x + 8 - i + 8 * c, y + j, backColor);;
+				}
 			}
 		}
 	}
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index 1deea71cdb4..d7548446333 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -263,6 +263,7 @@ void DrillerEngine::loadAssetsFullGame() {
 			}
 			_title = loadAndConvertNeoImage(&file, 0x10, palette);
 
+			loadFonts(&file, 0x8940);
 			loadMessagesFixedSize(&file, 0xc66e, 14, 20);
 			loadGlobalObjects(&file, 0xbd62);
 			load8bitBinary(&file, 0x29c16, 16);
@@ -287,6 +288,7 @@ void DrillerEngine::loadAssetsFullGame() {
 			if (!file.isOpen())
 				error("Failed to open 'driller' executable for Amiga");
 
+			loadFonts(&file, 0xa62);
 			loadMessagesFixedSize(&file, 0x499a, 14, 20);
 			loadGlobalObjects(&file, 0x4098);
 			load8bitBinary(&file, 0x21a3e, 16);
@@ -462,7 +464,12 @@ void DrillerEngine::drawDOSUI(Graphics::Surface *surface) {
 }
 
 void DrillerEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
-	// TODO: this needs to have fonts already parsed
+	uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0x55);
+	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
+
+	int score = _gameStateVars[k8bitVariableScore];
+	drawStringInSurface(_currentArea->_name, 188, 178, yellow, black, surface);
+	drawStringInSurface(Common::String::format("%07d", score), 240, 129, yellow, black, surface);
 }
 
 Math::Vector3d getProjectionToPlane(const Math::Vector3d &vect, const Math::Vector3d normal) {
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index 31ca3b81bce..f3fcdb24285 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -585,11 +585,21 @@ void FreescapeEngine::loadBundledImages() {
 void FreescapeEngine::loadFonts(Common::SeekableReadStream *file, int offset) {
 	file->seek(offset);
 	int charNumber = 60;
-	byte *font = (byte *)malloc(6 * charNumber);
-	file->read(font, 6 * charNumber);
-
-	_font.set_size(48 * charNumber);
-	_font.set_bits((byte *)font);
+	byte *font;
+	if (isDOS()) {
+		font = (byte *)malloc(6 * charNumber);
+		file->read(font, 6 * charNumber);
+
+		_font.set_size(48 * charNumber);
+		_font.set_bits((byte *)font);
+	} else if (isAmiga()) {
+		int fontSize = 4654; // Driller
+		font = (byte *)malloc(fontSize);
+		file->read(font, fontSize);
+
+		_font.set_size(fontSize * 8);
+		_font.set_bits((byte *)font);
+	}
 	_fontLoaded = true;
 	free(font);
 }


Commit: a786d9fe8e7eb5222e0d38267738525279c98cd3
    https://github.com/scummvm/scummvm/commit/a786d9fe8e7eb5222e0d38267738525279c98cd3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-21T22:23:47+01:00

Commit Message:
FREESCAPE: improved ui for amiga/atari driller

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/games/driller.cpp
    engines/freescape/loaders/8bitBinaryLoader.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index e6132435a47..b73dd71738e 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -615,7 +615,7 @@ void FreescapeEngine::drawStringInSurface(const Common::String &str, int x, int
 				}
 			}
 		}
-	} else if (isAmiga()) {
+	} else if (isAmiga() || isAtariST()) {
 		for (uint32 c = 0; c < ustr.size(); c++) {
 			assert(ustr[c] >= 32);
 			int position = 8 * (33*(ustr[c] - 32) + 1);
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index d7548446333..e3e48353bf2 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -186,6 +186,8 @@ void DrillerEngine::loadAssetsDemo() {
 		file.open("driller");
 		if (!file.isOpen())
 			error("Failed to open 'driller' file");
+
+		loadFonts(&file, 0xa30);
 		loadMessagesFixedSize(&file, 0x3960, 14, 20);
 		loadGlobalObjects(&file, 0x3716);
 
@@ -229,6 +231,8 @@ void DrillerEngine::loadAssetsDemo() {
 		file.open("x.prg");
 		if (!file.isOpen())
 			error("Failed to open 'x.prg' file");
+
+		loadFonts(&file, 0x7bc);
 		loadMessagesFixedSize(&file, 0x3b90, 14, 20);
 		loadGlobalObjects(&file, 0x3946);
 
@@ -318,6 +322,7 @@ void DrillerEngine::loadAssetsFullGame() {
 		}
 		_title = loadAndConvertNeoImage(&file, 0x10, palette);
 
+		loadFonts(&file, 0x8a32);
 		loadMessagesFixedSize(&file, 0xc5d8, 14, 20);
 		loadGlobalObjects(&file, 0xbccc);
 		load8bitBinary(&file, 0x29b3c, 16);
@@ -468,8 +473,33 @@ void DrillerEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
 	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
 
 	int score = _gameStateVars[k8bitVariableScore];
-	drawStringInSurface(_currentArea->_name, 188, 178, yellow, black, surface);
+	drawStringInSurface(_currentArea->_name, 188, 185, yellow, black, surface);
 	drawStringInSurface(Common::String::format("%07d", score), 240, 129, yellow, black, surface);
+
+	int hours = _countdown / 3600;
+	drawStringInSurface(Common::String::format("%02d:", hours), 208, 7, yellow, black, surface);
+	int minutes = (_countdown - hours * 3600) / 60;
+	drawStringInSurface(Common::String::format("%02d:", minutes), 230, 7, yellow, black, surface);
+	int seconds = _countdown - hours * 3600 - minutes * 60;
+	drawStringInSurface(Common::String::format("%02d", seconds), 254, 7, yellow, black, surface);
+
+	Common::String message;
+	int deadline;
+	getLatestMessages(message, deadline);
+	if (deadline <= _countdown) {
+		drawStringInSurface(message, 188, 177, black, yellow, surface);
+		_temporaryMessages.push_back(message);
+		_temporaryMessageDeadlines.push_back(deadline);
+	} else {
+		if (_currentArea->_gasPocketRadius == 0)
+			message = _messagesList[2];
+		else if (_drilledAreas[_currentArea->getAreaID()])
+			message = _messagesList[0];
+		else
+			message = _messagesList[1];
+
+		drawStringInSurface(message, 188, 177, yellow, black, surface);
+	}
 }
 
 Math::Vector3d getProjectionToPlane(const Math::Vector3d &vect, const Math::Vector3d normal) {
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index f3fcdb24285..70d53cd0774 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -592,7 +592,7 @@ void FreescapeEngine::loadFonts(Common::SeekableReadStream *file, int offset) {
 
 		_font.set_size(48 * charNumber);
 		_font.set_bits((byte *)font);
-	} else if (isAmiga()) {
+	} else if (isAmiga() || isAtariST()) {
 		int fontSize = 4654; // Driller
 		font = (byte *)malloc(fontSize);
 		file->read(font, fontSize);




More information about the Scummvm-git-logs mailing list