diff options
-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]; |