Converted LURE code to use KEYCODEs

svn-id: r27668
This commit is contained in:
Max Horn 2007-06-23 14:59:58 +00:00
parent 9f1e47aa53
commit 6ef494ab28
5 changed files with 23 additions and 23 deletions

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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;
}

View File

@ -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;
}