[Scummvm-git-logs] scummvm master -> a528254ab8372eb2f8212559927b9663a5dd0f48
Marisa-Chan
noreply at scummvm.org
Wed Mar 11 04:06:07 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
dfa954227b ZVISION: Convert text variables and fields to Unicode as it's in original game engine.
a528254ab8 ZVISION: Add support for RU version of Grand Inquisitor
Commit: dfa954227b3cfe39e00d74b28ebc871d91c6e666
https://github.com/scummvm/scummvm/commit/dfa954227b3cfe39e00d74b28ebc871d91c6e666
Author: Marisa-Chan (thunder_8888 at mail.ru)
Date: 2026-03-11T11:05:56+07:00
Commit Message:
ZVISION: Convert text variables and fields to Unicode as it's in original game engine.
Changed paths:
engines/zvision/core/events.cpp
engines/zvision/scripting/effects/ttytext_effect.cpp
engines/zvision/scripting/effects/ttytext_effect.h
engines/zvision/text/string_manager.cpp
engines/zvision/text/string_manager.h
engines/zvision/text/subtitle_manager.cpp
engines/zvision/text/subtitle_manager.h
engines/zvision/text/text.cpp
engines/zvision/text/text.h
engines/zvision/text/truetype_font.cpp
engines/zvision/text/truetype_font.h
diff --git a/engines/zvision/core/events.cpp b/engines/zvision/core/events.cpp
index efb1ed4bca3..086a84b33d6 100644
--- a/engines/zvision/core/events.cpp
+++ b/engines/zvision/core/events.cpp
@@ -74,11 +74,11 @@ void ZVision::cheatCodes(uint8 key) {
if (getGameId() == GID_GRANDINQUISITOR) {
if (checkCode("IMNOTDEAF")) {
// Unknown cheat
- _subtitleManager->showDebugMsg(Common::String::format("IMNOTDEAF cheat or debug, not implemented"));
+ _subtitleManager->showDebugMsg(Common::U32String::format("IMNOTDEAF cheat or debug, not implemented"));
}
if (checkCode("3100OPB")) {
- _subtitleManager->showDebugMsg(Common::String::format("Current location: %c%c%c%c",
+ _subtitleManager->showDebugMsg(Common::U32String::format("Current location: %c%c%c%c",
_scriptManager->getStateValue(StateKey_World),
_scriptManager->getStateValue(StateKey_Room),
_scriptManager->getStateValue(StateKey_Node),
@@ -105,7 +105,7 @@ void ZVision::cheatCodes(uint8 key) {
}
if (checkCode("77MASSAVE")) {
- _subtitleManager->showDebugMsg(Common::String::format("Current location: %c%c%c%c",
+ _subtitleManager->showDebugMsg(Common::U32String::format("Current location: %c%c%c%c",
_scriptManager->getStateValue(StateKey_World),
_scriptManager->getStateValue(StateKey_Room),
_scriptManager->getStateValue(StateKey_Node),
@@ -134,12 +134,11 @@ void ZVision::cheatCodes(uint8 key) {
}
if (checkCode("FRAME")) {
- Common::String fpsStr = Common::String::format("FPS: %d", getFPS());
- _subtitleManager->showDebugMsg(fpsStr);
+ _subtitleManager->showDebugMsg(Common::U32String::format("FPS: %d", getFPS()));
}
if (checkCode("COMPUTERARCH"))
- _subtitleManager->showDebugMsg("COMPUTERARCH: var-viewer not implemented");
+ _subtitleManager->showDebugMsg(Common::U32String("COMPUTERARCH: var-viewer not implemented"));
// This cheat essentially toggles the GOxxxx cheat below
if (checkCode("XYZZY"))
@@ -241,8 +240,7 @@ void ZVision::processEvents() {
break;
case kZVisionActionShowFPS: {
- Common::String fpsStr = Common::String::format("FPS: %d", getFPS());
- _subtitleManager->showDebugMsg(fpsStr);
+ _subtitleManager->showDebugMsg(Common::U32String::format("FPS: %d", getFPS()));
}
break;
default:
diff --git a/engines/zvision/scripting/effects/ttytext_effect.cpp b/engines/zvision/scripting/effects/ttytext_effect.cpp
index 1d2c9a81262..4b780cb0e59 100644
--- a/engines/zvision/scripting/effects/ttytext_effect.cpp
+++ b/engines/zvision/scripting/effects/ttytext_effect.cpp
@@ -59,7 +59,7 @@ ttyTextNode::ttyTextNode(ZVision *engine, uint32 key, const Common::Path &file,
_isRTL = Common::convertBiDiU32String(_txtbuf).visual != _txtbuf;
_img.create(_r.width(), _r.height(), _engine->_resourcePixelFormat);
_state._sharp = true;
- _state.readAllStyles(_txtbuf.encode());
+ _state.readAllStyles(_txtbuf);
_state.updateFontWithTextState(_fnt);
_engine->getScriptManager()->setStateValue(_key, 1);
}
@@ -180,7 +180,7 @@ void ttyTextNode::newline() {
_startX = _dx;
}
-void ttyTextNode::outchar(uint16 chr) {
+void ttyTextNode::outchar(uint32 chr) {
uint32 clr = _engine->_resourcePixelFormat.RGBToColor(_state._red, _state._green, _state._blue);
if (_dx + _fnt.getCharWidth(chr) > _r.width())
diff --git a/engines/zvision/scripting/effects/ttytext_effect.h b/engines/zvision/scripting/effects/ttytext_effect.h
index add5ef97e07..da2cd4f4621 100644
--- a/engines/zvision/scripting/effects/ttytext_effect.h
+++ b/engines/zvision/scripting/effects/ttytext_effect.h
@@ -66,7 +66,7 @@ private:
void newline();
void scroll();
- void outchar(uint16 chr);
+ void outchar(uint32 chr);
};
} // End of namespace ZVision
diff --git a/engines/zvision/text/string_manager.cpp b/engines/zvision/text/string_manager.cpp
index 4e5a2583d1a..38952d7ea86 100644
--- a/engines/zvision/text/string_manager.cpp
+++ b/engines/zvision/text/string_manager.cpp
@@ -31,6 +31,7 @@
namespace ZVision {
StringManager::StringManager(ZVision *engine) {
+ _engine = engine;
}
StringManager::~StringManager() {
@@ -51,14 +52,14 @@ void StringManager::loadStrFile(const Common::Path &fileName) {
uint lineNumber = 0;
while (!file.eos()) {
- _lines[lineNumber] = readWideLine(file).encode();
+ _lines[lineNumber] = readWideLine(file);
lineNumber++;
assert(lineNumber <= NUM_TEXT_LINES);
}
}
-const Common::String StringManager::getTextLine(uint stringNumber) {
+const Common::U32String StringManager::getTextLine(uint stringNumber) {
return _lines[stringNumber];
}
diff --git a/engines/zvision/text/string_manager.h b/engines/zvision/text/string_manager.h
index b1f6170342c..2e1ba80d4ac 100644
--- a/engines/zvision/text/string_manager.h
+++ b/engines/zvision/text/string_manager.h
@@ -51,11 +51,12 @@ private:
};
private:
- Common::String _lines[NUM_TEXT_LINES];
+ Common::U32String _lines[NUM_TEXT_LINES];
+ ZVision *_engine;
public:
void initialize(ZVisionGameId gameId);
- const Common::String getTextLine(uint stringNumber);
+ const Common::U32String getTextLine(uint stringNumber);
private:
void loadStrFile(const Common::Path &fileName);
diff --git a/engines/zvision/text/subtitle_manager.cpp b/engines/zvision/text/subtitle_manager.cpp
index ee44da8f1d5..ba77bb64747 100644
--- a/engines/zvision/text/subtitle_manager.cpp
+++ b/engines/zvision/text/subtitle_manager.cpp
@@ -116,9 +116,12 @@ uint16 SubtitleManager::create(const Common::Path &subname, Audio::SoundHandle h
return _subId;
}
-uint16 SubtitleManager::create(const Common::String &str) {
+uint16 SubtitleManager::create(const Common::U32String &str) {
_subId++;
- debugC(2, kDebugSubtitle, "Creating simple subtitle, subId=%d, message %s", _subId, str.c_str());
+ if (debugChannelSet(2, kDebugSubtitle)) {
+ const Common::String utf8str = str.encode();
+ debugC(2, kDebugSubtitle, "Creating simple subtitle, subId=%d, message %s", _subId, utf8str.c_str());
+ }
_subsList[_subId] = new Subtitle(_engine, str, _textArea);
_subsFocus.set(_subId);
return _subId;
@@ -138,17 +141,23 @@ void SubtitleManager::destroy(uint16 id, int16 delay) {
}
}
-void SubtitleManager::timedMessage(const Common::String &str, uint16 milsecs) {
+void SubtitleManager::timedMessage(const Common::U32String &str, uint16 milsecs) {
uint16 msgid = create(str);
- debugC(1, kDebugSubtitle, "initiating timed message: %s to subtitle id %d, time %d", str.c_str(), msgid, milsecs);
+ if (debugChannelSet(1, kDebugSubtitle)) {
+ const Common::String utf8str = str.encode();
+ debugC(1, kDebugSubtitle, "initiating timed message: %s to subtitle id %d, time %d", utf8str.c_str(), msgid, milsecs);
+ }
update(0, msgid);
process(0);
destroy(msgid, milsecs);
}
-bool SubtitleManager::askQuestion(const Common::String &str, bool streaming, bool safeDefault) {
+bool SubtitleManager::askQuestion(const Common::U32String &str, bool streaming, bool safeDefault) {
uint16 msgid = create(str);
- debugC(1, kDebugSubtitle, "initiating user question: %s to subtitle id %d", str.c_str(), msgid);
+ if (debugChannelSet(1, kDebugSubtitle)) {
+ const Common::String utf8str = str.encode();
+ debugC(1, kDebugSubtitle, "initiating user question: %s to subtitle id %d", utf8str.c_str(), msgid);
+ }
update(0, msgid);
process(0);
if(streaming)
@@ -225,9 +234,12 @@ bool SubtitleManager::askQuestion(const Common::String &str, bool streaming, boo
return result == 2;
}
-void SubtitleManager::delayedMessage(const Common::String &str, uint16 milsecs) {
+void SubtitleManager::delayedMessage(const Common::U32String &str, uint16 milsecs) {
uint16 msgid = create(str);
- debugC(1, kDebugSubtitle, "initiating delayed message: %s to subtitle id %d, delay %dms", str.c_str(), msgid, milsecs);
+ if (debugChannelSet(1, kDebugSubtitle)) {
+ const Common::String utf8str = str.encode();
+ debugC(1, kDebugSubtitle, "initiating delayed message: %s to subtitle id %d, delay %dms", utf8str.c_str(), msgid, milsecs);
+ }
update(0, msgid);
process(0);
_renderManager->renderSceneToScreen(true);
@@ -275,9 +287,12 @@ void SubtitleManager::delayedMessage(const Common::String &str, uint16 milsecs)
_engine->startClock();
}
-void SubtitleManager::showDebugMsg(const Common::String &msg, int16 delay) {
+void SubtitleManager::showDebugMsg(const Common::U32String &msg, int16 delay) {
uint16 msgid = create(msg);
- debugC(1, kDebugSubtitle, "initiating in-game debug message: %s to subtitle id %d, delay %dms", msg.c_str(), msgid, delay);
+ if (debugChannelSet(1, kDebugSubtitle)) {
+ const Common::String utf8msg = msg.encode();
+ debugC(1, kDebugSubtitle, "initiating in-game debug message: %s to subtitle id %d, delay %dms", utf8msg.c_str(), msgid, delay);
+ }
update(0, msgid);
process(0);
destroy(msgid, delay);
@@ -320,11 +335,10 @@ Subtitle::Subtitle(ZVision *engine, const Common::Path &subname, bool vob) :
Common::File txtFile;
if (txtFile.open(Common::Path(filename))) {
while (!txtFile.eos()) {
- Common::String txtline = readWideLine(txtFile).encode();
Line curLine;
curLine.start = -1;
curLine.stop = -1;
- curLine.subStr = txtline;
+ curLine.subStr = readWideLine(txtFile);
_lines.push_back(curLine);
}
txtFile.close();
@@ -352,7 +366,7 @@ Subtitle::Subtitle(ZVision *engine, const Common::Path &subname, bool vob) :
subFile.close();
}
-Subtitle::Subtitle(ZVision *engine, const Common::String &str, const Common::Rect &textArea) :
+Subtitle::Subtitle(ZVision *engine, const Common::U32String &str, const Common::Rect &textArea) :
_engine(engine),
_lineId(-1),
_timer(-1),
diff --git a/engines/zvision/text/subtitle_manager.h b/engines/zvision/text/subtitle_manager.h
index 216ec256a11..b3d254e00b5 100644
--- a/engines/zvision/text/subtitle_manager.h
+++ b/engines/zvision/text/subtitle_manager.h
@@ -34,7 +34,7 @@ class Subtitle {
friend class SubtitleManager;
public:
Subtitle(ZVision *engine, const Common::Path &subname, bool vob = false); // For scripted subtitles
- Subtitle(ZVision *engine, const Common::String &str, const Common::Rect &textArea); // For other text messages
+ Subtitle(ZVision *engine, const Common::U32String &str, const Common::Rect &textArea); // For other text messages
virtual ~Subtitle();
bool update(int32 count); // Return true if necessary to redraw
virtual bool selfUpdate() {
@@ -53,7 +53,7 @@ protected:
struct Line {
int start;
int stop;
- Common::String subStr;
+ Common::U32String subStr;
};
// NB: start & stop do not always use the same units between different instances of this struct!
// Sound effect & music subtitles use milliseconds
@@ -111,16 +111,16 @@ public:
// Create subtitle object and return ID
uint16 create(const Common::Path &subname, bool vob = false);
uint16 create(const Common::Path &subname, Audio::SoundHandle handle); // NB this creates an automatic subtitle
- uint16 create(const Common::String &str);
+ uint16 create(const Common::U32String &str);
// Delete subtitle object by ID
void destroy(uint16 id);
void destroy(uint16 id, int16 delay);
- bool askQuestion(const Common::String &str, bool streaming = false, bool safeDefault = false);
- void delayedMessage(const Common::String &str, uint16 milsecs);
- void timedMessage(const Common::String &str, uint16 milsecs);
- void showDebugMsg(const Common::String &msg, int16 delay = 3000);
+ bool askQuestion(const Common::U32String &str, bool streaming = false, bool safeDefault = false);
+ void delayedMessage(const Common::U32String &str, uint16 milsecs);
+ void timedMessage(const Common::U32String &str, uint16 milsecs);
+ void showDebugMsg(const Common::U32String &msg, int16 delay = 3000);
};
}
diff --git a/engines/zvision/text/text.cpp b/engines/zvision/text/text.cpp
index 3f6368f57c6..aec7addabd6 100644
--- a/engines/zvision/text/text.cpp
+++ b/engines/zvision/text/text.cpp
@@ -234,7 +234,7 @@ TextChange TextStyleState::parseStyle(const Common::String &str, int16 len) {
return (TextChange)retval;
}
-void TextStyleState::readAllStyles(const Common::String &txt) {
+void TextStyleState::readAllStyles(const Common::U32String &txt) {
int16 startTextPosition = -1;
int16 endTextPosition = -1;
@@ -245,7 +245,7 @@ void TextStyleState::readAllStyles(const Common::String &txt) {
endTextPosition = i;
if (startTextPosition != -1) {
if ((endTextPosition - startTextPosition - 1) > 0) {
- parseStyle(Common::String(txt.c_str() + startTextPosition + 1), endTextPosition - startTextPosition - 1);
+ parseStyle(Common::U32String(txt.c_str() + startTextPosition + 1).encode(), endTextPosition - startTextPosition - 1);
}
}
}
@@ -275,7 +275,7 @@ void TextStyleState::updateFontWithTextState(StyledTTFont &font) {
font.loadFont(_fontname, _size, tempStyle);
}
-void TextRenderer::drawTextWithJustification(const Common::String &text, StyledTTFont &font, uint32 color, Graphics::Surface &dest, int lineY, TextJustification justify) {
+void TextRenderer::drawTextWithJustification(const Common::U32String &text, StyledTTFont &font, uint32 color, Graphics::Surface &dest, int lineY, TextJustification justify) {
switch (justify) {
case TEXT_JUSTIFY_LEFT :
font.drawString(&dest, text, 0, lineY, dest.w, color, Graphics::kTextAlignLeft);
@@ -289,7 +289,7 @@ void TextRenderer::drawTextWithJustification(const Common::String &text, StyledT
}
}
-int32 TextRenderer::drawText(const Common::String &text, TextStyleState &state, Graphics::Surface &dest) {
+int32 TextRenderer::drawText(const Common::U32String &text, TextStyleState &state, Graphics::Surface &dest) {
StyledTTFont font(_engine);
state.updateFontWithTextState(font);
@@ -311,7 +311,7 @@ struct TextSurface {
uint _lineNumber;
};
-void TextRenderer::drawTextWithWordWrapping(const Common::String &text, Graphics::Surface &dest, bool blackFrame) {
+void TextRenderer::drawTextWithWordWrapping(const Common::U32String &text, Graphics::Surface &dest, bool blackFrame) {
Common::Array<TextSurface> textSurfaces;
Common::Array<uint> lineWidths;
Common::Array<TextJustification> lineJustifications;
@@ -323,8 +323,8 @@ void TextRenderer::drawTextWithWordWrapping(const Common::String &text, Graphics
StyledTTFont font(_engine);
currentState.updateFontWithTextState(font);
- Common::String currentSentence; // Not a true 'grammatical' sentence. Rather, it's just a collection of words
- Common::String currentWord;
+ Common::U32String currentSentence; // Not a true 'grammatical' sentence. Rather, it's just a collection of words
+ Common::U32String currentWord;
int sentenceWidth = 0;
int wordWidth = 0;
int lineWidth = 0;
@@ -364,7 +364,7 @@ void TextRenderer::drawTextWithWordWrapping(const Common::String &text, Graphics
uint stateChanges = 0u;
if ((endTextPosition - startTextPosition - 1) > 0) {
- stateChanges = currentState.parseStyle(Common::String(text.c_str() + startTextPosition + 1), endTextPosition - startTextPosition - 1);
+ stateChanges = currentState.parseStyle(Common::U32String(text.c_str() + startTextPosition + 1), endTextPosition - startTextPosition - 1);
}
if (stateChanges & (TEXT_CHANGE_FONT_TYPE | TEXT_CHANGE_FONT_STYLE)) {
@@ -410,7 +410,7 @@ void TextRenderer::drawTextWithWordWrapping(const Common::String &text, Graphics
lineJustifications.push_back(currentState._justification);
}
if (stateChanges & TEXT_CHANGE_HAS_STATE_BOX) {
- Common::String temp = Common::String::format("%d", _engine->getScriptManager()->getStateValue(currentState._statebox));
+ Common::U32String temp = Common::U32String::format("%d", _engine->getScriptManager()->getStateValue(currentState._statebox));
wordWidth += font.getStringWidth(temp);
// If the word causes the line to overflow, render the sentence and start a new line
diff --git a/engines/zvision/text/text.h b/engines/zvision/text/text.h
index a04f694c985..f309543ba70 100644
--- a/engines/zvision/text/text.h
+++ b/engines/zvision/text/text.h
@@ -48,7 +48,7 @@ class TextStyleState {
public:
TextStyleState();
TextChange parseStyle(const Common::String &str, int16 len);
- void readAllStyles(const Common::String &txt);
+ void readAllStyles(const Common::U32String &txt);
void updateFontWithTextState(StyledTTFont &font);
uint32 getTextColor(ZVision *engine) {
@@ -74,9 +74,9 @@ class TextRenderer {
public:
TextRenderer(ZVision *engine): _engine(engine) {};
- void drawTextWithJustification(const Common::String &text, StyledTTFont &font, uint32 color, Graphics::Surface &dest, int lineY, TextJustification jusification);
- int32 drawText(const Common::String &text, TextStyleState &state, Graphics::Surface &dest);
- void drawTextWithWordWrapping(const Common::String &text, Graphics::Surface &dest, bool blackFrame = false);
+ void drawTextWithJustification(const Common::U32String &text, StyledTTFont &font, uint32 color, Graphics::Surface &dest, int lineY, TextJustification jusification);
+ int32 drawText(const Common::U32String &text, TextStyleState &state, Graphics::Surface &dest);
+ void drawTextWithWordWrapping(const Common::U32String &text, Graphics::Surface &dest, bool blackFrame = false);
private:
ZVision *_engine;
diff --git a/engines/zvision/text/truetype_font.cpp b/engines/zvision/text/truetype_font.cpp
index 7a342596f38..66dcc1fbe2a 100644
--- a/engines/zvision/text/truetype_font.cpp
+++ b/engines/zvision/text/truetype_font.cpp
@@ -145,7 +145,7 @@ int StyledTTFont::getMaxCharWidth() {
return 0;
}
-int StyledTTFont::getCharWidth(uint16 chr) {
+int StyledTTFont::getCharWidth(uint32 chr) {
if (_font)
return _font->getCharWidth(chr);
@@ -159,7 +159,7 @@ int StyledTTFont::getKerningOffset(byte left, byte right) {
return 0;
}
-void StyledTTFont::drawChar(Graphics::Surface *dst, uint16 chr, int x, int y, uint32 color) {
+void StyledTTFont::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) {
if (_font) {
_font->drawChar(dst, chr, x, y, color);
if (_style & TTF_STYLE_UNDERLINE) {
@@ -175,13 +175,12 @@ void StyledTTFont::drawChar(Graphics::Surface *dst, uint16 chr, int x, int y, ui
}
}
-void StyledTTFont::drawString(Graphics::Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, Graphics::TextAlign align) {
+void StyledTTFont::drawString(Graphics::Surface *dst, const Common::U32String &str, int x, int y, int w, uint32 color, Graphics::TextAlign align) {
if (_font) {
- Common::U32String u32str = Common::convertUtf8ToUtf32(str);
- _font->drawString(dst, Common::convertBiDiU32String(u32str).visual, x, y, w, color, align);
+ _font->drawString(dst, Common::convertBiDiU32String(str).visual, x, y, w, color, align);
if (_style & TTF_STYLE_UNDERLINE) {
int16 pos = (int16)floor(_font->getFontHeight() * 0.87);
- int16 wd = MIN(_font->getStringWidth(u32str), w);
+ int16 wd = MIN(_font->getStringWidth(str), w);
int16 stX = x;
if (align == Graphics::kTextAlignCenter)
stX += (w - wd) / 2;
@@ -194,7 +193,7 @@ void StyledTTFont::drawString(Graphics::Surface *dst, const Common::String &str,
}
if (_style & TTF_STYLE_STRIKETHROUGH) {
int16 pos = (int16)floor(_font->getFontHeight() * 0.60);
- int16 wd = MIN(_font->getStringWidth(u32str), w);
+ int16 wd = MIN(_font->getStringWidth(str), w);
int16 stX = x;
if (align == Graphics::kTextAlignCenter)
stX += (w - wd) / 2;
@@ -208,13 +207,13 @@ void StyledTTFont::drawString(Graphics::Surface *dst, const Common::String &str,
}
}
-int StyledTTFont::getStringWidth(const Common::String &str) {
+int StyledTTFont::getStringWidth(const Common::U32String &str) {
if (_font)
return _font->getStringWidth(str);
return 0;
}
-Graphics::Surface *StyledTTFont::renderSolidText(const Common::String &str, uint32 color) {
+Graphics::Surface *StyledTTFont::renderSolidText(const Common::U32String &str, uint32 color) {
Graphics::Surface *tmp = new Graphics::Surface;
if (_font) {
int16 w = _font->getStringWidth(str);
diff --git a/engines/zvision/text/truetype_font.h b/engines/zvision/text/truetype_font.h
index 28b5b391403..fafa8e1e0af 100644
--- a/engines/zvision/text/truetype_font.h
+++ b/engines/zvision/text/truetype_font.h
@@ -69,15 +69,15 @@ public:
int getFontHeight();
int getMaxCharWidth();
- int getCharWidth(uint16 chr);
+ int getCharWidth(uint32 chr);
int getKerningOffset(byte left, byte right);
- void drawChar(Graphics::Surface *dst, uint16 chr, int x, int y, uint32 color);
+ void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color);
- void drawString(Graphics::Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft);
- int getStringWidth(const Common::String &str);
+ void drawString(Graphics::Surface *dst, const Common::U32String &str, int x, int y, int w, uint32 color, Graphics::TextAlign align = Graphics::kTextAlignLeft);
+ int getStringWidth(const Common::U32String &str);
- Graphics::Surface *renderSolidText(const Common::String &str, uint32 color);
+ Graphics::Surface *renderSolidText(const Common::U32String &str, uint32 color);
bool isLoaded() {
return _font != NULL;
Commit: a528254ab8372eb2f8212559927b9663a5dd0f48
https://github.com/scummvm/scummvm/commit/a528254ab8372eb2f8212559927b9663a5dd0f48
Author: Marisa-Chan (thunder_8888 at mail.ru)
Date: 2026-03-11T11:05:56+07:00
Commit Message:
ZVISION: Add support for RU version of Grand Inquisitor
Changed paths:
engines/zvision/detection_tables.h
engines/zvision/scripting/effects/ttytext_effect.cpp
engines/zvision/text/string_manager.cpp
engines/zvision/text/subtitle_manager.cpp
engines/zvision/text/text.cpp
engines/zvision/text/text.h
diff --git a/engines/zvision/detection_tables.h b/engines/zvision/detection_tables.h
index bb56fe3dff0..fb85da8eee6 100644
--- a/engines/zvision/detection_tables.h
+++ b/engines/zvision/detection_tables.h
@@ -257,6 +257,21 @@ static const ZVisionGameDescription gameDescriptions[] = {
GID_GRANDINQUISITOR
},
+ {
+ // Zork Grand Inquisitor Russian CD version
+ {
+ "zgi",
+ "CD",
+ AD_ENTRY2s("SCRIPTS.ZFS", "81efd40ecc3d22531e211368b779f17f", 8336944,
+ "SUBTITLE.ZFS", "4d117c6f4efc8b5d12d7ad47deae5b0b", 717757),
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO5(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_DOUBLE_FPS, GAMEOPTION_DISABLE_ANIM_WHILE_TURNING, GAMEOPTION_ENABLE_WIDESCREEN, GAMEOPTION_HQ_PANORAMA)
+ },
+ GID_GRANDINQUISITOR
+ },
+
{
AD_TABLE_END_MARKER,
GID_NONE
diff --git a/engines/zvision/scripting/effects/ttytext_effect.cpp b/engines/zvision/scripting/effects/ttytext_effect.cpp
index 4b780cb0e59..4f68cbbf18a 100644
--- a/engines/zvision/scripting/effects/ttytext_effect.cpp
+++ b/engines/zvision/scripting/effects/ttytext_effect.cpp
@@ -51,6 +51,8 @@ ttyTextNode::ttyTextNode(ZVision *engine, uint32 key, const Common::Path &file,
if (asciiLine.empty()) {
continue;
}
+ if (engine->getLanguage() == Common::RU_RUS)
+ fixPseudo1251(&asciiLine);
_txtbuf += asciiLine;
}
diff --git a/engines/zvision/text/string_manager.cpp b/engines/zvision/text/string_manager.cpp
index 38952d7ea86..36aa5fcc1ec 100644
--- a/engines/zvision/text/string_manager.cpp
+++ b/engines/zvision/text/string_manager.cpp
@@ -54,6 +54,9 @@ void StringManager::loadStrFile(const Common::Path &fileName) {
while (!file.eos()) {
_lines[lineNumber] = readWideLine(file);
+ if (_engine->getLanguage() == Common::RU_RUS)
+ fixPseudo1251(&_lines[lineNumber]);
+
lineNumber++;
assert(lineNumber <= NUM_TEXT_LINES);
}
diff --git a/engines/zvision/text/subtitle_manager.cpp b/engines/zvision/text/subtitle_manager.cpp
index ba77bb64747..c0f6beeb9bf 100644
--- a/engines/zvision/text/subtitle_manager.cpp
+++ b/engines/zvision/text/subtitle_manager.cpp
@@ -188,7 +188,7 @@ bool SubtitleManager::askQuestion(const Common::U32String &str, bool streaming,
// TODO: Handle this using the keymapper
switch (evnt.kbd.keycode) {
case Common::KEYCODE_y:
- if (_engine->getLanguage() == Common::EN_ANY)
+ if (_engine->getLanguage() == Common::EN_ANY || _engine->getLanguage() == Common::RU_RUS)
result = 2;
break;
case Common::KEYCODE_j:
@@ -339,6 +339,10 @@ Subtitle::Subtitle(ZVision *engine, const Common::Path &subname, bool vob) :
curLine.start = -1;
curLine.stop = -1;
curLine.subStr = readWideLine(txtFile);
+
+ if (_engine->getLanguage() == Common::RU_RUS)
+ fixPseudo1251(&curLine.subStr);
+
_lines.push_back(curLine);
}
txtFile.close();
diff --git a/engines/zvision/text/text.cpp b/engines/zvision/text/text.cpp
index aec7addabd6..718f513bb6f 100644
--- a/engines/zvision/text/text.cpp
+++ b/engines/zvision/text/text.cpp
@@ -20,6 +20,7 @@
*/
#include "common/debug.h"
+#include "common/enc-internal.h"
#include "common/file.h"
#include "common/rect.h"
#include "common/scummsys.h"
@@ -536,4 +537,12 @@ Common::U32String readWideLine(Common::SeekableReadStream &stream) {
return asciiString;
}
+void fixPseudo1251(Common::U32String *str) {
+ for (uint32 i = 0; i < str->size(); i++) {
+ uint32 c = str->operator[](i);
+ if (c >= 0x80 && c < 0x100)
+ str->operator[](i) = Common::kWindows1251ConversionTable[c & 0x7f];
+ }
+}
+
} // End of namespace ZVision
diff --git a/engines/zvision/text/text.h b/engines/zvision/text/text.h
index f309543ba70..3c8f08d9d0e 100644
--- a/engines/zvision/text/text.h
+++ b/engines/zvision/text/text.h
@@ -83,6 +83,7 @@ private:
};
Common::U32String readWideLine(Common::SeekableReadStream &stream);
+void fixPseudo1251(Common::U32String *str);
} // End of namespace ZVision
More information about the Scummvm-git-logs
mailing list