aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2007-06-23 14:59:58 +0000
committerMax Horn2007-06-23 14:59:58 +0000
commit6ef494ab28e0c326e874d85aebd333daedf1a54f (patch)
treef4e7eb9c35132a337a145acafb623d6bf8cad14b
parent9f1e47aa536f82fb20324a54da9510291ba9cccc (diff)
downloadscummvm-rg350-6ef494ab28e0c326e874d85aebd333daedf1a54f.tar.gz
scummvm-rg350-6ef494ab28e0c326e874d85aebd333daedf1a54f.tar.bz2
scummvm-rg350-6ef494ab28e0c326e874d85aebd333daedf1a54f.zip
Converted LURE code to use KEYCODEs
svn-id: r27668
-rw-r--r--engines/lure/animseq.cpp2
-rw-r--r--engines/lure/fights.cpp16
-rw-r--r--engines/lure/game.cpp21
-rw-r--r--engines/lure/menu.cpp5
-rw-r--r--engines/lure/surface.cpp2
5 files changed, 23 insertions, 23 deletions
diff --git a/engines/lure/animseq.cpp b/engines/lure/animseq.cpp
index 7b65d2cf0b..39d74e5ec8 100644
--- a/engines/lure/animseq.cpp
+++ b/engines/lure/animseq.cpp
@@ -42,7 +42,7 @@ AnimAbortType AnimationSequence::delay(uint32 milliseconds) {
while (_system.getMillis() < delayCtr) {
while (events.pollEvent()) {
if (events.type() == Common::EVENT_KEYDOWN) {
- if (events.event().kbd.keycode == 27) return ABORT_END_INTRO;
+ if (events.event().kbd.keycode == Common::KEYCODE_ESCAPE) return ABORT_END_INTRO;
else return ABORT_NEXT_SCENE;
} else if (events.type() == Common::EVENT_LBUTTONDOWN)
return ABORT_NEXT_SCENE;
diff --git a/engines/lure/fights.cpp b/engines/lure/fights.cpp
index 7eef545c8d..4c478bbc17 100644
--- a/engines/lure/fights.cpp
+++ b/engines/lure/fights.cpp
@@ -154,13 +154,13 @@ const CursorType moveList[] = {CURSOR_LEFT_ARROW, CURSOR_FIGHT_UPPER,
CURSOR_FIGHT_MIDDLE, CURSOR_FIGHT_LOWER, CURSOR_RIGHT_ARROW};
struct KeyMapping {
- uint16 keycode;
+ Common::KeyCode keycode;
uint8 moveNumber;
};
const KeyMapping keyList[] = {
- {/*LEFT*/276, 10}, {/*RIGHT*/275, 14}, {/*NUM7*/55, 11}, {/*NUM4*/52, 12},
- {/*NUM1*/49, 13}, {/*NUM9*/57, 6}, {/*NUM6*/54, 7}, {/*NUM3*/51, 8}, {0, 0}};
+ {Common::KEYCODE_LEFT, 10}, {Common::KEYCODE_RIGHT, 14}, {Common::KEYCODE_7, 11}, {Common::KEYCODE_4, 12},
+ {Common::KEYCODE_1, 13}, {Common::KEYCODE_9, 6}, {Common::KEYCODE_6, 7}, {Common::KEYCODE_3, 8}, {Common::KEYCODE_INVALID, 0}};
void FightsManager::checkEvents() {
Events &events = Events::getReference();
@@ -172,18 +172,18 @@ void FightsManager::checkEvents() {
int moveNumber = 0;
if (events.type() == Common::EVENT_KEYDOWN) {
- switch (events.event().kbd.ascii) {
- case 27:
+ switch (events.event().kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
events.quitFlag = true;
break;
default:
// Scan through the mapping list for a move for the keypress
const KeyMapping *keyPtr = &keyList[0];
- while ((keyPtr->keycode != 0) &&
- (keyPtr->keycode != events.event().kbd.ascii))
+ while ((keyPtr->keycode != Common::KEYCODE_INVALID) &&
+ (keyPtr->keycode != events.event().kbd.keycode))
++keyPtr;
- if (keyPtr->keycode != 0)
+ if (keyPtr->keycode != Common::KEYCODE_INVALID)
moveNumber = keyPtr->moveNumber;
}
}
diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp
index d96e42f450..3ac25f83b8 100644
--- a/engines/lure/game.cpp
+++ b/engines/lure/game.cpp
@@ -140,7 +140,7 @@ void Game::execute() {
uint16 roomNum = room.roomNumber();
if ((events.event().kbd.flags == Common::KBD_CTRL) &&
- (events.event().kbd.keycode == 'd')) {
+ (events.event().kbd.keycode == Common::KEYCODE_d)) {
// Activate the debugger
_debugger->attach();
break;
@@ -164,8 +164,8 @@ void Game::execute() {
continue;
// Handle any remaining standard keys
- switch (events.event().kbd.ascii) {
- case 27:
+ switch (events.event().kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
events.quitFlag = true;
break;
@@ -191,8 +191,8 @@ void Game::execute() {
room.roomNumber());
break;
- case 267: // keypad '/'
- case '/':
+ case Common::KEYCODE_KP_DIVIDE:
+ case Common::KEYCODE_SLASH:
room.setShowInfo(!room.showInfo());
break;
@@ -825,17 +825,18 @@ void Game::doQuit() {
s->centerOnScreen();
delete s;
- char key = '\0';
+ Common::KeyCode key = Common::KEYCODE_INVALID;
do {
if (events.pollEvent()) {
if (events.event().type == Common::EVENT_KEYDOWN) {
- key = events.event().kbd.ascii;
- if ((key >= 'A') && (key <= 'Z')) key += 'a' - 'A';
+ key = events.event().kbd.keycode;
}
}
- } while (((uint8) key != 27) && (key != 'y') && (key != 'n'));
+ } while ((key != Common::KEYCODE_ESCAPE) &&
+ (key != Common::KEYCODE_y) &&
+ (key != Common::KEYCODE_n));
- events.quitFlag = key == 'y';
+ events.quitFlag = (key == Common::KEYCODE_n);
if (!events.quitFlag) {
screen.update();
mouse.cursorOn();
diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp
index 95b27470cd..3bb6769ff7 100644
--- a/engines/lure/menu.cpp
+++ b/engines/lure/menu.cpp
@@ -475,7 +475,6 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
}
else if (e.type() == Common::EVENT_KEYDOWN) {
- byte ch = e.event().kbd.ascii;
uint16 keycode = e.event().kbd.keycode;
if (((keycode == Common::KEYCODE_KP8) || (keycode == Common::KEYCODE_UP)) && (selectedIndex > 0)) {
@@ -485,9 +484,9 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
(selectedIndex < numEntries-1)) {
++selectedIndex;
refreshFlag = true;
- } else if ((ch == '\xd') || (keycode == Common::KEYCODE_KP_ENTER)) {
+ } else if ((keycode == Common::KEYCODE_RETURN) || (keycode == Common::KEYCODE_KP_ENTER)) {
goto bail_out;
- } else if (ch == '\x1b') {
+ } else if (keycode == Common::KEYCODE_ESCAPE) {
selectedIndex = 0xffff;
goto bail_out;
}
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index 2642b929eb..3486a5abb9 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -690,7 +690,7 @@ bool SaveRestoreDialog::show(bool saveDialog) {
if (events.pollEvent()) {
if ((events.type() == Common::EVENT_KEYDOWN) &&
- (events.event().kbd.ascii == 27)) {
+ (events.event().kbd.keycode == Common::KEYCODE_ESCAPE)) {
abortFlag = true;
break;
}