diff options
author | Florian Kagerer | 2009-05-24 14:33:41 +0000 |
---|---|---|
committer | Florian Kagerer | 2009-05-24 14:33:41 +0000 |
commit | 84a2651e63addeb55c61ed6244c77073f8921193 (patch) | |
tree | f38f0793c8a7a53d5f2e4f34c989b68d11c0654e | |
parent | a4b733403a8ebc1acac608c953056eb498d900ba (diff) | |
download | scummvm-rg350-84a2651e63addeb55c61ed6244c77073f8921193.tar.gz scummvm-rg350-84a2651e63addeb55c61ed6244c77073f8921193.tar.bz2 scummvm-rg350-84a2651e63addeb55c61ed6244c77073f8921193.zip |
LOL: fixed some input code issues:
- party would move 2 steps instead of one when using keyboad while magic menu was open
- viewing notes would abort at once instead of waiting for the next click
svn-id: r40863
-rw-r--r-- | engines/kyra/gui_lol.cpp | 31 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.h | 2 | ||||
-rw-r--r-- | engines/kyra/lol.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/lol.h | 4 |
5 files changed, 26 insertions, 17 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index 066a7d0975..6817d85af9 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -704,18 +704,19 @@ void LoLEngine::gui_toggleFightButtons(bool disable) { void LoLEngine::gui_updateInput() { // TODO: We need to catch all cases where loading is not possible and // set the "mainLoop" parameter to false for them. - int inputFlag = checkInput(_activeButtons, !(_updateFlags & 3)); + int inputFlag = checkInput(_activeButtons, !(_updateFlags & 3), 0); if (_preserveEvents) - _preserveEvents = false; + _preserveEvents = false; else removeInputTop(); - if (inputFlag && _unkCharNum != -1 && !(inputFlag & 0x8800)) { + if (inputFlag && _activeMagicMenu != -1 && !(inputFlag & 0x8800)) { gui_enableDefaultPlayfieldButtons(); - _characters[_unkCharNum].flags &= 0xffef; - gui_drawCharPortraitWithStats(_unkCharNum); + _characters[_activeMagicMenu].flags &= 0xffef; + gui_drawCharPortraitWithStats(_activeMagicMenu); gui_triggerEvent(inputFlag); - _unkCharNum = -1; + _preserveEvents = false; + _activeMagicMenu = -1; inputFlag = 0; } @@ -955,6 +956,14 @@ void LoLEngine::gui_initButton(int index, int x, int y, int val) { b->buttonCallback = _buttonCallbacks[index]; } +void LoLEngine::gui_notifyButtonListChanged() { + if (_gui) { + if (!_gui->_buttonListChanged && !_preserveEvents) + removeInputTop(); + _gui->_buttonListChanged = true; + } +} + int LoLEngine::clickedUpArrow(Button *button) { if (button->arg && !_floatingCursorsEnabled) return 0; @@ -1093,7 +1102,7 @@ int LoLEngine::clickedMagicButton(Button *button) { gui_drawCharPortraitWithStats(c); gui_initMagicSubmenu(c); - _unkCharNum = c; + _activeMagicMenu = c; return 1; } @@ -1120,14 +1129,14 @@ int LoLEngine::clickedMagicSubmenu(Button *button) { } } - _unkCharNum = -1; + _activeMagicMenu = -1; return 1; } int LoLEngine::clickedScreen(Button *button) { - _characters[_unkCharNum].flags &= 0xffef; - gui_drawCharPortraitWithStats(_unkCharNum); - _unkCharNum = -1; + _characters[_activeMagicMenu].flags &= 0xffef; + gui_drawCharPortraitWithStats(_activeMagicMenu); + _activeMagicMenu = -1; if (!(button->flags2 & 0x80)) { if (button->flags2 & 0x100) diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index 8585b0fced..d642918667 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -224,7 +224,7 @@ void KyraEngine_v1::setMousePos(int x, int y) { _system->warpMouse(x, y); } -int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop) { +int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag) { _isSaveAllowed = mainLoop; updateInput(); _isSaveAllowed = false; @@ -365,7 +365,7 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop) { GUI *guiInstance = gui(); if (guiInstance) { if (keys) - return guiInstance->processButtonList(buttonList, keys | 0x8000, mouseWheel); + return guiInstance->processButtonList(buttonList, keys | eventFlag, mouseWheel); else return guiInstance->processButtonList(buttonList, 0, mouseWheel); } else { diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index efa84bb488..b45f21dd89 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -203,7 +203,7 @@ protected: // input void updateInput(); - int checkInput(Button *buttonList, bool mainLoop = false); + int checkInput(Button *buttonList, bool mainLoop = false, int eventFlag = 0x8000); void removeInputTop(); int _mouseX, _mouseY; diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 68b58b6a73..73615b2848 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -519,7 +519,7 @@ Common::Error LoLEngine::init() { memset(&_scriptData, 0, sizeof(EMCData)); _hasTempDataFlags = 0; - _unkCharNum = -1; + _activeMagicMenu = -1; _automapShapes = new const uint8*[109]; _mapOverlay = new uint8[256]; diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index dae5545bd3..029d7948cc 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -515,7 +515,7 @@ private: void gui_initMagicScrollButtons(); void gui_initMagicSubmenu(int charNum); void gui_initButton(int index, int x = -1, int y = -1, int val = -1); - void gui_notifyButtonListChanged() { if (_gui) _gui->_buttonListChanged = true; } + void gui_notifyButtonListChanged(); Common::Array<Button::Callback> _buttonCallbacks; Button *_activeButtons; @@ -870,7 +870,7 @@ private: int _loadLevelFlag; int _hasTempDataFlags; - int _unkCharNum; + int _activeMagicMenu; uint16 _scriptCharacterCycle; int _charStatsTemp[5]; |