aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.cpp10
-rw-r--r--engines/agos/agos.h3
-rw-r--r--engines/agos/event.cpp5
-rw-r--r--engines/agos/input.cpp60
-rw-r--r--engines/agos/oracle.cpp18
-rw-r--r--engines/agos/saveload.cpp18
-rw-r--r--engines/agos/script_s1.cpp24
7 files changed, 68 insertions, 70 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index c98257f028..2965d7d735 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -110,8 +110,6 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_debugger = 0;
- _keyPressed = 0;
-
_gameFile = 0;
_opcode = 0;
@@ -958,8 +956,8 @@ GUI::Debugger *AGOSEngine::getDebugger() {
}
void AGOSEngine::pause() {
- _keyPressed = 1;
- _pause = 1;
+ _keyPressed.reset();
+ _pause = true;
bool ambient_status = _ambientPaused;
bool music_status = _musicPaused;
@@ -969,8 +967,8 @@ void AGOSEngine::pause() {
while (_pause) {
delay(1);
- if (_keyPressed == 'p')
- _pause = 0;
+ if (_keyPressed.keycode == Common::KEYCODE_p)
+ _pause = false;
}
_midi.pause(music_status);
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 7e89396fa3..8841057925 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -28,6 +28,7 @@
#include "engines/engine.h"
+#include "common/keyboard.h"
#include "common/rect.h"
#include "common/util.h"
@@ -216,7 +217,7 @@ protected:
const GameSpecificSettings *gss;
- byte _keyPressed;
+ Common::KeyState _keyPressed;
Common::File *_gameFile;
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index 32329f34d9..5c673de700 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -500,10 +500,7 @@ void AGOSEngine::delay(uint amount) {
}
// Make sure backspace works right (this fixes a small issue on OS X)
- if (event.kbd.keycode == Common::KEYCODE_BACKSPACE)
- _keyPressed = 8;
- else
- _keyPressed = (byte)event.kbd.ascii;
+ _keyPressed = event.kbd;
break;
case Common::EVENT_MOUSEMOVE:
break;
diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp
index ef0791dc10..07b39c0ffe 100644
--- a/engines/agos/input.cpp
+++ b/engines/agos/input.cpp
@@ -195,7 +195,8 @@ void AGOSEngine::waitForInput() {
_dragAccept = 1;
for (;;) {
- if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && _keyPressed == 35)
+ if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
+ _keyPressed.keycode == Common::KEYCODE_HASH)
displayBoxStars();
if (processSpecialKeys()) {
if ((getGameType() == GType_PP && getGameId() != GID_DIMP) ||
@@ -238,7 +239,6 @@ void AGOSEngine::waitForInput() {
_dragMode = 0;
_dragCount = 0;
_dragEnd = 0;
- continue;
}
} while (!_dragEnd);
@@ -472,39 +472,39 @@ bool AGOSEngine::processSpecialKeys() {
}
}
- switch (_keyPressed) {
- case 17: // Up
+ switch (_keyPressed.keycode) {
+ case Common::KEYCODE_UP:
if (getGameType() == GType_PP)
_verbHitArea = 302;
else if (getGameType() == GType_WW)
_verbHitArea = 239;
verbCode = true;
break;
- case 18: // Down
+ case Common::KEYCODE_DOWN:
if (getGameType() == GType_PP)
_verbHitArea = 304;
else if (getGameType() == GType_WW)
_verbHitArea = 241;
verbCode = true;
break;
- case 19: // Right
+ case Common::KEYCODE_RIGHT:
if (getGameType() == GType_PP)
_verbHitArea = 303;
else if (getGameType() == GType_WW)
_verbHitArea = 240;
verbCode = true;
break;
- case 20: // Left
+ case Common::KEYCODE_LEFT:
if (getGameType() == GType_PP)
_verbHitArea = 301;
else if (getGameType() == GType_WW)
_verbHitArea = 242;
verbCode = true;
break;
- case 27: // escape
+ case Common::KEYCODE_ESCAPE:
_exitCutscene = true;
break;
- case 59: // F1
+ case Common::KEYCODE_F1:
if (getGameType() == GType_SIMON2) {
vcWriteVar(5, 50);
vcWriteVar(86, 0);
@@ -513,7 +513,7 @@ bool AGOSEngine::processSpecialKeys() {
vcWriteVar(86, 0);
}
break;
- case 60: // F2
+ case Common::KEYCODE_F2:
if (getGameType() == GType_SIMON2) {
vcWriteVar(5, 75);
vcWriteVar(86, 1);
@@ -522,7 +522,7 @@ bool AGOSEngine::processSpecialKeys() {
vcWriteVar(86, 1);
}
break;
- case 61: // F3
+ case Common::KEYCODE_F3:
if (getGameType() == GType_SIMON2) {
vcWriteVar(5, 125);
vcWriteVar(86, 2);
@@ -531,19 +531,19 @@ bool AGOSEngine::processSpecialKeys() {
vcWriteVar(86, 2);
}
break;
- case 63: // F5
+ case Common::KEYCODE_F5:
if (getGameType() == GType_SIMON2 || getGameType() == GType_FF)
_exitCutscene = true;
break;
- case 65: // F7
+ case Common::KEYCODE_F7:
if (getGameType() == GType_FF && getBitFlag(76))
_variableArray[254] = 70;
break;
- case 67: // F9
+ case Common::KEYCODE_F9:
if (getGameType() == GType_FF)
setBitFlag(73, !getBitFlag(73));
break;
- case 37: // F12
+ case Common::KEYCODE_F12:
if (getGameType() == GType_PP && getGameId() != GID_DIMP) {
if (!getBitFlag(110)) {
setBitFlag(107, !getBitFlag(107));
@@ -551,73 +551,75 @@ bool AGOSEngine::processSpecialKeys() {
}
}
break;
- case 'p':
+ case Common::KEYCODE_p:
pause();
break;
- case 't':
+ case Common::KEYCODE_t:
if (getGameType() == GType_FF || (getGameType() == GType_SIMON2 && (getFeatures() & GF_TALKIE)) ||
((getFeatures() & GF_TALKIE) && _language != Common::EN_ANY && _language != Common::DE_DEU)) {
if (_speech)
_subtitles ^= 1;
}
break;
- case 'v':
+ case Common::KEYCODE_v:
if (getGameType() == GType_FF || (getGameType() == GType_SIMON2 && (getFeatures() & GF_TALKIE))) {
if (_subtitles)
_speech ^= 1;
}
- case '+':
+ case Common::KEYCODE_PLUS:
if (_midiEnabled) {
_midi.setVolume(_midi.getVolume() + 16);
}
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) + 16);
break;
- case '-':
+ case Common::KEYCODE_MINUS:
if (_midiEnabled) {
_midi.setVolume(_midi.getVolume() - 16);
}
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) - 16);
break;
- case 'm':
+ case Common::KEYCODE_m:
_musicPaused ^= 1;
if (_midiEnabled) {
_midi.pause(_musicPaused);
}
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, (_musicPaused) ? 0 : ConfMan.getInt("music_volume"));
break;
- case 's':
+ case Common::KEYCODE_s:
if (getGameId() == GID_SIMON1DOS) {
_midi._enable_sfx ^= 1;
} else {
_sound->effectsPause(_effectsPaused ^= 1);
}
break;
- case 'b':
+ case Common::KEYCODE_b:
_sound->ambientPause(_ambientPaused ^= 1);
break;
- case 'r':
+ case Common::KEYCODE_r:
if (_debugMode)
_startMainScript ^= 1;
break;
- case 'o':
+ case Common::KEYCODE_o:
if (_debugMode)
_continousMainScript ^= 1;
break;
- case 'a':
+ case Common::KEYCODE_a:
if (_debugMode)
_startVgaScript ^= 1;
break;
- case 'g':
+ case Common::KEYCODE_g:
if (_debugMode)
_continousVgaScript ^= 1;
break;
- case 'd':
+ case Common::KEYCODE_d:
if (_debugMode)
_dumpImages ^=1;
break;
+ default:
+ break;
}
- _keyPressed = 0;
+ _keyPressed.reset();
return verbCode;
}
diff --git a/engines/agos/oracle.cpp b/engines/agos/oracle.cpp
index 787596a966..c7ad0ee8b7 100644
--- a/engines/agos/oracle.cpp
+++ b/engines/agos/oracle.cpp
@@ -464,37 +464,37 @@ void AGOSEngine_Feeble::saveUserGame(int slot) {
windowPutChar(window, 0x7f);
for (;;) {
- _keyPressed = 0;
+ _keyPressed.reset();
delay(1);
- if (_keyPressed == 0 || _keyPressed >= 127)
+ if (_keyPressed.ascii == 0 || _keyPressed.ascii >= 127)
continue;
window->textColumn -= getFeebleFontSize(127);
name[len] = 0;
windowBackSpace(_windowArray[3]);
- if (_keyPressed == 27) {
- _variableArray[55] = _keyPressed;
+ if (_keyPressed.keycode == Common::KEYCODE_ESCAPE) {
+ _variableArray[55] = 27;
break;
}
- if (_keyPressed == 10 || _keyPressed == 13) {
+ if (_keyPressed.keycode == Common::KEYCODE_KP_ENTER || _keyPressed.keycode == Common::KEYCODE_RETURN) {
if (!saveGame(readVariable(55), name))
_variableArray[55] = (int16)0xFFFF;
else
_variableArray[55] = 0;
break;
}
- if (_keyPressed == 8 && len != 0) {
+ if (_keyPressed.keycode == Common::KEYCODE_BACKSPACE && len != 0) {
len--;
byte chr = name[len];
window->textColumn -= getFeebleFontSize(chr);
name[len] = 0;
windowBackSpace(_windowArray[3]);
}
- if (_keyPressed >= 32 && window->textColumn + 26 <= window->width) {
- name[len++] = _keyPressed;
- windowPutChar(_windowArray[3], _keyPressed);
+ if (_keyPressed.ascii >= 32 && window->textColumn + 26 <= window->width) {
+ name[len++] = _keyPressed.ascii;
+ windowPutChar(_windowArray[3], _keyPressed.ascii);
}
windowPutChar(window, 0x7f);
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 56e314c3e7..dfd9f1eef9 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -257,12 +257,12 @@ restart:
for (;;) {
windowPutChar(window, 128);
- _keyPressed = 0;
+ _keyPressed.reset();
for (;;) {
delay(10);
- if (_keyPressed && _keyPressed < 128) {
- i = _keyPressed;
+ if (_keyPressed.ascii && _keyPressed.ascii < 128) {
+ i = _keyPressed.ascii;
break;
}
}
@@ -490,16 +490,16 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
HitArea *ha;
*b = true;
- _keyPressed = 0;
+ _keyPressed.reset();
for (;;) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
do {
- if (_saveLoadEdit && _keyPressed && _keyPressed < maxChar) {
+ if (_saveLoadEdit && _keyPressed.ascii && _keyPressed.ascii < maxChar) {
*b = false;
- return _keyPressed;
+ return _keyPressed.ascii;
}
delay(10);
} while (_lastHitArea3 == 0);
@@ -759,16 +759,16 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
listSaveGames(buf);
}
- _keyPressed = 0;
+ _keyPressed.reset();
for (;;) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
do {
- if (_saveLoadEdit && _keyPressed && _keyPressed < maxChar) {
+ if (_saveLoadEdit && _keyPressed.ascii && _keyPressed.ascii < maxChar) {
*b = false;
- return _keyPressed;
+ return _keyPressed.ascii;
}
delay(10);
} while (_lastHitArea3 == 0);
diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index 4dc7324f64..1a4f956b8b 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.cpp
@@ -311,29 +311,29 @@ void AGOSEngine_Simon1::os1_pauseGame() {
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
// If all else fails, use English as fallback.
- byte keyYes = 'y';
- byte keyNo = 'n';
+ Common::KeyCode keyYes = Common::KEYCODE_y;
+ Common::KeyCode keyNo = Common::KEYCODE_n;
switch (_language) {
case Common::RU_RUS:
break;
case Common::PL_POL:
- keyYes = 't';
+ keyYes = Common::KEYCODE_t;
break;
case Common::HB_ISR:
- keyYes = 'f';
+ keyYes = Common::KEYCODE_f;
break;
case Common::ES_ESP:
- keyYes = 's';
+ keyYes = Common::KEYCODE_s;
break;
case Common::IT_ITA:
- keyYes = 's';
+ keyYes = Common::KEYCODE_s;
break;
case Common::FR_FRA:
- keyYes = 'o';
+ keyYes = Common::KEYCODE_o;
break;
case Common::DE_DEU:
- keyYes = 'j';
+ keyYes = Common::KEYCODE_j;
break;
default:
break;
@@ -343,17 +343,17 @@ void AGOSEngine_Simon1::os1_pauseGame() {
delay(1);
#ifdef _WIN32_WCE
if (isSmartphone()) {
- if (_keyPressed) {
- if (_keyPressed == 13)
+ if (_keyPressed.keycode) {
+ if (_keyPressed.keycode == Common::KEYCODE_RETURN)
shutdown();
else
break;
}
}
#endif
- if (_keyPressed == keyYes || _keyPressed == (keyYes - 32))
+ if (_keyPressed.keycode == keyYes)
shutdown();
- else if (_keyPressed == keyNo || _keyPressed == (keyNo - 32))
+ else if (_keyPressed.keycode == keyNo)
break;
}