X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmenu%2FHeroStatus.cpp;h=919fd8553065dae2ca56524a3824c2561d60418f;hb=a3ba4dc677ad7c92eeb78b20b642241563605c9d;hp=2d038b1a3c69b247f661b4fe807c72c2a8ee5def;hpb=243cb7d922fe888be8d18241de138ad5949de430;p=l2e.git diff --git a/src/menu/HeroStatus.cpp b/src/menu/HeroStatus.cpp index 2d038b1..919fd85 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" @@ -12,12 +5,13 @@ #include "../graphics/Font.h" #include "../graphics/Sprite.h" -using geometry::Vector; +using math::Vector; 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() * 11; + return party[hero]->BattleSprite()->Width() + res->statusFont->CharWidth() * 11; } int HeroStatus::Height() const { - return hero->BattleSprite()->Height() + res->statusFont->CharWidth(); + 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, 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 += offset; - res->statusFont->DrawString(hero->Name(), screen, nameOffset, 5); + 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); } }