summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2009-05-18 18:18:23 +0100
committerDavid Athay <ko2fan@gmail.com>2009-05-18 18:18:23 +0100
commit72660d2c33773f0f74663efe6f9ac47648cdf283 (patch)
treee21d5a283eefaa5767d942f602c718eae42cbd4a /src/localplayer.cpp
parente7df8c9dd7ebc14c1263c19c6a238ebcf4fd9465 (diff)
downloadmana-72660d2c33773f0f74663efe6f9ac47648cdf283.tar.gz
mana-72660d2c33773f0f74663efe6f9ac47648cdf283.tar.bz2
mana-72660d2c33773f0f74663efe6f9ac47648cdf283.tar.xz
mana-72660d2c33773f0f74663efe6f9ac47648cdf283.zip
Added target combat
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index e9bc30f2..4c34394b 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -606,7 +606,7 @@ void LocalPlayer::emote(Uint8 emotion)
}
#ifdef TMWSERV_SUPPORT
-
+/*
void LocalPlayer::attack()
{
if (mLastAction != -1)
@@ -656,13 +656,14 @@ void LocalPlayer::attack()
}
Net::GameServer::Player::attack(getSpriteDirection());
}
-
+*/
void LocalPlayer::useSpecial(int special)
{
Net::GameServer::Player::useSpecial(special);
}
-#else
+#endif
+//#else
void LocalPlayer::attack(Being *target, bool keep)
{
@@ -676,9 +677,13 @@ void LocalPlayer::attack(Being *target, bool keep)
mLastTarget = -1;
setTarget(target);
}
-
+#ifdef TMWSERV_SUPPORT
+ int dist_x = target->getPixelX();
+ int dist_y = target->getPixelY();
+#else
int dist_x = target->mX - mX;
int dist_y = target->mY - mY;
+#endif
// Must be standing to attack
if (mAction != STAND)
@@ -699,8 +704,12 @@ void LocalPlayer::attack(Being *target, bool keep)
setDirection(LEFT);
}
+#ifdef TMWSERV_SUPPORT
+ mLastAction = tick_time;
+#else
mWalkTime = tick_time;
mTargetTime = tick_time;
+#endif
setAction(ATTACK);
@@ -715,14 +724,12 @@ void LocalPlayer::attack(Being *target, bool keep)
sound.playSfx("sfx/fist-swish.ogg");
}
- Net::getPlayerHandler()->attack(target);
+ Net::getPlayerHandler()->attack(target->getId());
if (!keep)
stopAttack();
}
-#endif // no TMWSERV_SUPPORT
-
void LocalPlayer::stopAttack()
{
if (mTarget)