[Scummvm-git-logs] scummvm master -> 46c94b7c0513a77ceba6ca1596c56a87f0460e09
yuv422
noreply at scummvm.org
Sat Mar 1 22:53:44 UTC 2025
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:
46c94b7c05 DARKSEED: Fixed printing time in Chinese version.
Commit: 46c94b7c0513a77ceba6ca1596c56a87f0460e09
https://github.com/scummvm/scummvm/commit/46c94b7c0513a77ceba6ca1596c56a87f0460e09
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2025-03-02T09:52:16+11:00
Commit Message:
DARKSEED: Fixed printing time in Chinese version.
Changed paths:
engines/darkseed/big5font.cpp
engines/darkseed/big5font.h
engines/darkseed/darkseed.cpp
diff --git a/engines/darkseed/big5font.cpp b/engines/darkseed/big5font.cpp
index a859b1e38bc..2e2b2d76e38 100644
--- a/engines/darkseed/big5font.cpp
+++ b/engines/darkseed/big5font.cpp
@@ -22,6 +22,8 @@
#include "darkseed/darkseed.h"
#include "darkseed/big5font.h"
+#include "graphics/fonts/dosfont.h"
+
namespace Darkseed {
Big5Font::Big5Font() {
@@ -42,7 +44,10 @@ int Big5Font::getMaxCharWidth() const {
}
int Big5Font::getCharWidth(uint32 chr) const {
- return getMaxCharWidth();
+ if (_big5.hasGlyphForBig5Char(chr)) {
+ return getMaxCharWidth();
+ }
+ return 9;
}
void Big5Font::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const {
@@ -51,6 +56,26 @@ void Big5Font::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32
charPos.x++;
_big5.drawBig5Char(g_engine->_screen->surfacePtr(), chr, charPos, 0xc);
charPos.x += Graphics::Big5Font::kChineseTraditionalWidth + 1;
+ } else if (chr < 128) {
+ drawBiosFontGlyph(chr, x, y, 0xf);
+ drawBiosFontGlyph(chr, x+1, y, 0xc);
+ }
+}
+
+void Big5Font::drawBiosFontGlyph(uint8 chr, int x, int y, uint8 color) const {
+ byte *ptr = (byte *)g_engine->_screen->getBasePtr(x, y);
+ int srcPixel = chr * 8;
+ for (int sy = 0; sy < 8; sy++) {
+ for (int sx = 0; sx < 8; sx++) {
+ if (Graphics::DosFont::fontData_PCBIOS[srcPixel] & 1 << (7 - sx)) {
+ *ptr = color;
+ ptr[g_engine->_screen->pitch] = color;
+ }
+ ptr++;
+ }
+ srcPixel++;
+ ptr -= 8;
+ ptr += (g_engine->_screen->pitch * 2);
}
}
diff --git a/engines/darkseed/big5font.h b/engines/darkseed/big5font.h
index eee97ac3618..d3117092b1f 100644
--- a/engines/darkseed/big5font.h
+++ b/engines/darkseed/big5font.h
@@ -39,6 +39,8 @@ public:
int getMaxCharWidth() const override;
int getCharWidth(uint32 chr) const override;
void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
+private:
+ void drawBiosFontGlyph(uint8 chr, int x, int y, uint8 color) const;
};
} // namespace Darkseed
diff --git a/engines/darkseed/darkseed.cpp b/engines/darkseed/darkseed.cpp
index ca34ce90364..0ddab8ec244 100644
--- a/engines/darkseed/darkseed.cpp
+++ b/engines/darkseed/darkseed.cpp
@@ -1935,8 +1935,13 @@ void DarkseedEngine::lookCode(int objNum) {
void DarkseedEngine::printTime() {
_console->printTosText(958);
int hour = g_engine->_currentTimeInSeconds / 60 / 60 + 1;
- // TODO fix chinese time display
- _console->addToCurrentLine(Common::String::format("%d: %02d %s", hour % 12, (g_engine->_currentTimeInSeconds / 60) % 60, hour < 12 ? "a.m." : "p.m."));
+
+ if (g_engine->getLanguage() == Common::ZH_ANY) {
+ _console->addToCurrentLineU32(convertToU32String(hour < 12 ? "\xa4\x57\xa4\xc8" : "\xa4\x55\xa4\xc8", Common::ZH_ANY));
+ _console->addToCurrentLine(Common::String::format("%d:%02d", hour % 12, (g_engine->_currentTimeInSeconds / 60) % 60));
+ } else {
+ _console->addToCurrentLine(Common::String::format("%d: %02d %s", hour % 12, (g_engine->_currentTimeInSeconds / 60) % 60, hour < 12 ? "a.m." : "p.m."));
+ }
}
void DarkseedEngine::showFullscreenPic(const Common::Path &filename) {
More information about the Scummvm-git-logs
mailing list