summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 1a9ce201f..7886f99d6 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
@@ -3999,16 +3999,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 +4305,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 +4342,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/plus!68.
if (!serverFeatures->haveServerHp())
{ // old servers
if ((damage == 0 && (this != localPlayer || hp == maxHP))