aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/scalpel/scalpel_user_interface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sherlock/scalpel/scalpel_user_interface.cpp')
-rw-r--r--engines/sherlock/scalpel/scalpel_user_interface.cpp336
1 files changed, 198 insertions, 138 deletions
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 = "";
}