diff options
author | Andrei Karas <akaras@inbox.ru> | 2009-10-05 21:20:24 +0300 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-02-12 13:40:01 +0100 |
commit | c57aeeaf880a416c1c25b2e2684a571fdb17f6c4 (patch) | |
tree | 46e6e951a2bded1c5bbdfd65fcc77378bf1c860e /src/game.cpp | |
parent | d3edbf792793ef1d4fdd321ef49dc99cdfb83aad (diff) | |
download | mana-c57aeeaf880a416c1c25b2e2684a571fdb17f6c4.tar.gz mana-c57aeeaf880a416c1c25b2e2684a571fdb17f6c4.tar.bz2 mana-c57aeeaf880a416c1c25b2e2684a571fdb17f6c4.tar.xz mana-c57aeeaf880a416c1c25b2e2684a571fdb17f6c4.zip |
Add outfits wear and copy keys in settings
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 117 |
1 files changed, 52 insertions, 65 deletions
diff --git a/src/game.cpp b/src/game.cpp index 900a6794..85dabbc9 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -601,82 +601,69 @@ void Game::handleInput() } } - if ((event.key.keysym.mod & KMOD_RCTRL || event.key.keysym.mod & KMOD_LCTRL) - && !chatWindow->isInputFocused()) + if (!chatWindow->isInputFocused()) { - int outfitNum = -1; - switch (event.key.keysym.sym) - { - case SDLK_1: - outfitNum = 0; - break; - - case SDLK_2: - outfitNum = 1; - break; - - case SDLK_3: - outfitNum = 2; - break; - - case SDLK_4: - outfitNum = 3; - break; - - case SDLK_5: - outfitNum = 4; - break; + bool wearOutfit = false; + bool copyOutfit = false; - case SDLK_6: - outfitNum = 5; - break; + if (keyboard.isKeyActive(keyboard.KEY_WEAR_OUTFIT)) + wearOutfit = true; - case SDLK_7: - outfitNum = 6; - break; + if (keyboard.isKeyActive(keyboard.KEY_COPY_OUTFIT)) + copyOutfit = true; - case SDLK_8: - outfitNum = 7; - break; - - case SDLK_9: - outfitNum = 8; - break; + if (wearOutfit || copyOutfit) + { + int outfitNum = -1; + switch (event.key.keysym.sym) + { + case SDLK_1: + case SDLK_2: + case SDLK_3: + case SDLK_4: + case SDLK_5: + case SDLK_6: + case SDLK_7: + case SDLK_8: + case SDLK_9: + outfitNum = event.key.keysym.sym - SDLK_1; + break; - case SDLK_0: - outfitNum = 9; - break; + case SDLK_0: + outfitNum = 9; + break; - case SDLK_MINUS: - outfitNum = 10; - break; + case SDLK_MINUS: + outfitNum = 10; + break; - case SDLK_EQUALS: - outfitNum = 11; - break; + case SDLK_EQUALS: + outfitNum = 11; + break; - case SDLK_BACKSPACE: - outfitNum = 12; - break; + case SDLK_BACKSPACE: + outfitNum = 12; + break; - case SDLK_INSERT: - outfitNum = 13; - break; + case SDLK_INSERT: + outfitNum = 13; + break; - case SDLK_HOME: - outfitNum = 14; - break; + case SDLK_HOME: + outfitNum = 14; + break; - default: - break; - } - if (outfitNum >= 0) - { - used = true; - if (event.key.keysym.mod & KMOD_RCTRL) - outfitWindow->wearOutfit(outfitNum); - else if (event.key.keysym.mod & KMOD_LCTRL) - outfitWindow->copyOutfit(outfitNum); + default: + break; + } + if (outfitNum >= 0) + { + used = true; + if (wearOutfit) + outfitWindow->wearOutfit(outfitNum); + else if (copyOutfit) + outfitWindow->copyOutfit(outfitNum); + } } } |