summaryrefslogtreecommitdiff
path: root/src/input/inputmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-02 16:13:36 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-03 21:50:05 +0300
commitf651273ebf2a8b11aa01ed1434ecb613177ced6a (patch)
treec51d2bed1476270e27ad95c5a46e15af32eaccdd /src/input/inputmanager.cpp
parent30846b7f68f1ad05a0719ae37f75fd2901a6545a (diff)
downloadplus-f651273ebf2a8b11aa01ed1434ecb613177ced6a.tar.gz
plus-f651273ebf2a8b11aa01ed1434ecb613177ced6a.tar.bz2
plus-f651273ebf2a8b11aa01ed1434ecb613177ced6a.tar.xz
plus-f651273ebf2a8b11aa01ed1434ecb613177ced6a.zip
Add gui mode for dyecmd. Now only basic code added.
Diffstat (limited to 'src/input/inputmanager.cpp')
-rw-r--r--src/input/inputmanager.cpp55
1 files changed, 35 insertions, 20 deletions
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