aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorYotam Barnoy2010-02-21 04:04:13 +0000
committerYotam Barnoy2010-02-21 04:04:13 +0000
commitef330ed9b4e5d6252134ed137b042593f79d02a9 (patch)
tree919c4ae91efca10102936a1833251b48323b8983 /engines
parentcebb052e2cfd963b95d7357b7c21dc8c437e058a (diff)
downloadscummvm-rg350-ef330ed9b4e5d6252134ed137b042593f79d02a9.tar.gz
scummvm-rg350-ef330ed9b4e5d6252134ed137b042593f79d02a9.tar.bz2
scummvm-rg350-ef330ed9b4e5d6252134ed137b042593f79d02a9.zip
Patch for bug 2943361 by littleboy, adding full kb modifier support to all engines + GUI and proper keypad handling
svn-id: r48101
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/agi.cpp2
-rw-r--r--engines/agi/preagi_troll.cpp2
-rw-r--r--engines/agos/event.cpp10
-rw-r--r--engines/cruise/cruise_main.cpp2
-rw-r--r--engines/draci/draci.cpp2
-rw-r--r--engines/gob/gob.cpp2
-rw-r--r--engines/gob/util.cpp2
-rw-r--r--engines/kyra/gui.cpp2
-rw-r--r--engines/kyra/kyra_v1.cpp8
-rw-r--r--engines/lure/fights.cpp2
-rw-r--r--engines/lure/game.cpp2
-rw-r--r--engines/m4/events.cpp2
-rw-r--r--engines/m4/mads_views.cpp2
-rw-r--r--engines/parallaction/input.cpp2
-rw-r--r--engines/queen/input.cpp6
-rw-r--r--engines/saga/input.cpp4
-rw-r--r--engines/saga/interface.cpp2
-rw-r--r--engines/sci/event.cpp43
-rw-r--r--engines/scumm/dialogs.cpp2
-rw-r--r--engines/scumm/input.cpp44
-rw-r--r--engines/sky/sky.cpp8
-rw-r--r--engines/sword2/sword2.cpp8
-rw-r--r--engines/teenagent/teenagent.cpp6
-rw-r--r--engines/tinsel/tinsel.cpp7
-rw-r--r--engines/touche/touche.cpp2
-rw-r--r--engines/tucker/tucker.cpp2
26 files changed, 71 insertions, 105 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index de2d9a8ab9..c66ccd4751 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -121,7 +121,7 @@ void AgiEngine::processEvents() {
_mouse.y = event.mouse.y;
break;
case Common::EVENT_KEYDOWN:
- if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == Common::KEYCODE_d) {
+ if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_d) {
_console->attach();
break;
}
diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp
index 619c0c0cc6..96a3147e5a 100644
--- a/engines/agi/preagi_troll.cpp
+++ b/engines/agi/preagi_troll.cpp
@@ -104,7 +104,7 @@ bool Troll::getMenuSel(const char *szMenu, int *iSel, int nSel) {
case Common::KEYCODE_KP_ENTER:
return true;
case Common::KEYCODE_s:
- if (event.kbd.flags == Common::KBD_CTRL) {
+ if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (_soundOn) {
playTune(2, 1);
_soundOn = !_soundOn;
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index 360fa4bf8c..f22a2e69e9 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -459,8 +459,8 @@ void AGOSEngine::delay(uint amount) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode >= Common::KEYCODE_0 && event.kbd.keycode <= Common::KEYCODE_9
- && (event.kbd.flags == Common::KBD_ALT ||
- event.kbd.flags == Common::KBD_CTRL)) {
+ && (event.kbd.hasFlags(Common::KBD_ALT) ||
+ event.kbd.hasFlags(Common::KBD_CTRL))) {
_saveLoadSlot = event.kbd.keycode - Common::KEYCODE_0;
// There is no save slot 0
@@ -469,13 +469,13 @@ void AGOSEngine::delay(uint amount) {
memset(_saveLoadName, 0, sizeof(_saveLoadName));
sprintf(_saveLoadName, "Quick %d", _saveLoadSlot);
- _saveLoadType = (event.kbd.flags == Common::KBD_ALT) ? 1 : 2;
+ _saveLoadType = (event.kbd.hasFlags(Common::KBD_ALT)) ? 1 : 2;
// We should only allow a load or save when it was possible in original
// This stops load/save during copy protection, conversations and cut scenes
if (!_mouseHideCount && !_showPreposition)
quickLoadOrSave();
- } else if (event.kbd.flags == Common::KBD_CTRL) {
+ } else if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (event.kbd.keycode == Common::KEYCODE_a) {
GUI::Dialog *_aboutDialog;
_aboutDialog = new GUI::AboutDialog();
@@ -492,7 +492,7 @@ void AGOSEngine::delay(uint amount) {
}
if (getGameType() == GType_PP) {
- if (event.kbd.flags == Common::KBD_SHIFT)
+ if (event.kbd.hasFlags(Common::KBD_SHIFT))
_variableArray[41] = 0;
else
_variableArray[41] = 1;
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index 92d484e241..14de916a84 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -1759,7 +1759,7 @@ bool manageEvents() {
break;
}
- if (event.kbd.flags == Common::KBD_CTRL) {
+ if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (event.kbd.keycode == Common::KEYCODE_d) {
// Start the debugger
_vm->getDebugger()->attach();
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp
index 31b2c28679..882b845f08 100644
--- a/engines/draci/draci.cpp
+++ b/engines/draci/draci.cpp
@@ -293,7 +293,7 @@ void DraciEngine::handleEvents() {
}
break;
case Common::KEYCODE_F5:
- if (event.kbd.flags == 0) {
+ if (event.kbd.hasFlags(0)) {
openMainMenuDialog();
}
break;
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index cf2f090351..e0d7a740eb 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -109,7 +109,7 @@ void PauseDialog::reflowLayout() {
void PauseDialog::handleKeyDown(Common::KeyState state) {
// Close on CTRL+p
- if ((state.flags == Common::KBD_CTRL) && (state.keycode == Common::KEYCODE_p))
+ if ((state.hasFlags(Common::KBD_CTRL)) && (state.keycode == Common::KEYCODE_p))
close();
}
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index 2e15948080..26899232e2 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -114,7 +114,7 @@ void Util::processInput(bool scroll) {
_mouseButtons = (MouseButtons) (((uint32) _mouseButtons) & ~((uint32) kMouseButtonsRight));
break;
case Common::EVENT_KEYDOWN:
- if (event.kbd.flags == Common::KBD_CTRL) {
+ if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (event.kbd.keycode == Common::KEYCODE_f)
_fastMode ^= 1;
else if (event.kbd.keycode == Common::KEYCODE_g)
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index d976c3463d..ac14a408a9 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -421,7 +421,7 @@ void GUI::checkTextfieldInput() {
while (_vm->_eventMan->pollEvent(event) && running) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode == Common::KEYCODE_q && event.kbd.flags == Common::KBD_CTRL)
+ if (event.kbd.keycode == Common::KEYCODE_q && event.kbd.hasFlags(Common::KBD_CTRL))
_vm->quitGame();
else
_keyPressed = event.kbd;
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index eebb493e38..b9894af98f 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -262,10 +262,10 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag)
switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode >= Common::KEYCODE_1 && event.kbd.keycode <= Common::KEYCODE_9 &&
- (event.kbd.flags == Common::KBD_CTRL || event.kbd.flags == Common::KBD_ALT) && mainLoop) {
+ (event.kbd.hasFlags(Common::KBD_CTRL) || event.kbd.hasFlags(Common::KBD_ALT)) && mainLoop) {
int saveLoadSlot = 9 - (event.kbd.keycode - Common::KEYCODE_0) + 990;
- if (event.kbd.flags == Common::KBD_CTRL) {
+ if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (saveFileLoadable(saveLoadSlot))
loadGameStateCheck(saveLoadSlot);
_eventList.clear();
@@ -275,7 +275,7 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag)
sprintf(savegameName, "Quicksave %d", event.kbd.keycode - Common::KEYCODE_0);
saveGameState(saveLoadSlot, savegameName, 0);
}
- } else if (event.kbd.flags == Common::KBD_CTRL) {
+ } else if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (event.kbd.keycode == Common::KEYCODE_d) {
if (_debugger)
_debugger->attach();
@@ -385,7 +385,7 @@ void KyraEngine_v1::updateInput() {
event.kbd.keycode == Common::KEYCODE_UP || event.kbd.keycode == Common::KEYCODE_RIGHT ||
event.kbd.keycode == Common::KEYCODE_DOWN || event.kbd.keycode == Common::KEYCODE_LEFT)
_eventList.push_back(Event(event, true));
- else if (event.kbd.keycode == Common::KEYCODE_q && event.kbd.flags == Common::KBD_CTRL)
+ else if (event.kbd.keycode == Common::KEYCODE_q && event.kbd.hasFlags(Common::KBD_CTRL))
quitGame();
else
_eventList.push_back(event);
diff --git a/engines/lure/fights.cpp b/engines/lure/fights.cpp
index 81dfac03c8..53539677c8 100644
--- a/engines/lure/fights.cpp
+++ b/engines/lure/fights.cpp
@@ -205,7 +205,7 @@ void FightsManager::checkEvents() {
return;
case Common::KEYCODE_d:
- if (events.event().kbd.flags == Common::KBD_CTRL) {
+ if (events.event().kbd.hasFlags(Common::KBD_CTRL)) {
// Activate the debugger
game.debugger().attach();
return;
diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp
index 36d423251b..49a100346e 100644
--- a/engines/lure/game.cpp
+++ b/engines/lure/game.cpp
@@ -195,7 +195,7 @@ void Game::execute() {
if (events.type() == Common::EVENT_KEYDOWN) {
uint16 roomNum = room.roomNumber();
- if ((events.event().kbd.flags == Common::KBD_CTRL) &&
+ if ((events.event().kbd.hasFlags(Common::KBD_CTRL)) &&
(events.event().kbd.keycode == Common::KEYCODE_d)) {
// Activate the debugger
_debugger->attach();
diff --git a/engines/m4/events.cpp b/engines/m4/events.cpp
index b0c5e8f85d..0acf0cd6e4 100644
--- a/engines/m4/events.cpp
+++ b/engines/m4/events.cpp
@@ -73,7 +73,7 @@ M4EventType Events::handleEvents() {
if ((_event.kbd.keycode == Common::KEYCODE_LCTRL) || (_event.kbd.keycode == Common::KEYCODE_RCTRL))
_ctrlFlag = true;
- else if (_event.kbd.flags == Common::KBD_CTRL) {
+ else if (_event.kbd.hasFlags(Common::KBD_CTRL)) {
if ((_event.kbd.keycode == Common::KEYCODE_d) && _ctrlFlag) {
_console->attach();
_console->onFrame();
diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp
index d4d3bc53cb..c06a8de513 100644
--- a/engines/m4/mads_views.cpp
+++ b/engines/m4/mads_views.cpp
@@ -362,7 +362,7 @@ bool MadsInterfaceView::handleKeypress(int32 keycode) {
// Capitalise the letter if necessary
if (_cheatKeyCtr < CHEAT_SEQUENCE_MAX) {
- if ((flags == Common::KBD_CTRL) && (kc == CHEAT_SEQUENCE[_cheatKeyCtr])) {
+ if ((flags & Common::KBD_CTRL) && (kc == CHEAT_SEQUENCE[_cheatKeyCtr])) {
++_cheatKeyCtr;
if (_cheatKeyCtr == CHEAT_SEQUENCE_MAX)
Dialog::display(_vm, 22, cheatingEnabledDesc);
diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index d1e2765539..42f60995ff 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -111,7 +111,7 @@ void Input::readInput() {
_hasKeyPressEvent = true;
_keyPressed = e.kbd;
- if (e.kbd.flags == Common::KBD_CTRL && e.kbd.keycode == 'd')
+ if (e.kbd.hasFlags(Common::KBD_CTRL) && e.kbd.keycode == Common::KEYCODE_d)
_vm->_debugger->attach();
updateMousePos = false;
diff --git a/engines/queen/input.cpp b/engines/queen/input.cpp
index 84e21fbcaa..473253786c 100644
--- a/engines/queen/input.cpp
+++ b/engines/queen/input.cpp
@@ -100,10 +100,10 @@ void Input::delay(uint amount) {
_idleTime = 0;
switch (event.type) {
case Common::EVENT_KEYDOWN:
- if (event.kbd.flags == Common::KBD_CTRL) {
- if (event.kbd.keycode == 'd') {
+ if (event.kbd.hasFlags(Common::KBD_CTRL)) {
+ if (event.kbd.keycode == Common::KEYCODE_d) {
_debugger = true;
- } else if (event.kbd.keycode == 'f') {
+ } else if (event.kbd.keycode == Common::KEYCODE_f) {
_fastMode = !_fastMode;
}
} else {
diff --git a/engines/saga/input.cpp b/engines/saga/input.cpp
index 7bce00686c..e3a3b49396 100644
--- a/engines/saga/input.cpp
+++ b/engines/saga/input.cpp
@@ -44,7 +44,7 @@ int SagaEngine::processInput() {
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
- if (event.kbd.flags == Common::KBD_CTRL) {
+ if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (event.kbd.keycode == Common::KEYCODE_d)
_console->attach();
}
@@ -56,7 +56,7 @@ int SagaEngine::processInput() {
switch (event.kbd.keycode) {
case Common::KEYCODE_HASH:
case Common::KEYCODE_BACKQUOTE:
- case Common::KEYCODE_QUOTE: // tilde ("~")
+ case Common::KEYCODE_TILDE: // tilde ("~")
_console->attach();
break;
case Common::KEYCODE_r:
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index 42336912d5..eb132e3831 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -651,7 +651,7 @@ bool Interface::processAscii(Common::KeyState keystate) {
return true;
}
}
- if (keystate.keycode == Common::KEYCODE_o && keystate.flags == Common::KBD_CTRL) { // ctrl-o
+ if (keystate.keycode == Common::KEYCODE_o && keystate.hasFlags(Common::KBD_CTRL)) { // ctrl-o
if (_saveReminderState > 0) {
setMode(kPanelOption);
return true;
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index 4f6201824e..dfc9c3c4f1 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -120,50 +120,15 @@ sciEvent SciEvent::getFromScummVM() {
int modifiers = em->getModifierState();
// We add the modifier key status to buckybits
- // SDL sends a keydown event if a modifier key is turned on and a keyup event if it's off
- //
- // FIXME: This code is semi-bogus. It only records the modifier key being *pressed*.
- // It does not track correctly whether capslock etc. is active. To do that, we
- // would have to record the fact that the modifier was pressed in global var,
- // and also watch for Common::EVENT_KEYUP events.
- // But this is still not quite good enough, because not all events might
- // pass through here (e.g. the GUI might be running with its own event loop).
- //
- // The best solution likely would be to add code to the EventManager class
- // for tracking which keys are pressed and which are not...
- if (ev.type == Common::EVENT_KEYDOWN || ev.type == Common::EVENT_KEYUP) {
- switch (ev.kbd.keycode) {
- case Common::KEYCODE_CAPSLOCK:
- if (ev.type == Common::EVENT_KEYDOWN) {
- _modifierStates |= SCI_KEYMOD_CAPSLOCK;
- } else {
- _modifierStates &= ~SCI_KEYMOD_CAPSLOCK;
- }
- break;
- case Common::KEYCODE_NUMLOCK:
- if (ev.type == Common::EVENT_KEYDOWN) {
- _modifierStates |= SCI_KEYMOD_NUMLOCK;
- } else {
- _modifierStates &= ~SCI_KEYMOD_NUMLOCK;
- }
- break;
- case Common::KEYCODE_SCROLLOCK:
- if (ev.type == Common::EVENT_KEYDOWN) {
- _modifierStates |= SCI_KEYMOD_SCRLOCK;
- } else {
- _modifierStates &= ~SCI_KEYMOD_SCRLOCK;
- }
- break;
- default:
- break;
- }
- }
//TODO: SCI_EVM_INSERT
input.modifiers =
((modifiers & Common::KBD_ALT) ? SCI_KEYMOD_ALT : 0) |
((modifiers & Common::KBD_CTRL) ? SCI_KEYMOD_CTRL : 0) |
((modifiers & Common::KBD_SHIFT) ? SCI_KEYMOD_LSHIFT | SCI_KEYMOD_RSHIFT : 0) |
+ ((ev.kbd.flags & Common::KBD_NUM) ? SCI_KEYMOD_NUMLOCK : 0) |
+ ((ev.kbd.flags & Common::KBD_CAPS) ? SCI_KEYMOD_CAPSLOCK : 0) |
+ ((ev.kbd.flags & Common::KBD_SCRL) ? SCI_KEYMOD_SCRLOCK : 0) |
_modifierStates;
switch (ev.type) {
@@ -173,7 +138,7 @@ sciEvent SciEvent::getFromScummVM() {
input.character = ev.kbd.ascii;
// Debug console
- if (ev.kbd.flags == Common::KBD_CTRL && ev.kbd.keycode == Common::KEYCODE_d) {
+ if (ev.kbd.hasFlags(Common::KBD_CTRL) && ev.kbd.keycode == Common::KEYCODE_d) {
// Open debug console
Console *con = g_sci->getSciDebugger();
con->attach();
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 3c329915f6..dd4569ca76 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -725,7 +725,7 @@ void SubtitleSettingsDialog::handleTickle() {
}
void SubtitleSettingsDialog::handleKeyDown(Common::KeyState state) {
- if (state.keycode == 't' && state.flags == Common::KBD_CTRL) {
+ if (state.keycode == Common::KEYCODE_t && state.hasFlags(Common::KBD_CTRL)) {
cycleValue();
reflowLayout();
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index 5e3f9fefeb..8a9570f534 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -110,26 +110,26 @@ void ScummEngine_v80he::parseEvent(Common::Event event) {
void ScummEngine::parseEvent(Common::Event event) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9' &&
- ((event.kbd.flags == Common::KBD_ALT && canSaveGameStateCurrently()) ||
- (event.kbd.flags == Common::KBD_CTRL && canLoadGameStateCurrently()))) {
- _saveLoadSlot = event.kbd.keycode - '0';
+ if (event.kbd.keycode >= Common::KEYCODE_0 && event.kbd.keycode <= Common::KEYCODE_9 &&
+ ((event.kbd.hasFlags(Common::KBD_ALT) && canSaveGameStateCurrently()) ||
+ (event.kbd.hasFlags(Common::KBD_CTRL) && canLoadGameStateCurrently()))) {
+ _saveLoadSlot = event.kbd.keycode - Common::KEYCODE_0;
// don't overwrite autosave (slot 0)
if (_saveLoadSlot == 0)
_saveLoadSlot = 10;
sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
- _saveLoadFlag = (event.kbd.flags == Common::KBD_ALT) ? 1 : 2;
+ _saveLoadFlag = (event.kbd.hasFlags(Common::KBD_ALT)) ? 1 : 2;
_saveTemporaryState = false;
- } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'f') {
+ } else if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_f) {
_fastMode ^= 1;
- } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'g') {
+ } else if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_g) {
_fastMode ^= 2;
- } else if ((event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'd') ||
- event.kbd.ascii == '~' || event.kbd.ascii == '#') {
+ } else if ((event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_d)
+ || event.kbd.ascii == '~' || event.kbd.ascii == '#') {
_debugger->attach();
- } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 's') {
+ } else if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_s) {
_res->resourceStats();
} else {
// Normal key press, pass on to the game.
@@ -355,12 +355,12 @@ void ScummEngine::processInput() {
#ifdef ENABLE_SCUMM_7_8
void ScummEngine_v8::processKeyboard(Common::KeyState lastKeyHit) {
// F1 (the trigger for the original save/load dialog) is mapped to F5
- if (!(_game.features & GF_DEMO) && lastKeyHit.keycode == Common::KEYCODE_F1 && lastKeyHit.flags == 0) {
+ if (!(_game.features & GF_DEMO) && lastKeyHit.keycode == Common::KEYCODE_F1 && lastKeyHit.hasFlags(0)) {
lastKeyHit = Common::KeyState(Common::KEYCODE_F5, 319);
}
// Alt-F5 should bring up the original save/load dialog, so map it to F1.
- if (!(_game.features & GF_DEMO) && lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.flags == Common::KBD_ALT) {
+ if (!(_game.features & GF_DEMO) && lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.hasFlags(Common::KBD_ALT)) {
lastKeyHit = Common::KeyState(Common::KEYCODE_F1, 315);
}
@@ -383,7 +383,7 @@ void ScummEngine_v7::processKeyboard(Common::KeyState lastKeyHit) {
// version string is hard coded in the engine, hence we don't invoke
// versionDialog for it. Dig/FT version strings are partly hard coded, too.
if (_game.id != GID_CMI && 0 != VAR(VAR_VERSION_KEY) &&
- lastKeyHit.keycode == Common::KEYCODE_v && lastKeyHit.flags == Common::KBD_CTRL) {
+ lastKeyHit.keycode == Common::KEYCODE_v && lastKeyHit.hasFlags(Common::KBD_CTRL)) {
versionDialog();
} else if (cutsceneExitKeyEnabled && lastKeyHit.keycode == Common::KEYCODE_ESCAPE) {
@@ -408,7 +408,7 @@ void ScummEngine_v7::processKeyboard(Common::KeyState lastKeyHit) {
#endif
void ScummEngine_v6::processKeyboard(Common::KeyState lastKeyHit) {
- if (lastKeyHit.keycode == Common::KEYCODE_t && lastKeyHit.flags == Common::KBD_CTRL) {
+ if (lastKeyHit.keycode == Common::KEYCODE_t && lastKeyHit.hasFlags(Common::KBD_CTRL)) {
SubtitleSettingsDialog dialog(this, _voiceMode);
_voiceMode = runDialog(dialog);
@@ -442,7 +442,7 @@ void ScummEngine_v2::processKeyboard(Common::KeyState lastKeyHit) {
ScummEngine::processKeyboard(lastKeyHit);
// On Alt-F5 prepare savegame for the original save/load dialog.
- if (lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.flags == Common::KBD_ALT) {
+ if (lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.hasFlags(Common::KBD_ALT)) {
prepareSavegame();
if (_game.id == GID_MANIAC && _game.version == 0) {
runScript(2, 0, 0, 0);
@@ -467,7 +467,7 @@ void ScummEngine_v3::processKeyboard(Common::KeyState lastKeyHit) {
ScummEngine::processKeyboard(lastKeyHit);
// On Alt-F5 prepare savegame for the original save/load dialog.
- if (lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.flags == Common::KBD_ALT) {
+ if (lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.hasFlags(Common::KBD_ALT)) {
prepareSavegame();
}
@@ -504,7 +504,7 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) {
if (_game.id == GID_CMI)
mainmenuKeyEnabled = true;
- if (mainmenuKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.flags == 0)) {
+ if (mainmenuKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.hasFlags(0))) {
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0);
@@ -513,25 +513,25 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) {
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
runScript(VAR(VAR_SAVELOAD_SCRIPT2), 0, 0, 0);
- } else if (restartKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_F8 && lastKeyHit.flags == 0)) {
+ } else if (restartKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_F8 && lastKeyHit.hasFlags(0))) {
confirmRestartDialog();
- } else if (pauseKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_SPACE && lastKeyHit.flags == 0)) {
+ } else if (pauseKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_SPACE && lastKeyHit.hasFlags(0))) {
pauseGame();
- } else if (talkstopKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_PERIOD && lastKeyHit.flags == 0)) {
+ } else if (talkstopKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_PERIOD && lastKeyHit.hasFlags(0))) {
_talkDelay = 0;
if (_sound->_sfxMode & 2)
stopTalk();
- } else if (cutsceneExitKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_ESCAPE && lastKeyHit.flags == 0)) {
+ } else if (cutsceneExitKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_ESCAPE && lastKeyHit.hasFlags(0))) {
abortCutscene();
// VAR_CUTSCENEEXIT_KEY doesn't exist in SCUMM0
if (VAR_CUTSCENEEXIT_KEY != 0xFF)
_mouseAndKeyboardStat = VAR(VAR_CUTSCENEEXIT_KEY);
} else if (snapScrollKeyEnabled && lastKeyHit.keycode == Common::KEYCODE_r &&
- lastKeyHit.flags == Common::KBD_CTRL) {
+ lastKeyHit.hasFlags(Common::KBD_CTRL)) {
_snapScroll ^= 1;
if (_snapScroll) {
messageDialog("Snap scroll on");
diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp
index 7fd13661ad..c099dbc8b1 100644
--- a/engines/sky/sky.cpp
+++ b/engines/sky/sky.cpp
@@ -113,12 +113,12 @@ void SkyEngine::handleKey() {
_skySound->fnUnPauseFx();
_systemVars.paused = false;
_skyScreen->setPaletteEndian((uint8 *)_skyCompact->fetchCpt(SkyEngine::_systemVars.currentPalette));
- } else if (_keyPressed.flags == Common::KBD_CTRL) {
- if (_keyPressed.keycode == 'f')
+ } else if (_keyPressed.hasFlags(Common::KBD_CTRL)) {
+ if (_keyPressed.keycode == Common::KEYCODE_f)
_fastMode ^= 1;
- else if (_keyPressed.keycode == 'g')
+ else if (_keyPressed.keycode == Common::KEYCODE_g)
_fastMode ^= 2;
- else if (_keyPressed.keycode == 'd')
+ else if (_keyPressed.keycode == Common::KEYCODE_d)
_debugger->attach();
} else if (_keyPressed.keycode) {
switch (_keyPressed.keycode) {
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index cf9e67e178..822946f42d 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -491,9 +491,9 @@ Common::Error Sword2Engine::run() {
KeyboardEvent *ke = keyboardEvent();
if (ke) {
- if ((ke->kbd.flags == Common::KBD_CTRL && ke->kbd.keycode == Common::KEYCODE_d) || ke->kbd.ascii == '#' || ke->kbd.ascii == '~') {
+ if ((ke->kbd.hasFlags(Common::KBD_CTRL) && ke->kbd.keycode == Common::KEYCODE_d) || ke->kbd.ascii == '#' || ke->kbd.ascii == '~') {
_debugger->attach();
- } else if (ke->kbd.flags == 0 || ke->kbd.flags == Common::KBD_SHIFT) {
+ } else if (ke->kbd.hasFlags(0) || ke->kbd.hasFlags(Common::KBD_SHIFT)) {
switch (ke->kbd.keycode) {
case Common::KEYCODE_p:
if (_gamePaused)
@@ -654,8 +654,8 @@ void Sword2Engine::parseInputEvents() {
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
- if (event.kbd.flags == Common::KBD_CTRL) {
- if (event.kbd.keycode == 'f') {
+ if (event.kbd.hasFlags(Common::KBD_CTRL)) {
+ if (event.kbd.keycode == Common::KEYCODE_f) {
if (_gameSpeed == 1)
_gameSpeed = 2;
else
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index 42478cfa12..5e3d960a28 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -474,12 +474,12 @@ Common::Error TeenAgentEngine::run() {
//debug(0, "event");
switch (event.type) {
case Common::EVENT_KEYDOWN:
- if ((event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'd') ||
+ if ((event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_d) ||
event.kbd.ascii == '~' || event.kbd.ascii == '#') {
console->attach();
- } else if (event.kbd.flags == 0 && event.kbd.keycode == Common::KEYCODE_F5) {
+ } else if (event.kbd.hasFlags(0) && event.kbd.keycode == Common::KEYCODE_F5) {
openMainMenuDialog();
- } if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'f') {
+ } if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_f) {
_mark_delay = _mark_delay == 80? 40: 80;
debug(0, "mark_delay = %u", _mark_delay);
}
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index ba667cf224..f3e52c929d 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -230,11 +230,11 @@ void KeyboardProcess(CORO_PARAM, const void *) {
continue;
case Common::KEYCODE_m:
// Debug facility - scene hopper
- if (TinselV2 && (evt.kbd.flags == Common::KBD_ALT))
+ if (TinselV2 && (evt.kbd.hasFlags(Common::KBD_ALT)))
ProcessKeyEvent(PLR_JUMP);
break;
case Common::KEYCODE_q:
- if ((evt.kbd.flags == Common::KBD_CTRL) || (evt.kbd.flags == Common::KBD_ALT))
+ if ((evt.kbd.hasFlags(Common::KBD_CTRL)) || (evt.kbd.hasFlags(Common::KBD_ALT)))
ProcessKeyEvent(PLR_QUIT);
continue;
case Common::KEYCODE_PAGEUP:
@@ -1201,7 +1201,8 @@ void TinselEngine::ProcessKeyEvent(const Common::Event &event) {
// Handle any special keys immediately
switch (event.kbd.keycode) {
case Common::KEYCODE_d:
- if ((event.kbd.flags == Common::KBD_CTRL) && (event.type == Common::EVENT_KEYDOWN)) {
+ // Checks for CTRL flag, ignoring all the sticky flags
+ if ((Common::KBD_CTRL == (event.kbd.flags & ~(Common::KBD_NUM|Common::KBD_CAPS|Common::KBD_SCRL))) && (event.type == Common::EVENT_KEYDOWN)) {
// Activate the debugger
assert(_console);
_console->attach();
diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp
index 25874f869e..3289afe00f 100644
--- a/engines/touche/touche.cpp
+++ b/engines/touche/touche.cpp
@@ -313,7 +313,7 @@ void ToucheEngine::processEvents(bool handleKeyEvents) {
} else if (event.kbd.keycode == Common::KEYCODE_F10) {
_fastWalkMode = false;
}
- if (event.kbd.flags == Common::KBD_CTRL) {
+ if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (event.kbd.keycode == Common::KEYCODE_f) {
_fastMode = !_fastMode;
}
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index 5cfa99def7..f704dcb195 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -607,7 +607,7 @@ void TuckerEngine::parseEvents() {
case Common::EVENT_KEYDOWN:
switch (ev.kbd.keycode) {
case Common::KEYCODE_f:
- if (ev.kbd.flags == Common::KBD_CTRL) {
+ if (ev.kbd.hasFlags(Common::KBD_CTRL)) {
_fastMode = !_fastMode;
}
break;