summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2009-10-05 21:20:24 +0300
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-12 13:40:01 +0100
commitc57aeeaf880a416c1c25b2e2684a571fdb17f6c4 (patch)
tree46e6e951a2bded1c5bbdfd65fcc77378bf1c860e /src
parentd3edbf792793ef1d4fdd321ef49dc99cdfb83aad (diff)
downloadmana-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')
-rw-r--r--src/game.cpp117
-rw-r--r--src/keyboardconfig.cpp2
-rw-r--r--src/keyboardconfig.h2
3 files changed, 56 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);
+ }
}
}
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index a9b702eb..3a1ce8fc 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -81,6 +81,8 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = {
{"keyWindowSocial", SDLK_F11, _("Social Window")},
{"keyWindowEmoteBar", SDLK_F12, _("Emote Shortcut Window")},
{"keyWindowOutfit", SDLK_o, _("Outfits Window")},
+ {"keyWearOutfit", SDLK_RCTRL, _("Wear Outfit")},
+ {"keyCopyOutfit", SDLK_RALT, _("Copy Outfit")},
{"keyEmoteShortcut1", SDLK_1, strprintf(_("Emote Shortcut %d"), 1)},
{"keyEmoteShortcut2", SDLK_2, strprintf(_("Emote Shortcut %d"), 2)},
{"keyEmoteShortcut3", SDLK_3, strprintf(_("Emote Shortcut %d"), 3)},
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h
index 9c23f53b..6b972428 100644
--- a/src/keyboardconfig.h
+++ b/src/keyboardconfig.h
@@ -196,6 +196,8 @@ class KeyboardConfig
KEY_WINDOW_SOCIAL,
KEY_WINDOW_EMOTE_SHORTCUT,
KEY_WINDOW_OUTFIT,
+ KEY_WEAR_OUTFIT,
+ KEY_COPY_OUTFIT,
KEY_EMOTE_1,
KEY_EMOTE_2,
KEY_EMOTE_3,