X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmenu%2FHeroStatus.cpp;h=30091cb14ef56d09a3ebe5e36f1c6abeba03dcf5;hb=d71217e2be1466726581146000a0f61620423e9b;hp=6f8b341c6a754a4facbe628a15c2ea1902aa9107;hpb=aedf4ae020e3c811341df79ceae63ca56fb7ce83;p=l2e.git diff --git a/src/menu/HeroStatus.cpp b/src/menu/HeroStatus.cpp index 6f8b341..30091cb 100644 --- a/src/menu/HeroStatus.cpp +++ b/src/menu/HeroStatus.cpp @@ -1,10 +1,3 @@ -/* - * HeroStatus.cpp - * - * Created on: Oct 21, 2012 - * Author: holy - */ - #include "HeroStatus.h" #include "Resources.h" @@ -18,6 +11,7 @@ namespace menu { HeroStatus::HeroStatus() : res(0) +, party(0) , hero(0) { } @@ -28,55 +22,55 @@ HeroStatus::~HeroStatus() { int HeroStatus::Width() const { - return hero->BattleSprite()->Width() + res->statusFont->CharWidth() * 10; + return party[hero]->BattleSprite()->Width() + res->statusFont->CharWidth() * 11; } int HeroStatus::Height() const { - return hero->BattleSprite()->Height(); + return party[hero]->BattleSprite()->Height() + res->statusFont->CharWidth(); } void HeroStatus::Render(SDL_Surface *screen, const Vector &offset) const { - if (!hero) return; + if (!party) return; - hero->BattleSprite()->Draw(screen, position + offset, 0, 0); + party[hero]->BattleSprite()->Draw(screen, offset, 0, 0); // for some reason, fonts are shifted by one pixel in the original Vector nameOffset( - hero->BattleSprite()->Width(), + party[hero]->BattleSprite()->Width(), res->statusFont->CharHeight() * 7 / 8); - nameOffset += position + offset; - res->statusFont->DrawString(hero->Name(), screen, nameOffset, 5); + nameOffset += offset; + res->statusFont->DrawString(party[hero]->Name(), screen, nameOffset, 5); Vector levelLabelOffset(nameOffset.X() + 6 * res->statusFont->CharWidth(), nameOffset.Y()); res->statusLabels->Draw(screen, levelLabelOffset, 0, 0); Vector levelOffset(levelLabelOffset.X() + 2 * res->statusFont->CharWidth(), levelLabelOffset.Y()); - res->statusFont->DrawNumber(hero->Level(), screen, levelOffset, 2); + res->statusFont->DrawNumber(party[hero]->Level(), screen, levelOffset, 2); Vector healthLabelOffset(nameOffset.X(), nameOffset.Y() + res->statusFont->CharHeight()); res->statusLabels->Draw(screen, healthLabelOffset, 0, 1); Vector healthOffset(nameOffset.X() + 3 * res->statusFont->CharWidth(), nameOffset.Y() + res->statusFont->CharHeight()); - res->statusFont->DrawNumber(hero->Health(), screen, healthOffset, 3); + res->statusFont->DrawNumber(party[hero]->Health(), screen, healthOffset, 3); Vector healthSeparatorOffset(healthOffset.X() + 3 * res->statusFont->CharWidth(), healthOffset.Y()); res->statusFont->DrawChar('/', screen, healthSeparatorOffset); Vector maxHealthOffset(healthSeparatorOffset.X() + res->statusFont->CharWidth(), healthOffset.Y()); - res->statusFont->DrawNumber(hero->MaxHealth(), screen, maxHealthOffset, 3); + res->statusFont->DrawNumber(party[hero]->MaxHealth(), screen, maxHealthOffset, 3); Vector manaLabelOffset(healthLabelOffset.X(), healthLabelOffset.Y() + res->statusFont->CharHeight()); res->statusLabels->Draw(screen, manaLabelOffset, 0, 2); Vector manaOffset(healthOffset.X(), healthOffset.Y() + res->statusFont->CharHeight()); - res->statusFont->DrawNumber(hero->Mana(), screen, manaOffset, 3); + res->statusFont->DrawNumber(party[hero]->Mana(), screen, manaOffset, 3); Vector manaSeparatorOffset(healthSeparatorOffset.X(), manaOffset.Y()); res->statusFont->DrawChar('/', screen, manaSeparatorOffset); Vector maxManaOffset(maxHealthOffset.X(), manaOffset.Y()); - res->statusFont->DrawNumber(hero->MaxMana(), screen, maxManaOffset, 3); + res->statusFont->DrawNumber(party[hero]->MaxMana(), screen, maxManaOffset, 3); } }