SAGA2: Replace remaining SpecialKey uses by Common::KeyCode

This commit is contained in:
a/ 2021-08-13 22:41:02 +09:00
parent 0793305470
commit 81909e6dab
3 changed files with 24 additions and 27 deletions

View File

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

View File

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

View File

@ -48,8 +48,6 @@ extern gFont *mainFont;
//-----------------------------------------------------------------------
// init
#define SpecialKey(k) ((k>>8)+0x80)
/****** gtextbox.cpp/gTextBox [class] ******************************
*
* NAME