X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FHeroTag.cpp;h=a83ba8b9fc1f019dd5695816db09388cb653d5fe;hb=b7a90738b9ae701cfc86bf74a11ba59d7fcb17ba;hp=531031f8e93868b2cb8143b40c650b6e424d6a0f;hpb=e16f1b77f9d7f09d232cfe34e4fc8b4be06f571d;p=l2e.git diff --git a/src/battle/HeroTag.cpp b/src/battle/HeroTag.cpp index 531031f..a83ba8b 100644 --- a/src/battle/HeroTag.cpp +++ b/src/battle/HeroTag.cpp @@ -7,6 +7,7 @@ #include "HeroTag.h" +#include "AttackChoice.h" #include "Hero.h" #include "Resources.h" #include "../geometry/operators.h" @@ -29,8 +30,6 @@ void HeroTag::Render(SDL_Surface *screen, int width, int height, Point posi Vector 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()); @@ -78,11 +77,20 @@ void HeroTag::Render(SDL_Surface *screen, int width, int height, Point posi // name res->normalFont->DrawString(hero->Name(), screen, position + frameOffset + alignOffset, 5); + // attack icon + if (choice->GetType() != AttackChoice::UNDECIDED) { + Vector attackIconOffset(labelX + res->heroTagLabels->Width(), frameOffset.Y() + 3 * res->heroTagFont->CharHeight()); + res->attackChoiceIcons->Draw(screen, position + attackIconOffset, 0, choice->GetType()); + } + // hero - Vector 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 HeroTag::HeroOffset() const { + return Vector( + (align == LEFT) ? res->normalFont->CharWidth() : 10 * res->normalFont->CharWidth(), + res->normalFont->CharWidth()); } }