[Scummvm-cvs-logs] scummvm master -> 741b868e70f48e73ba71078cc486ed20bf23a73f

m-kiewitz m_kiewitz at users.sourceforge.net
Sat Jan 30 15:52:53 CET 2016


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:
741b868e70 SHERLOCK: SS: Make load/save menu multilingual


Commit: 741b868e70f48e73ba71078cc486ed20bf23a73f
    https://github.com/scummvm/scummvm/commit/741b868e70f48e73ba71078cc486ed20bf23a73f
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-01-30T15:52:22+01:00

Commit Message:
SHERLOCK: SS: Make load/save menu multilingual

Also change behavior of makeButton/buttonPrint to directly
remove a hotkey-prefix, in case it was passed.

Changed paths:
    engines/sherlock/scalpel/scalpel_fixed_text.cpp
    engines/sherlock/scalpel/scalpel_fixed_text.h
    engines/sherlock/scalpel/scalpel_saveload.cpp
    engines/sherlock/scalpel/scalpel_saveload.h
    engines/sherlock/scalpel/scalpel_screen.cpp
    engines/sherlock/scalpel/scalpel_screen.h
    engines/sherlock/scalpel/scalpel_user_interface.cpp
    engines/sherlock/scalpel/settings.cpp



diff --git a/engines/sherlock/scalpel/scalpel_fixed_text.cpp b/engines/sherlock/scalpel/scalpel_fixed_text.cpp
index bfca97a..d2bbf4f 100644
--- a/engines/sherlock/scalpel/scalpel_fixed_text.cpp
+++ b/engines/sherlock/scalpel/scalpel_fixed_text.cpp
@@ -76,6 +76,17 @@ static const char *const fixedTextEN[] = {
 	"FFade Directly",
 	"KKey Pad Slow",
 	"KKey Pad Fast",
+	// Load/Save
+	"EExit",
+	"LLoad",
+	"SSave",
+	"UUp",
+	"DDown",
+	"QQuit",
+	// Quit Game
+	"Are you sure you wish to Quit ?",
+	"YYes",
+	"NNo",
 	// SH1: Press key text
 	"Press any Key for More.",
 	"P",
@@ -210,6 +221,17 @@ static const char *const fixedTextDE[] = {
 	"BBlende",
 	"CCursor langsam",
 	"CCursor schnell",
+	// Load/Save
+	"ZZur\201ck",
+	"LLaden",
+	"SSichern",
+	"HHoch",
+	"RRunter",
+	"EEnde",
+	// Quit Game
+	"Das Spiel verlassen ?",
+	"JJa",
+	"NNein",
 	// SH1: Press key text
 	"Mehr auf Tastendruck...",
 	"M",
@@ -343,6 +365,17 @@ static const char *const fixedTextES[] = {
 	"FFundido directo",
 	"eTeclado lento",
 	"eTeclado rapido",
+	// Load/Save
+	"aSalir", // original interpreter: "Exit"
+	"CCargar",
+	"GGrabar",
+	"SSubir",
+	"BBajar",
+	"AAcabar",
+	// Quit Game
+	"\250Seguro que quieres Acabar?",
+	"SSi",
+	"NNo",
 	// SH1: Press key text
 	"Tecla para ver mas",
 	"T",
diff --git a/engines/sherlock/scalpel/scalpel_fixed_text.h b/engines/sherlock/scalpel/scalpel_fixed_text.h
index 0fb9e13..1dfee1f 100644
--- a/engines/sherlock/scalpel/scalpel_fixed_text.h
+++ b/engines/sherlock/scalpel/scalpel_fixed_text.h
@@ -78,6 +78,17 @@ enum FixedTextId {
 	kFixedText_Settings_FadeDirectly,
 	kFixedText_Settings_KeyPadSlow,
 	kFixedText_Settings_KeyPadFast,
+	// Load/Save
+	kFixedText_LoadSave_Exit,
+	kFixedText_LoadSave_Load,
+	kFixedText_LoadSave_Save,
+	kFixedText_LoadSave_Up,
+	kFixedText_LoadSave_Down,
+	kFixedText_LoadSave_Quit,
+	// Quit Game
+	kFixedText_QuitGame_Question,
+	kFixedText_QuitGame_Yes,
+	kFixedText_QuitGame_No,
 	// Press key text
 	kFixedText_PressKey_ForMore,
 	kFixedText_PressKey_ForMoreHotkey,
diff --git a/engines/sherlock/scalpel/scalpel_saveload.cpp b/engines/sherlock/scalpel/scalpel_saveload.cpp
index d23c4ce..8845092 100644
--- a/engines/sherlock/scalpel/scalpel_saveload.cpp
+++ b/engines/sherlock/scalpel/scalpel_saveload.cpp
@@ -20,6 +20,7 @@
  *
  */
 
+#include "sherlock/scalpel/scalpel_fixed_text.h"
 #include "sherlock/scalpel/scalpel_saveload.h"
 #include "sherlock/scalpel/scalpel_screen.h"
 #include "sherlock/scalpel/scalpel.h"
@@ -41,6 +42,42 @@ const int ENV_POINTS[6][3] = {
 
 ScalpelSaveManager::ScalpelSaveManager(SherlockEngine *vm, const Common::String &target) : 
 	SaveManager(vm, target), _envMode(SAVEMODE_NONE) {
+
+	_fixedTextExit = FIXED(LoadSave_Exit);
+	_fixedTextLoad = FIXED(LoadSave_Load);
+	_fixedTextSave  = FIXED(LoadSave_Save);
+	_fixedTextUp = FIXED(LoadSave_Up);
+	_fixedTextDown = FIXED(LoadSave_Down);
+	_fixedTextQuit = FIXED(LoadSave_Quit);
+
+	_hotkeyExit = toupper(_fixedTextExit[0]);
+	_hotkeyLoad = toupper(_fixedTextLoad[0]);
+	_hotkeySave = toupper(_fixedTextSave[0]);
+	_hotkeyUp   = toupper(_fixedTextUp[0]);
+	_hotkeyDown = toupper(_fixedTextDown[0]);
+	_hotkeyQuit = toupper(_fixedTextQuit[0]);
+
+	_hotkeysIndexed[0] = _hotkeyExit;
+	_hotkeysIndexed[1] = _hotkeyLoad;
+	_hotkeysIndexed[2] = _hotkeySave;
+	_hotkeysIndexed[3] = _hotkeyUp;
+	_hotkeysIndexed[4] = _hotkeyDown;
+	_hotkeysIndexed[5] = _hotkeyQuit;
+
+	_fixedTextQuitGameQuestion = FIXED(QuitGame_Question);
+	_fixedTextQuitGameYes = FIXED(QuitGame_Yes);
+	_fixedTextQuitGameNo = FIXED(QuitGame_No);
+
+	_hotkeyQuitGameYes = toupper(_fixedTextQuitGameYes[0]);
+	_hotkeyQuitGameNo  = toupper(_fixedTextQuitGameNo[0]);
+}
+
+int ScalpelSaveManager::identifyUserButton(int key) {
+	for (uint16 hotkeyNr = 0; hotkeyNr < sizeof(_hotkeysIndexed); hotkeyNr++) {
+		if (key == _hotkeysIndexed[hotkeyNr])
+			return hotkeyNr;
+	}
+	return -1;
 }
 
 void ScalpelSaveManager::drawInterface() {
@@ -57,23 +94,23 @@ void ScalpelSaveManager::drawInterface() {
 	screen._backBuffer1.fillRect(Common::Rect(2, CONTROLS_Y + 10, SHERLOCK_SCREEN_WIDTH - 2, SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND);
 
 	screen.makeButton(Common::Rect(ENV_POINTS[0][0], CONTROLS_Y, ENV_POINTS[0][1], CONTROLS_Y + 10),
-		ENV_POINTS[0][2], "Exit");
+		ENV_POINTS[0][2], _fixedTextExit, true);
 	screen.makeButton(Common::Rect(ENV_POINTS[1][0], CONTROLS_Y, ENV_POINTS[1][1], CONTROLS_Y + 10),
-		ENV_POINTS[1][2], "Load");
+		ENV_POINTS[1][2], _fixedTextLoad, true);
 	screen.makeButton(Common::Rect(ENV_POINTS[2][0], CONTROLS_Y, ENV_POINTS[2][1], CONTROLS_Y + 10),
-		ENV_POINTS[2][2], "Save");
+		ENV_POINTS[2][2], _fixedTextSave, true);
 	screen.makeButton(Common::Rect(ENV_POINTS[3][0], CONTROLS_Y, ENV_POINTS[3][1], CONTROLS_Y + 10),
-		ENV_POINTS[3][2], "Up");
+		ENV_POINTS[3][2], _fixedTextUp, true);
 	screen.makeButton(Common::Rect(ENV_POINTS[4][0], CONTROLS_Y, ENV_POINTS[4][1], CONTROLS_Y + 10),
-		ENV_POINTS[4][2], "Down");
+		ENV_POINTS[4][2], _fixedTextDown, true);
 	screen.makeButton(Common::Rect(ENV_POINTS[5][0], CONTROLS_Y, ENV_POINTS[5][1], CONTROLS_Y + 10),
-		ENV_POINTS[5][2], "Quit");
+		ENV_POINTS[5][2], _fixedTextQuit, true);
 
 	if (!_savegameIndex)
-		screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_NULL, 0, "Up");
+		screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_NULL, 0, _fixedTextUp, true);
 
 	if (_savegameIndex == MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT)
-		screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_NULL, 0, "Down");
+		screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_NULL, 0, _fixedTextDown, true);
 
 	for (int idx = _savegameIndex; idx < _savegameIndex + ONSCREEN_FILES_COUNT; ++idx) {
 		screen.gPrint(Common::Point(6, CONTROLS_Y + 11 + (idx - _savegameIndex) * 10),
@@ -107,31 +144,31 @@ void ScalpelSaveManager::highlightButtons(int btnIndex) {
 	ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen;
 	byte color = (btnIndex == 0) ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND;
 
-	screen.buttonPrint(Common::Point(ENV_POINTS[0][2], CONTROLS_Y), color, 1, "Exit");
+	screen.buttonPrint(Common::Point(ENV_POINTS[0][2], CONTROLS_Y), color, 1, _fixedTextExit, true);
 
 	if ((btnIndex == 1) || ((_envMode == SAVEMODE_LOAD) && (btnIndex != 2)))
-		screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, "Load");
+		screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextLoad, true);
 	else
-		screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_FOREGROUND, true, "Load");
+		screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextLoad, true);
 
 	if ((btnIndex == 2) || ((_envMode == SAVEMODE_SAVE) && (btnIndex != 1)))
-		screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, "Save");
+		screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextSave, true);
 	else
-		screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_FOREGROUND, true, "Save");
+		screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextSave, true);
 
 	if (btnIndex == 3 && _savegameIndex)
-		screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, "Up");
+		screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextUp, true);
 	else
 		if (_savegameIndex)
-			screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_FOREGROUND, true, "Up");
+			screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextUp, true);
 
 	if ((btnIndex == 4) && (_savegameIndex < MAX_SAVEGAME_SLOTS - 5))
-		screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, "Down");
+		screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextDown, true);
 	else if (_savegameIndex < (MAX_SAVEGAME_SLOTS - 5))
-		screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_FOREGROUND, true, "Down");
+		screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextDown, true);
 
 	color = (btnIndex == 5) ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND;
-	screen.buttonPrint(Common::Point(ENV_POINTS[5][2], CONTROLS_Y), color, 1, "Quit");
+	screen.buttonPrint(Common::Point(ENV_POINTS[5][2], CONTROLS_Y), color, 1, _fixedTextQuit, true);
 }
 
 bool ScalpelSaveManager::checkGameOnScreen(int slot) {
@@ -154,10 +191,10 @@ bool ScalpelSaveManager::checkGameOnScreen(int slot) {
 		screen.slamRect(Common::Rect(3, CONTROLS_Y + 11, 318, SHERLOCK_SCREEN_HEIGHT));
 
 		byte color = !_savegameIndex ? COMMAND_NULL : COMMAND_FOREGROUND;
-		screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, 1, "Up");
+		screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, 1, _fixedTextUp, true);
 
 		color = (_savegameIndex == (MAX_SAVEGAME_SLOTS - 5)) ? COMMAND_NULL : COMMAND_FOREGROUND;
-		screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, 1, "Down");
+		screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, 1, _fixedTextDown, true);
 
 		return true;
 	}
@@ -173,12 +210,12 @@ bool ScalpelSaveManager::promptForDescription(int slot) {
 	int xp, yp;
 	bool flag = false;
 
-	screen.buttonPrint(Common::Point(ENV_POINTS[0][2], CONTROLS_Y), COMMAND_NULL, true, "Exit");
-	screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_NULL, true, "Load");
-	screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_NULL, true, "Save");
-	screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_NULL, true, "Up");
-	screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_NULL, true, "Down");
-	screen.buttonPrint(Common::Point(ENV_POINTS[5][2], CONTROLS_Y), COMMAND_NULL, true, "Quit");
+	screen.buttonPrint(Common::Point(ENV_POINTS[0][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextExit, true);
+	screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextLoad, true);
+	screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextSave, true);
+	screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextUp, true);
+	screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextDown, true);
+	screen.buttonPrint(Common::Point(ENV_POINTS[5][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextQuit, true);
 
 	Common::String saveName = _savegames[slot];
 	if (isSlotEmpty(slot)) {
diff --git a/engines/sherlock/scalpel/scalpel_saveload.h b/engines/sherlock/scalpel/scalpel_saveload.h
index 6b035ca..81e3d83 100644
--- a/engines/sherlock/scalpel/scalpel_saveload.h
+++ b/engines/sherlock/scalpel/scalpel_saveload.h
@@ -34,6 +34,30 @@ extern const int ENV_POINTS[6][3];
 class ScalpelSaveManager: public SaveManager {
 public:
 	SaveMode _envMode;
+
+	Common::String _fixedTextExit;
+	Common::String _fixedTextLoad;
+	Common::String _fixedTextSave;
+	Common::String _fixedTextUp;
+	Common::String _fixedTextDown;
+	Common::String _fixedTextQuit;
+
+	byte _hotkeyExit;
+	byte _hotkeyLoad;
+	byte _hotkeySave;
+	byte _hotkeyUp;
+	byte _hotkeyDown;
+	byte _hotkeyQuit;
+
+	byte _hotkeysIndexed[6];
+
+	Common::String _fixedTextQuitGameQuestion;
+	Common::String _fixedTextQuitGameYes;
+	Common::String _fixedTextQuitGameNo;
+
+	byte _hotkeyQuitGameYes;
+	byte _hotkeyQuitGameNo;
+
 public:
 	ScalpelSaveManager(SherlockEngine *vm, const Common::String &target);
 	virtual ~ScalpelSaveManager() {}
@@ -62,6 +86,11 @@ public:
 	 * Prompts the user to enter a description in a given slot
 	 */
 	bool promptForDescription(int slot);
+
+	/**
+	 * Identifies a button number according to the key, that the user pressed
+	 */
+	int identifyUserButton(int key);
 };
 
 } // End of namespace Scalpel
diff --git a/engines/sherlock/scalpel/scalpel_screen.cpp b/engines/sherlock/scalpel/scalpel_screen.cpp
index fcf548f..433d773 100644
--- a/engines/sherlock/scalpel/scalpel_screen.cpp
+++ b/engines/sherlock/scalpel/scalpel_screen.cpp
@@ -31,7 +31,7 @@ ScalpelScreen::ScalpelScreen(SherlockEngine *vm) : Screen(vm) {
 }
 
 void ScalpelScreen::makeButton(const Common::Rect &bounds, int textX,
-		const Common::String &str, const byte hotkey) {
+		const Common::String &str, bool textContainsHotkey) {
 
 	Surface &bb = *_backBuffer;
 	bb.fillRect(Common::Rect(bounds.left, bounds.top, bounds.right, bounds.top + 1), BUTTON_TOP);
@@ -40,24 +40,33 @@ void ScalpelScreen::makeButton(const Common::Rect &bounds, int textX,
 	bb.fillRect(Common::Rect(bounds.left + 1, bounds.bottom - 1, bounds.right, bounds.bottom), BUTTON_BOTTOM);
 	bb.fillRect(Common::Rect(bounds.left + 1, bounds.top + 1, bounds.right - 1, bounds.bottom - 1), BUTTON_MIDDLE);
 
-	buttonPrint(Common::Point(textX, bounds.top), COMMAND_FOREGROUND, false, str, hotkey);
+	buttonPrint(Common::Point(textX, bounds.top), COMMAND_FOREGROUND, false, str, textContainsHotkey);
 }
 
 void ScalpelScreen::buttonPrint(const Common::Point &pt, uint color, bool slamIt,
-		const Common::String &str, byte hotkey) {
-	int xStart = pt.x - stringWidth(str) / 2;
+		const Common::String &str, bool textContainsHotkey) {
+	int xStart = pt.x;
+	int skipTextOffset = textContainsHotkey ? +1 : 0; // skip first char in case text contains hotkey
+
+	// Center text around given x-coordinate
+	if (textContainsHotkey) {
+		xStart -= (stringWidth(Common::String(str.c_str() + 1)) / 2);
+	} else {
+		xStart -= (stringWidth(str) / 2);
+	}
 
 	if (color == COMMAND_FOREGROUND) {
-		Common::String prefixText = str;
 		uint16 prefixOffsetX = 0;
+		byte hotkey = str[0];
 
 		// Hotkey needs to be highlighted
-		if (hotkey) {
-			// Hotkey was passed, we search for the hotkey inside the button text and
-			// remove it from there. We then draw the whole text as highlighted and afterward
-			// the processed text again as regular text (without the hotkey)
+		if (textContainsHotkey) {
+			Common::String prefixText = Common::String(str.c_str() + 1);
 			uint16 prefixTextPos = 0;
 
+			// Hotkey was passed additionally, we search for the hotkey inside the button text and
+			// remove it from there. We then draw the whole text as highlighted and afterward
+			// the processed text again as regular text (without the hotkey)
 			while (prefixTextPos < prefixText.size()) {
 				if (prefixText[prefixTextPos] == hotkey) {
 					// Hotkey found, remove remaining text
@@ -69,25 +78,25 @@ void ScalpelScreen::buttonPrint(const Common::Point &pt, uint color, bool slamIt
 				prefixTextPos++;
 			}
 
-			prefixOffsetX = stringWidth(prefixText);
-		} else {
-			// no hotkey passed, used first character of text
-			hotkey = str[0];
+			if (prefixTextPos < prefixText.size()) {
+				// only adjust in case hotkey character was actually found
+				prefixOffsetX = stringWidth(prefixText);
+			}
 		}
 
 		if (slamIt) {
 			print(Common::Point(xStart, pt.y + 1),
-				COMMAND_FOREGROUND, "%s", str.c_str());
+				COMMAND_FOREGROUND, "%s", str.c_str() + skipTextOffset);
 			print(Common::Point(xStart + prefixOffsetX, pt.y + 1), COMMAND_HIGHLIGHTED, "%c", hotkey);
 		} else {
 			gPrint(Common::Point(xStart, pt.y),
-				COMMAND_FOREGROUND, "%s", str.c_str());
+				COMMAND_FOREGROUND, "%s", str.c_str() + skipTextOffset);
 			gPrint(Common::Point(xStart + prefixOffsetX, pt.y), COMMAND_HIGHLIGHTED, "%c", hotkey);
 		}
 	} else if (slamIt) {
-		print(Common::Point(xStart, pt.y + 1), color, "%s", str.c_str());
+		print(Common::Point(xStart, pt.y + 1), color, "%s", str.c_str() + skipTextOffset);
 	} else {
-		gPrint(Common::Point(xStart, pt.y), color, "%s", str.c_str());
+		gPrint(Common::Point(xStart, pt.y), color, "%s", str.c_str() + skipTextOffset);
 	}
 }
 
diff --git a/engines/sherlock/scalpel/scalpel_screen.h b/engines/sherlock/scalpel/scalpel_screen.h
index 55e104b..ff294f6 100644
--- a/engines/sherlock/scalpel/scalpel_screen.h
+++ b/engines/sherlock/scalpel/scalpel_screen.h
@@ -39,13 +39,13 @@ public:
 	/**
 	 * Draws a button for use in the inventory, talk, and examine dialogs.
 	 */
-	void makeButton(const Common::Rect &bounds, int textX, const Common::String &str, const byte hotkey = 0);
+	void makeButton(const Common::Rect &bounds, int textX, const Common::String &str, bool textContainsHotkey = false);
 
 	/**
 	 * Prints an interface command with the first letter highlighted to indicate
 	 * what keyboard shortcut is associated with it
 	 */
-	void buttonPrint(const Common::Point &pt, uint color, bool slamIt, const Common::String &str, byte hotkey = 0);
+	void buttonPrint(const Common::Point &pt, uint color, bool slamIt, const Common::String &str, bool textContainsHotkey = false);
 
 	/**
 	 * Draw a panel in the back buffer with a raised area effect around the edges
diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp
index 358ce70..2ed4971 100644
--- a/engines/sherlock/scalpel/scalpel_user_interface.cpp
+++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp
@@ -684,7 +684,6 @@ void ScalpelUserInterface::doEnvControl() {
 	ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen;
 	Talk &talk = *_vm->_talk;
 	Common::Point mousePos = events.mousePos();
-	static const char ENV_COMMANDS[7] = "ELSUDQ";
 
 	byte color;
 
@@ -725,13 +724,13 @@ void ScalpelUserInterface::doEnvControl() {
 		if (_key == Common::KEYCODE_ESCAPE)
 			_key = 'E';
 
-		if (_key == 'E' || _key == 'L' || _key == 'S' || _key == 'U' || _key == 'D' || _key == 'Q') {
-			const char *chP = strchr(ENV_COMMANDS, _key);
-			int btnIndex = !chP ? -1 : chP - ENV_COMMANDS;
-			saves.highlightButtons(btnIndex);
+		int buttonIndex = saves.identifyUserButton(_key);
+
+		if ((buttonIndex >= 0) || (_key >= '1' && _key <= '9')) {
+			saves.highlightButtons(buttonIndex);
 			_keyboardInput = true;
 
-			if (_key == 'E' || _key == 'Q') {
+			if (_key == saves._hotkeyExit || _key == saves._hotkeyQuit) {
 				saves._envMode = SAVEMODE_NONE;
 			} else if (_key >= '1' && _key <= '9') {
 				_keyboardInput = true;
@@ -766,18 +765,18 @@ void ScalpelUserInterface::doEnvControl() {
 	}
 
 	if (events._released || _keyboardInput) {
-		if ((found == 0 && events._released) || _key == 'E') {
+		if ((found == 0 && events._released) || _key == saves._hotkeyExit) {
 			banishWindow();
 			_windowBounds.top = CONTROLS_Y1;
 
 			events._pressed = events._released = _keyboardInput = false;
 			_keyPress = '\0';
-		} else if ((found == 1 && events._released) || _key == 'L') {
+		} else if ((found == 1 && events._released) || _key == saves._hotkeyLoad) {
 			saves._envMode = SAVEMODE_LOAD;
 			if (_selector != -1) {
 				saves.loadGame(_selector);
 			}
-		} else if ((found == 2 && events._released) || _key == 'S') {
+		} else if ((found == 2 && events._released) || _key == saves._hotkeySave) {
 			saves._envMode = SAVEMODE_SAVE;
 			if (_selector != -1) {
 				if (saves.checkGameOnScreen(_selector))
@@ -805,7 +804,7 @@ void ScalpelUserInterface::doEnvControl() {
 					}
 				}
 			}
-		} else if (((found == 3 && events._released) || _key == 'U') && saves._savegameIndex) {
+		} else if (((found == 3 && events._released) || _key == saves._hotkeyUp) && saves._savegameIndex) {
 			bool moreKeys;
 			do {
 				saves._savegameIndex--;
@@ -824,9 +823,9 @@ void ScalpelUserInterface::doEnvControl() {
 				screen.slamRect(Common::Rect(3, CONTROLS_Y + 11, SHERLOCK_SCREEN_WIDTH - 2, SHERLOCK_SCREEN_HEIGHT));
 
 				color = !saves._savegameIndex ? COMMAND_NULL : COMMAND_FOREGROUND;
-				screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, true, "Up");
+				screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, true, saves._fixedTextUp, true);
 				color = (saves._savegameIndex == MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT) ? COMMAND_NULL : COMMAND_FOREGROUND;
-				screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, true, "Down");
+				screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, true, saves._fixedTextDown, true);
 
 				// Check whether there are more pending U keys pressed
 				moreKeys = false;
@@ -834,10 +833,10 @@ void ScalpelUserInterface::doEnvControl() {
 					Common::KeyState keyState = events.getKey();
 
 					_key = toupper(keyState.keycode);
-					moreKeys = _key == 'U';
+					moreKeys = _key == saves._hotkeyUp;
 				}
 			} while ((saves._savegameIndex) && moreKeys);
-		} else if (((found == 4 && events._released) || _key == 'D') && saves._savegameIndex < (MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT)) {
+		} else if (((found == 4 && events._released) || _key == saves._hotkeyDown) && saves._savegameIndex < (MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT)) {
 			bool moreKeys;
 			do {
 				saves._savegameIndex++;
@@ -859,10 +858,10 @@ void ScalpelUserInterface::doEnvControl() {
 				screen.slamRect(Common::Rect(3, CONTROLS_Y + 11, SHERLOCK_SCREEN_WIDTH - 2, SHERLOCK_SCREEN_HEIGHT));
 
 				color = (!saves._savegameIndex) ? COMMAND_NULL : COMMAND_FOREGROUND;
-				screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, true, "Up");
+				screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), color, true, saves._fixedTextUp, true);
 
 				color = (saves._savegameIndex == MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT) ? COMMAND_NULL : COMMAND_FOREGROUND;
-				screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, true, "Down");
+				screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), color, true, saves._fixedTextDown, true);
 
 				// Check whether there are more pending D keys pressed
 				moreKeys = false;
@@ -870,16 +869,16 @@ void ScalpelUserInterface::doEnvControl() {
 					Common::KeyState keyState = events.getKey();
 					_key = toupper(keyState.keycode);
 
-					moreKeys = _key == 'D';
+					moreKeys = _key == saves._hotkeyDown;
 				}
 			} while (saves._savegameIndex < (MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT) && moreKeys);
-		} else if ((found == 5 && events._released) || _key == 'Q') {
+		} else if ((found == 5 && events._released) || _key == saves._hotkeyQuit) {
 			clearWindow();
-			screen.print(Common::Point(0, CONTROLS_Y + 20), INV_FOREGROUND, "Are you sure you wish to Quit ?");
+			screen.print(Common::Point(0, CONTROLS_Y + 20), INV_FOREGROUND, saves._fixedTextQuitGameQuestion.c_str());
 			screen.vgaBar(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y + 10), BORDER_COLOR);
 
-			screen.makeButton(Common::Rect(112, CONTROLS_Y, 160, CONTROLS_Y + 10), 136, "Yes");
-			screen.makeButton(Common::Rect(161, CONTROLS_Y, 209, CONTROLS_Y + 10), 184, "No");
+			screen.makeButton(Common::Rect(112, CONTROLS_Y, 160, CONTROLS_Y + 10), 136, saves._fixedTextQuitGameYes, true);
+			screen.makeButton(Common::Rect(161, CONTROLS_Y, 209, CONTROLS_Y + 10), 184, saves._fixedTextQuitGameNo, true);
 			screen.slamArea(112, CONTROLS_Y, 97, 10);
 
 			do {
@@ -903,7 +902,7 @@ void ScalpelUserInterface::doEnvControl() {
 					}
 
 					if (_key == Common::KEYCODE_ESCAPE)
-						_key = 'N';
+						_key = saves._hotkeyQuitGameNo;
 
 					if (_key == Common::KEYCODE_RETURN || _key == ' ') {
 						events._pressed = false;
@@ -918,28 +917,28 @@ void ScalpelUserInterface::doEnvControl() {
 						color = COMMAND_HIGHLIGHTED;
 					else
 						color = COMMAND_FOREGROUND;
-					screen.buttonPrint(Common::Point(136, CONTROLS_Y), color, true, "Yes");
+					screen.buttonPrint(Common::Point(136, CONTROLS_Y), color, true, saves._fixedTextQuitGameYes, true);
 
 					if (mousePos.x > 161 && mousePos.x < 208 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 9))
 						color = COMMAND_HIGHLIGHTED;
 					else
 						color = COMMAND_FOREGROUND;
-					screen.buttonPrint(Common::Point(184, CONTROLS_Y), color, true, "No");
+					screen.buttonPrint(Common::Point(184, CONTROLS_Y), color, true, saves._fixedTextQuitGameNo, true);
 				}
 
 				if (mousePos.x > 112 && mousePos.x < 159 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 9) && events._released)
-					_key = 'Y';
+					_key = saves._hotkeyQuitGameYes;
 
 				if (mousePos.x > 161 && mousePos.x < 208 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 9) && events._released)
-					_key = 'N';
-			} while (!_vm->shouldQuit() && _key != 'Y' && _key != 'N');
+					_key = saves._hotkeyQuitGameNo;
+			} while (!_vm->shouldQuit() && _key != saves._hotkeyQuitGameYes && _key != saves._hotkeyQuitGameNo);
 
-			if (_key == 'Y') {
+			if (_key == saves._hotkeyQuitGameYes) {
 				_vm->quitGame();
 				events.pollEvents();
 				return;
 			} else {
-				screen.buttonPrint(Common::Point(184, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, "No");
+				screen.buttonPrint(Common::Point(184, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, saves._fixedTextQuitGameNo, true);
 				banishWindow(1);
 				_windowBounds.top = CONTROLS_Y1;
 				_key = -1;
diff --git a/engines/sherlock/scalpel/settings.cpp b/engines/sherlock/scalpel/settings.cpp
index 855bb40..ad67dc0 100644
--- a/engines/sherlock/scalpel/settings.cpp
+++ b/engines/sherlock/scalpel/settings.cpp
@@ -67,105 +67,93 @@ void Settings::drawInterface(bool flag) {
 	}
 
 	tempStr = FIXED(Settings_Exit);
-	_hotkeyExit = tempStr.firstChar();
-	tempStr.deleteChar(0);
+	_hotkeyExit = toupper(tempStr.firstChar());
 	screen.makeButton(Common::Rect(SETUP_POINTS[0][0], SETUP_POINTS[0][1], SETUP_POINTS[0][2], SETUP_POINTS[0][1] + 10),
-		SETUP_POINTS[0][3], tempStr, _hotkeyExit);
+		SETUP_POINTS[0][3], tempStr, true);
 
 	if (music._musicOn) {
 		tempStr = FIXED(Settings_MusicOn);
 	} else {
 		tempStr = FIXED(Settings_MusicOff);
 	}
-	_hotkeyMusic = tempStr.firstChar();
-	tempStr.deleteChar(0);
+	_hotkeyMusic = toupper(tempStr.firstChar());
 	screen.makeButton(Common::Rect(SETUP_POINTS[1][0], SETUP_POINTS[1][1], SETUP_POINTS[1][2], SETUP_POINTS[1][1] + 10),
-		SETUP_POINTS[1][3], tempStr, _hotkeyMusic);
+		SETUP_POINTS[1][3], tempStr, true);
 
 	if (people._portraitsOn) {
 		tempStr = FIXED(Settings_PortraitsOn);
 	} else {
 		tempStr = FIXED(Settings_PortraitsOff);
 	}
-	_hotkeyPortraits = tempStr.firstChar();
-	tempStr.deleteChar(0);
+	_hotkeyPortraits = toupper(tempStr.firstChar());
 	screen.makeButton(Common::Rect(SETUP_POINTS[10][0], SETUP_POINTS[10][1], SETUP_POINTS[10][2], SETUP_POINTS[10][1] + 10),
-		SETUP_POINTS[10][3], tempStr, _hotkeyPortraits);
+		SETUP_POINTS[10][3], tempStr, true);
 
 	// WORKAROUND: We don't support the joystick in ScummVM, so draw the next two buttons as disabled
 	tempStr = FIXED(Settings_JoystickOff);
-	tempStr.deleteChar(0);
 	screen.makeButton(Common::Rect(SETUP_POINTS[6][0], SETUP_POINTS[6][1], SETUP_POINTS[6][2], SETUP_POINTS[6][1] + 10),
-		SETUP_POINTS[6][3], tempStr);
-	screen.buttonPrint(Common::Point(SETUP_POINTS[6][3], SETUP_POINTS[6][1]), COMMAND_NULL, false, tempStr);
+		SETUP_POINTS[6][3], tempStr, true);
+	screen.buttonPrint(Common::Point(SETUP_POINTS[6][3], SETUP_POINTS[6][1]), COMMAND_NULL, false, tempStr, true);
 
 	tempStr = FIXED(Settings_NewFontStyle);
-	_hotkeyNewFontStyle = tempStr.firstChar();
-	tempStr.deleteChar(0);
+	_hotkeyNewFontStyle = toupper(tempStr.firstChar());
 	screen.makeButton(Common::Rect(SETUP_POINTS[5][0], SETUP_POINTS[5][1], SETUP_POINTS[5][2], SETUP_POINTS[5][1] + 10),
-		SETUP_POINTS[5][3], tempStr, _hotkeyNewFontStyle);
+		SETUP_POINTS[5][3], tempStr, true);
 
 	if (sound._digitized) {
 		tempStr = FIXED(Settings_SoundEffectsOn);
 	} else {
 		tempStr = FIXED(Settings_SoundEffectsOff);
 	}
-	_hotkeySoundEffects = tempStr.firstChar();
-	tempStr.deleteChar(0);
+	_hotkeySoundEffects = toupper(tempStr.firstChar());
 	screen.makeButton(Common::Rect(SETUP_POINTS[3][0], SETUP_POINTS[3][1], SETUP_POINTS[3][2], SETUP_POINTS[3][1] + 10),
-		SETUP_POINTS[3][3], tempStr, _hotkeySoundEffects);
+		SETUP_POINTS[3][3], tempStr, true);
 
 	if (ui._slideWindows) {
 		tempStr = FIXED(Settings_WindowsSlide);
 	} else {
 		tempStr = FIXED(Settings_WindowsAppear);
 	}
-	_hotkeyWindows = tempStr.firstChar();
-	tempStr.deleteChar(0);
+	_hotkeyWindows = toupper(tempStr.firstChar());
 	screen.makeButton(Common::Rect(SETUP_POINTS[9][0], SETUP_POINTS[9][1], SETUP_POINTS[9][2], SETUP_POINTS[9][1] + 10),
-		SETUP_POINTS[9][3], tempStr, _hotkeyWindows);
+		SETUP_POINTS[9][3], tempStr, true);
 
 	tempStr = FIXED(Settings_CalibrateJoystick);
-	tempStr.deleteChar(0);
 	screen.makeButton(Common::Rect(SETUP_POINTS[7][0], SETUP_POINTS[7][1], SETUP_POINTS[7][2], SETUP_POINTS[7][1] + 10),
-		SETUP_POINTS[7][3], tempStr);
-	screen.buttonPrint(Common::Point(SETUP_POINTS[7][3], SETUP_POINTS[7][1]), COMMAND_NULL, false, tempStr);
+		SETUP_POINTS[7][3], tempStr, true);
+	screen.buttonPrint(Common::Point(SETUP_POINTS[7][3], SETUP_POINTS[7][1]), COMMAND_NULL, false, tempStr, true);
 
 	if (ui._helpStyle) {
 		tempStr = FIXED(Settings_AutoHelpRight);
 	} else {
 		tempStr = FIXED(Settings_AutoHelpLeft);
 	}
-	_hotkeyAutoHelp = tempStr.firstChar();
-	tempStr.deleteChar(0);
+	_hotkeyAutoHelp = toupper(tempStr.firstChar());
 	screen.makeButton(Common::Rect(SETUP_POINTS[4][0], SETUP_POINTS[4][1], SETUP_POINTS[4][2], SETUP_POINTS[4][1] + 10),
-		SETUP_POINTS[4][3], tempStr, _hotkeyAutoHelp);
+		SETUP_POINTS[4][3], tempStr, true);
 
 	if (sound._voices) {
 		tempStr = FIXED(Settings_VoicesOn);
 	} else {
 		tempStr = FIXED(Settings_VoicesOff);
 	}
-	_hotkeyVoices = tempStr.firstChar();
-	tempStr.deleteChar(0);
+	_hotkeyVoices = toupper(tempStr.firstChar());
 	screen.makeButton(Common::Rect(SETUP_POINTS[2][0], SETUP_POINTS[2][1], SETUP_POINTS[2][2], SETUP_POINTS[2][1] + 10),
-		SETUP_POINTS[2][3], tempStr, _hotkeyVoices);
+		SETUP_POINTS[2][3], tempStr, true);
 
 	if (screen._fadeStyle) {
 		tempStr = FIXED(Settings_FadeByPixel);
 	} else {
 		tempStr = FIXED(Settings_FadeDirectly);
 	}
-	_hotkeyFade = tempStr.firstChar();
-	tempStr.deleteChar(0);
+	_hotkeyFade = toupper(tempStr.firstChar());
 	screen.makeButton(Common::Rect(SETUP_POINTS[8][0], SETUP_POINTS[8][1], SETUP_POINTS[8][2], SETUP_POINTS[8][1] + 10),
-		SETUP_POINTS[8][3], tempStr, _hotkeyFade);
+		SETUP_POINTS[8][3], tempStr, true);
 
 	tempStr = FIXED(Settings_KeyPadSlow);
-	tempStr.deleteChar(0);
 	screen.makeButton(Common::Rect(SETUP_POINTS[11][0], SETUP_POINTS[11][1], SETUP_POINTS[11][2], SETUP_POINTS[11][1] + 10),
-		SETUP_POINTS[11][3], tempStr);
-	screen.buttonPrint(Common::Point(SETUP_POINTS[11][3], SETUP_POINTS[11][1]), COMMAND_NULL, false, tempStr);
+		SETUP_POINTS[11][3], tempStr, true);
+	screen.buttonPrint(Common::Point(SETUP_POINTS[11][3], SETUP_POINTS[11][1]), COMMAND_NULL, false, tempStr, true);
 
 	_hotkeysIndexed[0] = _hotkeyExit;
 	_hotkeysIndexed[1] = _hotkeyMusic;
@@ -281,8 +269,7 @@ int Settings::drawButtons(const Common::Point &pt, int _key) {
 		default:
 			continue;
 		}
-		tempStr.deleteChar(0);
-		screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr, _hotkeysIndexed[idx]);
+		screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr, true);
 	}
 
 	return found;
@@ -337,11 +324,11 @@ void Settings::show(SherlockEngine *vm) {
 			found = settings.drawButtons(pt, ui._key);
 		}
 
-		if ((found == 0 && events._released) || (ui._key == toupper(settings._hotkeyExit) || ui._key == Common::KEYCODE_ESCAPE))
+		if ((found == 0 && events._released) || (ui._key == settings._hotkeyExit || ui._key == Common::KEYCODE_ESCAPE))
 			// Exit
 			break;
 
-		if ((found == 1 && events._released) || ui._key == toupper(settings._hotkeyMusic)) {
+		if ((found == 1 && events._released) || ui._key == settings._hotkeyMusic) {
 			// Toggle music
 			music._musicOn = !music._musicOn;
 			if (!music._musicOn)
@@ -353,27 +340,27 @@ void Settings::show(SherlockEngine *vm) {
 			settings.drawInterface(true);
 		}
 
-		if ((found == 2 && events._released) || ui._key == toupper(settings._hotkeyVoices)) {
+		if ((found == 2 && events._released) || ui._key == settings._hotkeyVoices) {
 			sound._voices = !sound._voices;
 			updateConfig = true;
 			settings.drawInterface(true);
 		}
 
-		if ((found == 3 && events._released) || ui._key == toupper(settings._hotkeySoundEffects)) {
+		if ((found == 3 && events._released) || ui._key == settings._hotkeySoundEffects) {
 			// Toggle sound effects
 			sound._digitized = !sound._digitized;
 			updateConfig = true;
 			settings.drawInterface(true);
 		}
 
-		if ((found == 4 && events._released) || ui._key == toupper(settings._hotkeyAutoHelp)) {
+		if ((found == 4 && events._released) || ui._key == settings._hotkeyAutoHelp) {
 			// Help button style
 			ui._helpStyle = !ui._helpStyle;
 			updateConfig = true;
 			settings.drawInterface(true);
 		}
 
-		if ((found == 5 && events._released) || ui._key == toupper(settings._hotkeyNewFontStyle)) {
+		if ((found == 5 && events._released) || ui._key == settings._hotkeyNewFontStyle) {
 			// New font style
 			int fontNum = screen.fontNumber() + 1;
 			if (fontNum == 3)
@@ -384,21 +371,21 @@ void Settings::show(SherlockEngine *vm) {
 			settings.drawInterface(true);
 		}
 
-		if ((found == 8 && events._released) || ui._key == toupper(settings._hotkeyFade)) {
+		if ((found == 8 && events._released) || ui._key == settings._hotkeyFade) {
 			// Toggle fade style
 			screen._fadeStyle = !screen._fadeStyle;
 			updateConfig = true;
 			settings.drawInterface(true);
 		}
 
-		if ((found == 9 && events._released) || ui._key == toupper(settings._hotkeyWindows)) {
+		if ((found == 9 && events._released) || ui._key == settings._hotkeyWindows) {
 			// Window style
 			ui._slideWindows = !ui._slideWindows;
 			updateConfig = true;
 			settings.drawInterface(true);
 		}
 
-		if ((found == 10 && events._released) || ui._key == toupper(settings._hotkeyPortraits)) {
+		if ((found == 10 && events._released) || ui._key == settings._hotkeyPortraits) {
 			// Toggle portraits being shown
 			people._portraitsOn = !people._portraitsOn;
 			updateConfig = true;






More information about the Scummvm-git-logs mailing list