[Scummvm-git-logs] scummvm master -> 452874d48b41464bbdb0626c109ad4eadd91f6f1
sev-
sev at scummvm.org
Mon Jan 27 22:35:48 UTC 2020
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:
452874d48b SWORD1: Support for external translated menu in Russian Sword1
Commit: 452874d48b41464bbdb0626c109ad4eadd91f6f1
https://github.com/scummvm/scummvm/commit/452874d48b41464bbdb0626c109ad4eadd91f6f1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-01-27T23:35:29+01:00
Commit Message:
SWORD1: Support for external translated menu in Russian Sword1
Changed paths:
engines/sword1/control.cpp
engines/sword1/control.h
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp
index cd51f84..6204141 100644
--- a/engines/sword1/control.cpp
+++ b/engines/sword1/control.cpp
@@ -237,7 +237,7 @@ Control::Control(Common::SaveFileManager *saveFileMan, ResMan *pResMan, ObjectMa
_mouse = pMouse;
_music = pMusic;
_sound = pSound;
- _lStrings = _languageStrings + SwordEngine::_systemVars.language * 20;
+ _lStrings = loadCustomStrings("strings.txt") ? _customStrings : _languageStrings + SwordEngine::_systemVars.language * 20;
_selectedButton = 255;
_panelShown = false;
_tempThumbnail = 0;
@@ -635,7 +635,7 @@ void Control::setupVolumePanel() {
renderText(_lStrings[STR_MUSIC], 149, 39 + 40, TEXT_LEFT_ALIGN);
renderText(_lStrings[STR_SPEECH], 320, 39 + 40, TEXT_CENTER);
- renderText(_lStrings[STR_FX], 438, 39 + 40, TEXT_LEFT_ALIGN);
+ renderText(_lStrings[STR_FX], 449, 39 + 40, TEXT_CENTER);
createButtons(_volumeButtons, 4);
renderText(_lStrings[STR_DONE], _volumeButtons[0].x - 10, _volumeButtons[0].y, TEXT_RIGHT_ALIGN);
@@ -1444,6 +1444,26 @@ const ButtonInfo Control::_volumeButtons[4] = {
{ 404, 135, SR_VKNOB, 0, 0 },
};
+bool Control::loadCustomStrings(const char *filename) {
+ Common::File f;
+
+ if (f.open(filename)) {
+ Common::String line;
+
+ for (int lineNo = 0; lineNo < 20; lineNo++) {
+ line = f.readLine();
+
+ if (f.eos())
+ return false;
+
+ memset((void*)_customStrings[lineNo], 0, 43);
+ strncpy((char*)_customStrings[lineNo], line.c_str(), 42);
+ }
+ }
+
+ return true;
+}
+
const uint8 Control::_languageStrings[8 * 20][43] = {
// BS1_ENGLISH:
"PAUSED",
diff --git a/engines/sword1/control.h b/engines/sword1/control.h
index 4e27728..fdc903a 100644
--- a/engines/sword1/control.h
+++ b/engines/sword1/control.h
@@ -144,6 +144,8 @@ private:
ControlButton *_buttons[MAX_BUTTONS];
static const ButtonInfo _deathButtons[3], _panelButtons[7], _saveButtons[16], _volumeButtons[4];
static const uint8 _languageStrings[8 * 20][43];
+ bool loadCustomStrings(const char* filename);
+ uint8 _customStrings[20][43];
const uint8(*_lStrings)[43];
Common::SaveFileManager *_saveFileMan;
ObjectMan *_objMan;
More information about the Scummvm-git-logs
mailing list