From c595f66bc9031fd28e5146a7aaee686b4ecb9c67 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 3 Jan 2011 03:44:12 +0200 Subject: Increase emotes count to 44 and fix new emotes. --- data/graphics/sprites/manaplus_emote.xml | 2 +- src/emoteshortcut.h | 2 +- src/game.cpp | 55 ++++++++++++++++-------------- src/gui/widgets/emoteshortcutcontainer.cpp | 2 +- src/keyboardconfig.cpp | 6 +++- src/keyboardconfig.h | 2 ++ 6 files changed, 39 insertions(+), 30 deletions(-) diff --git a/data/graphics/sprites/manaplus_emote.xml b/data/graphics/sprites/manaplus_emote.xml index 6fa884e40..55f5cc91f 100644 --- a/data/graphics/sprites/manaplus_emote.xml +++ b/data/graphics/sprites/manaplus_emote.xml @@ -1,5 +1,5 @@ - + diff --git a/src/emoteshortcut.h b/src/emoteshortcut.h index 0e06bb633..af1c377e6 100644 --- a/src/emoteshortcut.h +++ b/src/emoteshortcut.h @@ -21,7 +21,7 @@ #ifndef EMOTESHORTCUT_H #define EMOTESHORTCUT_H -#define SHORTCUT_EMOTES 42 +#define SHORTCUT_EMOTES 44 /** * The class which keeps track of the emote shortcuts. diff --git a/src/game.cpp b/src/game.cpp index c0abdf543..bf944a710 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1146,47 +1146,50 @@ void Game::handleInput() setValidSpeed(); player_node->cancelFollow(); } - else if (keyboard.isKeyActive(keyboard.KEY_DIRECT_UP)) + else if (!keyboard.isKeyActive(keyboard.KEY_EMOTE)) { - if (player_node->getDirection() != Being::UP) + if (keyboard.isKeyActive(keyboard.KEY_DIRECT_UP)) { - if (Client::limitPackets(PACKET_DIRECTION)) + if (player_node->getDirection() != Being::UP) { - player_node->setDirection(Being::UP); - Net::getPlayerHandler()->setDirection(Being::UP); + if (Client::limitPackets(PACKET_DIRECTION)) + { + player_node->setDirection(Being::UP); + Net::getPlayerHandler()->setDirection(Being::UP); + } } } - } - else if (keyboard.isKeyActive(keyboard.KEY_DIRECT_DOWN)) - { - if (player_node->getDirection() != Being::DOWN) + else if (keyboard.isKeyActive(keyboard.KEY_DIRECT_DOWN)) { - if (Client::limitPackets(PACKET_DIRECTION)) + if (player_node->getDirection() != Being::DOWN) { - player_node->setDirection(Being::DOWN); - Net::getPlayerHandler()->setDirection(Being::DOWN); + if (Client::limitPackets(PACKET_DIRECTION)) + { + player_node->setDirection(Being::DOWN); + Net::getPlayerHandler()->setDirection(Being::DOWN); + } } } - } - else if (keyboard.isKeyActive(keyboard.KEY_DIRECT_LEFT)) - { - if (player_node->getDirection() != Being::LEFT) + else if (keyboard.isKeyActive(keyboard.KEY_DIRECT_LEFT)) { - if (Client::limitPackets(PACKET_DIRECTION)) + if (player_node->getDirection() != Being::LEFT) { - player_node->setDirection(Being::LEFT); - Net::getPlayerHandler()->setDirection(Being::LEFT); + if (Client::limitPackets(PACKET_DIRECTION)) + { + player_node->setDirection(Being::LEFT); + Net::getPlayerHandler()->setDirection(Being::LEFT); + } } } - } - else if (keyboard.isKeyActive(keyboard.KEY_DIRECT_RIGHT)) - { - if (player_node->getDirection() != Being::RIGHT) + else if (keyboard.isKeyActive(keyboard.KEY_DIRECT_RIGHT)) { - if (Client::limitPackets(PACKET_DIRECTION)) + if (player_node->getDirection() != Being::RIGHT) { - player_node->setDirection(Being::RIGHT); - Net::getPlayerHandler()->setDirection(Being::RIGHT); + if (Client::limitPackets(PACKET_DIRECTION)) + { + player_node->setDirection(Being::RIGHT); + Net::getPlayerHandler()->setDirection(Being::RIGHT); + } } } } diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index a9e435540..b90b2ca77 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -41,7 +41,7 @@ #include "utils/dtor.h" -static const int MAX_ITEMS = 42; +static const int MAX_ITEMS = 44; EmoteShortcutContainer::EmoteShortcutContainer(): ShortcutContainer(), diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index fd3c3aa09..625e467fc 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -243,6 +243,10 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { KeyboardConfig::GRP_EMOTION}, {"keyEmoteShortcut42", SDLK_c, strprintf(_("Emote Shortcut %d"), 42), KeyboardConfig::GRP_EMOTION}, + {"keyEmoteShortcut43", SDLK_v, strprintf(_("Emote Shortcut %d"), 43), + KeyboardConfig::GRP_EMOTION}, + {"keyEmoteShortcut44", SDLK_b, strprintf(_("Emote Shortcut %d"), 44), + KeyboardConfig::GRP_EMOTION}, {"keyWearOutfit", SDLK_RCTRL, _("Wear Outfit"), KeyboardConfig::GRP_DEFAULT}, {"keyCopyOutfit", SDLK_RALT, _("Copy Outfit"), @@ -411,7 +415,7 @@ int KeyboardConfig::getKeyIndex(int keyValue, int grp) const int KeyboardConfig::getKeyEmoteOffset(int keyValue) const { - for (int i = KEY_EMOTE_1; i <= KEY_EMOTE_42; i++) + for (int i = KEY_EMOTE_1; i <= KEY_EMOTE_44; i++) { if (keyValue == mKey[i].value) return 1 + i - KEY_EMOTE_1; diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index dbc90d2c4..a493bcf16 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -265,6 +265,8 @@ class KeyboardConfig KEY_EMOTE_40, KEY_EMOTE_41, KEY_EMOTE_42, + KEY_EMOTE_43, + KEY_EMOTE_44, KEY_WEAR_OUTFIT, KEY_COPY_OUTFIT, KEY_COPY_EQUIPED_OUTFIT, -- cgit v1.2.3-60-g2f50