]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/HeroTag.cpp
reworked gauges to better reflect the original ones
[l2e.git] / src / battle / HeroTag.cpp
index 96dedd9269e836037804c4d1a0c822375ca20763..3f9be08557fc45696dc4831f3cc54a6137fc351e 100644 (file)
@@ -30,8 +30,6 @@ void HeroTag::Render(SDL_Surface *screen, int width, int height, Point<int> posi
        Vector<int> alignOffset(align == LEFT ? 4 * res->heroTagFont->CharWidth() : 0, 0);
        frame->Draw(screen, position, width, height);
 
-       int yOffset((height - hero->Sprite()->Height()) / 2);
-
        // gauges
        // NOTE: assuming frame border is unit size until charsets are impemented
        int gaugeX((align == LEFT ? 10 : 6) * res->heroTagFont->CharWidth());
@@ -39,13 +37,13 @@ void HeroTag::Render(SDL_Surface *screen, int width, int height, Point<int> posi
        int gaugeWidth(width - gaugeX - (align == LEFT ? 1 : 5) * res->heroTagFont->CharWidth());
        // health gauge, second line
        Vector<int> healthGaugeOffset(gaugeX, frameOffset.Y() + res->heroTagFont->CharHeight());
-       res->healthGauge->Draw(screen, position + healthGaugeOffset, gaugeWidth, hero->RelativeHealth(gaugeWidth));
+       res->healthGauge->Draw(screen, position + healthGaugeOffset, gaugeWidth, hero->RelativeHealth(255));
        // mana gauge, third line
        Vector<int> manaGaugeOffset(gaugeX, frameOffset.Y() + 2 * res->heroTagFont->CharHeight());
-       res->manaGauge->Draw(screen, position + manaGaugeOffset, gaugeWidth, hero->RelativeMana(gaugeWidth));
+       res->manaGauge->Draw(screen, position + manaGaugeOffset, gaugeWidth, hero->RelativeMana(255));
        // ikari gauge, fourth line
        Vector<int> ikariGaugeOffset(gaugeX, frameOffset.Y() + 3 * res->heroTagFont->CharHeight());
-       res->ikariGauge->Draw(screen, position + ikariGaugeOffset, gaugeWidth, hero->RelativeIP(gaugeWidth));
+       res->ikariGauge->Draw(screen, position + ikariGaugeOffset, gaugeWidth, hero->RelativeIP(255));
 
        // labels
        int labelX((align == LEFT ? 5 : 1) * res->heroTagFont->CharWidth());
@@ -86,10 +84,13 @@ void HeroTag::Render(SDL_Surface *screen, int width, int height, Point<int> posi
        }
 
        // hero
-       Vector<int> heroOffset(
-                       (align == LEFT) ? yOffset : width - hero->Sprite()->Width() - yOffset,
-                       yOffset);
-       hero->Sprite()->Draw(screen, position + heroOffset, 0, hero->Health() > 0 ? 0 : 2);
+       hero->Sprite()->Draw(screen, position + HeroOffset(), 0, hero->Health() > 0 ? 0 : 2);
+}
+
+Vector<int> HeroTag::HeroOffset() const {
+       return Vector<int>(
+                       (align == LEFT) ? res->normalFont->CharWidth() : 10 * res->normalFont->CharWidth(),
+                       res->normalFont->CharWidth());
 }
 
 }