diff options
-rw-r--r-- | engines/sherlock/scalpel/scalpel_fixed_text.cpp | 63 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_fixed_text.h | 21 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_inventory.cpp | 16 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_journal.cpp | 24 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_saveload.cpp | 12 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_screen.cpp | 48 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_screen.h | 4 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.cpp | 8 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_user_interface.cpp | 6 | ||||
-rw-r--r-- | engines/sherlock/scalpel/settings.cpp | 249 | ||||
-rw-r--r-- | engines/sherlock/scalpel/settings.h | 28 |
11 files changed, 345 insertions, 134 deletions
diff --git a/engines/sherlock/scalpel/scalpel_fixed_text.cpp b/engines/sherlock/scalpel/scalpel_fixed_text.cpp index 372fbc3e7e..bfca97a6d3 100644 --- a/engines/sherlock/scalpel/scalpel_fixed_text.cpp +++ b/engines/sherlock/scalpel/scalpel_fixed_text.cpp @@ -55,6 +55,27 @@ static const char *const fixedTextEN[] = { "Backward", "Forward", "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 "Press any Key for More.", "P", @@ -168,6 +189,27 @@ static const char *const fixedTextDE[] = { "R\201ckw\204rts", // original: "Backward" "Vorw\204rts", // original: "Forward" "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 "Mehr auf Tastendruck...", "M", @@ -280,6 +322,27 @@ static const char *const fixedTextES[] = { "Retroceder", "Avanzar", "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 "Tecla para ver mas", "T", diff --git a/engines/sherlock/scalpel/scalpel_fixed_text.h b/engines/sherlock/scalpel/scalpel_fixed_text.h index f46587ce81..0fb9e13e59 100644 --- a/engines/sherlock/scalpel/scalpel_fixed_text.h +++ b/engines/sherlock/scalpel/scalpel_fixed_text.h @@ -57,6 +57,27 @@ enum FixedTextId { kFixedText_JournalSearch_Backward, kFixedText_JournalSearch_Forward, 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 kFixedText_PressKey_ForMore, kFixedText_PressKey_ForMoreHotkey, diff --git a/engines/sherlock/scalpel/scalpel_inventory.cpp b/engines/sherlock/scalpel/scalpel_inventory.cpp index e19a43238c..6cce32fe53 100644 --- a/engines/sherlock/scalpel/scalpel_inventory.cpp +++ b/engines/sherlock/scalpel/scalpel_inventory.cpp @@ -67,21 +67,21 @@ void ScalpelInventory::drawInventory(InvNewMode mode) { Common::String fixedText_Give = fixedText.getText(kFixedText_Inventory_Give); 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], - 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], - 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], - 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], - 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], - 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], - 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], - 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) mode = LOOK_INVENTORY_MODE; diff --git a/engines/sherlock/scalpel/scalpel_journal.cpp b/engines/sherlock/scalpel/scalpel_journal.cpp index 5c2b8f77f3..85a2a2f8b8 100644 --- a/engines/sherlock/scalpel/scalpel_journal.cpp +++ b/engines/sherlock/scalpel/scalpel_journal.cpp @@ -164,33 +164,33 @@ void ScalpelJournal::drawFrame() { // Draw the buttons screen.makeButton(Common::Rect(JOURNAL_POINTS[0][0], JOURNAL_BUTTONS_Y, 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, 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, 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, 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, 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, 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, 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, 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 screen.makeButton(Common::Rect(JOURNAL_POINTS[8][0], JOURNAL_BUTTONS_Y + 11, 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), COMMAND_NULL, false, fixedText_PrintText); } @@ -486,11 +486,11 @@ int ScalpelJournal::getSearchString(bool printError) { // Draw search panel screen.makePanel(Common::Rect(6, 171, 313, 199)); 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), - 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), - 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), COMMAND_HIGHLIGHTED, "%c", fixedText_Exit[0]); diff --git a/engines/sherlock/scalpel/scalpel_saveload.cpp b/engines/sherlock/scalpel/scalpel_saveload.cpp index 61830a56b2..d23c4ce3ba 100644 --- a/engines/sherlock/scalpel/scalpel_saveload.cpp +++ b/engines/sherlock/scalpel/scalpel_saveload.cpp @@ -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.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), - 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), - 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), - 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), - 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), - ENV_POINTS[5][2] - screen.stringWidth("Quit") / 2, "Quit"); + ENV_POINTS[5][2], "Quit"); if (!_savegameIndex) screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_NULL, 0, "Up"); diff --git a/engines/sherlock/scalpel/scalpel_screen.cpp b/engines/sherlock/scalpel/scalpel_screen.cpp index 71bcca5dc5..fcf548f478 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 Common::String &str, const byte hotkey) { Surface &bb = *_backBuffer; 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.top + 1, bounds.right - 1, bounds.bottom - 1), BUTTON_MIDDLE); - gPrint(Common::Point(textX, bounds.top), COMMAND_HIGHLIGHTED, "%c", str[0]); - gPrint(Common::Point(textX + charWidth(str[0]), bounds.top), - COMMAND_FOREGROUND, "%s", str.c_str() + 1); + buttonPrint(Common::Point(textX, bounds.top), COMMAND_FOREGROUND, false, str, hotkey); } 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; if (color == COMMAND_FOREGROUND) { - // First character needs to be highlighted + Common::String prefixText = str; + uint16 prefixOffsetX = 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) + 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 { + // no hotkey passed, used first character of text + hotkey = str[0]; + } + if (slamIt) { - print(Common::Point(xStart, pt.y + 1), COMMAND_HIGHLIGHTED, "%c", str[0]); - print(Common::Point(xStart + charWidth(str[0]), pt.y + 1), - COMMAND_FOREGROUND, "%s", str.c_str() + 1); + 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_HIGHLIGHTED, "%c", str[0]); - gPrint(Common::Point(xStart + charWidth(str[0]), pt.y), - COMMAND_FOREGROUND, "%s", str.c_str() + 1); + 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) { print(Common::Point(xStart, pt.y + 1), color, "%s", str.c_str()); diff --git a/engines/sherlock/scalpel/scalpel_screen.h b/engines/sherlock/scalpel/scalpel_screen.h index d6018a44a0..55e104bf43 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); + 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 * 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 diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index 2c447b09ab..f82ad099aa 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -703,18 +703,18 @@ void ScalpelTalk::drawInterface() { Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); 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), - 159 - screen.stringWidth(fixedText_Up) / 2, fixedText_Up); + 159, fixedText_Up); screen.makeButton(Common::Rect(181, CONTROLS_Y, 221, CONTROLS_Y + 10), - 200 - screen.stringWidth(fixedText_Down) / 2, fixedText_Down); + 200, fixedText_Down); } else { Common::String fixedText_PressKeyToContinue = fixedText.getText(kFixedText_PressKey_ToContinue); Common::String fixedText_PressKeyToContinueHotkey = fixedText.getText(kFixedText_PressKey_ToContinueHotkey); int fixedText_PressKeyToContinueLen = screen.stringWidth(fixedText_PressKeyToContinue); 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, "%s", fixedText_PressKeyToContinueHotkey.c_str()); } diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp index 79d74ba999..358ce70d32 100644 --- a/engines/sherlock/scalpel/scalpel_user_interface.cpp +++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp @@ -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.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(161, CONTROLS_Y, 209, CONTROLS_Y + 10), 184 - screen.stringWidth("No") / 2, "No"); + 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.slamArea(112, CONTROLS_Y, 97, 10); do { @@ -1955,7 +1955,7 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first int fixedText_PressKeyToContinueLen = screen.stringWidth(fixedText_PressKeyToContinue); screen.makeButton(Common::Rect(46, CONTROLS_Y, 272, CONTROLS_Y + 10), - (SHERLOCK_SCREEN_WIDTH - fixedText_PressKeyToContinueLen) / 2, + SHERLOCK_SCREEN_WIDTH / 2, fixedText_PressKeyToContinue); screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - fixedText_PressKeyToContinueLen) / 2, CONTROLS_Y), COMMAND_FOREGROUND, "%s", fixedText_PressKeyToContinueHotkey.c_str()); diff --git a/engines/sherlock/scalpel/settings.cpp b/engines/sherlock/scalpel/settings.cpp index f6769a4b99..855bb401a0 100644 --- a/engines/sherlock/scalpel/settings.cpp +++ b/engines/sherlock/scalpel/settings.cpp @@ -24,6 +24,7 @@ #include "sherlock/scalpel/settings.h" #include "sherlock/scalpel/scalpel_screen.h" #include "sherlock/scalpel/scalpel_user_interface.h" +#include "sherlock/scalpel/scalpel_fixed_text.h" #include "sherlock/scalpel/scalpel.h" namespace Sherlock { @@ -45,18 +46,9 @@ static const int SETUP_POINTS[12][4] = { { 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; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; Sound &sound = *_vm->_sound; @@ -74,55 +66,117 @@ void Settings::drawInteface(bool flag) { 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), - 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), - 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]); - 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] - screen.stringWidth(tempStr) / 2, tempStr); - - 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), - SETUP_POINTS[3][3] - screen.stringWidth(tempStr) / 2, tempStr); - - tempStr = Common::String::format("Auto Help %s", SETUP_STRS5[ui._helpStyle]); - 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"); + if (people._portraitsOn) { + tempStr = FIXED(Settings_PortraitsOn); + } else { + tempStr = FIXED(Settings_PortraitsOff); + } + _hotkeyPortraits = tempStr.firstChar(); + tempStr.deleteChar(0); + 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); // 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), - 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); - 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), - 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); - tempStr = Common::String::format("Fade %s", screen._fadeStyle ? "by Pixel" : "Directly"); - 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); + 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); - tempStr = Common::String::format("Windows %s", ui._slideWindows ? "Slide" : "Appear"); - 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] - screen.stringWidth(tempStr) / 2, tempStr); + 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); - 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); + 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), + SETUP_POINTS[8][3], tempStr, _hotkeyFade); - tempStr = "Key Pad Slow"; + 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] - 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); + _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 if (!flag) { if (!ui._slideWindows) { @@ -151,7 +205,7 @@ int Settings::drawButtons(const Common::Point &pt, int _key) { 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] && pt.y < (SETUP_POINTS[idx][1] + 10) && (events._pressed || events._released)) - || (_key == SETUP_NAMES[idx][0])) { + || (_key == toupper(_hotkeysIndexed[idx]))) { found = idx; color = COMMAND_HIGHLIGHTED; } else { @@ -160,50 +214,75 @@ int Settings::drawButtons(const Common::Point &pt, int _key) { // Print the button text switch (idx) { + case 0: + tempStr = FIXED(Settings_Exit); + break; case 1: - tempStr = Common::String::format("Music %s", SETUP_STRS0[music._musicOn]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (music._musicOn) { + tempStr = FIXED(Settings_MusicOn); + } else { + tempStr = FIXED(Settings_MusicOff); + } break; case 2: - tempStr = Common::String::format("Voices %s", SETUP_STRS0[sound._voices]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (sound._voices) { + tempStr = FIXED(Settings_VoicesOn); + } else { + tempStr = FIXED(Settings_VoicesOff); + } break; case 3: - tempStr = Common::String::format("Sound Effects %s", SETUP_STRS0[sound._digitized]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (sound._digitized) { + tempStr = FIXED(Settings_SoundEffectsOn); + } else { + tempStr = FIXED(Settings_SoundEffectsOff); + } break; case 4: - tempStr = Common::String::format("Auto Help %s", SETUP_STRS2[ui._helpStyle]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (ui._helpStyle) { + tempStr = FIXED(Settings_AutoHelpRight); + } else { + tempStr = FIXED(Settings_AutoHelpLeft); + } break; - case 6: - tempStr = "Joystick Off"; - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr); + case 5: + tempStr = FIXED(Settings_NewFontStyle); break; + case 6: + // Joystick Off - disabled in ScummVM + continue; case 7: - tempStr = "Calibrate Joystick"; - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr); - break; + // Calibrate Joystick - disabled in ScummVM + continue; case 8: - tempStr = Common::String::format("Fade %s", SETUP_STRS1[screen._fadeStyle]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (screen._fadeStyle) { + tempStr = FIXED(Settings_FadeByPixel); + } else { + tempStr = FIXED(Settings_FadeDirectly); + } break; case 9: - tempStr = Common::String::format("Windows %s", SETUP_STRS3[ui._slideWindows]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (ui._slideWindows) { + tempStr = FIXED(Settings_WindowsSlide); + } else { + tempStr = FIXED(Settings_WindowsAppear); + } break; case 10: - tempStr = Common::String::format("Portraits %s", SETUP_STRS0[people._portraitsOn]); - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); + if (people._portraitsOn) { + tempStr = FIXED(Settings_PortraitsOn); + } else { + tempStr = FIXED(Settings_PortraitsOff); + } break; case 11: - tempStr = "Key Pad Slow"; - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), COMMAND_NULL, true, tempStr); - break; + // Key Pad Slow - disabled in ScummVM + continue; default: - screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, SETUP_NAMES[idx]); - break; + continue; } + tempStr.deleteChar(0); + screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr, _hotkeysIndexed[idx]); } return found; @@ -222,7 +301,7 @@ void Settings::show(SherlockEngine *vm) { assert(vm->getGameID() == GType_SerratedScalpel); Settings settings(vm); - settings.drawInteface(false); + settings.drawInterface(false); do { if (ui._menuCounter) @@ -258,11 +337,11 @@ void Settings::show(SherlockEngine *vm) { 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 break; - if ((found == 1 && events._released) || ui._key == 'M') { + if ((found == 1 && events._released) || ui._key == toupper(settings._hotkeyMusic)) { // Toggle music music._musicOn = !music._musicOn; if (!music._musicOn) @@ -271,30 +350,30 @@ void Settings::show(SherlockEngine *vm) { music.startSong(); 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; 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 sound._digitized = !sound._digitized; 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 ui._helpStyle = !ui._helpStyle; 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 int fontNum = screen.fontNumber() + 1; if (fontNum == 3) @@ -302,28 +381,28 @@ void Settings::show(SherlockEngine *vm) { screen.setFont(fontNum); 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 screen._fadeStyle = !screen._fadeStyle; 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 ui._slideWindows = !ui._slideWindows; 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 people._portraitsOn = !people._portraitsOn; updateConfig = true; - settings.drawInteface(true); + settings.drawInterface(true); } } while (!vm->shouldQuit()); diff --git a/engines/sherlock/scalpel/settings.h b/engines/sherlock/scalpel/settings.h index ff2e647a62..9144e9d420 100644 --- a/engines/sherlock/scalpel/settings.h +++ b/engines/sherlock/scalpel/settings.h @@ -35,12 +35,36 @@ class Settings { private: 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 */ - void drawInteface(bool flag); + void drawInterface(bool flag); /** * Draws the buttons for the settings dialog |