diff options
Diffstat (limited to 'src/being/localplayer.cpp')
-rw-r--r-- | src/being/localplayer.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 1e2f16bea..e4285d991 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -299,10 +299,10 @@ void LocalPlayer::logic() { if (mMessageTime == 0) { - const MessagePair info = mMessages.front(); - if ((particleEngine != nullptr) && (gui != nullptr)) { + const MessagePair& info = mMessages.front(); + particleEngine->addTextRiseFadeOutEffect( info.first, mPixelX, @@ -328,14 +328,15 @@ void LocalPlayer::logic() else { // Find whether target is in range - const int rangeX = CAST_S32( - abs(mTarget->mX - mX)); - const int rangeY = CAST_S32( - abs(mTarget->mY - mY)); + const int dx = abs(mTarget->mX - mX); + const int dy = abs(mTarget->mY - mY); const int attackRange = getAttackRange(); - const TargetCursorTypeT targetType - = rangeX > attackRange || rangeY > attackRange - ? TargetCursorType::NORMAL : TargetCursorType::IN_RANGE; + const bool inRange = (dx <= attackRange + && dy <= attackRange); + const TargetCursorTypeT targetType = + inRange ? TargetCursorType::IN_RANGE + : TargetCursorType::NORMAL; + mTarget->setTargetType(targetType); if (!mTarget->isAlive() && (!mTargetDeadPlayers @@ -515,13 +516,11 @@ bool LocalPlayer::pickUp(FloorItem *const item) const int dx = item->getTileX() - mX; const int dy = item->getTileY() - mY; - int dist = 6; + const int maxTileDist = 1*1 + 1*1; // item in 3x3 area around player const unsigned int pickUpType = settings.pickUpType; - if (pickUpType >= 4 && pickUpType <= 6) - dist = 4; - if (dx * dx + dy * dy < dist) + if (dx*dx + dy*dy <= maxTileDist) { if ((actorManager != nullptr) && actorManager->checkForPickup(item)) { @@ -829,8 +828,8 @@ void LocalPlayer::attack(Being *const target, return; } -#ifdef TMWA_SUPPORT - if (Net::getNetworkType() == ServerType::TMWATHENA) + if ((mServerAttack == Keep_false) || + (Net::getNetworkType() == ServerType::TMWATHENA)) { const int dist_x = target->mX - mX; const int dist_y = target->mY - mY; @@ -850,7 +849,6 @@ void LocalPlayer::attack(Being *const target, setDirection(BeingDirection::LEFT); } } -#endif // TMWA_SUPPORT mActionTime = tick_time; |