summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
Diffstat (limited to 'src/being')
-rw-r--r--src/being/actor.cpp6
-rw-r--r--src/being/actor.h6
-rw-r--r--src/being/actorsprite.cpp54
-rw-r--r--src/being/actorsprite.h10
-rw-r--r--src/being/being.cpp42
-rw-r--r--src/being/being.h8
-rw-r--r--src/being/beingcacheentry.h6
-rw-r--r--src/being/beingflag.h6
-rw-r--r--src/being/beingspeech.h6
-rw-r--r--src/being/castingeffect.cpp6
-rw-r--r--src/being/castingeffect.h6
-rw-r--r--src/being/compounditem.h6
-rw-r--r--src/being/compoundsprite.cpp7
-rw-r--r--src/being/compoundsprite.h6
-rw-r--r--src/being/crazymoves.cpp6
-rw-r--r--src/being/crazymoves.h6
-rw-r--r--src/being/flooritem.cpp8
-rw-r--r--src/being/flooritem.h6
-rw-r--r--src/being/homunculusinfo.h6
-rw-r--r--src/being/localclan.cpp6
-rw-r--r--src/being/localclan.h6
-rw-r--r--src/being/localplayer.cpp142
-rw-r--r--src/being/localplayer.h18
-rw-r--r--src/being/mercenaryinfo.h6
-rw-r--r--src/being/petinfo.h6
-rw-r--r--src/being/playerignorestrategy.h6
-rw-r--r--src/being/playerinfo.cpp6
-rw-r--r--src/being/playerinfo.h6
-rw-r--r--src/being/playerrelation.cpp6
-rw-r--r--src/being/playerrelation.h6
-rw-r--r--src/being/playerrelations.cpp6
-rw-r--r--src/being/playerrelations.h6
32 files changed, 219 insertions, 214 deletions
diff --git a/src/being/actor.cpp b/src/being/actor.cpp
index 9b850d100..32dd516fa 100644
--- a/src/being/actor.cpp
+++ b/src/being/actor.cpp
@@ -1,10 +1,10 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 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
diff --git a/src/being/actor.h b/src/being/actor.h
index 11e15c969..c76411634 100644
--- a/src/being/actor.h
+++ b/src/being/actor.h
@@ -1,10 +1,10 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 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
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index 7bfb95df4..6c79488a1 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -1,10 +1,10 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 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
@@ -46,6 +46,7 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
#include "utils/foreach.h"
+#include "utils/performance.h"
#include "utils/timer.h"
#include "debug.h"
@@ -124,9 +125,7 @@ void ActorSprite::logic()
if (effect != nullptr &&
effect->mIsPersistent)
{
- updateStatusEffect(*it,
- Enable_true,
- IsStart_false);
+ updateStatusEffect(*it, Enable_true, IsStart_false);
}
}
}
@@ -228,9 +227,7 @@ static void applyEffectByOption(ActorSprite *const actor,
const Enable enable = (opt & option) != 0 ? Enable_true : Enable_false;
option |= opt;
option ^= opt;
- actor->setStatusEffect(id,
- enable,
- IsStart_false);
+ actor->setStatusEffect(id, enable, IsStart_false);
}
if (option != 0U &&
config.getBoolValue("unimplimentedLog"))
@@ -240,8 +237,8 @@ static void applyEffectByOption(ActorSprite *const actor,
"Left value: %u",
name,
option);
- logger->log(str);
- DebugMessageListener::distributeEvent(str);
+ logger->log(str);
+ DebugMessageListener::distributeEvent(str);
}
}
@@ -256,16 +253,12 @@ static void applyEffectByOption1(ActorSprite *const actor,
const int32_t id = (*it).second;
if (opt == option)
{
- actor->setStatusEffect(id,
- Enable_true,
- IsStart_false);
+ actor->setStatusEffect(id, Enable_true, IsStart_false);
option = 0U;
}
else
{
- actor->setStatusEffect(id,
- Enable_false,
- IsStart_false);
+ actor->setStatusEffect(id, Enable_false, IsStart_false);
}
}
if (option != 0 &&
@@ -276,12 +269,12 @@ static void applyEffectByOption1(ActorSprite *const actor,
"Left value: %u",
name,
option);
- logger->log(str);
- DebugMessageListener::distributeEvent(str);
+ logger->log(str);
+ DebugMessageListener::distributeEvent(str);
}
}
-void ActorSprite::setStatusEffectOpitons(const uint32_t option,
+void ActorSprite::setStatusEffectOptions(const uint32_t option,
const uint32_t opt1,
const uint32_t opt2,
const uint32_t opt3)
@@ -296,7 +289,7 @@ void ActorSprite::setStatusEffectOpitons(const uint32_t option,
StatusEffectDB::getOpt3Map());
}
-void ActorSprite::setStatusEffectOpitons(const uint32_t option,
+void ActorSprite::setStatusEffectOptions(const uint32_t option,
const uint32_t opt1,
const uint32_t opt2)
{
@@ -318,8 +311,9 @@ void ActorSprite::updateStatusEffect(const int32_t index,
const Enable newStatus,
const IsStart start)
{
- StatusEffect *const effect = StatusEffectDB::getStatusEffect(
- index, newStatus);
+ StatusEffect *const effect
+ = StatusEffectDB::getStatusEffect(index, newStatus);
+
if (effect == nullptr)
return;
if (effect->mIsPoison && getType() == ActorType::Player)
@@ -385,9 +379,10 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display,
{
if (display.image.empty())
{
- addSprite(AnimatedSprite::delayedLoad(pathJoin(
- paths.getStringValue("sprites"),
- paths.getStringValue("spriteErrorFile")),
+ addSprite(AnimatedSprite::delayedLoad(
+ pathJoin(
+ paths.getStringValue("sprites"),
+ paths.getStringValue("spriteErrorFile")),
0));
}
else
@@ -524,10 +519,9 @@ std::string ActorSprite::getStatusEffectsString() const
{
FOR_EACH (std::set<int32_t>::const_iterator, it, mStatusEffects)
{
- const StatusEffect *const effect =
- StatusEffectDB::getStatusEffect(
- *it,
- Enable_true);
+ const StatusEffect *const effect
+ = StatusEffectDB::getStatusEffect(*it, Enable_true);
+
if (effect == nullptr)
continue;
if (!effectsStr.empty())
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h
index 5b5b513ba..97be88653 100644
--- a/src/being/actorsprite.h
+++ b/src/being/actorsprite.h
@@ -1,10 +1,10 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 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
@@ -120,12 +120,12 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
const Enable active,
const IsStart start);
- void setStatusEffectOpitons(const uint32_t option,
+ void setStatusEffectOptions(const uint32_t option,
const uint32_t opt1,
const uint32_t opt2,
const uint32_t opt3);
- void setStatusEffectOpitons(const uint32_t option,
+ void setStatusEffectOptions(const uint32_t option,
const uint32_t opt1,
const uint32_t opt2);
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 1a9ce201f..980bec103 100644
--- a/src/being/being.cpp
+++ b/src/being/being.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
@@ -117,6 +117,7 @@
#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/likely.h"
+#include "utils/performance.h"
#include "utils/stdmove.h"
#include "utils/timer.h"
@@ -3999,16 +4000,40 @@ void Being::drawPlayerSpriteAt(Graphics *restrict const graphics,
localPlayer == this &&
mAction != BeingAction::DEAD)
{
+ int barX = x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX();
+ int barY = y + mapTileSize - 6 + mInfo->getHpBarOffsetY();
+ const int barW = 2 * 50;
+ const int barH = 4;
+
+ const bool drawMpBar =
+ PlayerInfo::getStatEffective(Attributes::PLAYER_MATK) > 0;
+ if (drawMpBar)
+ barY -= 3;
+
drawHpBar(graphics,
PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP),
PlayerInfo::getAttribute(Attributes::PLAYER_HP),
0,
UserColorId::PLAYER_HP_FG,
UserColorId::PLAYER_HP_BG,
- x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
- y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
- 2 * 50,
- 4);
+ barX,
+ barY,
+ barW,
+ barH);
+
+ if (drawMpBar)
+ {
+ drawHpBar(graphics,
+ PlayerInfo::getAttribute(Attributes::PLAYER_MAX_MP),
+ PlayerInfo::getAttribute(Attributes::PLAYER_MP),
+ 0,
+ UserColorId::PLAYER_MP_FG,
+ UserColorId::PLAYER_MP_BG,
+ barX,
+ barY + barH + 1,
+ barW,
+ barH);
+ }
}
}
@@ -4281,6 +4306,7 @@ void Being::drawPortalSpriteAt(Graphics *restrict const graphics,
CompoundSprite::drawSimple(graphics, x, y);
}
+// TODO: Additionally used for drawing the MP/SP bar
void Being::drawHpBar(Graphics *restrict const graphics,
const int maxHP,
const int hp,
@@ -4317,6 +4343,8 @@ void Being::drawHpBar(Graphics *restrict const graphics,
const int dx = static_cast<int>(static_cast<float>(width) / p);
#ifdef TMWA_SUPPORT
+ // TODO: this is support for pre-2015 TMWAthena, remove in 2025?
+ // See mana/verse!68.
if (!serverFeatures->haveServerHp())
{ // old servers
if ((damage == 0 && (this != localPlayer || hp == maxHP))
diff --git a/src/being/being.h b/src/being/being.h
index 678ea0c2a..320faa5e2 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -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
@@ -192,7 +192,7 @@ class Being notfinal : public ActorSprite,
* Puts a damage bubble above this being.
*
* @param attacker the attacking being
- * @param amount the amount of damage recieved (0 means miss)
+ * @param amount the amount of damage received (0 means miss)
* @param type the attack type
* @param attackId the attack id
* @param level the skill level
diff --git a/src/being/beingcacheentry.h b/src/being/beingcacheentry.h
index 5a584deea..4b251aa94 100644
--- a/src/being/beingcacheentry.h
+++ b/src/being/beingcacheentry.h
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* 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
diff --git a/src/being/beingflag.h b/src/being/beingflag.h
index f662ef6ab..7e93ea196 100644
--- a/src/being/beingflag.h
+++ b/src/being/beingflag.h
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* 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
diff --git a/src/being/beingspeech.h b/src/being/beingspeech.h
index 8d72f6f6d..e06927362 100644
--- a/src/being/beingspeech.h
+++ b/src/being/beingspeech.h
@@ -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
diff --git a/src/being/castingeffect.cpp b/src/being/castingeffect.cpp
index 88af882dd..9ceaf5b41 100644
--- a/src/being/castingeffect.cpp
+++ b/src/being/castingeffect.cpp
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* 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
diff --git a/src/being/castingeffect.h b/src/being/castingeffect.h
index a417e1069..1519d1a59 100644
--- a/src/being/castingeffect.h
+++ b/src/being/castingeffect.h
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* 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
diff --git a/src/being/compounditem.h b/src/being/compounditem.h
index 82be9a499..3880242df 100644
--- a/src/being/compounditem.h
+++ b/src/being/compounditem.h
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* 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
diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp
index da8d497a3..054da503c 100644
--- a/src/being/compoundsprite.cpp
+++ b/src/being/compoundsprite.cpp
@@ -1,10 +1,10 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 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
@@ -39,6 +39,7 @@
#include "utils/dtor.h"
#include "utils/foreach.h"
#include "utils/likely.h"
+#include "utils/performance.h"
#include "utils/sdlcheckutils.h"
#ifndef USE_SDL2
diff --git a/src/being/compoundsprite.h b/src/being/compoundsprite.h
index eee99a6a4..bb14815ee 100644
--- a/src/being/compoundsprite.h
+++ b/src/being/compoundsprite.h
@@ -1,10 +1,10 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 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
diff --git a/src/being/crazymoves.cpp b/src/being/crazymoves.cpp
index d757b1f8c..3d161cba8 100644
--- a/src/being/crazymoves.cpp
+++ b/src/being/crazymoves.cpp
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* 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
diff --git a/src/being/crazymoves.h b/src/being/crazymoves.h
index e7a3ec37e..8ccdaf30e 100644
--- a/src/being/crazymoves.h
+++ b/src/being/crazymoves.h
@@ -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
diff --git a/src/being/flooritem.cpp b/src/being/flooritem.cpp
index c618660f1..fbfcf2e83 100644
--- a/src/being/flooritem.cpp
+++ b/src/being/flooritem.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
@@ -43,6 +43,8 @@
#endif // TMWA_SUPPORT
#include "net/serverfeatures.h"
+#include "utils/performance.h"
+
#include "debug.h"
extern volatile time_t cur_time;
diff --git a/src/being/flooritem.h b/src/being/flooritem.h
index b63a02103..ac17fad71 100644
--- a/src/being/flooritem.h
+++ b/src/being/flooritem.h
@@ -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
diff --git a/src/being/homunculusinfo.h b/src/being/homunculusinfo.h
index 8f23ec430..f6b1c7456 100644
--- a/src/being/homunculusinfo.h
+++ b/src/being/homunculusinfo.h
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* 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
diff --git a/src/being/localclan.cpp b/src/being/localclan.cpp
index b8744e6ec..12a0b01ea 100644
--- a/src/being/localclan.cpp
+++ b/src/being/localclan.cpp
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2018-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
diff --git a/src/being/localclan.h b/src/being/localclan.h
index 9ad3628d4..36c0dae07 100644
--- a/src/being/localclan.h
+++ b/src/being/localclan.h
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2018-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
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 8f0f7a4cd..218a77ce2 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
@@ -91,6 +91,7 @@
#include "utils/delete2.h"
#include "utils/foreach.h"
#include "utils/gettext.h"
+#include "utils/performance.h"
#include "utils/timer.h"
#ifdef USE_MUMBLE
@@ -137,8 +138,7 @@ LocalPlayer::LocalPlayer(const BeingId id,
mPingTime(0),
mAfkTime(0),
mActivityTime(0),
- mNavigateX(0),
- mNavigateY(0),
+ mNavigateDest(0, 0),
mNavigateId(BeingId_zero),
mCrossX(0),
mCrossY(0),
@@ -178,7 +178,7 @@ LocalPlayer::LocalPlayer(const BeingId id,
mKeepAttacking(false),
mPathSetByMouse(false),
mWaitPing(false),
- mShowNavigePath(false),
+ mShowNavigatePath(false),
mAllowRename(false),
mFreezed(false)
{
@@ -282,7 +282,7 @@ void LocalPlayer::logic()
if (!mSyncPlayerMove)
dist = 20;
- if (((mNavigateX != 0) || (mNavigateY != 0)) &&
+ if (((mNavigateDest.x != 0) || (mNavigateDest.y != 0)) &&
((mCrossX + dist >= mX && mCrossX <= mX + dist
&& mCrossY + dist >= mY && mCrossY <= mY + dist)
|| ((mCrossX == 0) && (mCrossY == 0))))
@@ -300,10 +300,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,
@@ -329,14 +329,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
@@ -516,13 +517,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))
{
@@ -549,13 +548,13 @@ bool LocalPlayer::pickUp(FloorItem *const item)
break;
case 1:// should never happen due to above check for adjecent-tile
// pickup, but you never know.
- navigateTo(item->getTileX(), item->getTileY());
+ navigateTo({item->getTileX(), item->getTileY()});
break;
default:
{
// at least two spots, move nearby.
const Position& nearby = *(++debugPath.rbegin());
- navigateTo(nearby.x, nearby.y);
+ navigateTo(nearby);
break;
}
}
@@ -830,8 +829,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;
@@ -851,12 +850,11 @@ void LocalPlayer::attack(Being *const target,
setDirection(BeingDirection::LEFT);
}
}
-#endif // TMWA_SUPPORT
mActionTime = tick_time;
if (target->getType() != ActorType::Player
- || checAttackPermissions(target))
+ || checkAttackPermissions(target))
{
setAction(BeingAction::ATTACK, 0);
@@ -1059,8 +1057,7 @@ void LocalPlayer::setGotoTarget(Being *const target)
mPickUpTarget = nullptr;
setTarget(target);
mGoingToTarget = true;
- navigateTo(target->mX,
- target->mY);
+ navigateTo({target->mX, target->mY});
}
void LocalPlayer::handleStatusEffect(const StatusEffect *const effect,
@@ -1371,12 +1368,13 @@ void LocalPlayer::moveToTarget(int dist)
ServerType::TMWATHENA);
switch (dist)
{
- case 10:
+ case 10: // range
+ case 11: // archer
dist = mAttackRange;
if (dist == 1 && broken)
dist = 2;
break;
- case 11:
+ case 12: // range-1
dist = mAttackRange - 1;
if (dist < 1)
dist = 1;
@@ -1408,7 +1406,7 @@ void LocalPlayer::moveToTarget(int dist)
limit = CAST_S32(sz) - dist;
gotPos = true;
}
- else if ((mNavigateX != 0) || (mNavigateY != 0))
+ else if ((mNavigateDest.x != 0) || (mNavigateDest.y != 0))
{
debugPath = mNavigatePath;
limit = dist;
@@ -1420,7 +1418,7 @@ void LocalPlayer::moveToTarget(int dist)
if (dist == 0)
{
if (mTarget != nullptr)
- navigateTo(mTarget->mX, mTarget->mY);
+ navigateTo({mTarget->mX, mTarget->mY});
}
else
{
@@ -1433,12 +1431,12 @@ void LocalPlayer::moveToTarget(int dist)
{
pos = (*i);
}
- navigateTo(pos.x, pos.y);
+ navigateTo(pos);
}
}
else if ((mLastTargetX != 0) || (mLastTargetY != 0))
{
- navigateTo(mLastTargetX, mLastTargetY);
+ navigateTo({mLastTargetX, mLastTargetY});
}
}
@@ -1466,7 +1464,7 @@ void LocalPlayer::moveToHome()
}
else
{
- navigateTo(CAST_S32(pos.x), CAST_S32(pos.y));
+ navigateTo({CAST_S32(pos.x), CAST_S32(pos.y)});
}
}
}
@@ -1672,39 +1670,18 @@ bool LocalPlayer::pickUpItems(int pickUpType)
break;
case 4:
- if (!actorManager->pickUpAll(x - 1, y - 1, x + 1, y + 1, false))
- {
- if (actorManager->pickUpNearest(x, y, 4))
- status = true;
- }
- else
- {
+ if (actorManager->pickUpNearest(x, y, 4))
status = true;
- }
break;
case 5:
- if (!actorManager->pickUpAll(x - 1, y - 1, x + 1, y + 1, false))
- {
- if (actorManager->pickUpNearest(x, y, 8))
- status = true;
- }
- else
- {
+ if (actorManager->pickUpNearest(x, y, 8))
status = true;
- }
break;
case 6:
- if (!actorManager->pickUpAll(x - 1, y - 1, x + 1, y + 1, false))
- {
- if (actorManager->pickUpNearest(x, y, 90))
- status = true;
- }
- else
- {
+ if (actorManager->pickUpNearest(x, y, 90))
status = true;
- }
break;
default:
@@ -1731,8 +1708,11 @@ void LocalPlayer::moveByDirection(const unsigned char dir)
void LocalPlayer::specialMove(const unsigned char direction)
{
- if ((direction != 0U) && ((mNavigateX != 0) || (mNavigateY != 0)))
+ if ((direction != 0U)
+ && ((mNavigateDest.x != 0) || (mNavigateDest.y != 0)))
+ {
navigateClean();
+ }
if ((direction != 0U) && (settings.moveType >= 2
&& settings.moveType <= 4))
@@ -2134,7 +2114,8 @@ void LocalPlayer::afkRespond(ChatTab *const tab, const std::string &nick)
}
}
-bool LocalPlayer::navigateTo(const int x, const int y)
+
+bool LocalPlayer::navigateTo(const Position& to)
{
if (mMap == nullptr)
return false;
@@ -2143,20 +2124,19 @@ bool LocalPlayer::navigateTo(const int x, const int y)
if (tmpLayer == nullptr)
return false;
- mShowNavigePath = true;
+ mShowNavigatePath = true;
mOldX = mPixelX;
mOldY = mPixelY;
mOldTileX = mX;
mOldTileY = mY;
- mNavigateX = x;
- mNavigateY = y;
+ mNavigateDest = to;
mNavigateId = BeingId_zero;
mNavigatePath = mMap->findPath(
(mPixelX - mapTileSize / 2) / mapTileSize,
(mPixelY - mapTileSize) / mapTileSize,
- x,
- y,
+ to.x,
+ to.y,
getBlockWalkMask(),
0);
@@ -2165,18 +2145,18 @@ bool LocalPlayer::navigateTo(const int x, const int y)
return !mNavigatePath.empty();
}
+
void LocalPlayer::navigateClean()
{
if (mMap == nullptr)
return;
- mShowNavigePath = false;
+ mShowNavigatePath = false;
mOldX = 0;
mOldY = 0;
mOldTileX = 0;
mOldTileY = 0;
- mNavigateX = 0;
- mNavigateY = 0;
+ mNavigateDest = {0, 0};
mNavigateId = BeingId_zero;
mNavigatePath.clear();
@@ -2244,11 +2224,10 @@ void LocalPlayer::updateCoords()
navigateClean();
return;
}
- mNavigateX = being->mX;
- mNavigateY = being->mY;
+ mNavigateDest = {being->mX, being->mY};
}
- if (mNavigateX == x && mNavigateY == y)
+ if (mNavigateDest.x == x && mNavigateDest.y == y)
{
navigateClean();
return;
@@ -2265,7 +2244,7 @@ void LocalPlayer::updateCoords()
break;
}
}
- if (mDrawPath && mShowNavigePath)
+ if (mDrawPath && mShowNavigatePath)
{
tmpLayer->clean();
tmpLayer->addRoad(mNavigatePath);
@@ -2550,7 +2529,7 @@ void LocalPlayer::followMoveTo(const Being *const being,
being->mName == mPlayerFollowed)
{
mPickUpTarget = nullptr;
- navigateTo(x, y);
+ navigateTo({x, y});
}
}
@@ -2568,20 +2547,20 @@ void LocalPlayer::followMoveTo(const Being *const being,
switch (settings.followMode)
{
case 0:
- navigateTo(x1, y1);
+ navigateTo({x1, y1});
setNextDest(x2, y2);
break;
case 1:
if (x1 != x2 || y1 != y2)
{
- navigateTo(mX + x2 - x1, mY + y2 - y1);
+ navigateTo({mX + x2 - x1, mY + y2 - y1});
setNextDest(mX + x2 - x1, mY + y2 - y1);
}
break;
case 2:
if (x1 != x2 || y1 != y2)
{
- navigateTo(mX + x1 - x2, mY + y1 - y2);
+ navigateTo({mX + x1 - x2, mY + y1 - y2});
setNextDest(mX + x1 - x2, mY + y1 - y2);
}
break;
@@ -2659,13 +2638,13 @@ void LocalPlayer::fixPos()
#endif
setTileCoords(mCrossX, mCrossY);
/*
- if (mNavigateX != 0 || mNavigateY != 0)
+ if (mNavigateDest.x != 0 || mNavigateDest.y != 0)
{
#ifdef ENABLEDEBUGLOG
logger->dlog(strprintf("Renavigate to (%d,%d)",
- mNavigateX, mNavigateY));
+ mNavigateDest.x, mNavigateDest.y));
#endif
- navigateTo(mNavigateX, mNavigateY);
+ navigateTo({mNavigateDest.x, mNavigateDest.y});
}
*/
// alternative way to fix, move to real position
@@ -2731,6 +2710,7 @@ void LocalPlayer::fixAttackTarget()
if ((mMap == nullptr) || (mTarget == nullptr))
return;
+ // 11 == archer
if (settings.moveToTargetType == 11 || (settings.attackType == 0U)
|| !config.getBoolValue("autofixPos"))
{
@@ -2857,7 +2837,7 @@ void LocalPlayer::stopAdvert()
mBlockAdvert = true;
}
-bool LocalPlayer::checAttackPermissions(const Being *const target)
+bool LocalPlayer::checkAttackPermissions(const Being *const target)
{
if (target == nullptr)
return false;
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 05724a14a..2a63e9080 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -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
@@ -243,10 +243,11 @@ class LocalPlayer final : public Being,
static void setAfkMessage(std::string message);
- bool navigateTo(const int x, const int y);
+ bool navigateTo(const Position& to);
void navigateClean();
+
void imitateEmote(const Being *const being,
const unsigned char action) const;
@@ -390,8 +391,8 @@ class LocalPlayer final : public Being,
void addSpMessage(const int change);
- static bool checAttackPermissions(const Being *const target)
- A_WARN_UNUSED;
+ static bool checkAttackPermissions(const Being *const target)
+ A_WARN_UNUSED;
void updateStatus() const;
@@ -486,8 +487,7 @@ class LocalPlayer final : public Being,
time_t mPingTime;
time_t mAfkTime;
time_t mActivityTime;
- int mNavigateX;
- int mNavigateY;
+ Position mNavigateDest;
BeingId mNavigateId;
int mCrossX;
int mCrossY;
@@ -531,7 +531,7 @@ class LocalPlayer final : public Being,
// Tells if the path was set using mouse
bool mPathSetByMouse;
bool mWaitPing;
- bool mShowNavigePath;
+ bool mShowNavigatePath;
bool mAllowRename;
bool mFreezed;
};
diff --git a/src/being/mercenaryinfo.h b/src/being/mercenaryinfo.h
index 7671fadf3..0c766e80a 100644
--- a/src/being/mercenaryinfo.h
+++ b/src/being/mercenaryinfo.h
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* 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
diff --git a/src/being/petinfo.h b/src/being/petinfo.h
index 6109776ba..91864ed9d 100644
--- a/src/being/petinfo.h
+++ b/src/being/petinfo.h
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* 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
diff --git a/src/being/playerignorestrategy.h b/src/being/playerignorestrategy.h
index 9bd732f29..1ce3a38fa 100644
--- a/src/being/playerignorestrategy.h
+++ b/src/being/playerignorestrategy.h
@@ -1,11 +1,11 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2008-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
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index d99e6bd56..25605ff2b 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -1,10 +1,10 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 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
diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h
index ff1da6495..995fdd1bf 100644
--- a/src/being/playerinfo.h
+++ b/src/being/playerinfo.h
@@ -1,10 +1,10 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 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
diff --git a/src/being/playerrelation.cpp b/src/being/playerrelation.cpp
index b2cef86ee..863399124 100644
--- a/src/being/playerrelation.cpp
+++ b/src/being/playerrelation.cpp
@@ -1,11 +1,11 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2008-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
diff --git a/src/being/playerrelation.h b/src/being/playerrelation.h
index 4c9b5d31d..b69858028 100644
--- a/src/being/playerrelation.h
+++ b/src/being/playerrelation.h
@@ -1,11 +1,11 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2008-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
diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp
index 4fc4020d1..b61b66852 100644
--- a/src/being/playerrelations.cpp
+++ b/src/being/playerrelations.cpp
@@ -1,11 +1,11 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2008-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
diff --git a/src/being/playerrelations.h b/src/being/playerrelations.h
index 773f21bb3..7b06c569d 100644
--- a/src/being/playerrelations.h
+++ b/src/being/playerrelations.h
@@ -1,11 +1,11 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2008-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