From 81909e6dabffe56949ff410c4c387aea4b71934a Mon Sep 17 00:00:00 2001 From: a/ Date: Fri, 13 Aug 2021 22:41:02 +0900 Subject: [PATCH] SAGA2: Replace remaining SpecialKey uses by Common::KeyCode --- engines/saga2/automap.cpp | 24 ++++++++++++------------ engines/saga2/document.cpp | 25 ++++++++++++------------- engines/saga2/gtextbox.cpp | 2 -- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/engines/saga2/automap.cpp b/engines/saga2/automap.cpp index 734d895b51a..06686c1eaf2 100644 --- a/engines/saga2/automap.cpp +++ b/engines/saga2/automap.cpp @@ -24,6 +24,8 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ +#include "common/keyboard.h" + #include "saga2/saga2.h" #include "saga2/automap.h" #include "saga2/blitters.h" @@ -253,24 +255,22 @@ bool CAutoMap::activate(gEventType why) { return false; } -#define SpecialKey(k) ((k>>8)+0x80) - bool CAutoMap::keyStroke(gPanelMessage &msg) { gEvent ev; switch (msg.key) { - case 0x1B: + case Common::ASCII_ESCAPE: cmdAutoMapEsc(ev); return true; - case SpecialKey(homeKey): + case Common::KEYCODE_HOME: cmdAutoMapHome(ev); return true; - case SpecialKey(endKey): + case Common::KEYCODE_END: cmdAutoMapEnd(ev); return true; - case SpecialKey(pageUpKey): + case Common::KEYCODE_PAGEUP: cmdAutoMapPgUp(ev); return true; - case SpecialKey(pageDownKey): + case Common::KEYCODE_PAGEDOWN: cmdAutoMapPgDn(ev); return true; default: @@ -282,11 +282,11 @@ bool CAutoMap::keyStroke(gPanelMessage &msg) { gPanel *CAutoMap::keyTest(int16 key) { switch (key) { - case 0x1B: - case SpecialKey(homeKey): - case SpecialKey(endKey): - case SpecialKey(pageUpKey): - case SpecialKey(pageDownKey): + case Common::ASCII_ESCAPE: + case Common::KEYCODE_HOME: + case Common::KEYCODE_END: + case Common::KEYCODE_PAGEUP: + case Common::KEYCODE_PAGEDOWN: return this; default: return NULL; diff --git a/engines/saga2/document.cpp b/engines/saga2/document.cpp index de9631e5a76..e88b6ece3fe 100644 --- a/engines/saga2/document.cpp +++ b/engines/saga2/document.cpp @@ -24,6 +24,8 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ +#include "common/keyboard.h" + #include "saga2/saga2.h" #include "saga2/document.h" #include "saga2/script.h" @@ -235,25 +237,22 @@ bool CDocument::activate(gEventType why) { return false; } -#define SpecialKey(k) ((k>>8)+0x80) - - bool CDocument::keyStroke(gPanelMessage &msg) { gEvent ev; switch (msg.key) { - case 0x1B: + case Common::ASCII_ESCAPE: cmdDocumentEsc(ev); return true; - case SpecialKey(leftArrowKey): + case Common::KEYCODE_LEFT: cmdDocumentLt(ev); return true; - case SpecialKey(rightArrowKey): + case Common::KEYCODE_RIGHT: cmdDocumentRt(ev); return true; - case SpecialKey(upArrowKey): + case Common::KEYCODE_UP: cmdDocumentUp(ev); return true; - case SpecialKey(downArrowKey): + case Common::KEYCODE_DOWN: cmdDocumentDn(ev); return true; default: @@ -265,11 +264,11 @@ bool CDocument::keyStroke(gPanelMessage &msg) { gPanel *CDocument::keyTest(int16 key) { switch (key) { - case 0x1B: - case SpecialKey(leftArrowKey): - case SpecialKey(rightArrowKey): - case SpecialKey(upArrowKey): - case SpecialKey(downArrowKey): + case Common::ASCII_ESCAPE: + case Common::KEYCODE_LEFT: + case Common::KEYCODE_RIGHT: + case Common::KEYCODE_UP: + case Common::KEYCODE_DOWN: return this; default: return NULL; diff --git a/engines/saga2/gtextbox.cpp b/engines/saga2/gtextbox.cpp index 119200d9488..e098d42a4f0 100644 --- a/engines/saga2/gtextbox.cpp +++ b/engines/saga2/gtextbox.cpp @@ -48,8 +48,6 @@ extern gFont *mainFont; //----------------------------------------------------------------------- // init -#define SpecialKey(k) ((k>>8)+0x80) - /****** gtextbox.cpp/gTextBox [class] ****************************** * * NAME