summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-02-05 11:44:31 -0700
committerIra Rice <irarice@gmail.com>2009-02-05 11:44:31 -0700
commit34f27b882cf63ca4dfda6079253adb959ebaeadd (patch)
tree7bdc1e9c41865b9b7ba83296d7d4198655fceb7c /src
parent620e3d945884f0bfa304092f3924c8b7ea6110d0 (diff)
downloadmana-client-34f27b882cf63ca4dfda6079253adb959ebaeadd.tar.gz
mana-client-34f27b882cf63ca4dfda6079253adb959ebaeadd.tar.bz2
mana-client-34f27b882cf63ca4dfda6079253adb959ebaeadd.tar.xz
mana-client-34f27b882cf63ca4dfda6079253adb959ebaeadd.zip
Rather than to settle for a broken default (if it's left at space,
then you won't be able to type spaces in the NPC integer or string dialogs. And no, assigning focus to the ok button doesn't resolve anything, but makes things worse, as then the user has to click on the input field to input text, then must click the ok button, as the chat window already overrode it's confirmation action), this commit allows for both the chat input and the NPC dialog confirming to share the same key, but allows for people to change one or the other if they want to. This will still allow for the player to use the keyboard fully for NPC dialogs, but allow for people who don't like not being able to use chat with an NPC dialog open to assign confirmation to another key and get their way as well. This is a rather ugly way of resolving both sides of the issue, but it's the only way to appease both sides. The Aethyra players want things the way they were, while Bjorn wanted things a different way. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp91
-rw-r--r--src/keyboardconfig.cpp9
2 files changed, 56 insertions, 44 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 3f6de6af..7c038074 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -515,6 +515,57 @@ void Game::handleInput()
}
}
+ if (keyboard.isKeyActive(keyboard.KEY_TOGGLE_CHAT))
+ {
+ // Input chat window
+ if (!(chatWindow->isInputFocused() ||
+ deathNotice != NULL ||
+ weightNotice != NULL))
+ {
+ // Quit by pressing Enter if the exit confirm is there
+ if (exitConfirm)
+ done = true;
+ // Close the Browser if opened
+ else if (helpWindow->isVisible())
+ helpWindow->setVisible(false);
+ // Close the config window, cancelling changes if opened
+ else if (setupWindow->isVisible())
+ setupWindow->action(gcn::ActionEvent(NULL, "cancel"));
+ else if (!(keyboard.getKeyValue(
+ KeyboardConfig::KEY_TOGGLE_CHAT) ==
+ keyboard.getKeyValue(
+ KeyboardConfig::KEY_OK) &&
+ (npcStringDialog->isVisible() ||
+ npcTextDialog->isVisible() ||
+ npcListDialog->isVisible() ||
+ npcIntegerDialog->isVisible())))
+ {
+ chatWindow->requestChatFocus();
+ used = true;
+ }
+ }
+ }
+
+ if (keyboard.isKeyActive(keyboard.KEY_OK))
+ {
+ if (!(exitConfirm || helpWindow->isVisible() ||
+ setupWindow->isVisible()))
+ {
+ // Submits the text and proceeds to the next dialog
+ if (npcStringDialog->isVisible())
+ npcStringDialog->action(gcn::ActionEvent(NULL, "ok"));
+ // Proceed to the next dialog option, or close the window
+ else if (npcTextDialog->isVisible())
+ npcTextDialog->action(gcn::ActionEvent(NULL, "ok"));
+ // Choose the currently highlighted dialogue option
+ else if (npcListDialog->isVisible())
+ npcListDialog->action(gcn::ActionEvent(NULL, "ok"));
+ // Submits the text and proceeds to the next dialog
+ else if (npcIntegerDialog->isVisible())
+ npcIntegerDialog->action(gcn::ActionEvent(NULL, "ok"));
+ }
+ }
+
const int tKey = keyboard.getKeyIndex(event.key.keysym.sym);
switch (tKey)
{
@@ -544,45 +595,6 @@ void Game::handleInput()
}
used = true;
break;
-
- case KeyboardConfig::KEY_TOGGLE_CHAT:
- // Input chat window
- if (chatWindow->isInputFocused() ||
- deathNotice != NULL ||
- weightNotice != NULL)
- {
- break;
- }
-
- // Quit by pressing Enter if the exit confirm is there
- if (exitConfirm)
- done = true;
- // Close the Browser if opened
- else if (helpWindow->isVisible())
- helpWindow->setVisible(false);
- // Close the config window, cancelling changes if opened
- else if (setupWindow->isVisible())
- setupWindow->action(gcn::ActionEvent(NULL, "cancel"));
- else
- {
- chatWindow->requestChatFocus();
- used = true;
- }
- break;
- case KeyboardConfig::KEY_OK:
- // Submits the text and proceeds to the next dialog
- if (npcStringDialog->isVisible())
- npcStringDialog->action(gcn::ActionEvent(NULL, "ok"));
- // Proceed to the next dialog option, or close the window
- else if (npcTextDialog->isVisible())
- npcTextDialog->action(gcn::ActionEvent(NULL, "ok"));
- // Choose the currently highlighted dialogue option
- else if (npcListDialog->isVisible())
- npcListDialog->action(gcn::ActionEvent(NULL, "ok"));
- // Submits the text and proceeds to the next dialog
- else if (npcIntegerDialog->isVisible())
- npcIntegerDialog->action(gcn::ActionEvent(NULL, "ok"));
- break;
// Quitting confirmation dialog
case KeyboardConfig::KEY_QUIT:
if (!exitConfirm)
@@ -598,7 +610,6 @@ void Game::handleInput()
exitConfirm->action(gcn::ActionEvent(NULL, _("no")));
}
break;
-
default:
break;
}
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index 68d51572..745a81db 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -95,7 +95,7 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = {
{"keyChat", SDLK_RETURN, _("Toggle Chat")},
{"keyChatScrollUp", SDLK_PAGEUP, _("Scroll Chat Up")},
{"keyChatScrollDown", SDLK_PAGEDOWN, _("Scroll Chat Down")},
- {"keyOK", SDLK_SPACE, _("Select OK")},
+ {"keyOK", SDLK_RETURN, _("Select OK")},
{"keyQuit", SDLK_ESCAPE, _("Quit")}
};
@@ -151,9 +151,10 @@ bool KeyboardConfig::hasConflicts()
for (j = i, j++; j < KEY_TOTAL; j++)
{
// Allow for item shortcut and emote keys to overlap, but no other keys
- if (!(((i >= KEY_SHORTCUT_1) && (i <= KEY_SHORTCUT_12)) &&
- ((j >= KEY_EMOTE_1) && (j <= KEY_EMOTE_12)))
- && mKey[i].value == mKey[j].value
+ if (!((((i >= KEY_SHORTCUT_1) && (i <= KEY_SHORTCUT_12)) &&
+ ((j >= KEY_EMOTE_1) && (j <= KEY_EMOTE_12))) ||
+ ((i == KEY_TOGGLE_CHAT) && (j == KEY_OK))) &&
+ (mKey[i].value == mKey[j].value)
)
{
return true;