From c053762c6398c7d818d5c7f319877c4b1e712070 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 31 Jul 2011 19:56:14 +0200 Subject: CGE: Replace magic values by defines, rename some defines --- engines/cge/cge_main.cpp | 12 ++++++------ engines/cge/events.cpp | 4 ++-- engines/cge/events.h | 9 ++------- engines/cge/gettext.cpp | 2 +- engines/cge/snail.cpp | 2 +- 5 files changed, 12 insertions(+), 17 deletions(-) (limited to 'engines') diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 37449fd5dd..302a25a3d5 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -737,13 +737,13 @@ void System::touch(uint16 mask, int x, int y) { pp0 = pp; switch (x) { case Del: - if (_keyboard->_key[ALT] && _keyboard->_key[CTRL]) + if (_keyboard->_key[kKeyAlt] && _keyboard->_key[kKeyCtrl]) _vm->AltCtrlDel(); else _vm->killSprite(); break; case 'F': - if (_keyboard->_key[ALT]) { + if (_keyboard->_key[kKeyAlt]) { Sprite *m = _vga->_showQ->locate(17001); if (m) { m->step(1); @@ -761,7 +761,7 @@ void System::touch(uint16 mask, int x, int y) { _vm->nextStep(); break; case '`': - if (_keyboard->_key[ALT]) + if (_keyboard->_key[kKeyAlt]) _vm->saveMapping(); else _vm->switchMapping(); @@ -791,7 +791,7 @@ void System::touch(uint16 mask, int x, int y) { _sys->_funDel = 1; break; case 'X': - if (_keyboard->_key[ALT]) + if (_keyboard->_key[kKeyAlt]) _finis = true; break; case '0': @@ -799,7 +799,7 @@ void System::touch(uint16 mask, int x, int y) { case '2': case '3': case '4': - if (_keyboard->_key[ALT]) { + if (_keyboard->_key[kKeyAlt]) { _snail->addCom(kSnLevel, -1, x - '0', NULL); break; } @@ -917,7 +917,7 @@ void CGEEngine::switchColorMode() { void CGEEngine::switchMusic() { debugC(1, kCGEDebugEngine, "CGEEngine::switchMusic()"); - if (_keyboard->_key[ALT]) { + if (_keyboard->_key[kKeyAlt]) { if (Vmenu::_addr) _snail_->addCom(kSnKill, -1, 0, Vmenu::_addr); else { diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index e2aaaa587d..119390944e 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -102,11 +102,11 @@ Sprite *Keyboard::setClient(Sprite *spr) { bool Keyboard::getKey(Common::Event &event, int &cgeCode) { Common::KeyCode keycode = event.kbd.keycode; if ((keycode == Common::KEYCODE_LCTRL) || (keycode == Common::KEYCODE_RCTRL)) { - cgeCode = 29; + cgeCode = kKeyCtrl; return true; } if ((keycode == Common::KEYCODE_LALT) || (keycode == Common::KEYCODE_RALT)) { - cgeCode = 56; + cgeCode = kKeyAlt; return true; } if (keycode == Common::KEYCODE_KP_ENTER) { diff --git a/engines/cge/events.h b/engines/cge/events.h index 2d85574bd7..3b4ff2092f 100644 --- a/engines/cge/events.h +++ b/engines/cge/events.h @@ -38,12 +38,8 @@ namespace CGE { /*----------------- KEYBOARD interface -----------------*/ -#define KEYBD_INT 9 -#define LSHIFT 42 -#define RSHIFT 54 -#define CTRL 29 -#define ALT 56 - +#define kKeyCtrl 29 +#define kKeyAlt 56 class Keyboard { private: @@ -79,7 +75,6 @@ public: #define ATTN 0x20 // 0x40 #define KEYB 0x80 - extern Talk *_talk; struct CGEEvent { diff --git a/engines/cge/gettext.cpp b/engines/cge/gettext.cpp index f64f4b2619..a2408bc792 100644 --- a/engines/cge/gettext.cpp +++ b/engines/cge/gettext.cpp @@ -103,7 +103,7 @@ void GetText::touch(uint16 mask, int x, int y) { if (_oldKeybClient) _oldKeybClient->touch(mask, x, y); } else { - if (_keyboard->_key[ALT]) { + if (_keyboard->_key[kKeyAlt]) { p = strchr(bezo, x); if (p) x = ogon[p - bezo]; diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index 03cb43f4f1..e188f76650 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -153,7 +153,7 @@ void CGEEngine::snGame(Sprite *spr, int num) { _sprK2->step(new_random(6)); _sprK3->step(new_random(6)); ///-------------------- - if (spr->_ref == 1 && _keyboard->_key[ALT]) { + if (spr->_ref == 1 && _keyboard->_key[kKeyAlt]) { _sprK1->step(5); _sprK2->step(5); _sprK3->step(5); -- cgit v1.2.3