From 72660d2c33773f0f74663efe6f9ac47648cdf283 Mon Sep 17 00:00:00 2001 From: David Athay Date: Mon, 18 May 2009 18:18:23 +0100 Subject: Added target combat --- src/localplayer.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/localplayer.cpp') 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) -- cgit v1.2.3-70-g09d2