diff options
author | Ira Rice <irarice@gmail.com> | 2009-02-05 09:30:52 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-02-05 09:30:52 -0700 |
commit | b2972f32eb806f8d3f1acc110f2b8a994c902c2c (patch) | |
tree | 879f70722eadadbbc738ded0e5933c66825c9a3a /src/game.cpp | |
parent | b64fd3b17bcd3f750851f0213eac43d467de8600 (diff) | |
download | mana-b2972f32eb806f8d3f1acc110f2b8a994c902c2c.tar.gz mana-b2972f32eb806f8d3f1acc110f2b8a994c902c2c.tar.bz2 mana-b2972f32eb806f8d3f1acc110f2b8a994c902c2c.tar.xz mana-b2972f32eb806f8d3f1acc110f2b8a994c902c2c.zip |
Three things: Split chat and NPC dialog functionality based on the TMW
complaint commit d2876ad85935c5d0b181d050bd4c19a4682123b1 (btw, if
you're concerned about that, return is also a bad choice for the chat
window in general, which overrides the GuiChan default for use widget.
Tab would also be a bad choice, as it cycles through the widgets), next,
I made the text displayed by the keyboard configuration setup dialog
translatable, and lastly, I exposed the rest of the previously
unconfigurable keys to be configurable through the keyboard setup tab.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 110 |
1 files changed, 48 insertions, 62 deletions
diff --git a/src/game.cpp b/src/game.cpp index 43b3e986..3f6de6af 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -501,55 +501,6 @@ void Game::handleInput() keyboard.setNewKeyIndex(keyboard.KEY_NO_VALUE); return; } - // Keys pressed together with Alt/Meta - // Emotions and some internal gui windows -#ifndef __APPLE__ - if (event.key.keysym.mod & KMOD_LALT) -#else - if (event.key.keysym.mod & KMOD_LMETA) -#endif - { - switch (event.key.keysym.sym) - { - case SDLK_p: - // Screenshot (picture, hence the p) - saveScreenshot(); - used = true; - break; - - default: - break; - - case SDLK_f: - // Find path to mouse (debug purpose) - viewport->toggleDebugPath(); - used = true; - break; - - case SDLK_t: - // Toggle accepting of incoming trade requests - unsigned int deflt = player_relations.getDefault(); - if (deflt & PlayerRelation::TRADE) - { - chatWindow->chatLog( - _("Ignoring incoming trade requests"), - BY_SERVER); - deflt &= ~PlayerRelation::TRADE; - } - else - { - chatWindow->chatLog( - _("Accepting incoming trade requests"), - BY_SERVER); - deflt |= PlayerRelation::TRADE; - } - - player_relations.setDefault(deflt); - - used = true; - break; - } - } // Mode switch to emotes if (keyboard.isKeyActive(keyboard.KEY_EMOTE)) @@ -563,16 +514,18 @@ void Game::handleInput() return; } } - switch (event.key.keysym.sym) + + const int tKey = keyboard.getKeyIndex(event.key.keysym.sym); + switch (tKey) { - case SDLK_PAGEUP: + case KeyboardConfig::KEY_SCROLL_CHAT_UP: if (chatWindow->isVisible()) { chatWindow->scroll(-DEFAULT_CHAT_WINDOW_SCROLL); used = true; } break; - case SDLK_PAGEDOWN: + case KeyboardConfig::KEY_SCROLL_CHAT_DOWN: if (chatWindow->isVisible()) { chatWindow->scroll(DEFAULT_CHAT_WINDOW_SCROLL); @@ -580,7 +533,7 @@ void Game::handleInput() return; } break; - case SDLK_F1: + case KeyboardConfig::KEY_WINDOW_HELP: // In-game Help if (helpWindow->isVisible()) helpWindow->setVisible(false); @@ -592,7 +545,7 @@ void Game::handleInput() used = true; break; - case SDLK_RETURN: + case KeyboardConfig::KEY_TOGGLE_CHAT: // Input chat window if (chatWindow->isInputFocused() || deathNotice != NULL || @@ -610,8 +563,15 @@ void Game::handleInput() // 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 - else if (npcStringDialog->isVisible()) + if (npcStringDialog->isVisible()) npcStringDialog->action(gcn::ActionEvent(NULL, "ok")); // Proceed to the next dialog option, or close the window else if (npcTextDialog->isVisible()) @@ -622,15 +582,9 @@ void Game::handleInput() // Submits the text and proceeds to the next dialog else if (npcIntegerDialog->isVisible()) npcIntegerDialog->action(gcn::ActionEvent(NULL, "ok")); - // Else, open the chat edit box - else - { - chatWindow->requestChatFocus(); - used = true; - } break; // Quitting confirmation dialog - case SDLK_ESCAPE: + case KeyboardConfig::KEY_QUIT: if (!exitConfirm) { exitConfirm = new ConfirmDialog( _("Quit"), @@ -754,6 +708,38 @@ void Game::handleInput() case KeyboardConfig::KEY_WINDOW_EMOTE_SHORTCUT: requestedWindow = emoteShortcutWindow; break; + case KeyboardConfig::KEY_SCREENSHOT: + // Screenshot (picture, hence the p) + saveScreenshot(); + used = true; + break; + case KeyboardConfig::KEY_PATHFIND: + // Find path to mouse (debug purpose) + viewport->toggleDebugPath(); + used = true; + break; + case KeyboardConfig::KEY_TRADE: + // Toggle accepting of incoming trade requests + unsigned int deflt = player_relations.getDefault(); + if (deflt & PlayerRelation::TRADE) + { + chatWindow->chatLog( + _("Ignoring incoming trade requests"), + BY_SERVER); + deflt &= ~PlayerRelation::TRADE; + } + else + { + chatWindow->chatLog( + _("Accepting incoming trade requests"), + BY_SERVER); + deflt |= PlayerRelation::TRADE; + } + + player_relations.setDefault(deflt); + + used = true; + break; } } |