[Scummvm-git-logs] scummvm master -> 11f268f81ca14060bf4ed39ae7146dd2d8e32793

yuv422 noreply at scummvm.org
Fri Jan 24 12:16:38 UTC 2025


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:
b626d5ac16 DARKSEED: Added other korean glyphs. Added korean menu items.
11f268f81c DARKSEED: Clear sound menu item in korean version


Commit: b626d5ac16a95da4aa0893dbe434ad5475d21f98
    https://github.com/scummvm/scummvm/commit/b626d5ac16a95da4aa0893dbe434ad5475d21f98
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2025-01-24T23:14:17+11:00

Commit Message:
DARKSEED: Added other korean glyphs. Added korean menu items.

Changed paths:
    engines/darkseed/console.cpp
    engines/darkseed/kofont.cpp
    engines/darkseed/kofont.h
    engines/darkseed/langtext.cpp
    engines/darkseed/langtext.h
    engines/darkseed/menu.cpp


diff --git a/engines/darkseed/console.cpp b/engines/darkseed/console.cpp
index c3222dfef5c..412a7c42030 100644
--- a/engines/darkseed/console.cpp
+++ b/engines/darkseed/console.cpp
@@ -27,7 +27,7 @@
 
 namespace Darkseed {
 
-static constexpr Common::Rect consoleArea = {{0x70, 279}, 416, 49};
+static constexpr Common::Rect consoleArea = {{0x70, 277}, 416, 51};
 
 Console::Console(TosText *tosText, Sound *sound) : _tosText(tosText), _sound(sound) {
 	switch (g_engine->getLanguage()) {
diff --git a/engines/darkseed/kofont.cpp b/engines/darkseed/kofont.cpp
index 1d7fa97f602..629fd3c62a6 100644
--- a/engines/darkseed/kofont.cpp
+++ b/engines/darkseed/kofont.cpp
@@ -30,10 +30,18 @@ KoFont::KoFont() {
 		error("Error: failed to open k16.bin");
 	}
 
-	loadFontDataSet(_fontDataSet1, 191, fontData);
-	loadFontDataSet(_fontDataSet2, 85, fontData);
-	loadFontDataSet(_fontDataSet3, 109, fontData);
+	loadFontDataSet(_fontDataSet1, 191, 64, fontData);
+	loadFontDataSet(_fontDataSet2, 85, 64, fontData);
+	loadFontDataSet(_fontDataSet3, 109, 64, fontData);
 
+	Common::File fontOthersData;
+	if (!fontOthersData.open("others.bin")) {
+		error("Error: failed to open others.bin");
+	}
+
+	loadFontDataSet(_fontDataSetOther, 20, 32, fontOthersData);
+
+	fontOthersData.close();
 	fontData.close();
 
 	_gameFont = new GameFont();
@@ -43,20 +51,20 @@ KoFont::~KoFont() {
 	delete _gameFont;
 }
 
-void KoFont::loadFontDataSet(Common::Array<Common::Array<uint8> > &dataSet, int size, Common::File &file) {
+void KoFont::loadFontDataSet(Common::Array<Common::Array<uint8> > &dataSet, int size, int packedGlyphSize, Common::File &file) {
 	dataSet.resize(size);
 
 	for (int i = 0; i < size; i++) {
-		dataSet[i].resize(16 * 16, 0);
-		loadFontGlyph(dataSet[i], file);
+		dataSet[i].resize(packedGlyphSize * 4, 0);
+		loadFontGlyph(dataSet[i], packedGlyphSize, file);
 	}
 }
 
 static constexpr uint8 kFontPal[4] = {0, 2, 4, 11};
 
-void KoFont::loadFontGlyph(Common::Array<uint8> &pixels, Common::File &file) {
+void KoFont::loadFontGlyph(Common::Array<uint8> &pixels, int packedGlyphSize, Common::File &file) {
 	// Unpack 2bpp font data into 8bpp
-	for (int i = 0; i < 64; i++) {
+	for (int i = 0; i < packedGlyphSize; i++) {
 		uint8 byte = file.readByte();
 		for (int j = 0; j < 4; j++) {
 			pixels[i * 4 + j] = kFontPal[(byte >> (3 - j) * 2) & 3];
@@ -75,6 +83,9 @@ int KoFont::getMaxCharWidth() const {
 
 int KoFont::getCharWidth(uint32 chr) const {
 	if (chr < 128) {
+		if (getOtherCharIdx(chr) != -1) {
+			return 10;
+		}
 		return _gameFont->getCharWidth(chr);
 	}
 	return getMaxCharWidth();
@@ -192,32 +203,63 @@ void KoFont::extractKoIndexComponents(uint32 charIdx, uint16 *param_2, uint16 *p
 	iVar2 = (charIdx & 31) * 2;
 	uVar5 = (charIdx << 1) >> 5 & 62;
 	uVar4 = (charIdx << 1) >> 10 & 62;
-	uVar1 = SHORT_ARRAY_1000_020a[uVar5/2];
+	uVar1 = SHORT_ARRAY_1000_020a[uVar5 / 2];
 	if (uVar1 > 0) {
-		uVar1 += SHORT_ARRAY_1000_028a[uVar4/2] + SHORT_ARRAY_1000_034a[iVar2/2] - 3;
+		uVar1 += SHORT_ARRAY_1000_028a[uVar4 / 2] + SHORT_ARRAY_1000_034a[iVar2 / 2] - 3;
 	}
-	uVar4 = SHORT_ARRAY_1000_01ca[uVar4/2];
+	uVar4 = SHORT_ARRAY_1000_01ca[uVar4 / 2];
 	if (uVar4 > 0) {
-		uVar4 += SHORT_ARRAY_1000_02ca[uVar5/2] + SHORT_ARRAY_1000_034a[iVar2/2];
+		uVar4 += SHORT_ARRAY_1000_02ca[uVar5 / 2] + SHORT_ARRAY_1000_034a[iVar2 / 2];
 	}
-	uVar3 = SHORT_ARRAY_1000_024a[iVar2/2];
+	uVar3 = SHORT_ARRAY_1000_024a[iVar2 / 2];
 	if (uVar3 > 0) {
-		uVar3 += SHORT_ARRAY_1000_030a[uVar5/2] - 3;
+		uVar3 += SHORT_ARRAY_1000_030a[uVar5 / 2] - 3;
 	}
 	*param_2 = uVar4 >> 5;
 	*param_3 = (uVar1 >> 5) - 2;
 	*param_4 = (uVar3 >> 5) - 2;
 }
 
+int KoFont::getOtherCharIdx(uint32 chr) const {
+	switch (chr) {
+	case '!':
+		return 2;
+	case '"':
+		return 6;
+	case '(':
+		return 3;
+	case ')':
+		return 4;
+	case ',':
+		return 0;
+	case '.':
+		return 1;
+	case '?':
+		return 5;
+	default:
+		break;
+	}
+	return -1;
+}
+
+void KoFont::drawOtherGlyph(Graphics::Surface *dst, uint8 chr, int x, int y) const {
+	g_engine->_screen->copyRectToSurfaceWithKey(_fontDataSetOther[chr].data(), 8, x, y, 8, 16,0xf);
+}
+
 void KoFont::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const {
 	if (chr < 128) {
-		_gameFont->drawChar(dst, chr, x, y, color);
+		int otherCharIdx = getOtherCharIdx(chr);
+		if (otherCharIdx != -1) {
+			drawOtherGlyph(dst, (uint8)otherCharIdx, x, y);
+		} else {
+			_gameFont->drawChar(dst, chr, x, y, color);
+		}
 		return;
 	}
 	uint8 pixels[256];
 	memset(pixels, 0, 256);
 	createGlyph(pixels, chr);
-	g_engine->_screen->copyRectToSurfaceWithKey(pixels, 16, x, y, 16, 16,0xf);
+	g_engine->_screen->copyRectToSurfaceWithKey(pixels, 16, x, y - 2, 16, 16,0xf);
 }
 
 
diff --git a/engines/darkseed/kofont.h b/engines/darkseed/kofont.h
index 7cb954fbbe6..f7b12cb0c94 100644
--- a/engines/darkseed/kofont.h
+++ b/engines/darkseed/kofont.h
@@ -33,6 +33,8 @@ private:
 	Common::Array<Common::Array<uint8>> _fontDataSet1;
 	Common::Array<Common::Array<uint8>> _fontDataSet2;
 	Common::Array<Common::Array<uint8>> _fontDataSet3;
+	Common::Array<Common::Array<uint8>> _fontDataSetOther;
+
 	GameFont *_gameFont;
 
 public:
@@ -45,13 +47,15 @@ public:
 	void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
 
 private:
-	void loadFontDataSet(Common::Array<Common::Array<uint8>> &dataSet, int size, Common::File &file);
-	void loadFontGlyph(Common::Array<uint8> &pixels, Common::File &file);
+	void loadFontDataSet(Common::Array<Common::Array<uint8>> &dataSet, int size, int packedGlyphSize, Common::File &file);
+	void loadFontGlyph(Common::Array<uint8> &pixels, int packedGlyphSize, Common::File &file);
 
 	void createGlyph(uint8 *pixels, uint32 chr) const;
 	void addToGlyph(uint8 *destPixels, int16 index) const;
 	void addPixels(uint8 *destPixels, const Common::Array<uint8> &pixels) const;
 	void extractKoIndexComponents(uint32 charIdx, uint16 *param_2, uint16 *param_3, uint16 *param_4) const;
+	int getOtherCharIdx(uint32 chr) const;
+	void drawOtherGlyph(Graphics::Surface *dst, uint8 chr, int x, int y) const;
 };
 
 } // namespace Darkseed
diff --git a/engines/darkseed/langtext.cpp b/engines/darkseed/langtext.cpp
index e6e7526c896..8bb28ef117b 100644
--- a/engines/darkseed/langtext.cpp
+++ b/engines/darkseed/langtext.cpp
@@ -38,8 +38,34 @@ const TextWithPosition &getI18NTextWithPosition(const I18NTextWithPosition &i18n
 	case Common::ES_ESP : return i18nTextWithPosition.es;
 	case Common::FR_FRA : return i18nTextWithPosition.fr;
 	case Common::DE_DEU : return i18nTextWithPosition.de;
+	case Common::KO_KOR : return i18nTextWithPosition.ko;
 	default : return i18nTextWithPosition.en;
 	}
 }
 
+Common::U32String convertToU32String(const char *text, Common::Language language) {
+	uint len = strlen(text);
+	switch (language) {
+	case Common::ZH_ANY:
+	case Common::KO_KOR: {
+		Common::U32String str;
+		for (int i = 0; i < len; i++) {
+			uint8 byte = text[i];
+			if (byte & 0x80) {
+				if (i < len - 1) {
+					uint8 byte2 = text[i + 1];
+					str += (int)byte << 8 | byte2;
+					i++;
+				}
+			} else {
+				str += byte;
+			}
+		}
+		return str;
+	}
+	default : break;
+	}
+	return Common::U32String(text);
+}
+
 } // End of namespace Darkseed
diff --git a/engines/darkseed/langtext.h b/engines/darkseed/langtext.h
index 0ff9dfa93a3..c514d45c6a5 100644
--- a/engines/darkseed/langtext.h
+++ b/engines/darkseed/langtext.h
@@ -22,6 +22,8 @@
 #ifndef DARKSEED_LANGTEXT_H
 #define DARKSEED_LANGTEXT_H
 
+#include "common/language.h"
+
 namespace Darkseed {
 
 struct I18nText {
@@ -42,11 +44,15 @@ struct I18NTextWithPosition {
 	const TextWithPosition es;
 	const TextWithPosition fr;
 	const TextWithPosition de;
+	const TextWithPosition ko;
+
 };
 
 const char *getI18NText(const I18nText &text);
 const TextWithPosition &getI18NTextWithPosition(const I18NTextWithPosition &i18nTextWithPosition);
 
+Common::U32String convertToU32String(const char *text, Common::Language language);
+
 constexpr I18nText kI18N_CarKeysIgnitionText = {
 	"You see the car keys in the ignition.",
 	"VES LAS LLAVES DEL COCHE EN EL CONTACTO.",
diff --git a/engines/darkseed/menu.cpp b/engines/darkseed/menu.cpp
index e32f35d8dd9..8bad869940c 100644
--- a/engines/darkseed/menu.cpp
+++ b/engines/darkseed/menu.cpp
@@ -31,47 +31,53 @@ constexpr I18NTextWithPosition kMenu_load = {
 	{127, 62, "Load"},
 	{119, 62, "CARGAR"},
 	{118, 62, "CHARGER"},
-	{121, 62, "LADEN"}
+	{121, 62, "LADEN"},
+	{120, 62, "\xA6\x89\x9C\xE1\x90\x91"}
 };
 
 constexpr I18NTextWithPosition kMenu_silent = {
 	{123, 136, "Silent"},
 	{115, 136, "SIN SON"},
 	{118, 136, "SILENCE"},
-	{129, 136, "RUHE"}
+	{129, 136, "RUHE"},
+	{121, 136, "\xB7q\xAD\xA1\x88\xE1"}
 };
 
 constexpr I18NTextWithPosition kMenu_sounds = {
 	{117, 136, "Sounds"},
 	{121, 136, "SONIDO"},
 	{126, 136, "SONS"},
-	{123, 136, "SOUND"}
+	{123, 136, "SOUND"},
+	{128, 136, "\xB7q\xD0\xB7"}
 };
 
 constexpr I18NTextWithPosition kMenu_save = {
 	{127, 99, "Save"},
 	{119, 99, "GRABAR"},
 	{121, 99, "SAUVER"},
-	{115, 99, "SICHERN"}
+	{115, 99, "SICHERN"},
+	{128, 99, "\xB8\xE1\xB8w"}
 };
 
 constexpr I18NTextWithPosition kMenu_resume = {
 	{118, 173, "Resume"},
 	{122, 173, "SEQUIR"},
 	{124, 173, "JOUER"},
-	{118, 173, "WEITER"}
+	{118, 173, "WEITER"},
+	{128, 173, "\xA5\xA2\x8A\xE1"}
 };
 
 constexpr I18NTextWithPosition kMenu_quit = {
 	{129, 210, "Quit"},
 	{125, 210, "SALIR"},
 	{117, 210, "QUITTER"},
-	{129, 210, "ENDE"}
+	{129, 210, "ENDE"},
+	{119, 210, "\x8F{\xA0""a\xC3\xB1"}
 };
 
 void drawMenuItem(const I18NTextWithPosition &menuText) {
 	const TextWithPosition &textWithPosition = getI18NTextWithPosition(menuText);
-	g_engine->_console->drawStringAt(textWithPosition.x, textWithPosition.y, Common::U32String(textWithPosition.text));
+	g_engine->_console->drawStringAt(textWithPosition.x, textWithPosition.y, convertToU32String(textWithPosition.text, g_engine->getLanguage()));
 }
 
 void Menu::drawSoundMenuItem() {


Commit: 11f268f81ca14060bf4ed39ae7146dd2d8e32793
    https://github.com/scummvm/scummvm/commit/11f268f81ca14060bf4ed39ae7146dd2d8e32793
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2025-01-24T23:14:17+11:00

Commit Message:
DARKSEED: Clear sound menu item in korean version

Changed paths:
    engines/darkseed/menu.cpp


diff --git a/engines/darkseed/menu.cpp b/engines/darkseed/menu.cpp
index 8bad869940c..79990953e69 100644
--- a/engines/darkseed/menu.cpp
+++ b/engines/darkseed/menu.cpp
@@ -81,7 +81,7 @@ void drawMenuItem(const I18NTextWithPosition &menuText) {
 }
 
 void Menu::drawSoundMenuItem() {
-	g_engine->_screen->fillRect({{115, 136}, 62, 11}, 0);
+	g_engine->_screen->fillRect({{115, 136}, 62, 13}, 0);
 	if (g_engine->_sound->isMuted()) {
 		drawMenuItem(kMenu_silent);
 	} else {




More information about the Scummvm-git-logs mailing list