diff options
25 files changed, 1183 insertions, 516 deletions
diff --git a/backends/platform/sdl/amigaos/amigaos.mk b/backends/platform/sdl/amigaos/amigaos.mk index 5cec9c1588..0c3c467965 100644 --- a/backends/platform/sdl/amigaos/amigaos.mk +++ b/backends/platform/sdl/amigaos/amigaos.mk @@ -10,4 +10,9 @@ amigaosdist: $(EXECUTABLE) ifdef DIST_FILES_ENGINEDATA cp $(DIST_FILES_ENGINEDATA) $(AMIGAOSPATH)/extras/ endif + cat ${srcdir}/README | sed -f ${srcdir}/dists/amiga/convertRM.sed > README.conv + rx dists/amiga/RM2AG.rx README.conv + cp ${srcdir}/README.guide $(AMIGAOSPATH) + rm ${srcdir}/README.conv + rm ${srcdir}/README.guide cp $(DIST_FILES_DOCS) $(AMIGAOSPATH) diff --git a/dists/amiga/RM2AG.rx b/dists/amiga/RM2AG.rx new file mode 100644 index 0000000000..6ee56bb645 --- /dev/null +++ b/dists/amiga/RM2AG.rx @@ -0,0 +1,170 @@ +/* +README to .guide converter $Ver: 0.13 (29.01.2016) + +This script converts the pure ASCII-text based README file of ScummVM to a +basic Amiga guide file. + +More AmigaGuide features being added in the process if feasible. +*/ + +PARSE ARG readme_txt + +/* Check if the given file is really the readme */ +/* If a given filename has spaces in it's name, AmigaDOS/AmigaCLI will add extra quotation marks +to secure a sane working path. We get rid of them to make AREXX find the file */ +readme_txt=COMPRESS(readme_txt,'"') +OPEN(check_readme,readme_txt,'R') +IF READCH(check_readme,14) = 'ScummVM README' THEN + CLOSE(check_readme) +ELSE DO + SAY "Not the README file. Aborting!" + CLOSE(readme_read) + EXIT 0 +END + +/* If it's the proper file, lets start converting */ + +OPEN(readme_read,readme_txt,'R') +OPEN(guide_write,'README.guide','W') + +/* Prepare the Amiga guide file, add the intro and fixed text */ + +WRITELN(guide_write,'@DATABASE ScummVM README.guide') +WRITELN(guide_write,'@WORDWRAP') +WRITELN(guide_write,'@NODE "main" "ScummVM README Guide"') +WRITELN(guide_write,' ') +WRITELN(guide_write,'@{b}') +WRITELN(guide_write,READLN(readme_read)) +WRITELN(guide_write,'@{ub}') + +/* Creating the main link nodes */ + +x=1 + +DO WHILE EOF(readme_read) = 0 + /* Read in the line */ + working_line=READLN(readme_read) + + /* Checking if the sub links have been reached and leave the loop, if met */ + IF POS('°1.0°',working_line) = 1 & x > 1 THEN + LEAVE + ENDIF + /* If no chapter has been found, simply write the line */ + IF POS('°',working_line) = 0 THEN + WRITELN(guide_write,working_line) + ENDIF + + /* Fix the empty chapters - two chapters (1.0 and 7.8) are empty and consist of only the headlines. + We add them to the following chapter and link both of them to the empty one */ + + /* If chapter 1.1 is found add a link node to 1.0 (as chapter 1.0 is empty) */ + IF POS(' * °1.1°',working_line) = 1 THEN DO + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*°') + WRITELN(guide_write,' @{" 1.1 " Link "1.0"} 'working_line) + END + + /* If chapter 7.8.1 is found add a link node to 7.8 (as chapter 7.8 is empty) */ + IF POS(' * * °7.8.1°',working_line) = 1 THEN DO + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*°') + WRITELN(guide_write,' @{" 7.8.1 " Link "7.8"} 'working_line) + END + + /* If a single number main chapter is found 1.0 upto 9.0), prepare and write the link node */ + IF POS('.0',working_line) = 3 THEN DO + WRITELN(guide_write,' ') + WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('°',working_line)+1,LASTPOS('°',working_line)-POS('°',working_line)-1) '" Link "'SUBSTR(working_line,POS('°',working_line)+1,LASTPOS('°',working_line)-POS('°',working_line)-1)'"} 'COMPRESS(working_line,'*°')) + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*°') + x=x+1 + END + + /* If a double number main chapter is found (10.0 ff), prepare and write the link node */ + IF POS('.0',working_line) = 4 THEN DO + WRITELN(guide_write,' ') + WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('°',working_line)+1,LASTPOS('°',working_line)-POS('°',working_line)-1) '" Link "'SUBSTR(working_line,POS('°',working_line)+1,LASTPOS('°',working_line)-POS('°',working_line)-1)'"} 'COMPRESS(working_line,'*°')) + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*°') + END + + /* If a level one sub chapter is found (i.e. 1.1), prepare and write the link node */ + IF POS(' * °',working_line) = 1 THEN DO + WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('°',working_line)+1,LASTPOS('°',working_line)-POS('°',working_line)-1) '" Link "'SUBSTR(working_line,POS('°',working_line)+1,LASTPOS('°',working_line)-POS('°',working_line)-1)'"} 'COMPRESS(working_line,'*°')) + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*°') + END + + /* If a level two sub chapter is found (i.e. 1.1.1), prepare and write the link node */ + IF POS(' * * °',working_line) = 1 THEN DO + WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('°',working_line)+1,LASTPOS('°',working_line)-POS('°',working_line)-1) '" Link "'SUBSTR(working_line,POS('°',working_line)+1,LASTPOS('°',working_line)-POS('°',working_line)-1)'"} 'COMPRESS(working_line,'*°')) + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*°') + END +END + +/* Finish the TOC, hardcoded due the outro text getting read in last, but needs to be read/written after the TOC creation */ +WRITELN(guide_write,'------------------------------------------------------------------------') +WRITELN(guide_write,'Good Luck and Happy Adventuring!') +WRITELN(guide_write,'The ScummVM team.') +WRITELN(guide_write,'@{"http://www.scummvm.org/" System "URLOpen http://www.scummvm.org/"}') +WRITELN(guide_write,'------------------------------------------------------------------------') + +/* Creating the sub links nodes */ + +DO WHILE EOF(readme_read) = 0 + /* If no chapter has been found, simply write the line */ + IF POS('°',working_line) = 0 THEN + WRITELN(guide_write,working_line) + ENDIF + + /* Fix the empty chapters - two chapters (1.0 and 7.8) are empty and consist of only the Headlines. + We don't close the NODE, rather add the following chapter to the former empty one */ + + /* If chapter 1.1 is found don't close the NODE, just write the line */ + IF POS('°1.1°',working_line) = 1 THEN DO + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'°') + WRITELN(guide_write,working_line) + END + /* If chapter 7.8.1 is found don't close the NODE, just write the line */ + IF POS('°7.8.1°',working_line) = 1 THEN DO + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'°') + WRITELN(guide_write,working_line) + END + + IF POS('°',working_line) > 0 THEN DO + /* Check for link references inside the text and create link nodes for them */ + IF POS('section °',working_line) > 0 THEN DO + working_line=SUBSTR(working_line,1,POS('°',working_line)-1)'@{"'SUBSTR(working_line,POS('°',working_line)+1,LASTPOS('°',working_line)-POS('°',working_line)-1)'" Link "'SUBSTR(working_line,POS('°',working_line)+1,LASTPOS('°',working_line)-POS('°',working_line)-1)'"}'SUBSTR(working_line,LASTPOS('°',working_line)+1) + /* Get rid of the markers so the following loops doesn't process them again */ + WRITELN(guide_write,COMPRESS(working_line,'°')) + END + ELSE DO + /* If a chapter has been found, prepare and write the link */ + WRITELN(guide_write,'@ENDNODE') + WRITELN(guide_write,'@NODE "'SUBSTR(working_line,POS('°',working_line)+1,LASTPOS('°',working_line)-POS('°',working_line)-1)'" "'COMPRESS(working_line,'°')'"') + WRITELN(guide_write,' ') + /* Get rid of the markers so the following loops doesn't process them again */ + WRITELN(guide_write,COMPRESS(working_line,'°')) + END + END + + /* Read in the line at the end of the second loop, as the first line to work with was already read in on the end of the first loop */ + working_line=READLN(readme_read) + + /* If the outtro text is found, leave the loop and prepare for closing */ + IF POS('------------------------------------------------------------------------',working_line) > 0 THEN + LEAVE + ENDIF +END + +WRITELN(guide_write,'@ENDNODE') + +/* Closing the guide and cleaning up */ +WRITELN(guide_write,'@ENDNODE') + +CLOSE(readme_read) +CLOSE(guide_write) +EXIT 0
\ No newline at end of file diff --git a/dists/amiga/convertRM.sed b/dists/amiga/convertRM.sed new file mode 100644 index 0000000000..47b6707001 --- /dev/null +++ b/dists/amiga/convertRM.sed @@ -0,0 +1,17 @@ +# $VER: READMEconverter.sed 1.04 (22.12.2015) © Eugene "sev" Sandulenko
+# Additions by Raziel
+#
+# Preprocessing the README file and adding some landmarks for easier parsing
+# and for converting it to an AmigaGuide Hypertext file later.
+#
+s/http:\/\/[#?=&a-zA-Z0-9_.\/\-]*/@{"&" System "URLOpen &"}/ # Convert all URLs to AmigaGuide format
+s/https:\/\/[#?=&a-zA-Z0-9_.\/\-]*/@{"&" System "URLOpen &"}/ # Convert all secure URLs to AmigaGuide format
+s/[0-9][0-9]*\.[0-9][0-9]*/°&°/ # Convert all chapter numbers to °x°...
+s/°\([0-9][0-9]*\.[0-9][0-9]*\)°\(\.[0-9]\)/°\1\2°/ # ...and all three-digit chapter numbers...
+s/°\([01]\.[0-9][0-9]*\.[0-9][0-9]*\)°/\1/ # ...and restore mentioned version numbers like 1.0.0 and 0.7.0.
+s/of °0\.0°/of 0.0/ # "Fluidsynth's gain setting of 0.0" is not a chapter reference.
+s/through °10\.0°/through 10.0/ # "through 10.0" is not a chapter reference.
+s/ttf-°2\.00.1°/ttf-2.00.1/ # This part of an url link is not a chapter reference.
+s/patch °1\.2°/patch 1.2/ # "Zork patch 1.2" is not a chapter reference.
+s/Mac OS X °10\.2.8°/Mac OS X 10.2.8/ # "Mac OS X 10.2.8" is not a chapter reference.
+s/Mac_OS_X_°10\.2.8°/Mac_OS_X_10.2.8/ # "Mac_OS_X_10.2.8" is not a chapter reference.
\ No newline at end of file diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp index 3f615f610f..90ddaaf967 100644 --- a/engines/sci/event.cpp +++ b/engines/sci/event.cpp @@ -214,6 +214,15 @@ SciEvent EventManager::getScummVMEvent() { //((ev.kbd.flags & Common::KBD_CAPS) ? SCI_KEYMOD_CAPSLOCK : 0) | //((ev.kbd.flags & Common::KBD_SCRL) ? SCI_KEYMOD_SCRLOCK : 0) | + if (input.data >= Common::KEYCODE_KP0 && input.data <= Common::KEYCODE_KP9) { + if (!(ev.kbd.flags & Common::KBD_NUM)) { + // HACK: Num-Lock not enabled + // We shouldn't get a valid ascii code in these cases. We fix it here, so that cursor keys + // on the numpad work properly. + input.character = 0; + } + } + if ((input.character) && (input.character <= 0xFF)) { // Directly accept most common keys without conversion if ((input.character >= 0x80) && (input.character <= 0xFF)) { diff --git a/engines/sherlock/fonts.cpp b/engines/sherlock/fonts.cpp index 4d0991a47c..9b58eea17c 100644 --- a/engines/sherlock/fonts.cpp +++ b/engines/sherlock/fonts.cpp @@ -53,6 +53,15 @@ void Fonts::setFont(int fontNum) { // Discard previous font delete _font; + if (IS_SERRATED_SCALPEL) { + // Scalpel + if ((_vm->isDemo()) && (!_vm->_interactiveFl)) { + // Do not set up any font for the non-interactive demo of scalpel + // The non-interactive demo does not contain any font at all + return; + } + } + Common::String fontFilename; if (_vm->getPlatform() != Common::kPlatform3DO) { diff --git a/engines/sherlock/scalpel/scalpel_fixed_text.cpp b/engines/sherlock/scalpel/scalpel_fixed_text.cpp index 372fbc3e7e..8932fb29c5 100644 --- a/engines/sherlock/scalpel/scalpel_fixed_text.cpp +++ b/engines/sherlock/scalpel/scalpel_fixed_text.cpp @@ -28,38 +28,70 @@ namespace Sherlock { namespace Scalpel { static const char *const fixedTextEN[] = { + // Game hotkeys + "LMTPOCIUGJFS", // SH1: Window buttons - "Exit", - "Up", - "Down", + "EExit", + "UUp", + "DDown", // SH1: Inventory buttons - "Exit", - "Look", - "Use", - "Give", + "EExit", + "LLook", + "UUse", + "GGive", // SH1: Journal text "Watson's Journal", "Page %d", // SH1: Journal buttons - "Exit", - "Back 10", - "Up", - "Down", - "Ahead 10", - "Search", - "First Page", - "Last Page", - "Print Text", + "EExit", + "BBack 10", + "UUp", + "DDown", + "AAhead 10", + "SSearch", + "FFirst Page", + "LLast Page", + "PPrint Text", // SH1: Journal search - "Exit", - "Backward", - "Forward", + "EExit", + "BBackward", + "FForward", "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", + // 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", - "Press any Key to Continue.", - "P", + "PPress any Key for More.", + "PPress any Key to Continue.", // SH1: Initial Inventory "A message requesting help", "A number of business cards", @@ -141,38 +173,70 @@ static const char *const fixedTextEN[] = { // small o-umlaut: 0x94 / octal 224 // small u-umlaut: 0x81 / octal 201 static const char *const fixedTextDE[] = { + // Game hotkeys + "SBRNOCTEGADU", // original: did not support hotkeys for actions // SH1: Window buttons - "Zur\201ck", - "Hoch", - "Runter", + "ZZur\201ck", + "HHoch", + "RRunter", // SH1: Inventory buttons - "Zur\201ck", - "Schau", - "Benutze", - "Gib", + "ZZur\201ck", + "SSchau", + "BBenutze", + "GGib", // SH1: Journal text "Watsons Tagebuch", "Seite %d", // SH1: Journal buttons - "Zur\201ck", - "10 hoch", - "Hoch", - "Runter", - "10 runter", - "Suche", - "Erste Seite", - "Letzte Seite", - "Drucke Text", + "ZZur\201ck", // original: "Zur\201ck" + "o10 hoch", + "HHoch", + "RRunter", + "u10 runter", // original: "10 runter" + "SSuche", + "EErste Seite", + "LLetzte Seite", + "DDrucke Text", // SH1: Journal search - "Zur\201ck", - "R\201ckw\204rts", // original: "Backward" - "Vorw\204rts", // original: "Forward" + "ZZur\201ck", + "RR\201ckw\204rts", // original: "Backward" + "VVorw\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", + // Load/Save + "ZZur\201ck", + "LLaden", + "SSichern", + "HHoch", + "RRunter", + "EEnde", + // Quit Game + "Das Spiel verlassen ?", + "JJa", + "NNein", // SH1: Press key text - "Mehr auf Tastendruck...", - "M", - "Beliebige Taste dr\201cken.", - "B", + "MMehr auf Tastendruck...", + "BBeliebige Taste dr\201cken.", // SH1: Initial Inventory "Ein Hilferuf von Lestrade", "Holmes' Visitenkarten", @@ -253,38 +317,70 @@ static const char *const fixedTextDE[] = { // up-side down question mark - 0xA8 / octal 250 // n with a wave on top - 0xA4 / octal 244 static const char *const fixedTextES[] = { + // Game hotkeys + "VMHTACIUDNFO", // SH1: Window buttons - "Salir", // original interpreter: "Exit" - "Subir", - "Bajar", + "aSalir", // original interpreter: "Exit" + "SSubir", + "BBajar", // SH1: Inventory buttons - "Salir", // original interpreter: "Exit" - "Mirar", - "Usar", - "Dar", + "SSalir", // original interpreter: "Exit" + "MMirar", + "UUsar", + "DDar", // SH1: Journal text "Diario de Watson", "Pagina %d", // SH1: Journal buttons - "Salir", // original interpreter: "Exit" - "Retroceder", - "Subir", - "baJar", - "Adelante", - "Buscar", - "1a pagina", - "Ult pagina", - "Imprimir", + "aSalir", // original interpreter: "Exit" + "RRetroceder", + "SSubir", + "JbaJar", + "AAdelante", + "BBuscar", + "11a pagina", + "UUlt pagina", + "IImprimir", // SH1: Journal search - "Salir", // original interpreter: "Exit" - "Retroceder", - "Avanzar", + "SSalir", // original interpreter: "Exit" + "RRetroceder", + "AAvanzar", "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", + // 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", - "Tecla para continuar", - "T", + "TTecla para ver mas", + "TTecla para continuar", // SH1: Initial Inventory "Un mensaje solicitando ayuda", "Unas cuantas tarjetas de visita", diff --git a/engines/sherlock/scalpel/scalpel_fixed_text.h b/engines/sherlock/scalpel/scalpel_fixed_text.h index f46587ce81..841d602408 100644 --- a/engines/sherlock/scalpel/scalpel_fixed_text.h +++ b/engines/sherlock/scalpel/scalpel_fixed_text.h @@ -30,8 +30,10 @@ namespace Sherlock { namespace Scalpel { enum FixedTextId { + // Game hotkeys + kFixedText_Game_Hotkeys = 0, // Window buttons - kFixedText_Window_Exit = 0, + kFixedText_Window_Exit, kFixedText_Window_Up, kFixedText_Window_Down, // Inventory buttons @@ -57,11 +59,41 @@ 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, + // 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, kFixedText_PressKey_ToContinue, - kFixedText_PressKey_ToContinueHotkey, // Initial inventory kFixedText_InitInventory_Message, kFixedText_InitInventory_HolmesCard, diff --git a/engines/sherlock/scalpel/scalpel_inventory.cpp b/engines/sherlock/scalpel/scalpel_inventory.cpp index e19a43238c..c3e20295fd 100644 --- a/engines/sherlock/scalpel/scalpel_inventory.cpp +++ b/engines/sherlock/scalpel/scalpel_inventory.cpp @@ -32,13 +32,39 @@ namespace Scalpel { ScalpelInventory::ScalpelInventory(SherlockEngine *vm) : Inventory(vm) { _invShapes.resize(6); + + _fixedTextExit = FIXED(Inventory_Exit); + _fixedTextLook = FIXED(Inventory_Look); + _fixedTextUse = FIXED(Inventory_Use); + _fixedTextGive = FIXED(Inventory_Give); + + _hotkeyExit = toupper(_fixedTextExit[0]); + _hotkeyLook = toupper(_fixedTextLook[0]); + _hotkeyUse = toupper(_fixedTextUse[0]); + _hotkeyGive = toupper(_fixedTextGive[0]); + + _hotkeysIndexed[0] = _hotkeyExit; + _hotkeysIndexed[1] = _hotkeyLook; + _hotkeysIndexed[2] = _hotkeyUse; + _hotkeysIndexed[3] = _hotkeyGive; + _hotkeysIndexed[4] = '-'; + _hotkeysIndexed[5] = '+'; + _hotkeysIndexed[6] = ','; + _hotkeysIndexed[7] = '.'; } ScalpelInventory::~ScalpelInventory() { } +int ScalpelInventory::identifyUserButton(int key) { + for (uint16 hotkeyNr = 0; hotkeyNr < sizeof(_hotkeysIndexed); hotkeyNr++) { + if (key == _hotkeysIndexed[hotkeyNr]) + return hotkeyNr; + } + return -1; +} + void ScalpelInventory::drawInventory(InvNewMode mode) { - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; UserInterface &ui = *_vm->_ui; InvNewMode tempMode = mode; @@ -61,34 +87,30 @@ void ScalpelInventory::drawInventory(InvNewMode mode) { INV_BACKGROUND); // Draw the buttons - Common::String fixedText_Exit = fixedText.getText(kFixedText_Inventory_Exit); - Common::String fixedText_Look = fixedText.getText(kFixedText_Inventory_Look); - Common::String fixedText_Use = fixedText.getText(kFixedText_Inventory_Use); - Common::String fixedText_Give = fixedText.getText(kFixedText_Inventory_Give); - 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], _fixedTextExit); 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], _fixedTextLook); 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], _fixedTextUse); 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], _fixedTextGive); 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, "^^", false); // 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, "^", false); // 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, "_", false); // 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, "__", false); // 2 arrows pointing to the right if (tempMode == INVENTORY_DONT_DISPLAY) mode = LOOK_INVENTORY_MODE; _invMode = (InvMode)((int)mode); if (mode != PLAIN_INVENTORY) { - ui._oldKey = INVENTORY_COMMANDS[(int)mode]; + assert(mode < sizeof(_hotkeysIndexed)); + ui._oldKey = _hotkeysIndexed[mode]; } else { ui._oldKey = -1; } @@ -114,28 +136,22 @@ void ScalpelInventory::drawInventory(InvNewMode mode) { } void ScalpelInventory::invCommands(bool slamIt) { - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; UserInterface &ui = *_vm->_ui; - Common::String fixedText_Exit = fixedText.getText(kFixedText_Inventory_Exit); - Common::String fixedText_Look = fixedText.getText(kFixedText_Inventory_Look); - Common::String fixedText_Use = fixedText.getText(kFixedText_Inventory_Use); - Common::String fixedText_Give = fixedText.getText(kFixedText_Inventory_Give); - if (slamIt) { screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1), _invMode == INVMODE_EXIT ? COMMAND_HIGHLIGHTED :COMMAND_FOREGROUND, - true, fixedText_Exit); + true, _fixedTextExit); screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), _invMode == INVMODE_LOOK ? COMMAND_HIGHLIGHTED :COMMAND_FOREGROUND, - true, fixedText_Look); + true, _fixedTextLook); screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), _invMode == INVMODE_USE ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - true, fixedText_Use); + true, _fixedTextUse); screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), _invMode == INVMODE_GIVE ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - true, fixedText_Give); + true, _fixedTextGive); screen.print(Common::Point(INVENTORY_POINTS[4][2], CONTROLS_Y1 + 1), _invIndex == 0 ? COMMAND_NULL : COMMAND_FOREGROUND, "^^"); // 2 arrows pointing to the left @@ -153,16 +169,16 @@ void ScalpelInventory::invCommands(bool slamIt) { } else { screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1), _invMode == INVMODE_EXIT ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - false, fixedText_Exit); + false, _fixedTextExit); screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), _invMode == INVMODE_LOOK ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - false, fixedText_Look); + false, _fixedTextLook); screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), _invMode == INVMODE_USE ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - false, fixedText_Use); + false, _fixedTextUse); screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), _invMode == INVMODE_GIVE ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND, - false, fixedText_Give); + false, _fixedTextGive); screen.gPrint(Common::Point(INVENTORY_POINTS[4][2], CONTROLS_Y1), _invIndex == 0 ? COMMAND_NULL : COMMAND_FOREGROUND, "^^"); // 2 arrows pointing to the left diff --git a/engines/sherlock/scalpel/scalpel_inventory.h b/engines/sherlock/scalpel/scalpel_inventory.h index afafb0b94a..49d055593a 100644 --- a/engines/sherlock/scalpel/scalpel_inventory.h +++ b/engines/sherlock/scalpel/scalpel_inventory.h @@ -34,6 +34,18 @@ public: ScalpelInventory(SherlockEngine *vm); ~ScalpelInventory(); + Common::String _fixedTextExit; + Common::String _fixedTextLook; + Common::String _fixedTextUse; + Common::String _fixedTextGive; + + byte _hotkeyExit; + byte _hotkeyLook; + byte _hotkeyUse; + byte _hotkeyGive; + + byte _hotkeysIndexed[8]; + /** * Put the game into inventory mode and open the interface window. */ @@ -65,6 +77,11 @@ public: * and then calls loadGraphics to load the associated graphics */ virtual void loadInv(); + + /** + * 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_journal.cpp b/engines/sherlock/scalpel/scalpel_journal.cpp index 5c2b8f77f3..d6f8021e5b 100644 --- a/engines/sherlock/scalpel/scalpel_journal.cpp +++ b/engines/sherlock/scalpel/scalpel_journal.cpp @@ -64,6 +64,36 @@ ScalpelJournal::ScalpelJournal(SherlockEngine *vm) : Journal(vm) { // Load the journal directory and location names loadLocations(); } + + _fixedTextWatsonsJournal = FIXED(Journal_WatsonsJournal); + _fixedTextExit = FIXED(Journal_Exit); + _fixedTextBack10 = FIXED(Journal_Back10); + _fixedTextUp = FIXED(Journal_Up); + _fixedTextDown = FIXED(Journal_Down); + _fixedTextAhead10 = FIXED(Journal_Ahead10); + _fixedTextSearch = FIXED(Journal_Search); + _fixedTextFirstPage = FIXED(Journal_FirstPage); + _fixedTextLastPage = FIXED(Journal_LastPage); + _fixedTextPrintText = FIXED(Journal_PrintText); + + _hotkeyExit = toupper(_fixedTextExit[0]); + _hotkeyBack10 = toupper(_fixedTextBack10[0]); + _hotkeyUp = toupper(_fixedTextUp[0]); + _hotkeyDown = toupper(_fixedTextDown[0]); + _hotkeyAhead10 = toupper(_fixedTextAhead10[0]); + _hotkeySearch = toupper(_fixedTextSearch[0]); + _hotkeyFirstPage = toupper(_fixedTextFirstPage[0]); + _hotkeyLastPage = toupper(_fixedTextLastPage[0]); + _hotkeyPrintText = toupper(_fixedTextPrintText[0]); + + _fixedTextSearchExit = FIXED(JournalSearch_Exit); + _fixedTextSearchBackward = FIXED(JournalSearch_Backward); + _fixedTextSearchForward = FIXED(JournalSearch_Forward); + _fixedTextSearchNotFound = FIXED(JournalSearch_NotFound); + + _hotkeySearchExit = toupper(_fixedTextSearchExit[0]); + _hotkeySearchBackward = toupper(_fixedTextSearchBackward[0]); + _hotkeySearchForward = toupper(_fixedTextSearchForward[0]); } void ScalpelJournal::loadLocations() { @@ -130,7 +160,6 @@ void ScalpelJournal::loadLocations() { } void ScalpelJournal::drawFrame() { - FixedText &fixedText = *_vm->_fixedText; Resources &res = *_vm->_res; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; byte palette[PALETTE_SIZE]; @@ -145,54 +174,43 @@ void ScalpelJournal::drawFrame() { for (int idx = 0; idx < PALETTE_SIZE; ++idx) palette[idx] = VGA_COLOR_TRANS(palette[idx]); - Common::String fixedText_WatsonsJournal = fixedText.getText(kFixedText_Journal_WatsonsJournal); - Common::String fixedText_Exit = fixedText.getText(kFixedText_Journal_Exit); - Common::String fixedText_Back10 = fixedText.getText(kFixedText_Journal_Back10); - Common::String fixedText_Up = fixedText.getText(kFixedText_Journal_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Journal_Down); - Common::String fixedText_Ahead10 = fixedText.getText(kFixedText_Journal_Ahead10); - Common::String fixedText_Search = fixedText.getText(kFixedText_Journal_Search); - Common::String fixedText_FirstPage = fixedText.getText(kFixedText_Journal_FirstPage); - Common::String fixedText_LastPage = fixedText.getText(kFixedText_Journal_LastPage); - Common::String fixedText_PrintText = fixedText.getText(kFixedText_Journal_PrintText); - // Set the palette and print the title screen.setPalette(palette); - screen.gPrint(Common::Point(111, 18), BUTTON_BOTTOM, "%s", fixedText_WatsonsJournal.c_str()); - screen.gPrint(Common::Point(110, 17), INV_FOREGROUND, "%s", fixedText_WatsonsJournal.c_str()); + screen.gPrint(Common::Point(111, 18), BUTTON_BOTTOM, "%s", _fixedTextWatsonsJournal.c_str()); + screen.gPrint(Common::Point(110, 17), INV_FOREGROUND, "%s", _fixedTextWatsonsJournal.c_str()); // 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], _fixedTextExit); 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], _fixedTextBack10); 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], _fixedTextUp); 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], _fixedTextDown); 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], _fixedTextAhead10); 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], _fixedTextSearch); 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], _fixedTextFirstPage); 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], _fixedTextLastPage); // 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], _fixedTextPrintText); screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11), - COMMAND_NULL, false, fixedText_PrintText); + COMMAND_NULL, false, _fixedTextPrintText); } void ScalpelJournal::drawInterface() { @@ -213,34 +231,24 @@ void ScalpelJournal::drawInterface() { } void ScalpelJournal::doArrows() { - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; byte color; - Common::String fixedText_Back10 = fixedText.getText(kFixedText_Journal_Back10); - Common::String fixedText_Up = fixedText.getText(kFixedText_Journal_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Journal_Down); - Common::String fixedText_Ahead10 = fixedText.getText(kFixedText_Journal_Ahead10); - Common::String fixedText_Search = fixedText.getText(kFixedText_Journal_Search); - Common::String fixedText_FirstPage = fixedText.getText(kFixedText_Journal_FirstPage); - Common::String fixedText_LastPage = fixedText.getText(kFixedText_Journal_LastPage); - Common::String fixedText_PrintText = fixedText.getText(kFixedText_Journal_PrintText); - color = (_page > 1) ? COMMAND_FOREGROUND : COMMAND_NULL; - screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), color, false, fixedText_Back10); - screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), color, false, fixedText_Up); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), color, false, _fixedTextBack10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), color, false, _fixedTextUp); color = _down ? COMMAND_FOREGROUND : COMMAND_NULL; - screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), color, false, fixedText_Down); - screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), color, false, fixedText_Ahead10); - screen.buttonPrint(Common::Point(JOURNAL_POINTS[7][2], JOURNAL_BUTTONS_Y + 11), color, false, fixedText_LastPage); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), color, false, _fixedTextDown); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), color, false, _fixedTextAhead10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[7][2], JOURNAL_BUTTONS_Y + 11), color, false, _fixedTextLastPage); color = _journal.size() > 0 ? COMMAND_FOREGROUND : COMMAND_NULL; - screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), color, false, fixedText_Search); - screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11), COMMAND_NULL, false, fixedText_PrintText); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), color, false, _fixedTextSearch); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11), COMMAND_NULL, false, _fixedTextPrintText); color = _page > 1 ? COMMAND_FOREGROUND : COMMAND_NULL; - screen.buttonPrint(Common::Point(JOURNAL_POINTS[6][2], JOURNAL_BUTTONS_Y + 11), color, false, fixedText_FirstPage); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[6][2], JOURNAL_BUTTONS_Y + 11), color, false, _fixedTextFirstPage); } JournalButton ScalpelJournal::getHighlightedButton(const Common::Point &pt) { @@ -285,7 +293,6 @@ JournalButton ScalpelJournal::getHighlightedButton(const Common::Point &pt) { bool ScalpelJournal::handleEvents(int key) { Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; bool doneFlag = false; @@ -294,46 +301,36 @@ bool ScalpelJournal::handleEvents(int key) { byte color; if (events._pressed || events._released) { - Common::String fixedText_Exit = fixedText.getText(kFixedText_Journal_Exit); - Common::String fixedText_Back10 = fixedText.getText(kFixedText_Journal_Back10); - Common::String fixedText_Up = fixedText.getText(kFixedText_Journal_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Journal_Down); - Common::String fixedText_Ahead10 = fixedText.getText(kFixedText_Journal_Ahead10); - Common::String fixedText_Search = fixedText.getText(kFixedText_Journal_Search); - Common::String fixedText_FirstPage = fixedText.getText(kFixedText_Journal_FirstPage); - Common::String fixedText_LastPage = fixedText.getText(kFixedText_Journal_LastPage); - Common::String fixedText_PrintText = fixedText.getText(kFixedText_Journal_PrintText); - // Exit button color = (btn == BTN_EXIT) ? COMMAND_HIGHLIGHTED : COMMAND_FOREGROUND; - screen.buttonPrint(Common::Point(JOURNAL_POINTS[0][2], JOURNAL_BUTTONS_Y), color, true, fixedText_Exit); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[0][2], JOURNAL_BUTTONS_Y), color, true, _fixedTextExit); // Back 10 button if (btn == BTN_BACK10) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Back10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextBack10); } else if (_page > 1) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, fixedText_Back10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, _fixedTextBack10); } // Up button if (btn == BTN_UP) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Up); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextUp); } else if (_up) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, fixedText_Up); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[2][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, _fixedTextUp); } // Down button if (btn == BTN_DOWN) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Down); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextDown); } else if (_down) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, fixedText_Down); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[3][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, _fixedTextDown); } // Ahead 10 button if (btn == BTN_AHEAD110) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Ahead10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), COMMAND_HIGHLIGHTED, true, _fixedTextAhead10); } else if (_down) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, fixedText_Ahead10); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[4][2], JOURNAL_BUTTONS_Y), COMMAND_FOREGROUND, true, _fixedTextAhead10); } // Search button @@ -344,7 +341,7 @@ bool ScalpelJournal::handleEvents(int key) { } else { color = COMMAND_FOREGROUND; } - screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), color, true, fixedText_Search); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), color, true, _fixedTextSearch); // First Page button if (btn == BTN_FIRST_PAGE) { @@ -354,7 +351,7 @@ bool ScalpelJournal::handleEvents(int key) { } else { color = COMMAND_NULL; } - screen.buttonPrint(Common::Point(JOURNAL_POINTS[6][2], JOURNAL_BUTTONS_Y + 11), color, true, fixedText_FirstPage); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[6][2], JOURNAL_BUTTONS_Y + 11), color, true, _fixedTextFirstPage); // Last Page button if (btn == BTN_LAST_PAGE) { @@ -364,17 +361,17 @@ bool ScalpelJournal::handleEvents(int key) { } else { color = COMMAND_NULL; } - screen.buttonPrint(Common::Point(JOURNAL_POINTS[7][2], JOURNAL_BUTTONS_Y + 11), color, true, fixedText_LastPage); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[7][2], JOURNAL_BUTTONS_Y + 11), color, true, _fixedTextLastPage); // Print Text button - screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11), COMMAND_NULL, true, fixedText_PrintText); + screen.buttonPrint(Common::Point(JOURNAL_POINTS[8][2], JOURNAL_BUTTONS_Y + 11), COMMAND_NULL, true, _fixedTextPrintText); } if (btn == BTN_EXIT && events._released) { // Exit button pressed doneFlag = true; - } else if (((btn == BTN_BACK10 && events._released) || key == 'B') && (_page > 1)) { + } else if (((btn == BTN_BACK10 && events._released) || key == _hotkeyBack10) && (_page > 1)) { // Scrolll up 10 pages if (_page < 11) drawJournal(1, (_page - 1) * LINES_PER_PAGE); @@ -384,19 +381,19 @@ bool ScalpelJournal::handleEvents(int key) { doArrows(); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); - } else if (((btn == BTN_UP && events._released) || key == 'U') && _up) { + } else if (((btn == BTN_UP && events._released) || key == _hotkeyUp) && _up) { // Scroll up drawJournal(1, LINES_PER_PAGE); doArrows(); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); - } else if (((btn == BTN_DOWN && events._released) || key == 'D') && _down) { + } else if (((btn == BTN_DOWN && events._released) || key == _hotkeyDown) && _down) { // Scroll down drawJournal(2, LINES_PER_PAGE); doArrows(); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); - } else if (((btn == BTN_AHEAD110 && events._released) || key == 'A') && _down) { + } else if (((btn == BTN_AHEAD110 && events._released) || key == _hotkeyAhead10) && _down) { // Scroll down 10 pages if ((_page + 10) > _maxPage) drawJournal(2, (_maxPage - _page) * LINES_PER_PAGE); @@ -406,8 +403,8 @@ bool ScalpelJournal::handleEvents(int key) { doArrows(); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); - } else if (((btn == BTN_SEARCH && events._released) || key == 'S') && !_journal.empty()) { - screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), COMMAND_FOREGROUND, true, "Search"); + } else if (((btn == BTN_SEARCH && events._released) || key == _hotkeySearch) && !_journal.empty()) { + screen.buttonPrint(Common::Point(JOURNAL_POINTS[5][2], JOURNAL_BUTTONS_Y + 11), COMMAND_FOREGROUND, true, _fixedTextSearch); bool notFound = false; do { @@ -437,7 +434,7 @@ bool ScalpelJournal::handleEvents(int key) { } while (!doneFlag); doneFlag = false; - } else if (((btn == BTN_FIRST_PAGE && events._released) || key == 'F') && _up) { + } else if (((btn == BTN_FIRST_PAGE && events._released) || key == _hotkeyFirstPage) && _up) { // First page _index = _sub = 0; _up = _down = false; @@ -448,7 +445,7 @@ bool ScalpelJournal::handleEvents(int key) { doArrows(); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); - } else if (((btn == BTN_LAST_PAGE && events._released) || key == 'L') && _down) { + } else if (((btn == BTN_LAST_PAGE && events._released) || key == _hotkeyLastPage) && _down) { // Last page if ((_page + 10) > _maxPage) drawJournal(2, (_maxPage - _page) * LINES_PER_PAGE); @@ -468,7 +465,6 @@ int ScalpelJournal::getSearchString(bool printError) { enum Button { BTN_NONE, BTN_EXIT, BTN_BACKWARD, BTN_FORWARD }; Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; Talk &talk = *_vm->_talk; int xp; @@ -478,26 +474,14 @@ int ScalpelJournal::getSearchString(bool printError) { int done = 0; byte color; - Common::String fixedText_Exit = fixedText.getText(kFixedText_JournalSearch_Exit); - Common::String fixedText_Backward = fixedText.getText(kFixedText_JournalSearch_Backward); - Common::String fixedText_Forward = fixedText.getText(kFixedText_JournalSearch_Forward); - Common::String fixedText_NotFound = fixedText.getText(kFixedText_JournalSearch_NotFound); - // 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], _fixedTextSearchExit); 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], _fixedTextSearchBackward); 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); - - screen.gPrint(Common::Point(SEARCH_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, yp), - COMMAND_HIGHLIGHTED, "%c", fixedText_Exit[0]); - screen.gPrint(Common::Point(SEARCH_POINTS[1][2] - screen.stringWidth(fixedText_Backward) / 2, yp), - COMMAND_HIGHLIGHTED, "%c", fixedText_Backward[0]); - screen.gPrint(Common::Point(SEARCH_POINTS[2][2] - screen.stringWidth(fixedText_Forward) / 2, yp), - COMMAND_HIGHLIGHTED, "%c", fixedText_Forward[0]); + SEARCH_POINTS[2][2], _fixedTextSearchForward); screen.makeField(Common::Rect(12, 185, 307, 196)); @@ -507,8 +491,8 @@ int ScalpelJournal::getSearchString(bool printError) { screen.hLine(306, 186, 195, BUTTON_TOP); if (printError) { - screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - screen.stringWidth(fixedText_NotFound)) / 2, 185), - INV_FOREGROUND, "%s", fixedText_NotFound.c_str()); + screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - screen.stringWidth(_fixedTextSearchNotFound)) / 2, 185), + INV_FOREGROUND, "%s", _fixedTextSearchNotFound.c_str()); } else if (!_find.empty()) { // There's already a search term, display it already screen.gPrint(Common::Point(15, 185), TALK_FOREGROUND, "%s", _find.c_str()); @@ -563,7 +547,7 @@ int ScalpelJournal::getSearchString(bool printError) { } else { color = COMMAND_FOREGROUND; } - screen.print(Common::Point(SEARCH_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, 175), color, "%s", fixedText_Exit.c_str()); + screen.buttonPrint(Common::Point(SEARCH_POINTS[0][0], SEARCH_POINTS[0][2]), color, false, _fixedTextSearchExit); if (pt.x > SEARCH_POINTS[1][0] && pt.x < SEARCH_POINTS[1][1] && pt.y > 174 && pt.y < 183) { found = BTN_BACKWARD; @@ -571,7 +555,7 @@ int ScalpelJournal::getSearchString(bool printError) { } else { color = COMMAND_FOREGROUND; } - screen.print(Common::Point(SEARCH_POINTS[1][2] - screen.stringWidth(fixedText_Backward) / 2, 175), color, "%s", fixedText_Backward.c_str()); + screen.buttonPrint(Common::Point(SEARCH_POINTS[1][0], SEARCH_POINTS[1][2]), color, false, _fixedTextSearchBackward); if (pt.x > SEARCH_POINTS[2][0] && pt.x < SEARCH_POINTS[2][1] && pt.y > 174 && pt.y < 183) { found = BTN_FORWARD; @@ -579,7 +563,7 @@ int ScalpelJournal::getSearchString(bool printError) { } else { color = COMMAND_FOREGROUND; } - screen.print(Common::Point(SEARCH_POINTS[2][2] - screen.stringWidth(fixedText_Forward) / 2, 175), color, "%s", fixedText_Forward.c_str()); + screen.buttonPrint(Common::Point(SEARCH_POINTS[2][0], SEARCH_POINTS[2][2]), color, false, _fixedTextSearchForward); } events.wait(2); diff --git a/engines/sherlock/scalpel/scalpel_journal.h b/engines/sherlock/scalpel/scalpel_journal.h index c8e9c01739..50f1917fca 100644 --- a/engines/sherlock/scalpel/scalpel_journal.h +++ b/engines/sherlock/scalpel/scalpel_journal.h @@ -41,6 +41,37 @@ enum JournalButton { }; class ScalpelJournal: public Journal { +public: + Common::String _fixedTextWatsonsJournal; + Common::String _fixedTextExit; + Common::String _fixedTextBack10; + Common::String _fixedTextUp; + Common::String _fixedTextDown; + Common::String _fixedTextAhead10; + Common::String _fixedTextSearch; + Common::String _fixedTextFirstPage; + Common::String _fixedTextLastPage; + Common::String _fixedTextPrintText; + + byte _hotkeyExit; + byte _hotkeyBack10; + byte _hotkeyUp; + byte _hotkeyDown; + byte _hotkeyAhead10; + byte _hotkeySearch; + byte _hotkeyFirstPage; + byte _hotkeyLastPage; + byte _hotkeyPrintText; + + Common::String _fixedTextSearchExit; + Common::String _fixedTextSearchBackward; + Common::String _fixedTextSearchForward; + Common::String _fixedTextSearchNotFound; + + byte _hotkeySearchExit; + byte _hotkeySearchBackward; + byte _hotkeySearchForward; + private: /** * Load the list of journal locations diff --git a/engines/sherlock/scalpel/scalpel_saveload.cpp b/engines/sherlock/scalpel/scalpel_saveload.cpp index 61830a56b2..90eab5930c 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] - screen.stringWidth("Exit") / 2, "Exit"); + ENV_POINTS[0][2], _fixedTextExit); 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], _fixedTextLoad); 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], _fixedTextSave); 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], _fixedTextUp); 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], _fixedTextDown); 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], _fixedTextQuit); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); } 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); 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); 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); + screen.buttonPrint(Common::Point(ENV_POINTS[1][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextLoad); + screen.buttonPrint(Common::Point(ENV_POINTS[2][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextSave); + screen.buttonPrint(Common::Point(ENV_POINTS[3][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextUp); + screen.buttonPrint(Common::Point(ENV_POINTS[4][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextDown); + screen.buttonPrint(Common::Point(ENV_POINTS[5][2], CONTROLS_Y), COMMAND_NULL, true, _fixedTextQuit); 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 6b035cace3..81e3d834aa 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 71bcca5dc5..197a2a2634 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 &buttonText, bool textContainsHotkey) { Surface &bb = *_backBuffer; bb.fillRect(Common::Rect(bounds.left, bounds.top, bounds.right, bounds.top + 1), BUTTON_TOP); @@ -40,30 +40,65 @@ 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, buttonText, textContainsHotkey); } +// ButtonText is supposed to have its hotkey as a prefix. The hotkey will get highlighted. void ScalpelScreen::buttonPrint(const Common::Point &pt, uint color, bool slamIt, - const Common::String &str) { - int xStart = pt.x - stringWidth(str) / 2; + const Common::String &buttonText, 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(buttonText.c_str() + 1)) / 2); + } else { + xStart -= (stringWidth(buttonText) / 2); + } if (color == COMMAND_FOREGROUND) { - // First character needs to be highlighted + uint16 prefixOffsetX = 0; + byte hotkey = buttonText[0]; + + // Hotkey needs to be highlighted + if (textContainsHotkey) { + Common::String prefixText = Common::String(buttonText.c_str() + 1); + uint16 prefixTextLen = prefixText.size(); + 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 < prefixTextLen) { + if (prefixText[prefixTextPos] == hotkey) { + // Hotkey found, remove remaining text + while (prefixTextPos < prefixText.size()) { + prefixText.deleteLastChar(); + } + break; + } + prefixTextPos++; + } + + if (prefixTextPos < prefixTextLen) { + // only adjust in case hotkey character was actually found + prefixOffsetX = stringWidth(prefixText); + } + } + 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", buttonText.c_str() + skipTextOffset); + 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", buttonText.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", buttonText.c_str() + skipTextOffset); } else { - gPrint(Common::Point(xStart, pt.y), color, "%s", str.c_str()); + gPrint(Common::Point(xStart, pt.y), color, "%s", buttonText.c_str() + skipTextOffset); } } diff --git a/engines/sherlock/scalpel/scalpel_screen.h b/engines/sherlock/scalpel/scalpel_screen.h index d6018a44a0..cee33b8c6c 100644 --- a/engines/sherlock/scalpel/scalpel_screen.h +++ b/engines/sherlock/scalpel/scalpel_screen.h @@ -38,14 +38,16 @@ public: /** * Draws a button for use in the inventory, talk, and examine dialogs. + * ButtonText is supposed to have its hotkey as a prefix. The hotkey will get highlighted. */ - void makeButton(const Common::Rect &bounds, int textX, const Common::String &str); + void makeButton(const Common::Rect &bounds, int textX, const Common::String &buttonText, bool textContainsHotkey = true); /** * Prints an interface command with the first letter highlighted to indicate * what keyboard shortcut is associated with it + * ButtonText is supposed to have its hotkey as a prefix. The hotkey will get highlighted. */ - 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 &buttonText, bool textContainsHotkey = true); /** * 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..be2baf9184 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -170,6 +170,13 @@ ScalpelTalk::ScalpelTalk(SherlockEngine *vm) : Talk(vm) { _opcodes = opcodes; } + _fixedTextWindowExit = FIXED(Window_Exit); + _fixedTextWindowUp = FIXED(Window_Up); + _fixedTextWindowDown = FIXED(Window_Down); + + _hotkeyWindowExit = toupper(_fixedTextWindowExit[0]); + _hotkeyWindowUp = toupper(_fixedTextWindowUp[0]); + _hotkeyWindowDown = toupper(_fixedTextWindowDown[0]); } void ScalpelTalk::talkTo(const Common::String filename) { @@ -185,7 +192,6 @@ void ScalpelTalk::talkTo(const Common::String filename) { } void ScalpelTalk::talkInterface(const byte *&str) { - FixedText &fixedText = *_vm->_fixedText; People &people = *_vm->_people; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; UserInterface &ui = *_vm->_ui; @@ -199,12 +205,9 @@ void ScalpelTalk::talkInterface(const byte *&str) { drawInterface(); if (_talkTo != -1) { - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, fixedText_Exit); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, fixedText_Up); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, fixedText_Down); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowExit); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowUp); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowDown); } } @@ -512,7 +515,6 @@ OpcodeReturn ScalpelTalk::cmdSfxCommand(const byte *&str) { OpcodeReturn ScalpelTalk::cmdSummonWindow(const byte *&str) { Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; drawInterface(); @@ -521,12 +523,9 @@ OpcodeReturn ScalpelTalk::cmdSummonWindow(const byte *&str) { _noTextYet = false; if (_speaker != -1) { - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, fixedText_Exit); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, fixedText_Up); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, fixedText_Down); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowExit); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowUp); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowDown); } return RET_SUCCESS; @@ -684,7 +683,6 @@ Common::Point ScalpelTalk::get3doPortraitPosition() const { } void ScalpelTalk::drawInterface() { - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; Surface &bb = *screen._backBuffer; @@ -698,30 +696,25 @@ void ScalpelTalk::drawInterface() { SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND); if (_talkTo != -1) { - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); + Common::String fixedText_Exit = FIXED(Window_Exit); + Common::String fixedText_Up = FIXED(Window_Up); + Common::String fixedText_Down = FIXED(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); + Common::String fixedText_PressKeyToContinue = FIXED(PressKey_ToContinue); screen.makeButton(Common::Rect(46, CONTROLS_Y, 273, CONTROLS_Y + 10), - 160 - fixedText_PressKeyToContinueLen / 2, fixedText_PressKeyToContinue); - screen.gPrint(Common::Point(160 - fixedText_PressKeyToContinueLen / 2, CONTROLS_Y), COMMAND_FOREGROUND, - "%s", fixedText_PressKeyToContinueHotkey.c_str()); + 160, fixedText_PressKeyToContinue); } } bool ScalpelTalk::displayTalk(bool slamIt) { - FixedText &fixedText = *_vm->_fixedText; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; int yp = CONTROLS_Y + 14; int lineY = -1; @@ -739,22 +732,20 @@ bool ScalpelTalk::displayTalk(bool slamIt) { } // Display the up arrow and enable Up button if the first option is scrolled off-screen - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); if (_moreTalkUp) { if (slamIt) { screen.print(Common::Point(5, CONTROLS_Y + 13), INV_FOREGROUND, "~"); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextWindowUp); } else { screen.gPrint(Common::Point(5, CONTROLS_Y + 12), INV_FOREGROUND, "~"); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, false, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, false, _fixedTextWindowUp); } } else { if (slamIt) { - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, _fixedTextWindowUp); screen.vgaBar(Common::Rect(5, CONTROLS_Y + 11, 15, CONTROLS_Y + 22), INV_BACKGROUND); } else { - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowUp); screen._backBuffer1.fillRect(Common::Rect(5, CONTROLS_Y + 11, 15, CONTROLS_Y + 22), INV_BACKGROUND); } @@ -789,17 +780,17 @@ bool ScalpelTalk::displayTalk(bool slamIt) { if (slamIt) { screen.print(Common::Point(5, 190), INV_FOREGROUND, "|"); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, _fixedTextWindowDown); } else { screen.gPrint(Common::Point(5, 189), INV_FOREGROUND, "|"); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, false, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, false, _fixedTextWindowDown); } } else { if (slamIt) { - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, _fixedTextWindowDown); screen.vgaBar(Common::Rect(5, 189, 16, 199), INV_BACKGROUND); } else { - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, false, _fixedTextWindowDown); screen._backBuffer1.fillRect(Common::Rect(5, 189, 16, 199), INV_BACKGROUND); } } @@ -896,11 +887,9 @@ int ScalpelTalk::talkLine(int lineNum, int stateNum, byte color, int lineY, bool } void ScalpelTalk::showTalk() { - FixedText &fixedText = *_vm->_fixedText; People &people = *_vm->_people; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; ScalpelUserInterface &ui = *(ScalpelUserInterface *)_vm->_ui; - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); byte color = ui._endKeyActive ? COMMAND_FOREGROUND : COMMAND_NULL; clearSequences(); @@ -920,9 +909,9 @@ void ScalpelTalk::showTalk() { // If the window is already open, simply draw. Otherwise, do it // to the back buffer and then summon the window if (ui._windowOpen) { - screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, true, _fixedTextWindowExit); } else { - screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, false, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), color, false, _fixedTextWindowExit); if (!ui._slideWindows) { screen.slamRect(Common::Rect(0, CONTROLS_Y, diff --git a/engines/sherlock/scalpel/scalpel_talk.h b/engines/sherlock/scalpel/scalpel_talk.h index 3ba61dadc1..e542331ce6 100644 --- a/engines/sherlock/scalpel/scalpel_talk.h +++ b/engines/sherlock/scalpel/scalpel_talk.h @@ -88,6 +88,14 @@ public: ScalpelTalk(SherlockEngine *vm); virtual ~ScalpelTalk() {} + Common::String _fixedTextWindowExit; + Common::String _fixedTextWindowUp; + Common::String _fixedTextWindowDown; + + byte _hotkeyWindowExit; + byte _hotkeyWindowUp; + byte _hotkeyWindowDown; + /** * Opens the talk file 'talk.tlk' and searches the index for the specified * conversation. If found, the data for that conversation is loaded diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp index 79d74ba999..4e7cf5c378 100644 --- a/engines/sherlock/scalpel/scalpel_user_interface.cpp +++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp @@ -64,9 +64,6 @@ const int INVENTORY_POINTS[8][3] = { { 285, 315, 294 } }; -const char COMMANDS[13] = "LMTPOCIUGJFS"; -const char COMMANDS_3DO[13] = "LMTPOCIUGSFF"; -const char INVENTORY_COMMANDS[9] = { "ELUG-+,." }; const int UI_OFFSET_3DO = 16; // (320 - 288) / 2 /*----------------------------------------------------------------*/ @@ -99,6 +96,43 @@ ScalpelUserInterface::ScalpelUserInterface(SherlockEngine *vm): UserInterface(vm _cNum = 0; _find = 0; _oldUse = 0; + + // Set up hotkeys + Common::String gameHotkeys = FIXED(Game_Hotkeys); + + memset(_hotkeysIndexed, 0, sizeof(_hotkeysIndexed)); + assert(gameHotkeys.size() <= sizeof(_hotkeysIndexed)); + memcpy(_hotkeysIndexed, gameHotkeys.c_str(), gameHotkeys.size()); + + _hotkeyLook = gameHotkeys[0]; + _hotkeyMove = gameHotkeys[1]; + _hotkeyTalk = gameHotkeys[2]; + _hotkeyPickUp = gameHotkeys[3]; + _hotkeyOpen = gameHotkeys[4]; + _hotkeyClose = gameHotkeys[5]; + _hotkeyInventory = gameHotkeys[6]; + _hotkeyUse = gameHotkeys[7]; + _hotkeyGive = gameHotkeys[8]; + _hotkeyJournal = gameHotkeys[9]; + _hotkeyFiles = gameHotkeys[10]; + _hotkeySetUp = gameHotkeys[11]; + _hotkeyLoadGame = 0; + _hotkeySaveGame = 0; + + if (IS_3DO) { + // 3DO doesn't have a Journal nor a Files button + // Instead it has the setup button in place of the journal + // and also "Load" and "Save" buttons underneath it. + _hotkeyJournal = 0; + _hotkeyFiles = 0; + _hotkeyLoadGame = 'A'; // "S" already used for SetUp + _hotkeySaveGame = 'V'; // ditto + + _hotkeysIndexed[MAINBUTTON_JOURNAL] = 0; + _hotkeysIndexed[MAINBUTTON_FILES] = 0; + _hotkeysIndexed[MAINBUTTON_LOADGAME] = 'A'; + _hotkeysIndexed[MAINBUTTON_SAVEGAME] = 'V'; + } } ScalpelUserInterface::~ScalpelUserInterface() { @@ -435,12 +469,13 @@ void ScalpelUserInterface::pushButton(int num) { restoreButton(num); } -void ScalpelUserInterface::toggleButton(int num) { +void ScalpelUserInterface::toggleButton(uint16 num) { Screen &screen = *_vm->_screen; if (_menuMode != (MenuMode)(num + 1)) { _menuMode = (MenuMode)(num + 1); - _oldKey = COMMANDS[num]; + assert(num < sizeof(_hotkeysIndexed)); + _oldKey = _hotkeysIndexed[num]; _oldTemp = num; if (_keyboardInput) { @@ -684,7 +719,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; @@ -723,15 +757,15 @@ void ScalpelUserInterface::doEnvControl() { // Escape _key will close the dialog if (_key == Common::KEYCODE_ESCAPE) - _key = 'E'; + _key = saves._hotkeyExit; + + int buttonIndex = saves.identifyUserButton(_key); - 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); + 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 +800,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 +839,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 +858,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); 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); // Check whether there are more pending U keys pressed moreKeys = false; @@ -834,10 +868,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 +893,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); 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); // Check whether there are more pending D keys pressed moreKeys = false; @@ -870,16 +904,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 - 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, saves._fixedTextQuitGameYes); + screen.makeButton(Common::Rect(161, CONTROLS_Y, 209, CONTROLS_Y + 10), 184, saves._fixedTextQuitGameNo); screen.slamArea(112, CONTROLS_Y, 97, 10); do { @@ -903,7 +937,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 +952,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); 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); } 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); banishWindow(1); _windowBounds.top = CONTROLS_Y1; _key = -1; @@ -981,7 +1015,6 @@ void ScalpelUserInterface::doEnvControl() { void ScalpelUserInterface::doInvControl() { Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelInventory &inv = *(ScalpelInventory *)_vm->_inventory; Scene &scene = *_vm->_scene; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; @@ -1007,20 +1040,15 @@ void ScalpelUserInterface::doInvControl() { if (events._pressed || events._released) { events.clearKeyboard(); - Common::String fixedText_Exit = fixedText.getText(kFixedText_Inventory_Exit); - Common::String fixedText_Look = fixedText.getText(kFixedText_Inventory_Look); - Common::String fixedText_Use = fixedText.getText(kFixedText_Inventory_Use); - Common::String fixedText_Give = fixedText.getText(kFixedText_Inventory_Give); - if (found != -1) // If a slot highlighted, set its color colors[found] = COMMAND_HIGHLIGHTED; - screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1), colors[0], true, fixedText_Exit); + screen.buttonPrint(Common::Point(INVENTORY_POINTS[0][2], CONTROLS_Y1), colors[0], true, inv._fixedTextExit); if (found >= 0 && found <= 3) { - screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), colors[1], true, fixedText_Look); - screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), colors[2], true, fixedText_Use); - screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), colors[3], true, fixedText_Give); + screen.buttonPrint(Common::Point(INVENTORY_POINTS[1][2], CONTROLS_Y1), colors[1], true, inv._fixedTextLook); + screen.buttonPrint(Common::Point(INVENTORY_POINTS[2][2], CONTROLS_Y1), colors[2], true, inv._fixedTextUse); + screen.buttonPrint(Common::Point(INVENTORY_POINTS[3][2], CONTROLS_Y1), colors[3], true, inv._fixedTextGive); inv._invMode = (InvMode)found; _selector = -1; } @@ -1054,19 +1082,19 @@ void ScalpelUserInterface::doInvControl() { if (_key == Common::KEYCODE_ESCAPE) // Escape will also 'E'xit out of inventory display - _key = 'E'; + _key = inv._hotkeyExit; + + int buttonIndex = inv.identifyUserButton(_key); - if (_key == 'E' || _key == 'L' || _key == 'U' || _key == 'G' - || _key == '-' || _key == '+') { + if ((buttonIndex >= 0) && (buttonIndex <= 5)) { InvMode temp = inv._invMode; - const char *chP = strchr(INVENTORY_COMMANDS, _key); - inv._invMode = !chP ? INVMODE_INVALID : (InvMode)(chP - INVENTORY_COMMANDS); + inv._invMode = (InvMode)buttonIndex; inv.invCommands(true); inv._invMode = temp; _keyboardInput = true; - if (_key == 'E') + if (_key == inv._hotkeyExit) inv._invMode = INVMODE_EXIT; _selector = -1; } else { @@ -1088,7 +1116,7 @@ void ScalpelUserInterface::doInvControl() { } if (events._released || _keyboardInput) { - if ((found == 0 && events._released) || _key == 'E') { + if ((found == 0 && events._released) || _key == inv._hotkeyExit) { inv.freeInv(); _infoFlag = true; clearInfo(); @@ -1096,11 +1124,11 @@ void ScalpelUserInterface::doInvControl() { _key = -1; events.clearEvents(); events.setCursor(ARROW); - } else if ((found == 1 && events._released) || (_key == 'L')) { + } else if ((found == 1 && events._released) || (_key == inv._hotkeyLook)) { inv._invMode = INVMODE_LOOK; - } else if ((found == 2 && events._released) || (_key == 'U')) { + } else if ((found == 2 && events._released) || (_key == inv._hotkeyUse)) { inv._invMode = INVMODE_USE; - } else if ((found == 3 && events._released) || (_key == 'G')) { + } else if ((found == 3 && events._released) || (_key == inv._hotkeyGive)) { inv._invMode = INVMODE_GIVE; } else if (((found == 4 && events._released) || _key == ',') && inv._invIndex) { if (inv._invIndex >= 6) @@ -1230,7 +1258,7 @@ void ScalpelUserInterface::doLookControl() { banishWindow(true); _windowBounds.top = CONTROLS_Y1; - _key = _oldKey = COMMANDS[LOOK_MODE - 1]; + _key = _oldKey = _hotkeyLook; _temp = _oldTemp = 0; _menuMode = LOOK_MODE; events.clearEvents(); @@ -1260,7 +1288,7 @@ void ScalpelUserInterface::doLookControl() { screen._backBuffer2.blitFrom(tempSurface, Common::Point(0, CONTROLS_Y1)); _windowBounds.top = CONTROLS_Y1; - _key = _oldKey = COMMANDS[LOOK_MODE - 1]; + _key = _oldKey = _hotkeyLook; _temp = _oldTemp = 0; events.clearEvents(); _invLookFlag = false; @@ -1276,41 +1304,83 @@ void ScalpelUserInterface::doMainControl() { ScalpelInventory &inv = *(ScalpelInventory *)_vm->_inventory; ScalpelSaveManager &saves = *(ScalpelSaveManager *)_vm->_saves; Common::Point pt = events.mousePos(); - const char *commands = IS_3DO ? COMMANDS_3DO : COMMANDS; + int pressedButtonId = -1; // button id according to enum MAINBUTTON_* if ((events._pressed || events._released) && pt.y > CONTROLS_Y) { events.clearKeyboard(); _key = -1; + _temp = 12; // no button currently selected // Check whether the mouse is in any of the command areas - for (_temp = 0; (_temp < 12) && (_key == -1); ++_temp) { - Common::Rect r(MENU_POINTS[_temp][0], MENU_POINTS[_temp][1], - MENU_POINTS[_temp][2], MENU_POINTS[_temp][3]); - if (IS_3DO && _temp >= 0 && _temp <= 2) { + for (uint16 buttonNr = 0; buttonNr < 12; buttonNr++) { + Common::Rect r(MENU_POINTS[buttonNr][0], MENU_POINTS[buttonNr][1], + MENU_POINTS[buttonNr][2], MENU_POINTS[buttonNr][3]); + if (IS_3DO && buttonNr <= 2) { r.left += UI_OFFSET_3DO - 1; r.right += UI_OFFSET_3DO - 1; } - if (r.contains(pt)) - _key = commands[_temp]; + if (r.contains(pt)) { + _temp = buttonNr; + pressedButtonId = buttonNr; + if (IS_3DO) { + // Replace some buttons according to 3DO + switch (pressedButtonId) { + case MAINBUTTON_JOURNAL: + pressedButtonId = MAINBUTTON_SETUP; + break; + case MAINBUTTON_FILES: + pressedButtonId = MAINBUTTON_LOADGAME; + break; + case MAINBUTTON_SETUP: + pressedButtonId = MAINBUTTON_SAVEGAME; + break; + default: + break; + } + } + // Get hotkey, that's assigned to it + assert(buttonNr < sizeof(_hotkeysIndexed)); + _key = _hotkeysIndexed[buttonNr]; + break; + } } - --_temp; } else if (_keyPress) { // Keyboard control _keyboardInput = true; + _temp = 12; // no button currently selected + + byte key = toupper(_keyPress); - char key = toupper(_keyPress); - const char *c = strchr(commands, key); - if (c) { - _temp = c - commands; + for (uint16 buttonId = 0; buttonId < sizeof(_hotkeysIndexed); buttonId++) { + if (key == _hotkeysIndexed[buttonId]) { + pressedButtonId = buttonId; + } + } + if (pressedButtonId >= 0) { + _temp = pressedButtonId; _key = key; + if (IS_3DO) { + // Fix up button number for 3DO + switch (pressedButtonId) { + case MAINBUTTON_SETUP: + _temp = 9; + break; + case MAINBUTTON_LOADGAME: + _temp = 10; + break; + case MAINBUTTON_SAVEGAME: + _temp = 11; + break; + default: + break; + } + } } else { - _temp = 12; + _key = -1; } - if (_temp == 12) - _key = -1; - if (events._rightPressed) { + pressedButtonId = -1; _temp = 12; _key = -1; } @@ -1340,58 +1410,52 @@ void ScalpelUserInterface::doMainControl() { } if (!events._pressed && !_windowOpen) { - switch (_key) { - case 'L': + switch (pressedButtonId) { + case MAINBUTTON_LOOK: toggleButton(0); break; - case 'M': + case MAINBUTTON_MOVE: toggleButton(1); break; - case 'T': + case MAINBUTTON_TALK: toggleButton(2); break; - case 'P': + case MAINBUTTON_PICKUP: toggleButton(3); break; - case 'O': + case MAINBUTTON_OPEN: toggleButton(4); break; - case 'C': + case MAINBUTTON_CLOSE: toggleButton(5); break; - case 'I': + case MAINBUTTON_INVENTORY: pushButton(6); _selector = _oldSelector = -1; _menuMode = INV_MODE; - inv.drawInventory(PLAIN_INVENTORY); + inv.drawInventory(LOOK_INVENTORY_MODE); break; - case 'U': + case MAINBUTTON_USE: pushButton(7); _selector = _oldSelector = -1; _menuMode = USE_MODE; inv.drawInventory(USE_INVENTORY_MODE); break; - case 'G': + case MAINBUTTON_GIVE: pushButton(8); _selector = _oldSelector = -1; _menuMode = GIVE_MODE; inv.drawInventory(GIVE_INVENTORY_MODE); break; - case 'J': - pushButton(9); - _menuMode = JOURNAL_MODE; - journalControl(); + case MAINBUTTON_JOURNAL: + if (!IS_3DO) { + pushButton(9); + _menuMode = JOURNAL_MODE; + journalControl(); + } break; - case 'F': - if (IS_3DO) { - if (_temp == 10) { - pushButton(10); - vm.showScummVMRestoreDialog(); - } else if (_temp == 11) { - pushButton(11); - vm.showScummVMSaveDialog(); - } - } else { + case MAINBUTTON_FILES: + if (!IS_3DO) { pushButton(10); // Create a thumbnail of the current screen before the files dialog is shown, in case @@ -1413,7 +1477,19 @@ void ScalpelUserInterface::doMainControl() { } } break; - case 'S': + case MAINBUTTON_LOADGAME: + if (IS_3DO) { + pushButton(10); + vm.showScummVMRestoreDialog(); + } + break; + case MAINBUTTON_SAVEGAME: + if (IS_3DO) { + pushButton(11); + vm.showScummVMSaveDialog(); + } + break; + case MAINBUTTON_SETUP: pushButton(IS_3DO ? 9 : 11); _menuMode = SETUP_MODE; Settings::show(_vm); @@ -1500,7 +1576,6 @@ void ScalpelUserInterface::doPickControl() { void ScalpelUserInterface::doTalkControl() { Events &events = *_vm->_events; - FixedText &fixedText = *_vm->_fixedText; ScalpelJournal &journal = *(ScalpelJournal *)_vm->_journal; ScalpelPeople &people = *(ScalpelPeople *)_vm->_people; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; @@ -1511,28 +1586,24 @@ void ScalpelUserInterface::doTalkControl() { _key = _oldKey = -1; _keyboardInput = false; - Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); - Common::String fixedText_Up = fixedText.getText(kFixedText_Window_Up); - Common::String fixedText_Down = fixedText.getText(kFixedText_Window_Down); - if (events._pressed || events._released) { events.clearKeyboard(); // Handle button printing if (mousePos.x > 99 && mousePos.x < 138 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 10) && !_endKeyActive) - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, talk._fixedTextWindowExit); else if (_endKeyActive) - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowExit); if (mousePos.x > 140 && mousePos.x < 170 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 10) && talk._moreTalkUp) - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, talk._fixedTextWindowUp); else if (talk._moreTalkUp) - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Up); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowUp); if (mousePos.x > 181&& mousePos.x < 220 && mousePos.y > CONTROLS_Y && mousePos.y < (CONTROLS_Y + 10) && talk._moreTalkDown) - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_HIGHLIGHTED, true, talk._fixedTextWindowDown); else if (talk._moreTalkDown) - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Down); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowDown); bool found = false; for (_selector = talk._talkIndex; _selector < (int)talk._statements.size() && !found; ++_selector) { @@ -1548,7 +1619,7 @@ void ScalpelUserInterface::doTalkControl() { if (_keyPress) { _key = toupper(_keyPress); if (_key == Common::KEYCODE_ESCAPE) - _key = 'E'; + _key = talk._hotkeyWindowExit; // Check for number press indicating reply line if (_key >= '1' && _key <= ('1' + (int)talk._statements.size() - 1)) { @@ -1561,7 +1632,7 @@ void ScalpelUserInterface::doTalkControl() { break; } } - } else if (_key == 'E' || _key == 'U' || _key == 'D') { + } else if (_key == talk._hotkeyWindowExit || _key == talk._hotkeyWindowUp || _key == talk._hotkeyWindowDown) { _keyboardInput = true; } else { _selector = -1; @@ -1589,7 +1660,7 @@ void ScalpelUserInterface::doTalkControl() { if (events._released || _keyboardInput) { if (((Common::Rect(99, CONTROLS_Y, 138, CONTROLS_Y + 10).contains(mousePos) && events._released) - || _key == 'E') && _endKeyActive) { + || _key == talk._hotkeyWindowExit) && _endKeyActive) { talk.freeTalkVars(); talk.pullSequence(); @@ -1597,7 +1668,7 @@ void ScalpelUserInterface::doTalkControl() { banishWindow(); _windowBounds.top = CONTROLS_Y1; } else if (((Common::Rect(140, CONTROLS_Y, 179, CONTROLS_Y + 10).contains(mousePos) && events._released) - || _key == 'U') && talk._moreTalkUp) { + || _key == talk._hotkeyWindowUp) && talk._moreTalkUp) { while (talk._statements[--talk._talkIndex]._talkMap == -1) ; screen._backBuffer1.fillRect(Common::Rect(5, CONTROLS_Y + 11, SHERLOCK_SCREEN_WIDTH - 2, @@ -1606,7 +1677,7 @@ void ScalpelUserInterface::doTalkControl() { screen.slamRect(Common::Rect(5, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH - 5, SHERLOCK_SCREEN_HEIGHT - 2)); } else if (((Common::Rect(181, CONTROLS_Y, 220, CONTROLS_Y + 10).contains(mousePos) && events._released) - || _key == 'D') && talk._moreTalkDown) { + || _key == talk._hotkeyWindowDown) && talk._moreTalkDown) { do { ++talk._talkIndex; } while (talk._talkIndex < (int)talk._statements.size() && talk._statements[talk._talkIndex]._talkMap == -1); @@ -1617,9 +1688,9 @@ void ScalpelUserInterface::doTalkControl() { screen.slamRect(Common::Rect(5, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH - 5, SHERLOCK_SCREEN_HEIGHT - 2)); } else if (_selector != -1) { - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, fixedText_Exit); - screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, fixedText_Up); - screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, fixedText_Down); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowExit); + screen.buttonPrint(Common::Point(159, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowUp); + screen.buttonPrint(Common::Point(200, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowDown); // If the reply is new, add it to the journal if (!talk._talkHistory[talk._converseNum][_selector]) { @@ -1713,9 +1784,9 @@ void ScalpelUserInterface::doTalkControl() { !talk._statements[select]._statement.hasPrefix("^")) { // Not a reply first file, so display the new selections if (_endKeyActive) - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_FOREGROUND, true, talk._fixedTextWindowExit); else - screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, fixedText_Exit); + screen.buttonPrint(Common::Point(119, CONTROLS_Y), COMMAND_NULL, true, talk._fixedTextWindowExit); talk.displayTalk(true); events.setCursor(ARROW); @@ -1776,7 +1847,7 @@ void ScalpelUserInterface::journalControl() { if (keyState.keycode == Common::KEYCODE_x && (keyState.flags & Common::KBD_ALT)) { _vm->quitGame(); return; - } else if (keyState.keycode == Common::KEYCODE_e || keyState.keycode == Common::KEYCODE_ESCAPE) { + } else if (toupper(keyState.ascii) == journal._hotkeyExit || keyState.keycode == Common::KEYCODE_ESCAPE) { doneFlag = true; } else { _key = toupper(keyState.keycode); @@ -1808,7 +1879,6 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first ScalpelInventory &inv = *(ScalpelInventory *)_vm->_inventory; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; Talk &talk = *_vm->_talk; - FixedText &fixedText = *_vm->_fixedText; if (str.hasPrefix("_")) { _lookScriptFlag = true; @@ -1840,7 +1910,7 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first banishWindow(1); events.setCursor(MAGNIFY); _windowBounds.top = CONTROLS_Y1; - _key = _oldKey = COMMANDS[LOOK_MODE - 1]; + _key = _oldKey = _hotkeyLook; _temp = _oldTemp = 0; _menuMode = LOOK_MODE; events.clearEvents(); @@ -1867,7 +1937,7 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first banishWindow(1); _windowBounds.top = CONTROLS_Y1; - _key = _oldKey = COMMANDS[INV_MODE - 1]; + _key = _oldKey = _hotkeyInventory; _temp = _oldTemp = 0; events.clearEvents(); @@ -1939,26 +2009,16 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first // Handle display depending on whether all the message was shown if (!endOfStr) { - Common::String fixedText_PressKeyForMore = fixedText.getText(kFixedText_PressKey_ForMore); - Common::String fixedText_PressKeyForMoreHotkey = fixedText.getText(kFixedText_PressKey_ForMoreHotkey); - int fixedText_PressKeyForMoreLen = screen.stringWidth(fixedText_PressKeyForMore); + Common::String fixedText_PressKeyForMore = FIXED(PressKey_ForMore); screen.makeButton(Common::Rect(46, CONTROLS_Y, 272, CONTROLS_Y + 10), - (SHERLOCK_SCREEN_WIDTH - fixedText_PressKeyForMoreLen) / 2, - fixedText_PressKeyForMore); - screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - fixedText_PressKeyForMoreLen) / 2, CONTROLS_Y), - COMMAND_FOREGROUND, "%s", fixedText_PressKeyForMoreHotkey.c_str()); + SHERLOCK_SCREEN_WIDTH / 2, fixedText_PressKeyForMore); _descStr = msgP; } 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); + Common::String fixedText_PressKeyToContinue = FIXED(PressKey_ToContinue); screen.makeButton(Common::Rect(46, CONTROLS_Y, 272, CONTROLS_Y + 10), - (SHERLOCK_SCREEN_WIDTH - fixedText_PressKeyToContinueLen) / 2, - fixedText_PressKeyToContinue); - screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - fixedText_PressKeyToContinueLen) / 2, CONTROLS_Y), - COMMAND_FOREGROUND, "%s", fixedText_PressKeyToContinueHotkey.c_str()); + SHERLOCK_SCREEN_WIDTH / 2, fixedText_PressKeyToContinue); _descStr = ""; } diff --git a/engines/sherlock/scalpel/scalpel_user_interface.h b/engines/sherlock/scalpel/scalpel_user_interface.h index 8c2f3f9e3b..c0b8672a87 100644 --- a/engines/sherlock/scalpel/scalpel_user_interface.h +++ b/engines/sherlock/scalpel/scalpel_user_interface.h @@ -33,12 +33,26 @@ class Talk; namespace Scalpel { -extern const char COMMANDS[13]; -extern const char COMMANDS_3DO[13]; extern const int MENU_POINTS[12][4]; extern const int INVENTORY_POINTS[8][3]; -extern const char INVENTORY_COMMANDS[9]; + +enum { + MAINBUTTON_LOOK = 0, + MAINBUTTON_MOVE, + MAINBUTTON_TALK, + MAINBUTTON_PICKUP, + MAINBUTTON_OPEN, + MAINBUTTON_CLOSE, + MAINBUTTON_INVENTORY, + MAINBUTTON_USE, + MAINBUTTON_GIVE, + MAINBUTTON_JOURNAL, + MAINBUTTON_FILES, + MAINBUTTON_SETUP, + MAINBUTTON_LOADGAME, + MAINBUTTON_SAVEGAME +}; class Settings; @@ -50,7 +64,7 @@ private: int _lookHelp; int _help, _oldHelp; int _key, _oldKey; - int _temp, _oldTemp; + int _temp, _oldTemp; // button number (0-11) int _oldLook; bool _keyboardInput; bool _pause; @@ -75,7 +89,7 @@ private: * have already been drawn. This simply takes care of switching the mode around * accordingly */ - void toggleButton(int num); + void toggleButton(uint16 num); /** * Print the name of an object in the scene @@ -145,6 +159,24 @@ public: ImageFile *_controlPanel; ImageFile *_controls; int _oldUse; + + byte _hotkeyLook; + byte _hotkeyMove; + byte _hotkeyTalk; + byte _hotkeyPickUp; + byte _hotkeyOpen; + byte _hotkeyClose; + byte _hotkeyInventory; + byte _hotkeyUse; + byte _hotkeyGive; + byte _hotkeyJournal; // not used for 3DO + byte _hotkeyFiles; // not used for 3DO + byte _hotkeySetUp; // SetUp-button is in the spot of Journal for 3DO + byte _hotkeyLoadGame; // 3DO + byte _hotkeySaveGame; // 3DO + + byte _hotkeysIndexed[14]; + public: ScalpelUserInterface(SherlockEngine *vm); virtual ~ScalpelUserInterface(); diff --git a/engines/sherlock/scalpel/settings.cpp b/engines/sherlock/scalpel/settings.cpp index f6769a4b99..a061e40397 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,105 @@ void Settings::drawInteface(bool flag) { SHERLOCK_SCREEN_HEIGHT - 2), INV_BACKGROUND); } + tempStr = FIXED(Settings_Exit); + _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] - screen.stringWidth("Exit") / 2, "Exit"); + SETUP_POINTS[0][3], tempStr); - tempStr = Common::String::format("Music %s", SETUP_STRS0[music._musicOn]); + if (music._musicOn) { + tempStr = FIXED(Settings_MusicOn); + } else { + tempStr = FIXED(Settings_MusicOff); + } + _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] - screen.stringWidth(tempStr) / 2, tempStr); + SETUP_POINTS[1][3], tempStr); - 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 = 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); // WORKAROUND: We don't support the joystick in ScummVM, so draw the next two buttons as disabled - tempStr = "Joystick Off"; + tempStr = FIXED(Settings_JoystickOff); 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 = 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); + + if (sound._digitized) { + tempStr = FIXED(Settings_SoundEffectsOn); + } else { + tempStr = FIXED(Settings_SoundEffectsOff); + } + _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); + + if (ui._slideWindows) { + tempStr = FIXED(Settings_WindowsSlide); + } else { + tempStr = FIXED(Settings_WindowsAppear); + } + _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); + + tempStr = FIXED(Settings_CalibrateJoystick); 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 = 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); - 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 = 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); - 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 = 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); - tempStr = "Key Pad Slow"; + tempStr = FIXED(Settings_KeyPadSlow); 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 +193,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 +202,74 @@ 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; } + screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); } return found; @@ -222,7 +288,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 +324,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 == settings._hotkeyExit || ui._key == Common::KEYCODE_ESCAPE)) // Exit break; - if ((found == 1 && events._released) || ui._key == 'M') { + if ((found == 1 && events._released) || ui._key == settings._hotkeyMusic) { // Toggle music music._musicOn = !music._musicOn; if (!music._musicOn) @@ -271,30 +337,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 == 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 == 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 == 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 == settings._hotkeyNewFontStyle) { // New font style int fontNum = screen.fontNumber() + 1; if (fontNum == 3) @@ -302,28 +368,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 == 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 == 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 == 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 diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index b239fd9fb7..b543472513 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -401,7 +401,7 @@ void Talk::talkTo(const Common::String filename) { _talkHistory[_converseNum][select] = true; } - ui._key = ui._oldKey = Scalpel::COMMANDS[TALK_MODE - 1]; + ui._key = ui._oldKey = 'T'; // FIXME: I'm not sure what to do here, I need ScalpelUI->_hotkeyTalk ui._temp = ui._oldTemp = 0; ui._menuMode = TALK_MODE; _talkToFlag = 2; diff --git a/engines/sherlock/tattoo/widget_files.cpp b/engines/sherlock/tattoo/widget_files.cpp index ca5e1bff93..ff8cb83dca 100644 --- a/engines/sherlock/tattoo/widget_files.cpp +++ b/engines/sherlock/tattoo/widget_files.cpp @@ -386,7 +386,7 @@ bool WidgetFiles::getFilename() { done = -1; } - if ((keyState.ascii >= ' ') && ((keyState.ascii <= 168) || (keyState.ascii == 225)) && (index < 50)) { + if ((keyState.ascii >= ' ') && (keyState.ascii <= 'z') && (index < 50)) { if (pt.x + _surface.charWidth(keyState.ascii) < _surface.w() - BUTTON_SIZE - 20) { if (insert) filename.insertChar(keyState.ascii, index); diff --git a/engines/sherlock/tattoo/widget_foolscap.cpp b/engines/sherlock/tattoo/widget_foolscap.cpp index 8246e9a371..c8df71e873 100644 --- a/engines/sherlock/tattoo/widget_foolscap.cpp +++ b/engines/sherlock/tattoo/widget_foolscap.cpp @@ -184,8 +184,7 @@ void WidgetFoolscap::handleKeyboardEvents() { TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; Common::KeyState keyState = ui._keyState; - if (((toupper(keyState.ascii) >= 'A') && (toupper(keyState.ascii) <= 'Z')) || - ((keyState.ascii >= 128) && ((keyState.ascii <= 168) || (keyState.ascii == 225)))) { + if ((toupper(keyState.ascii) >= 'A') && (toupper(keyState.ascii) <= 'Z')) { // Visible key pressed, set it and set the keycode to move the caret to the right _answers[_lineNum][_charNum] = keyState.ascii; keyState.keycode = Common::KEYCODE_RIGHT; diff --git a/engines/sherlock/tattoo/widget_password.cpp b/engines/sherlock/tattoo/widget_password.cpp index 3dd0e308ff..57a5e02653 100644 --- a/engines/sherlock/tattoo/widget_password.cpp +++ b/engines/sherlock/tattoo/widget_password.cpp @@ -159,7 +159,7 @@ void WidgetPassword::handleEvents() { } else if (keycode == Common::KEYCODE_RETURN || keycode == Common::KEYCODE_ESCAPE) { close(); return; - } else if (((ui._keyState.ascii >= ' ' && ui._keyState.ascii < 169) || ui._keyState.ascii == 225)) { + } else if ((ui._keyState.ascii >= ' ') && (ui._keyState.ascii <= 'z')) { if (_cursorPos.x + _surface.charWidth(ui._keyState.ascii) < _bounds.width() - _surface.widestChar() - 3) { if (_insert) _password.insertChar(ui._keyState.ascii, _index); |