SHERLOCK: SS: make settings multilingual

Also make it possible to somewhat easily have hotkeys within
the button text itself and not just having to use the very first
button text character as hotkey.
This commit is contained in:
Martin Kiewitz 2016-01-30 14:03:38 +01:00
parent 42f327e5fd
commit dc3c3a84fd
11 changed files with 347 additions and 136 deletions

View file

@ -55,6 +55,27 @@ static const char *const fixedTextEN[] = {
"Backward", "Backward",
"Forward", "Forward",
"Text Not Found !", "Text Not Found !",
// SH1: Settings
"EExit",
"MMusic on",
"MMusic off",
"PPortraits on",
"PPortraits off",
"JJoystick off",
"NNew Font Style",
"SSound Effects on",
"SSound Effects off",
"WWindows Slide",
"WWindows Appear",
"CCalibrate Joystick",
"AAuto Help left",
"AAuto Help right",
"VVoices on",
"VVoices off",
"FFade by Pixel",
"FFade Directly",
"KKey Pad Slow",
"KKey Pad Fast",
// SH1: Press key text // SH1: Press key text
"Press any Key for More.", "Press any Key for More.",
"P", "P",
@ -168,6 +189,27 @@ static const char *const fixedTextDE[] = {
"R\201ckw\204rts", // original: "Backward" "R\201ckw\204rts", // original: "Backward"
"Vorw\204rts", // original: "Forward" "Vorw\204rts", // original: "Forward"
"Text nicht gefunden!", "Text nicht gefunden!",
// SH1: Settings
"ZZur\201ck", // original interpreter: "Exit"
"MMusik an",
"MMusik aus",
"PPortr\204ts an", // original interpreter: "Portraits"
"PPortr\204ts aus",
"JJoystick aus",
"NNeue Schrift",
"GGer\204uscheffekte on", // original interpreter: "Effekte"
"GGer\204uscheffekte off",
"FFenster gleitend",
"FFenster direkt",
"JJustiere Joystick",
"HHilfe links",
"HHilfe rechts",
"SSprache an",
"SSprache aus",
"cSchnitt",
"BBlende",
"CCursor langsam",
"CCursor schnell",
// SH1: Press key text // SH1: Press key text
"Mehr auf Tastendruck...", "Mehr auf Tastendruck...",
"M", "M",
@ -280,6 +322,27 @@ static const char *const fixedTextES[] = {
"Retroceder", "Retroceder",
"Avanzar", "Avanzar",
"Texto no encontrado!", "Texto no encontrado!",
// SH1: Settings
"aSalir", // original interpreter: "Exit"
"MMusica si",
"MMusica no",
"RRetratos si",
"RRetratos no",
"JJoystick no",
"NNuevo fuente",
"Sefectos Sonido si",
"Sefectos Sonido no",
"Tven Tanas desliz.",
"Tven Tanas aparecen",
"CCalibrar Joystick",
"yAyuda lzq", // TODO: check this
"yAyuda Dcha",
"VVoces si",
"VVoces no",
"FFundido a pixel",
"FFundido directo",
"eTeclado lento",
"eTeclado rapido",
// SH1: Press key text // SH1: Press key text
"Tecla para ver mas", "Tecla para ver mas",
"T", "T",

View file

@ -57,6 +57,27 @@ enum FixedTextId {
kFixedText_JournalSearch_Backward, kFixedText_JournalSearch_Backward,
kFixedText_JournalSearch_Forward, kFixedText_JournalSearch_Forward,
kFixedText_JournalSearch_NotFound, kFixedText_JournalSearch_NotFound,
// Settings
kFixedText_Settings_Exit,
kFixedText_Settings_MusicOn,
kFixedText_Settings_MusicOff,
kFixedText_Settings_PortraitsOn,
kFixedText_Settings_PortraitsOff,
kFixedText_Settings_JoystickOff,
kFixedText_Settings_NewFontStyle,
kFixedText_Settings_SoundEffectsOn,
kFixedText_Settings_SoundEffectsOff,
kFixedText_Settings_WindowsSlide,
kFixedText_Settings_WindowsAppear,
kFixedText_Settings_CalibrateJoystick,
kFixedText_Settings_AutoHelpLeft,
kFixedText_Settings_AutoHelpRight,
kFixedText_Settings_VoicesOn,
kFixedText_Settings_VoicesOff,
kFixedText_Settings_FadeByPixel,
kFixedText_Settings_FadeDirectly,
kFixedText_Settings_KeyPadSlow,
kFixedText_Settings_KeyPadFast,
// Press key text // Press key text
kFixedText_PressKey_ForMore, kFixedText_PressKey_ForMore,
kFixedText_PressKey_ForMoreHotkey, kFixedText_PressKey_ForMoreHotkey,

View file

@ -67,21 +67,21 @@ void ScalpelInventory::drawInventory(InvNewMode mode) {
Common::String fixedText_Give = fixedText.getText(kFixedText_Inventory_Give); Common::String fixedText_Give = fixedText.getText(kFixedText_Inventory_Give);
screen.makeButton(Common::Rect(INVENTORY_POINTS[0][0], CONTROLS_Y1, INVENTORY_POINTS[0][1], screen.makeButton(Common::Rect(INVENTORY_POINTS[0][0], CONTROLS_Y1, INVENTORY_POINTS[0][1],
CONTROLS_Y1 + 10), INVENTORY_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, fixedText_Exit); CONTROLS_Y1 + 10), INVENTORY_POINTS[0][2], fixedText_Exit);
screen.makeButton(Common::Rect(INVENTORY_POINTS[1][0], CONTROLS_Y1, INVENTORY_POINTS[1][1], screen.makeButton(Common::Rect(INVENTORY_POINTS[1][0], CONTROLS_Y1, INVENTORY_POINTS[1][1],
CONTROLS_Y1 + 10), INVENTORY_POINTS[1][2] - screen.stringWidth(fixedText_Look) / 2, fixedText_Look); CONTROLS_Y1 + 10), INVENTORY_POINTS[1][2], fixedText_Look);
screen.makeButton(Common::Rect(INVENTORY_POINTS[2][0], CONTROLS_Y1, INVENTORY_POINTS[2][1], screen.makeButton(Common::Rect(INVENTORY_POINTS[2][0], CONTROLS_Y1, INVENTORY_POINTS[2][1],
CONTROLS_Y1 + 10), INVENTORY_POINTS[2][2] - screen.stringWidth(fixedText_Use) / 2, fixedText_Use); CONTROLS_Y1 + 10), INVENTORY_POINTS[2][2], fixedText_Use);
screen.makeButton(Common::Rect(INVENTORY_POINTS[3][0], CONTROLS_Y1, INVENTORY_POINTS[3][1], screen.makeButton(Common::Rect(INVENTORY_POINTS[3][0], CONTROLS_Y1, INVENTORY_POINTS[3][1],
CONTROLS_Y1 + 10), INVENTORY_POINTS[3][2] - screen.stringWidth(fixedText_Give) / 2, fixedText_Give); CONTROLS_Y1 + 10), INVENTORY_POINTS[3][2], fixedText_Give);
screen.makeButton(Common::Rect(INVENTORY_POINTS[4][0], CONTROLS_Y1, INVENTORY_POINTS[4][1], screen.makeButton(Common::Rect(INVENTORY_POINTS[4][0], CONTROLS_Y1, INVENTORY_POINTS[4][1],
CONTROLS_Y1 + 10), INVENTORY_POINTS[4][2], "^^"); // 2 arrows pointing to the left CONTROLS_Y1 + 10), INVENTORY_POINTS[4][2] + 8, "^^"); // 2 arrows pointing to the left
screen.makeButton(Common::Rect(INVENTORY_POINTS[5][0], CONTROLS_Y1, INVENTORY_POINTS[5][1], screen.makeButton(Common::Rect(INVENTORY_POINTS[5][0], CONTROLS_Y1, INVENTORY_POINTS[5][1],
CONTROLS_Y1 + 10), INVENTORY_POINTS[5][2], "^"); // 1 arrow pointing to the left CONTROLS_Y1 + 10), INVENTORY_POINTS[5][2] + 4, "^"); // 1 arrow pointing to the left
screen.makeButton(Common::Rect(INVENTORY_POINTS[6][0], CONTROLS_Y1, INVENTORY_POINTS[6][1], screen.makeButton(Common::Rect(INVENTORY_POINTS[6][0], CONTROLS_Y1, INVENTORY_POINTS[6][1],
CONTROLS_Y1 + 10), INVENTORY_POINTS[6][2], "_"); // 1 arrow pointing to the right CONTROLS_Y1 + 10), INVENTORY_POINTS[6][2] + 4, "_"); // 1 arrow pointing to the right
screen.makeButton(Common::Rect(INVENTORY_POINTS[7][0], CONTROLS_Y1, INVENTORY_POINTS[7][1], screen.makeButton(Common::Rect(INVENTORY_POINTS[7][0], CONTROLS_Y1, INVENTORY_POINTS[7][1],
CONTROLS_Y1 + 10), INVENTORY_POINTS[7][2], "__"); // 2 arrows pointing to the right CONTROLS_Y1 + 10), INVENTORY_POINTS[7][2] + 8, "__"); // 2 arrows pointing to the right
if (tempMode == INVENTORY_DONT_DISPLAY) if (tempMode == INVENTORY_DONT_DISPLAY)
mode = LOOK_INVENTORY_MODE; mode = LOOK_INVENTORY_MODE;

View file

@ -164,33 +164,33 @@ void ScalpelJournal::drawFrame() {
// Draw the buttons // Draw the buttons
screen.makeButton(Common::Rect(JOURNAL_POINTS[0][0], JOURNAL_BUTTONS_Y, screen.makeButton(Common::Rect(JOURNAL_POINTS[0][0], JOURNAL_BUTTONS_Y,
JOURNAL_POINTS[0][1], JOURNAL_BUTTONS_Y + 10), JOURNAL_POINTS[0][1], JOURNAL_BUTTONS_Y + 10),
JOURNAL_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, fixedText_Exit); JOURNAL_POINTS[0][2], fixedText_Exit);
screen.makeButton(Common::Rect(JOURNAL_POINTS[1][0], JOURNAL_BUTTONS_Y, screen.makeButton(Common::Rect(JOURNAL_POINTS[1][0], JOURNAL_BUTTONS_Y,
JOURNAL_POINTS[1][1], JOURNAL_BUTTONS_Y + 10), JOURNAL_POINTS[1][1], JOURNAL_BUTTONS_Y + 10),
JOURNAL_POINTS[1][2] - screen.stringWidth(fixedText_Back10) / 2, fixedText_Back10); JOURNAL_POINTS[1][2], fixedText_Back10);
screen.makeButton(Common::Rect(JOURNAL_POINTS[2][0], JOURNAL_BUTTONS_Y, screen.makeButton(Common::Rect(JOURNAL_POINTS[2][0], JOURNAL_BUTTONS_Y,
JOURNAL_POINTS[2][1], JOURNAL_BUTTONS_Y + 10), JOURNAL_POINTS[2][1], JOURNAL_BUTTONS_Y + 10),
JOURNAL_POINTS[2][2] - screen.stringWidth(fixedText_Up) / 2, fixedText_Up); JOURNAL_POINTS[2][2], fixedText_Up);
screen.makeButton(Common::Rect(JOURNAL_POINTS[3][0], JOURNAL_BUTTONS_Y, screen.makeButton(Common::Rect(JOURNAL_POINTS[3][0], JOURNAL_BUTTONS_Y,
JOURNAL_POINTS[3][1], JOURNAL_BUTTONS_Y + 10), JOURNAL_POINTS[3][1], JOURNAL_BUTTONS_Y + 10),
JOURNAL_POINTS[3][2] - screen.stringWidth(fixedText_Down) / 2, fixedText_Down); JOURNAL_POINTS[3][2], fixedText_Down);
screen.makeButton(Common::Rect(JOURNAL_POINTS[4][0], JOURNAL_BUTTONS_Y, screen.makeButton(Common::Rect(JOURNAL_POINTS[4][0], JOURNAL_BUTTONS_Y,
JOURNAL_POINTS[4][1], JOURNAL_BUTTONS_Y + 10), JOURNAL_POINTS[4][1], JOURNAL_BUTTONS_Y + 10),
JOURNAL_POINTS[4][2] - screen.stringWidth(fixedText_Ahead10) / 2, fixedText_Ahead10); JOURNAL_POINTS[4][2], fixedText_Ahead10);
screen.makeButton(Common::Rect(JOURNAL_POINTS[5][0], JOURNAL_BUTTONS_Y + 11, screen.makeButton(Common::Rect(JOURNAL_POINTS[5][0], JOURNAL_BUTTONS_Y + 11,
JOURNAL_POINTS[5][1], JOURNAL_BUTTONS_Y + 21), JOURNAL_POINTS[5][1], JOURNAL_BUTTONS_Y + 21),
JOURNAL_POINTS[5][2] - screen.stringWidth(fixedText_Search) / 2, fixedText_Search); JOURNAL_POINTS[5][2], fixedText_Search);
screen.makeButton(Common::Rect(JOURNAL_POINTS[6][0], JOURNAL_BUTTONS_Y + 11, screen.makeButton(Common::Rect(JOURNAL_POINTS[6][0], JOURNAL_BUTTONS_Y + 11,
JOURNAL_POINTS[6][1], JOURNAL_BUTTONS_Y + 21), JOURNAL_POINTS[6][1], JOURNAL_BUTTONS_Y + 21),
JOURNAL_POINTS[6][2] - screen.stringWidth(fixedText_FirstPage) / 2, fixedText_FirstPage); JOURNAL_POINTS[6][2], fixedText_FirstPage);
screen.makeButton(Common::Rect(JOURNAL_POINTS[7][0], JOURNAL_BUTTONS_Y + 11, screen.makeButton(Common::Rect(JOURNAL_POINTS[7][0], JOURNAL_BUTTONS_Y + 11,
JOURNAL_POINTS[7][1], JOURNAL_BUTTONS_Y + 21), JOURNAL_POINTS[7][1], JOURNAL_BUTTONS_Y + 21),
JOURNAL_POINTS[7][2] - screen.stringWidth(fixedText_LastPage) / 2, fixedText_LastPage); JOURNAL_POINTS[7][2], fixedText_LastPage);
// WORKAROUND: Draw Print Text button as disabled, since we don't support it in ScummVM // WORKAROUND: Draw Print Text button as disabled, since we don't support it in ScummVM
screen.makeButton(Common::Rect(JOURNAL_POINTS[8][0], JOURNAL_BUTTONS_Y + 11, screen.makeButton(Common::Rect(JOURNAL_POINTS[8][0], JOURNAL_BUTTONS_Y + 11,
JOURNAL_POINTS[8][1], JOURNAL_BUTTONS_Y + 21), JOURNAL_POINTS[8][1], JOURNAL_BUTTONS_Y + 21),
JOURNAL_POINTS[8][2] - screen.stringWidth(fixedText_PrintText) / 2, fixedText_PrintText); JOURNAL_POINTS[8][2], fixedText_PrintText);
screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11), screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11),
COMMAND_NULL, false, fixedText_PrintText); COMMAND_NULL, false, fixedText_PrintText);
} }
@ -486,11 +486,11 @@ int ScalpelJournal::getSearchString(bool printError) {
// Draw search panel // Draw search panel
screen.makePanel(Common::Rect(6, 171, 313, 199)); screen.makePanel(Common::Rect(6, 171, 313, 199));
screen.makeButton(Common::Rect(SEARCH_POINTS[0][0], yp, SEARCH_POINTS[0][1], yp + 10), screen.makeButton(Common::Rect(SEARCH_POINTS[0][0], yp, SEARCH_POINTS[0][1], yp + 10),
SEARCH_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, fixedText_Exit); SEARCH_POINTS[0][2], fixedText_Exit);
screen.makeButton(Common::Rect(SEARCH_POINTS[1][0], yp, SEARCH_POINTS[1][1], yp + 10), screen.makeButton(Common::Rect(SEARCH_POINTS[1][0], yp, SEARCH_POINTS[1][1], yp + 10),
SEARCH_POINTS[1][2] - screen.stringWidth(fixedText_Backward) / 2, fixedText_Backward); SEARCH_POINTS[1][2], fixedText_Backward);
screen.makeButton(Common::Rect(SEARCH_POINTS[2][0], yp, SEARCH_POINTS[2][1], yp + 10), screen.makeButton(Common::Rect(SEARCH_POINTS[2][0], yp, SEARCH_POINTS[2][1], yp + 10),
SEARCH_POINTS[2][2] - screen.stringWidth(fixedText_Forward) / 2, fixedText_Forward); SEARCH_POINTS[2][2], fixedText_Forward);
screen.gPrint(Common::Point(SEARCH_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, yp), screen.gPrint(Common::Point(SEARCH_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, yp),
COMMAND_HIGHLIGHTED, "%c", fixedText_Exit[0]); COMMAND_HIGHLIGHTED, "%c", fixedText_Exit[0]);

View file

@ -57,17 +57,17 @@ void ScalpelSaveManager::drawInterface() {
screen._backBuffer1.fillRect(Common::Rect(2, CONTROLS_Y + 10, SHERLOCK_SCREEN_WIDTH - 2, SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND); 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), screen.makeButton(Common::Rect(ENV_POINTS[0][0], CONTROLS_Y, ENV_POINTS[0][1], CONTROLS_Y + 10),
ENV_POINTS[0][2] - screen.stringWidth("Exit") / 2, "Exit"); ENV_POINTS[0][2], "Exit");
screen.makeButton(Common::Rect(ENV_POINTS[1][0], CONTROLS_Y, ENV_POINTS[1][1], CONTROLS_Y + 10), screen.makeButton(Common::Rect(ENV_POINTS[1][0], CONTROLS_Y, ENV_POINTS[1][1], CONTROLS_Y + 10),
ENV_POINTS[1][2] - screen.stringWidth("Load") / 2, "Load"); ENV_POINTS[1][2], "Load");
screen.makeButton(Common::Rect(ENV_POINTS[2][0], CONTROLS_Y, ENV_POINTS[2][1], CONTROLS_Y + 10), screen.makeButton(Common::Rect(ENV_POINTS[2][0], CONTROLS_Y, ENV_POINTS[2][1], CONTROLS_Y + 10),
ENV_POINTS[2][2] - screen.stringWidth("Save") / 2, "Save"); ENV_POINTS[2][2], "Save");
screen.makeButton(Common::Rect(ENV_POINTS[3][0], CONTROLS_Y, ENV_POINTS[3][1], CONTROLS_Y + 10), screen.makeButton(Common::Rect(ENV_POINTS[3][0], CONTROLS_Y, ENV_POINTS[3][1], CONTROLS_Y + 10),
ENV_POINTS[3][2] - screen.stringWidth("Up") / 2, "Up"); ENV_POINTS[3][2], "Up");
screen.makeButton(Common::Rect(ENV_POINTS[4][0], CONTROLS_Y, ENV_POINTS[4][1], CONTROLS_Y + 10), screen.makeButton(Common::Rect(ENV_POINTS[4][0], CONTROLS_Y, ENV_POINTS[4][1], CONTROLS_Y + 10),
ENV_POINTS[4][2] - screen.stringWidth("Down") / 2, "Down"); ENV_POINTS[4][2], "Down");
screen.makeButton(Common::Rect(ENV_POINTS[5][0], CONTROLS_Y, ENV_POINTS[5][1], CONTROLS_Y + 10), screen.makeButton(Common::Rect(ENV_POINTS[5][0], CONTROLS_Y, ENV_POINTS[5][1], CONTROLS_Y + 10),
ENV_POINTS[5][2] - screen.stringWidth("Quit") / 2, "Quit"); ENV_POINTS[5][2], "Quit");
if (!_savegameIndex) 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, "Up");

View file

@ -31,7 +31,7 @@ ScalpelScreen::ScalpelScreen(SherlockEngine *vm) : Screen(vm) {
} }
void ScalpelScreen::makeButton(const Common::Rect &bounds, int textX, void ScalpelScreen::makeButton(const Common::Rect &bounds, int textX,
const Common::String &str) { const Common::String &str, const byte hotkey) {
Surface &bb = *_backBuffer; Surface &bb = *_backBuffer;
bb.fillRect(Common::Rect(bounds.left, bounds.top, bounds.right, bounds.top + 1), BUTTON_TOP); bb.fillRect(Common::Rect(bounds.left, bounds.top, bounds.right, bounds.top + 1), BUTTON_TOP);
@ -40,25 +40,49 @@ 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.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); bb.fillRect(Common::Rect(bounds.left + 1, bounds.top + 1, bounds.right - 1, bounds.bottom - 1), BUTTON_MIDDLE);
gPrint(Common::Point(textX, bounds.top), COMMAND_HIGHLIGHTED, "%c", str[0]); buttonPrint(Common::Point(textX, bounds.top), COMMAND_FOREGROUND, false, str, hotkey);
gPrint(Common::Point(textX + charWidth(str[0]), bounds.top),
COMMAND_FOREGROUND, "%s", str.c_str() + 1);
} }
void ScalpelScreen::buttonPrint(const Common::Point &pt, uint color, bool slamIt, void ScalpelScreen::buttonPrint(const Common::Point &pt, uint color, bool slamIt,
const Common::String &str) { const Common::String &str, byte hotkey) {
int xStart = pt.x - stringWidth(str) / 2; int xStart = pt.x - stringWidth(str) / 2;
if (color == COMMAND_FOREGROUND) { if (color == COMMAND_FOREGROUND) {
// First character needs to be highlighted Common::String prefixText = str;
if (slamIt) { uint16 prefixOffsetX = 0;
print(Common::Point(xStart, pt.y + 1), COMMAND_HIGHLIGHTED, "%c", str[0]);
print(Common::Point(xStart + charWidth(str[0]), pt.y + 1), // Hotkey needs to be highlighted
COMMAND_FOREGROUND, "%s", str.c_str() + 1); 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)
uint16 prefixTextPos = 0;
while (prefixTextPos < prefixText.size()) {
if (prefixText[prefixTextPos] == hotkey) {
// Hotkey found, remove remaining text
while (prefixTextPos < prefixText.size()) {
prefixText.deleteLastChar();
}
break;
}
prefixTextPos++;
}
prefixOffsetX = stringWidth(prefixText);
} else { } else {
gPrint(Common::Point(xStart, pt.y), COMMAND_HIGHLIGHTED, "%c", str[0]); // no hotkey passed, used first character of text
gPrint(Common::Point(xStart + charWidth(str[0]), pt.y), hotkey = str[0];
COMMAND_FOREGROUND, "%s", str.c_str() + 1); }
if (slamIt) {
print(Common::Point(xStart, pt.y + 1),
COMMAND_FOREGROUND, "%s", str.c_str());
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());
gPrint(Common::Point(xStart + prefixOffsetX, pt.y), COMMAND_HIGHLIGHTED, "%c", hotkey);
} }
} else if (slamIt) { } 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());

View file

@ -39,13 +39,13 @@ public:
/** /**
* Draws a button for use in the inventory, talk, and examine dialogs. * Draws a button for use in the inventory, talk, and examine dialogs.
*/ */
void makeButton(const Common::Rect &bounds, int textX, const Common::String &str); void makeButton(const Common::Rect &bounds, int textX, const Common::String &str, const byte hotkey = 0);
/** /**
* Prints an interface command with the first letter highlighted to indicate * Prints an interface command with the first letter highlighted to indicate
* what keyboard shortcut is associated with it * what keyboard shortcut is associated with it
*/ */
void buttonPrint(const Common::Point &pt, uint color, bool slamIt, const Common::String &str); void buttonPrint(const Common::Point &pt, uint color, bool slamIt, const Common::String &str, byte hotkey = 0);
/** /**
* Draw a panel in the back buffer with a raised area effect around the edges * Draw a panel in the back buffer with a raised area effect around the edges

View file

@ -703,18 +703,18 @@ void ScalpelTalk::drawInterface() {
Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down);
screen.makeButton(Common::Rect(99, CONTROLS_Y, 139, CONTROLS_Y + 10), screen.makeButton(Common::Rect(99, CONTROLS_Y, 139, CONTROLS_Y + 10),
119 - screen.stringWidth(fixedText_Exit) / 2, fixedText_Exit); 119, fixedText_Exit);
screen.makeButton(Common::Rect(140, CONTROLS_Y, 180, CONTROLS_Y + 10), screen.makeButton(Common::Rect(140, CONTROLS_Y, 180, CONTROLS_Y + 10),
159 - screen.stringWidth(fixedText_Up) / 2, fixedText_Up); 159, fixedText_Up);
screen.makeButton(Common::Rect(181, CONTROLS_Y, 221, CONTROLS_Y + 10), screen.makeButton(Common::Rect(181, CONTROLS_Y, 221, CONTROLS_Y + 10),
200 - screen.stringWidth(fixedText_Down) / 2, fixedText_Down); 200, fixedText_Down);
} else { } else {
Common::String fixedText_PressKeyToContinue = fixedText.getText(kFixedText_PressKey_ToContinue); Common::String fixedText_PressKeyToContinue = fixedText.getText(kFixedText_PressKey_ToContinue);
Common::String fixedText_PressKeyToContinueHotkey = fixedText.getText(kFixedText_PressKey_ToContinueHotkey); Common::String fixedText_PressKeyToContinueHotkey = fixedText.getText(kFixedText_PressKey_ToContinueHotkey);
int fixedText_PressKeyToContinueLen = screen.stringWidth(fixedText_PressKeyToContinue); int fixedText_PressKeyToContinueLen = screen.stringWidth(fixedText_PressKeyToContinue);
screen.makeButton(Common::Rect(46, CONTROLS_Y, 273, CONTROLS_Y + 10), screen.makeButton(Common::Rect(46, CONTROLS_Y, 273, CONTROLS_Y + 10),
160 - fixedText_PressKeyToContinueLen / 2, fixedText_PressKeyToContinue); 160, fixedText_PressKeyToContinue);
screen.gPrint(Common::Point(160 - fixedText_PressKeyToContinueLen / 2, CONTROLS_Y), COMMAND_FOREGROUND, screen.gPrint(Common::Point(160 - fixedText_PressKeyToContinueLen / 2, CONTROLS_Y), COMMAND_FOREGROUND,
"%s", fixedText_PressKeyToContinueHotkey.c_str()); "%s", fixedText_PressKeyToContinueHotkey.c_str());
} }

View file

@ -878,8 +878,8 @@ void ScalpelUserInterface::doEnvControl() {
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, "Are you sure you wish to Quit ?");
screen.vgaBar(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y + 10), BORDER_COLOR); 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 - screen.stringWidth("Yes") / 2, "Yes"); 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 - screen.stringWidth("No") / 2, "No"); screen.makeButton(Common::Rect(161, CONTROLS_Y, 209, CONTROLS_Y + 10), 184, "No");
screen.slamArea(112, CONTROLS_Y, 97, 10); screen.slamArea(112, CONTROLS_Y, 97, 10);
do { do {
@ -1955,7 +1955,7 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first
int fixedText_PressKeyToContinueLen = screen.stringWidth(fixedText_PressKeyToContinue); int fixedText_PressKeyToContinueLen = screen.stringWidth(fixedText_PressKeyToContinue);
screen.makeButton(Common::Rect(46, CONTROLS_Y, 272, CONTROLS_Y + 10), screen.makeButton(Common::Rect(46, CONTROLS_Y, 272, CONTROLS_Y + 10),
(SHERLOCK_SCREEN_WIDTH - fixedText_PressKeyToContinueLen) / 2, SHERLOCK_SCREEN_WIDTH / 2,
fixedText_PressKeyToContinue); fixedText_PressKeyToContinue);
screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - fixedText_PressKeyToContinueLen) / 2, CONTROLS_Y), screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - fixedText_PressKeyToContinueLen) / 2, CONTROLS_Y),
COMMAND_FOREGROUND, "%s", fixedText_PressKeyToContinueHotkey.c_str()); COMMAND_FOREGROUND, "%s", fixedText_PressKeyToContinueHotkey.c_str());

View file

@ -24,6 +24,7 @@
#include "sherlock/scalpel/settings.h" #include "sherlock/scalpel/settings.h"
#include "sherlock/scalpel/scalpel_screen.h" #include "sherlock/scalpel/scalpel_screen.h"
#include "sherlock/scalpel/scalpel_user_interface.h" #include "sherlock/scalpel/scalpel_user_interface.h"
#include "sherlock/scalpel/scalpel_fixed_text.h"
#include "sherlock/scalpel/scalpel.h" #include "sherlock/scalpel/scalpel.h"
namespace Sherlock { namespace Sherlock {
@ -45,18 +46,9 @@ static const int SETUP_POINTS[12][4] = {
{ 219, 187, 316, 268 } // _key Pad Accel. Toggle { 219, 187, 316, 268 } // _key Pad Accel. Toggle
}; };
static const char *const SETUP_STRS0[2] = { "off", "on" };
static const char *const SETUP_STRS1[2] = { "Directly", "by Pixel" };
static const char *const SETUP_STRS2[2] = { "Left", "Right" };
static const char *const SETUP_STRS3[2] = { "Appear", "Slide" };
static const char *const SETUP_STRS5[2] = { "Left", "Right" };
static const char *const SETUP_NAMES[12] = {
"Exit", "M", "V", "S", "B", "New Font Style", "J", "Calibrate Joystick", "F", "W", "P", "K"
};
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/
void Settings::drawInteface(bool flag) { void Settings::drawInterface(bool flag) {
People &people = *_vm->_people; People &people = *_vm->_people;
ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen;
Sound &sound = *_vm->_sound; Sound &sound = *_vm->_sound;
@ -74,55 +66,117 @@ void Settings::drawInteface(bool flag) {
SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND); SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND);
} }
tempStr = FIXED(Settings_Exit);
_hotkeyExit = tempStr.firstChar();
tempStr.deleteChar(0);
screen.makeButton(Common::Rect(SETUP_POINTS[0][0], SETUP_POINTS[0][1], SETUP_POINTS[0][2], SETUP_POINTS[0][1] + 10), 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] - screen.stringWidth("Exit") / 2, "Exit"); SETUP_POINTS[0][3], tempStr, _hotkeyExit);
tempStr = Common::String::format("Music %s", SETUP_STRS0[music._musicOn]); if (music._musicOn) {
tempStr = FIXED(Settings_MusicOn);
} else {
tempStr = FIXED(Settings_MusicOff);
}
_hotkeyMusic = tempStr.firstChar();
tempStr.deleteChar(0);
screen.makeButton(Common::Rect(SETUP_POINTS[1][0], SETUP_POINTS[1][1], SETUP_POINTS[1][2], SETUP_POINTS[1][1] + 10), 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] - screen.stringWidth(tempStr) / 2, tempStr); SETUP_POINTS[1][3], tempStr, _hotkeyMusic);
tempStr = Common::String::format("Voices %s", SETUP_STRS0[sound._voices]); if (people._portraitsOn) {
screen.makeButton(Common::Rect(SETUP_POINTS[2][0], SETUP_POINTS[2][1], SETUP_POINTS[2][2], SETUP_POINTS[2][1] + 10), tempStr = FIXED(Settings_PortraitsOn);
SETUP_POINTS[2][3] - screen.stringWidth(tempStr) / 2, tempStr); } else {
tempStr = FIXED(Settings_PortraitsOff);
tempStr = Common::String::format("Sound Effects %s", SETUP_STRS0[sound._digitized]); }
screen.makeButton(Common::Rect(SETUP_POINTS[3][0], SETUP_POINTS[3][1], SETUP_POINTS[3][2], SETUP_POINTS[3][1] + 10), _hotkeyPortraits = tempStr.firstChar();
SETUP_POINTS[3][3] - screen.stringWidth(tempStr) / 2, tempStr); tempStr.deleteChar(0);
screen.makeButton(Common::Rect(SETUP_POINTS[10][0], SETUP_POINTS[10][1], SETUP_POINTS[10][2], SETUP_POINTS[10][1] + 10),
tempStr = Common::String::format("Auto Help %s", SETUP_STRS5[ui._helpStyle]); SETUP_POINTS[10][3], tempStr, _hotkeyPortraits);
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] - screen.stringWidth(tempStr) / 2, tempStr);
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] - screen.stringWidth("New Font Style") / 2, "New Font Style");
// WORKAROUND: We don't support the joystick in ScummVM, so draw the next two buttons as disabled // WORKAROUND: We don't support the joystick in ScummVM, so draw the next two buttons as disabled
tempStr = "Joystick Off"; 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), 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] - screen.stringWidth(tempStr) / 2, tempStr); SETUP_POINTS[6][3], tempStr);
screen.buttonPrint(Common::Point(SETUP_POINTS[6][3], SETUP_POINTS[6][1]), COMMAND_NULL, false, tempStr); screen.buttonPrint(Common::Point(SETUP_POINTS[6][3], SETUP_POINTS[6][1]), COMMAND_NULL, false, tempStr);
tempStr = "Calibrate Joystick"; tempStr = FIXED(Settings_NewFontStyle);
_hotkeyNewFontStyle = tempStr.firstChar();
tempStr.deleteChar(0);
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);
if (sound._digitized) {
tempStr = FIXED(Settings_SoundEffectsOn);
} else {
tempStr = FIXED(Settings_SoundEffectsOff);
}
_hotkeySoundEffects = tempStr.firstChar();
tempStr.deleteChar(0);
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);
if (ui._slideWindows) {
tempStr = FIXED(Settings_WindowsSlide);
} else {
tempStr = FIXED(Settings_WindowsAppear);
}
_hotkeyWindows = tempStr.firstChar();
tempStr.deleteChar(0);
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);
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), 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] - screen.stringWidth(tempStr) / 2, tempStr); SETUP_POINTS[7][3], tempStr);
screen.buttonPrint(Common::Point(SETUP_POINTS[7][3], SETUP_POINTS[7][1]), COMMAND_NULL, false, tempStr); screen.buttonPrint(Common::Point(SETUP_POINTS[7][3], SETUP_POINTS[7][1]), COMMAND_NULL, false, tempStr);
tempStr = Common::String::format("Fade %s", screen._fadeStyle ? "by Pixel" : "Directly"); if (ui._helpStyle) {
tempStr = FIXED(Settings_AutoHelpRight);
} else {
tempStr = FIXED(Settings_AutoHelpLeft);
}
_hotkeyAutoHelp = tempStr.firstChar();
tempStr.deleteChar(0);
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);
if (sound._voices) {
tempStr = FIXED(Settings_VoicesOn);
} else {
tempStr = FIXED(Settings_VoicesOff);
}
_hotkeyVoices = tempStr.firstChar();
tempStr.deleteChar(0);
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);
if (screen._fadeStyle) {
tempStr = FIXED(Settings_FadeByPixel);
} else {
tempStr = FIXED(Settings_FadeDirectly);
}
_hotkeyFade = tempStr.firstChar();
tempStr.deleteChar(0);
screen.makeButton(Common::Rect(SETUP_POINTS[8][0], SETUP_POINTS[8][1], SETUP_POINTS[8][2], SETUP_POINTS[8][1] + 10), 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] - screen.stringWidth(tempStr) / 2, tempStr); SETUP_POINTS[8][3], tempStr, _hotkeyFade);
tempStr = Common::String::format("Windows %s", ui._slideWindows ? "Slide" : "Appear"); tempStr = FIXED(Settings_KeyPadSlow);
screen.makeButton(Common::Rect(SETUP_POINTS[9][0], SETUP_POINTS[9][1], SETUP_POINTS[9][2], SETUP_POINTS[9][1] + 10), tempStr.deleteChar(0);
SETUP_POINTS[9][3] - screen.stringWidth(tempStr) / 2, tempStr);
tempStr = Common::String::format("Portraits %s", SETUP_STRS0[people._portraitsOn]);
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] - screen.stringWidth(tempStr) / 2, tempStr);
tempStr = "Key Pad Slow";
screen.makeButton(Common::Rect(SETUP_POINTS[11][0], SETUP_POINTS[11][1], SETUP_POINTS[11][2], SETUP_POINTS[11][1] + 10), 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] - screen.stringWidth(tempStr) / 2, tempStr); SETUP_POINTS[11][3], tempStr);
screen.buttonPrint(Common::Point(SETUP_POINTS[11][3], SETUP_POINTS[11][1]), COMMAND_NULL, false, tempStr); screen.buttonPrint(Common::Point(SETUP_POINTS[11][3], SETUP_POINTS[11][1]), COMMAND_NULL, false, tempStr);
_hotkeysIndexed[0] = _hotkeyExit;
_hotkeysIndexed[1] = _hotkeyMusic;
_hotkeysIndexed[2] = _hotkeyVoices;
_hotkeysIndexed[3] = _hotkeySoundEffects;
_hotkeysIndexed[4] = _hotkeyAutoHelp;
_hotkeysIndexed[5] = _hotkeyNewFontStyle;
_hotkeysIndexed[8] = _hotkeyFade;
_hotkeysIndexed[9] = _hotkeyWindows;
_hotkeysIndexed[10] = _hotkeyPortraits;
// Show the window immediately, or slide it on-screen // Show the window immediately, or slide it on-screen
if (!flag) { if (!flag) {
if (!ui._slideWindows) { if (!ui._slideWindows) {
@ -151,7 +205,7 @@ int Settings::drawButtons(const Common::Point &pt, int _key) {
for (int idx = 0; idx < 12; ++idx) { for (int idx = 0; idx < 12; ++idx) {
if ((pt.x > SETUP_POINTS[idx][0] && pt.x < SETUP_POINTS[idx][2] && pt.y > SETUP_POINTS[idx][1] if ((pt.x > SETUP_POINTS[idx][0] && pt.x < SETUP_POINTS[idx][2] && pt.y > SETUP_POINTS[idx][1]
&& pt.y < (SETUP_POINTS[idx][1] + 10) && (events._pressed || events._released)) && pt.y < (SETUP_POINTS[idx][1] + 10) && (events._pressed || events._released))
|| (_key == SETUP_NAMES[idx][0])) { || (_key == toupper(_hotkeysIndexed[idx]))) {
found = idx; found = idx;
color = COMMAND_HIGHLIGHTED; color = COMMAND_HIGHLIGHTED;
} else { } else {
@ -160,50 +214,75 @@ int Settings::drawButtons(const Common::Point &pt, int _key) {
// Print the button text // Print the button text
switch (idx) { switch (idx) {
case 0:
tempStr = FIXED(Settings_Exit);
break;
case 1: case 1:
tempStr = Common::String::format("Music %s", SETUP_STRS0[music._musicOn]); if (music._musicOn) {
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); tempStr = FIXED(Settings_MusicOn);
} else {
tempStr = FIXED(Settings_MusicOff);
}
break; break;
case 2: case 2:
tempStr = Common::String::format("Voices %s", SETUP_STRS0[sound._voices]); if (sound._voices) {
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); tempStr = FIXED(Settings_VoicesOn);
} else {
tempStr = FIXED(Settings_VoicesOff);
}
break; break;
case 3: case 3:
tempStr = Common::String::format("Sound Effects %s", SETUP_STRS0[sound._digitized]); if (sound._digitized) {
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); tempStr = FIXED(Settings_SoundEffectsOn);
} else {
tempStr = FIXED(Settings_SoundEffectsOff);
}
break; break;
case 4: case 4:
tempStr = Common::String::format("Auto Help %s", SETUP_STRS2[ui._helpStyle]); if (ui._helpStyle) {
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); tempStr = FIXED(Settings_AutoHelpRight);
} else {
tempStr = FIXED(Settings_AutoHelpLeft);
}
break;
case 5:
tempStr = FIXED(Settings_NewFontStyle);
break; break;
case 6: case 6:
tempStr = "Joystick Off"; // Joystick Off - disabled in ScummVM
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr); continue;
break;
case 7: case 7:
tempStr = "Calibrate Joystick"; // Calibrate Joystick - disabled in ScummVM
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr); continue;
break;
case 8: case 8:
tempStr = Common::String::format("Fade %s", SETUP_STRS1[screen._fadeStyle]); if (screen._fadeStyle) {
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); tempStr = FIXED(Settings_FadeByPixel);
} else {
tempStr = FIXED(Settings_FadeDirectly);
}
break; break;
case 9: case 9:
tempStr = Common::String::format("Windows %s", SETUP_STRS3[ui._slideWindows]); if (ui._slideWindows) {
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); tempStr = FIXED(Settings_WindowsSlide);
} else {
tempStr = FIXED(Settings_WindowsAppear);
}
break; break;
case 10: case 10:
tempStr = Common::String::format("Portraits %s", SETUP_STRS0[people._portraitsOn]); if (people._portraitsOn) {
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); tempStr = FIXED(Settings_PortraitsOn);
} else {
tempStr = FIXED(Settings_PortraitsOff);
}
break; break;
case 11: case 11:
tempStr = "Key Pad Slow"; // Key Pad Slow - disabled in ScummVM
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr); continue;
break;
default: default:
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, SETUP_NAMES[idx]); continue;
break;
} }
tempStr.deleteChar(0);
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr, _hotkeysIndexed[idx]);
} }
return found; return found;
@ -222,7 +301,7 @@ void Settings::show(SherlockEngine *vm) {
assert(vm->getGameID() == GType_SerratedScalpel); assert(vm->getGameID() == GType_SerratedScalpel);
Settings settings(vm); Settings settings(vm);
settings.drawInteface(false); settings.drawInterface(false);
do { do {
if (ui._menuCounter) if (ui._menuCounter)
@ -258,11 +337,11 @@ void Settings::show(SherlockEngine *vm) {
found = settings.drawButtons(pt, ui._key); found = settings.drawButtons(pt, ui._key);
} }
if ((found == 0 && events._released) || (ui._key == 'E' || ui._key == Common::KEYCODE_ESCAPE)) if ((found == 0 && events._released) || (ui._key == toupper(settings._hotkeyExit) || ui._key == Common::KEYCODE_ESCAPE))
// Exit // Exit
break; break;
if ((found == 1 && events._released) || ui._key == 'M') { if ((found == 1 && events._released) || ui._key == toupper(settings._hotkeyMusic)) {
// Toggle music // Toggle music
music._musicOn = !music._musicOn; music._musicOn = !music._musicOn;
if (!music._musicOn) if (!music._musicOn)
@ -271,30 +350,30 @@ void Settings::show(SherlockEngine *vm) {
music.startSong(); music.startSong();
updateConfig = true; updateConfig = true;
settings.drawInteface(true); settings.drawInterface(true);
} }
if ((found == 2 && events._released) || ui._key == 'V') { if ((found == 2 && events._released) || ui._key == toupper(settings._hotkeyVoices)) {
sound._voices = !sound._voices; sound._voices = !sound._voices;
updateConfig = true; updateConfig = true;
settings.drawInteface(true); settings.drawInterface(true);
} }
if ((found == 3 && events._released) || ui._key == 'S') { if ((found == 3 && events._released) || ui._key == toupper(settings._hotkeySoundEffects)) {
// Toggle sound effects // Toggle sound effects
sound._digitized = !sound._digitized; sound._digitized = !sound._digitized;
updateConfig = true; updateConfig = true;
settings.drawInteface(true); settings.drawInterface(true);
} }
if ((found == 4 && events._released) || ui._key == 'A') { if ((found == 4 && events._released) || ui._key == toupper(settings._hotkeyAutoHelp)) {
// Help button style // Help button style
ui._helpStyle = !ui._helpStyle; ui._helpStyle = !ui._helpStyle;
updateConfig = true; updateConfig = true;
settings.drawInteface(true); settings.drawInterface(true);
} }
if ((found == 5 && events._released) || ui._key == 'N') { if ((found == 5 && events._released) || ui._key == toupper(settings._hotkeyNewFontStyle)) {
// New font style // New font style
int fontNum = screen.fontNumber() + 1; int fontNum = screen.fontNumber() + 1;
if (fontNum == 3) if (fontNum == 3)
@ -302,28 +381,28 @@ void Settings::show(SherlockEngine *vm) {
screen.setFont(fontNum); screen.setFont(fontNum);
updateConfig = true; updateConfig = true;
settings.drawInteface(true); settings.drawInterface(true);
} }
if ((found == 8 && events._released) || ui._key == 'F') { if ((found == 8 && events._released) || ui._key == toupper(settings._hotkeyFade)) {
// Toggle fade style // Toggle fade style
screen._fadeStyle = !screen._fadeStyle; screen._fadeStyle = !screen._fadeStyle;
updateConfig = true; updateConfig = true;
settings.drawInteface(true); settings.drawInterface(true);
} }
if ((found == 9 && events._released) || ui._key == 'W') { if ((found == 9 && events._released) || ui._key == toupper(settings._hotkeyWindows)) {
// Window style // Window style
ui._slideWindows = !ui._slideWindows; ui._slideWindows = !ui._slideWindows;
updateConfig = true; updateConfig = true;
settings.drawInteface(true); settings.drawInterface(true);
} }
if ((found == 10 && events._released) || ui._key == 'P') { if ((found == 10 && events._released) || ui._key == toupper(settings._hotkeyPortraits)) {
// Toggle portraits being shown // Toggle portraits being shown
people._portraitsOn = !people._portraitsOn; people._portraitsOn = !people._portraitsOn;
updateConfig = true; updateConfig = true;
settings.drawInteface(true); settings.drawInterface(true);
} }
} while (!vm->shouldQuit()); } while (!vm->shouldQuit());

View file

@ -35,12 +35,36 @@ class Settings {
private: private:
SherlockEngine *_vm; SherlockEngine *_vm;
Settings(SherlockEngine *vm) : _vm(vm) {} Settings(SherlockEngine *vm) : _vm(vm) {
_hotkeyExit = 0;
_hotkeyMusic = 0;
_hotkeyPortraits = 0;
_hotkeyNewFontStyle = 0;
_hotkeySoundEffects = 0;
_hotkeyWindows = 0;
_hotkeyAutoHelp = 0;
_hotkeyVoices = 0;
_hotkeyFade = 0;
memset(_hotkeysIndexed, 0, sizeof(_hotkeysIndexed));
}
byte _hotkeyExit;
byte _hotkeyMusic;
byte _hotkeyPortraits;
byte _hotkeyNewFontStyle;
byte _hotkeySoundEffects;
byte _hotkeyWindows;
byte _hotkeyAutoHelp;
byte _hotkeyVoices;
byte _hotkeyFade;
byte _hotkeysIndexed[12];
/** /**
* Draws the interface for the settings window * Draws the interface for the settings window
*/ */
void drawInteface(bool flag); void drawInterface(bool flag);
/** /**
* Draws the buttons for the settings dialog * Draws the buttons for the settings dialog