From f651273ebf2a8b11aa01ed1434ecb613177ced6a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 2 Aug 2015 16:13:36 +0300 Subject: Add gui mode for dyecmd. Now only basic code added. --- src/input/inputmanager.cpp | 55 +++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 20 deletions(-) (limited to 'src/input') diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 12c28c806..a9d35fb64 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -323,7 +323,9 @@ bool InputManager::hasConflicts(InputActionT &restrict key1, void InputManager::callbackNewKey() { +#ifndef DYECMD mSetupInput->newKeyCallback(mNewKeyIndex); +#endif } bool InputManager::isActionActive(const InputActionT index) const @@ -521,7 +523,9 @@ void InputManager::unassignKey() update(); } -bool InputManager::handleAssignKey(const SDL_Event &event, const int type) +#ifndef DYECMD +bool InputManager::handleAssignKey(const SDL_Event &event, + const int type) { if (setupWindow && setupWindow->isWindowVisible() && getNewKeyIndex() > InputAction::NO_VALUE) @@ -533,6 +537,13 @@ bool InputManager::handleAssignKey(const SDL_Event &event, const int type) } return false; } +#else +bool InputManager::handleAssignKey(const SDL_Event &event A_UNUSED, + const int type A_UNUSED) +{ + return false; +} +#endif bool InputManager::handleEvent(const SDL_Event &event) { @@ -551,6 +562,7 @@ bool InputManager::handleEvent(const SDL_Event &event) keyboard.handleActicateKey(event); // send straight to gui for certain windows +#ifndef DYECMD if (quitDialog || TextDialog::isActive()) { if (guiInput) @@ -560,6 +572,7 @@ bool InputManager::handleEvent(const SDL_Event &event) BLOCK_END("InputManager::handleEvent") return true; } +#endif break; } case SDL_KEYUP: @@ -666,6 +679,7 @@ void InputManager::updateConditionMask() mMask = 1; if (keyboard.isEnabled()) mMask |= InputCondition::ENABLED; +#ifndef DYECMD if ((!chatWindow || !chatWindow->isInputFocused()) && !NpcDialog::isAnyInputFocused() && !InventoryWindow::isAnyInputFocused() && @@ -700,18 +714,6 @@ void InputManager::updateConditionMask() #endif mMask |= InputCondition::NOROOM; - if (!settings.awayMode) - mMask |= InputCondition::NOAWAY; - - if (!setupWindow || !setupWindow->isWindowVisible()) - mMask |= InputCondition::NOSETUP; - - if (Game::instance() && Game::instance()->getValidSpeed()) - mMask |= InputCondition::VALIDSPEED; - - if (gui && !gui->getFocusHandler()->getModalFocused()) - mMask |= InputCondition::NOMODAL; - const NpcDialog *const dialog = NpcDialog::getActive(); if (!dialog || !dialog->isTextInputFocused()) mMask |= InputCondition::NONPCINPUT; @@ -721,15 +723,12 @@ void InputManager::updateConditionMask() if (!InventoryWindow::isStorageActive()) mMask |= InputCondition::NOTALKING; } + if (!setupWindow || !setupWindow->isWindowVisible()) + mMask |= InputCondition::NOSETUP; - if (!settings.disableGameModifiers) - mMask |= InputCondition::EMODS; + if (Game::instance() && Game::instance()->getValidSpeed()) + mMask |= InputCondition::VALIDSPEED; - if (!isActionActive0(InputAction::STOP_ATTACK) - && !isActionActive0(InputAction::UNTARGET)) - { - mMask |= InputCondition::NOTARGET; - } if (Game::instance()) mMask |= InputCondition::INGAME; @@ -738,6 +737,22 @@ void InputManager::updateConditionMask() if (localPlayer && localPlayer->isAlive()) mMask |= InputCondition::ALIVE; +#endif + + if (!settings.awayMode) + mMask |= InputCondition::NOAWAY; + + if (gui && !gui->getFocusHandler()->getModalFocused()) + mMask |= InputCondition::NOMODAL; + + if (!settings.disableGameModifiers) + mMask |= InputCondition::EMODS; + + if (!isActionActive0(InputAction::STOP_ATTACK) + && !isActionActive0(InputAction::UNTARGET)) + { + mMask |= InputCondition::NOTARGET; + } } bool InputManager::checkKey(const InputActionData *const key) const -- cgit v1.2.3-70-g09d2