diff options
author | Martin Kiewitz | 2016-01-30 19:45:09 +0100 |
---|---|---|
committer | Martin Kiewitz | 2016-01-30 19:45:09 +0100 |
commit | 33cedb65fa05e05e5467aa5f80338cd19bec5e34 (patch) | |
tree | 30e8457022f66e5bbdf3699e4fc7e02034b4ad8f | |
parent | d79728114ef61dd8761bee2966701667a41daf13 (diff) | |
download | scummvm-rg350-33cedb65fa05e05e5467aa5f80338cd19bec5e34.tar.gz scummvm-rg350-33cedb65fa05e05e5467aa5f80338cd19bec5e34.tar.bz2 scummvm-rg350-33cedb65fa05e05e5467aa5f80338cd19bec5e34.zip |
SHERLOCK: SS: window hotkeys now multilingual
-rw-r--r-- | engines/sherlock/scalpel/scalpel_fixed_text.cpp | 18 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.cpp | 58 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.h | 8 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_user_interface.cpp | 37 |
4 files changed, 59 insertions, 62 deletions
diff --git a/engines/sherlock/scalpel/scalpel_fixed_text.cpp b/engines/sherlock/scalpel/scalpel_fixed_text.cpp index 1cbd0c0cd8..8932fb29c5 100644 --- a/engines/sherlock/scalpel/scalpel_fixed_text.cpp +++ b/engines/sherlock/scalpel/scalpel_fixed_text.cpp @@ -31,9 +31,9 @@ static const char *const fixedTextEN[] = { // Game hotkeys "LMTPOCIUGJFS", // SH1: Window buttons - "Exit", - "Up", - "Down", + "EExit", + "UUp", + "DDown", // SH1: Inventory buttons "EExit", "LLook", @@ -176,9 +176,9 @@ static const char *const fixedTextDE[] = { // Game hotkeys "SBRNOCTEGADU", // original: did not support hotkeys for actions // SH1: Window buttons - "Zur\201ck", - "Hoch", - "Runter", + "ZZur\201ck", + "HHoch", + "RRunter", // SH1: Inventory buttons "ZZur\201ck", "SSchau", @@ -320,9 +320,9 @@ static const char *const fixedTextES[] = { // Game hotkeys "VMHTACIUDNFO", // SH1: Window buttons - "Salir", // original interpreter: "Exit" - "Subir", - "Bajar", + "aSalir", // original interpreter: "Exit" + "SSubir", + "BBajar", // SH1: Inventory buttons "SSalir", // original interpreter: "Exit" "MMirar", diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index b6c14aaa87..c921c1ee9b 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -170,6 +170,13 @@ ScalpelTalk::ScalpelTalk(SherlockEngine *vm) : Talk(vm) { _opcodes = opcodes; } + _fixedTextWindowExit = FIXED(Window_Exit); + _fixedTextWindowUp = FIXED(Window_Up); + _fixedTextWindowDown = FIXED(Window_Down); + + _hotkeyWindowExit = toupper(_fixedTextWindowExit[0]); + _hotkeyWindowUp = toupper(_fixedTextWindowUp[0]); + _hotkeyWindowDown = toupper(_fixedTextWindowDown[0]); } void ScalpelTalk::talkTo(const Common::String filename) { @@ -185,7 +192,6 @@ void ScalpelTalk::talkTo(const Common::String filename) { } void ScalpelTalk::talkInterface(const byte *&str) { - FixedText &fixedText = *_vm->_fixedText; People &people = *_vm->_people; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; UserInterface &ui = *_vm->_ui; @@ -199,12 +205,9 @@ void ScalpelTalk::talkInterface(const byte *&str) { drawInterface(); if (_talkTo != -1) { - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, fixedText_Exit); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, fixedText_Up); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, fixedText_Down); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowExit, true); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowUp, true); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowDown, true); } } @@ -512,7 +515,6 @@ OpcodeReturn ScalpelTalk::cmdSfxCommand(const byte *&str) { OpcodeReturn ScalpelTalk::cmdSummonWindow(const byte *&str) { Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; drawInterface(); @@ -521,12 +523,9 @@ OpcodeReturn ScalpelTalk::cmdSummonWindow(const byte *&str) { _noTextYet = false; if (_speaker != -1) { - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, fixedText_Exit); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, fixedText_Up); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, fixedText_Down); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowExit, true); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowUp, true); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowDown, true); } return RET_SUCCESS; @@ -702,11 +701,11 @@ void ScalpelTalk::drawInterface() { Common::String fixedText_Down = FIXED(Window_Down); screen.makeButton(Common::Rect(99, CONTROLS_Y, 139, CONTROLS_Y + 10), - 119, fixedText_Exit); + 119, fixedText_Exit, true); screen.makeButton(Common::Rect(140, CONTROLS_Y, 180, CONTROLS_Y + 10), - 159, fixedText_Up); + 159, fixedText_Up, true); screen.makeButton(Common::Rect(181, CONTROLS_Y, 221, CONTROLS_Y + 10), - 200, fixedText_Down); + 200, fixedText_Down, true); } else { Common::String fixedText_PressKeyToContinue = FIXED(PressKey_ToContinue); @@ -716,7 +715,6 @@ void ScalpelTalk::drawInterface() { } bool ScalpelTalk::displayTalk(bool slamIt) { - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; int yp = CONTROLS_Y + 14; int lineY = -1; @@ -734,22 +732,20 @@ bool ScalpelTalk::displayTalk(bool slamIt) { } // Display the up arrow and enable Up button if the first option is scrolled off-screen - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); if (_moreTalkUp) { if (slamIt) { screen.print(Common::Point(5, CONTROLS_Y + 13), INV_FOREGROUND, "~"); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextWindowUp, true); } else { screen.gPrint(Common::Point(5, CONTROLS_Y + 12), INV_FOREGROUND, "~"); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, false, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, false, _fixedTextWindowUp, true); } } else { if (slamIt) { - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, _fixedTextWindowUp, true); screen.vgaBar(Common::Rect(5, CONTROLS_Y + 11, 15, CONTROLS_Y + 22), INV_BACKGROUND); } else { - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowUp, true); screen._backBuffer1.fillRect(Common::Rect(5, CONTROLS_Y + 11, 15, CONTROLS_Y + 22), INV_BACKGROUND); } @@ -784,17 +780,17 @@ bool ScalpelTalk::displayTalk(bool slamIt) { if (slamIt) { screen.print(Common::Point(5, 190), INV_FOREGROUND, "|"); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextWindowDown, true); } else { screen.gPrint(Common::Point(5, 189), INV_FOREGROUND, "|"); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, false, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, false, _fixedTextWindowDown, true); } } else { if (slamIt) { - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, _fixedTextWindowDown, true); screen.vgaBar(Common::Rect(5, 189, 16, 199), INV_BACKGROUND); } else { - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowDown, true); screen._backBuffer1.fillRect(Common::Rect(5, 189, 16, 199), INV_BACKGROUND); } } @@ -891,11 +887,9 @@ int ScalpelTalk::talkLine(int lineNum, int stateNum, byte color, int lineY, bool } void ScalpelTalk::showTalk() { - FixedText &fixedText = *_vm->_fixedText; People &people = *_vm->_people; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; ScalpelUserInterface &ui = *(ScalpelUserInterface *)_vm->_ui; - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); byte color = ui._endKeyActive ? COMMAND_FOREGROUND : COMMAND_NULL; clearSequences(); @@ -915,9 +909,9 @@ void ScalpelTalk::showTalk() { // If the window is already open, simply draw. Otherwise, do it // to the back buffer and then summon the window if (ui._windowOpen) { - screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, true, _fixedTextWindowExit, true); } else { - screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, false, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, false, _fixedTextWindowExit, true); if (!ui._slideWindows) { screen.slamRect(Common::Rect(0, CONTROLS_Y, diff --git a/engines/sherlock/scalpel/scalpel_talk.h b/engines/sherlock/scalpel/scalpel_talk.h index 3ba61dadc1..e542331ce6 100644 --- a/engines/sherlock/scalpel/scalpel_talk.h +++ b/engines/sherlock/scalpel/scalpel_talk.h @@ -88,6 +88,14 @@ public: ScalpelTalk(SherlockEngine *vm); virtual ~ScalpelTalk() {} + Common::String _fixedTextWindowExit; + Common::String _fixedTextWindowUp; + Common::String _fixedTextWindowDown; + + byte _hotkeyWindowExit; + byte _hotkeyWindowUp; + byte _hotkeyWindowDown; + /** * Opens the talk file 'talk.tlk' and searches the index for the specified * conversation. If found, the data for that conversation is loaded diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp index 379e9bf288..6292f3b7e1 100644 --- a/engines/sherlock/scalpel/scalpel_user_interface.cpp +++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp @@ -1576,7 +1576,6 @@ void ScalpelUserInterface::doPickControl() { void ScalpelUserInterface::doTalkControl() { Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelJournal &journal = *(ScalpelJournal *)_vm->_journal; ScalpelPeople &people = *(ScalpelPeople *)_vm->_people; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; @@ -1587,28 +1586,24 @@ void ScalpelUserInterface::doTalkControl() { _key = _oldKey = -1; _keyboardInput = false; - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); - if (events._pressed || events._released) { events.clearKeyboard(); // Handle button printing if (mousePos.x > 99 && mousePos.x < 138 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 10) && !_endKeyActive) - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, talk._fixedTextWindowExit, true); else if (_endKeyActive) - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowExit, true); if (mousePos.x > 140 && mousePos.x < 170 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 10) && talk._moreTalkUp) - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, talk._fixedTextWindowUp, true); else if (talk._moreTalkUp) - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowUp, true); if (mousePos.x > 181&& mousePos.x < 220 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 10) && talk._moreTalkDown) - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, talk._fixedTextWindowDown, true); else if (talk._moreTalkDown) - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowDown, true); bool found = false; for (_selector = talk._talkIndex; _selector < (int)talk._statements.size() && !found; ++_selector) { @@ -1624,7 +1619,7 @@ void ScalpelUserInterface::doTalkControl() { if (_keyPress) { _key = toupper(_keyPress); if (_key == Common::KEYCODE_ESCAPE) - _key = 'E'; + _key = talk._hotkeyWindowExit; // Check for number press indicating reply line if (_key >= '1' && _key <= ('1' + (int)talk._statements.size() - 1)) { @@ -1637,7 +1632,7 @@ void ScalpelUserInterface::doTalkControl() { break; } } - } else if (_key == 'E' || _key == 'U' || _key == 'D') { + } else if (_key == talk._hotkeyWindowExit || _key == talk._hotkeyWindowUp || _key == talk._hotkeyWindowDown) { _keyboardInput = true; } else { _selector = -1; @@ -1665,7 +1660,7 @@ void ScalpelUserInterface::doTalkControl() { if (events._released || _keyboardInput) { if (((Common::Rect(99, CONTROLS_Y, 138, CONTROLS_Y + 10).contains(mousePos) && events._released) - || _key == 'E') && _endKeyActive) { + || _key == talk._hotkeyWindowExit) && _endKeyActive) { talk.freeTalkVars(); talk.pullSequence(); @@ -1673,7 +1668,7 @@ void ScalpelUserInterface::doTalkControl() { banishWindow(); _windowBounds.top = CONTROLS_Y1; } else if (((Common::Rect(140, CONTROLS_Y, 179, CONTROLS_Y + 10).contains(mousePos) && events._released) - || _key == 'U') && talk._moreTalkUp) { + || _key == talk._hotkeyWindowUp) && talk._moreTalkUp) { while (talk._statements[--talk._talkIndex]._talkMap == -1) ; screen._backBuffer1.fillRect(Common::Rect(5, CONTROLS_Y + 11, SHERLOCK_SCREEN_WIDTH - 2, @@ -1682,7 +1677,7 @@ void ScalpelUserInterface::doTalkControl() { screen.slamRect(Common::Rect(5, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH - 5, SHERLOCK_SCREEN_HEIGHT - 2)); } else if (((Common::Rect(181, CONTROLS_Y, 220, CONTROLS_Y + 10).contains(mousePos) && events._released) - || _key == 'D') && talk._moreTalkDown) { + || _key == talk._hotkeyWindowDown) && talk._moreTalkDown) { do { ++talk._talkIndex; } while (talk._talkIndex < (int)talk._statements.size() && talk._statements[talk._talkIndex]._talkMap == -1); @@ -1693,9 +1688,9 @@ void ScalpelUserInterface::doTalkControl() { screen.slamRect(Common::Rect(5, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH - 5, SHERLOCK_SCREEN_HEIGHT - 2)); } else if (_selector != -1) { - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, fixedText_Exit); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, fixedText_Up); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, fixedText_Down); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowExit, true); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowUp, true); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowDown, true); // If the reply is new, add it to the journal if (!talk._talkHistory[talk._converseNum][_selector]) { @@ -1789,9 +1784,9 @@ void ScalpelUserInterface::doTalkControl() { !talk._statements[select]._statement.hasPrefix("^")) { // Not a reply first file, so display the new selections if (_endKeyActive) - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowExit, true); else - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowExit, true); talk.displayTalk(true); events.setCursor(ARROW); |