aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/scalpel/scalpel_user_interface.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2016-01-30 16:23:23 +0100
committerMartin Kiewitz2016-01-30 16:23:23 +0100
commit9257597160bf70b6c7e323d27f3f8b6a47daa182 (patch)
treef88669cd088fa791dc2067361a0c4953772b32cd /engines/sherlock/scalpel/scalpel_user_interface.cpp
parent741b868e70f48e73ba71078cc486ed20bf23a73f (diff)
downloadscummvm-rg350-9257597160bf70b6c7e323d27f3f8b6a47daa182.tar.gz
scummvm-rg350-9257597160bf70b6c7e323d27f3f8b6a47daa182.tar.bz2
scummvm-rg350-9257597160bf70b6c7e323d27f3f8b6a47daa182.zip
SHERLOCK: SS: make inventory hotkeys multilingual
Diffstat (limited to 'engines/sherlock/scalpel/scalpel_user_interface.cpp')
-rw-r--r--engines/sherlock/scalpel/scalpel_user_interface.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp
index 2ed49713b7..3a64178cea 100644
--- a/engines/sherlock/scalpel/scalpel_user_interface.cpp
+++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp
@@ -66,7 +66,6 @@ const int INVENTORY_POINTS[8][3] = {
const char COMMANDS[13] = "LMTPOCIUGJFS";
const char COMMANDS_3DO[13] = "LMTPOCIUGSFF";
-const char INVENTORY_COMMANDS[9] = { "ELUG-+,." };
const int UI_OFFSET_3DO = 16; // (320 - 288) / 2
/*----------------------------------------------------------------*/
@@ -980,7 +979,6 @@ void ScalpelUserInterface::doEnvControl() {
void ScalpelUserInterface::doInvControl() {
Events &events = *_vm->_events;
- FixedText &fixedText = *_vm->_fixedText;
ScalpelInventory &inv = *(ScalpelInventory *)_vm->_inventory;
Scene &scene = *_vm->_scene;
ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen;
@@ -1006,20 +1004,15 @@ void ScalpelUserInterface::doInvControl() {
if (events._pressed || events._released) {
events.clearKeyboard();
- Common::String fixedText_Exit = fixedText.getText(kFixedText_Inventory_Exit);
- Common::String fixedText_Look = fixedText.getText(kFixedText_Inventory_Look);
- Common::String fixedText_Use = fixedText.getText(kFixedText_Inventory_Use);
- Common::String fixedText_Give = fixedText.getText(kFixedText_Inventory_Give);
-
if (found != -1)
// If a slot highlighted, set its color
colors[found] = COMMAND_HIGHLIGHTED;
- screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1), colors[0], true, fixedText_Exit);
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1), colors[0], true, inv._fixedTextExit);
if (found >= 0 && found <= 3) {
- screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), colors[1], true, fixedText_Look);
- screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), colors[2], true, fixedText_Use);
- screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), colors[3], true, fixedText_Give);
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), colors[1], true, inv._fixedTextLook);
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), colors[2], true, inv._fixedTextUse);
+ screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), colors[3], true, inv._fixedTextGive);
inv._invMode = (InvMode)found;
_selector = -1;
}
@@ -1053,19 +1046,19 @@ void ScalpelUserInterface::doInvControl() {
if (_key == Common::KEYCODE_ESCAPE)
// Escape will also 'E'xit out of inventory display
- _key = 'E';
+ _key = inv._hotkeyExit;
+
+ int buttonIndex = inv.identifyUserButton(_key);
- if (_key == 'E' || _key == 'L' || _key == 'U' || _key == 'G'
- || _key == '-' || _key == '+') {
+ if ((buttonIndex >= 0) && (buttonIndex <= 5)) {
InvMode temp = inv._invMode;
- const char *chP = strchr(INVENTORY_COMMANDS, _key);
- inv._invMode = !chP ? INVMODE_INVALID : (InvMode)(chP - INVENTORY_COMMANDS);
+ inv._invMode = (InvMode)buttonIndex;
inv.invCommands(true);
inv._invMode = temp;
_keyboardInput = true;
- if (_key == 'E')
+ if (_key == inv._hotkeyExit)
inv._invMode = INVMODE_EXIT;
_selector = -1;
} else {
@@ -1087,7 +1080,7 @@ void ScalpelUserInterface::doInvControl() {
}
if (events._released || _keyboardInput) {
- if ((found == 0 && events._released) || _key == 'E') {
+ if ((found == 0 && events._released) || _key == inv._hotkeyExit) {
inv.freeInv();
_infoFlag = true;
clearInfo();
@@ -1095,11 +1088,11 @@ void ScalpelUserInterface::doInvControl() {
_key = -1;
events.clearEvents();
events.setCursor(ARROW);
- } else if ((found == 1 && events._released) || (_key == 'L')) {
+ } else if ((found == 1 && events._released) || (_key == inv._hotkeyLook)) {
inv._invMode = INVMODE_LOOK;
- } else if ((found == 2 && events._released) || (_key == 'U')) {
+ } else if ((found == 2 && events._released) || (_key == inv._hotkeyUse)) {
inv._invMode = INVMODE_USE;
- } else if ((found == 3 && events._released) || (_key == 'G')) {
+ } else if ((found == 3 && events._released) || (_key == inv._hotkeyGive)) {
inv._invMode = INVMODE_GIVE;
} else if (((found == 4 && events._released) || _key == ',') && inv._invIndex) {
if (inv._invIndex >= 6)