summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-28 18:48:09 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-28 18:48:09 +0300
commit36f19b67df5ba7b00e91d9a234088f276b8bf513 (patch)
treee6bcba65ee03e34bcb0b7566090e17798cf182ce
parent39c0baaad44c49c41ac9311bcf39c2844a49e921 (diff)
downloadmanaverse-36f19b67df5ba7b00e91d9a234088f276b8bf513.tar.gz
manaverse-36f19b67df5ba7b00e91d9a234088f276b8bf513.tar.bz2
manaverse-36f19b67df5ba7b00e91d9a234088f276b8bf513.tar.xz
manaverse-36f19b67df5ba7b00e91d9a234088f276b8bf513.zip
Add untarget key. By default unassigned.
It remove targeting but not stop server side attack.
-rw-r--r--src/game.cpp10
-rw-r--r--src/keyboardconfig.cpp2
-rw-r--r--src/keyboardconfig.h1
-rw-r--r--src/localplayer.cpp5
-rw-r--r--src/localplayer.h2
5 files changed, 17 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 81f987376..0527e8481 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1148,6 +1148,7 @@ void Game::handleInput()
&& !NpcDialog::isAnyInputFocused()
&& (!player_node || !player_node->getAwayMode())
&& !keyboard.isKeyActive(keyboard.KEY_TARGET)
+ && !keyboard.isKeyActive(keyboard.KEY_UNTARGET)
&& !InventoryWindow::isAnyInputFocused())
{
// const int tKey = keyboard.getKeyIndex(event.key.keysym.sym);
@@ -1611,7 +1612,8 @@ void Game::handleInput()
keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) ||
keyboard.isKeyActive(keyboard.KEY_TARGET_NPC) ||
(joystick && joystick->buttonPressed(3))) &&
- !keyboard.isKeyActive(keyboard.KEY_TARGET))
+ !keyboard.isKeyActive(keyboard.KEY_TARGET) &&
+ !keyboard.isKeyActive(keyboard.KEY_UNTARGET))
{
ActorSprite::Type currentTarget = ActorSprite::UNKNOWN;
if (keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) ||
@@ -1663,10 +1665,12 @@ void Game::handleInput()
// Stop attacking if the right key is pressed
if (!keyboard.isKeyActive(keyboard.KEY_ATTACK)
- && keyboard.isKeyActive(keyboard.KEY_TARGET)
&& !keyboard.isKeyActive(keyboard.KEY_EMOTE))
{
- player_node->stopAttack();
+ if (keyboard.isKeyActive(keyboard.KEY_TARGET))
+ player_node->stopAttack();
+ else if (keyboard.isKeyActive(keyboard.KEY_UNTARGET))
+ player_node->untarget();
}
if (joystick)
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index f9831c18f..fdc8201ca 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -61,6 +61,8 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = {
KeyboardConfig::GRP_DEFAULT},
{"keyTalk", SDLK_t, N_("Talk"), KeyboardConfig::GRP_DEFAULT},
{"keyTarget", SDLK_LSHIFT, N_("Stop Attack"), KeyboardConfig::GRP_DEFAULT},
+ {"keyUnTarget", KeyboardConfig::KEY_NO_VALUE,
+ N_("Untarget"), KeyboardConfig::GRP_DEFAULT},
{"keyTargetClosest", SDLK_a, N_("Target Closest"),
KeyboardConfig::GRP_DEFAULT},
{"keyTargetNPC", SDLK_n, N_("Target NPC"), KeyboardConfig::GRP_DEFAULT},
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h
index bfec0fc87..b322eb6d1 100644
--- a/src/keyboardconfig.h
+++ b/src/keyboardconfig.h
@@ -174,6 +174,7 @@ class KeyboardConfig
KEY_MOVE_TO_POINT,
KEY_TALK,
KEY_TARGET,
+ KEY_UNTARGET,
KEY_TARGET_CLOSEST,
KEY_TARGET_NPC,
KEY_TARGET_PLAYER,
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 324f3af54..721c71b1a 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1389,6 +1389,11 @@ void LocalPlayer::stopAttack()
if (mServerAttack && mAction == ATTACK)
Net::getPlayerHandler()->stopAttack();
+ untarget();
+}
+
+void LocalPlayer::untarget()
+{
if (mAction == ATTACK)
setAction(STAND);
diff --git a/src/localplayer.h b/src/localplayer.h
index 278598d58..bbd17f53c 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -152,6 +152,8 @@ class LocalPlayer : public Being, public ActorSpriteListener,
void stopAttack();
+ void untarget();
+
/**
* Returns the current target of the player. Returns 0 if no being is
* currently targeted.