#include "../common/GameState.h"
#include "../common/Hero.h"
#include "../common/Item.h"
+#include "../common/Stats.h"
#include "../graphics/Font.h"
using app::Input;
using common::Hero;
using common::Item;
+using common::Stats;
using geometry::Vector;
using graphics::Font;
5 * parent->Res().statusFont->CharWidth(),
parent->Res().statusFont->CharHeight());
Vector<int> statsOffset(
+ 4 * parent->Res().statusFont->CharWidth(),
+ 8 * parent->Res().statusFont->CharHeight() - parent->Res().statusFont->CharHeight() / 8);
+ Vector<int> equipOffset(
17 * parent->Res().statusFont->CharWidth(),
4 * parent->Res().statusFont->CharHeight() - parent->Res().statusFont->CharHeight() / 8);
parent->RenderBackground(screen);
parent->Res().shoulderNav->Draw(screen, offset + shoulderNavOffset);
RenderStatus(screen, offset + parent->StatusOffset(0));
- RenderEquipment(screen, offset + statsOffset);
+ RenderStats(screen, offset + statsOffset);
+ RenderEquipment(screen, offset + equipOffset);
}
int StatusMenu::Width() const {
parent->GetHeroStatus(cursor).Render(screen, offset);
}
-void StatusMenu::RenderEquipment(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+void StatusMenu::RenderStats(SDL_Surface *screen, const Vector<int> &offset) const {
+ const Stats &stats(parent->Game().state->party[cursor]->GetStats());
+ Vector<int> lineBreak(0, parent->Res().statusFont->CharHeight());
+
+ Vector<int> position(offset);
+ RenderStatsLine(parent->Res().atpLabel, stats.Attack(), screen, position);
+
+ position += lineBreak;
+ RenderStatsLine(parent->Res().dfpLabel, stats.Defense(), screen, position);
+
+ position += lineBreak;
+ RenderStatsLine(parent->Res().strLabel, stats.Strength(), screen, position);
+
+ position += lineBreak;
+ RenderStatsLine(parent->Res().aglLabel, stats.Agility(), screen, position);
+
+ position += lineBreak;
+ RenderStatsLine(parent->Res().intLabel, stats.Intelligence(), screen, position);
+
+ position += lineBreak;
+ RenderStatsLine(parent->Res().gutLabel, stats.Gut(), screen, position);
+
+ position += lineBreak;
+ RenderStatsLine(parent->Res().mgrLabel, stats.MagicResistance(), screen, position);
+}
+
+void StatusMenu::RenderStatsLine(const char *label, int number, SDL_Surface *screen, const Vector<int> &position) const {
+ const Font &font(*parent->Res().statusFont);
+ const Vector<int> numberOffset(4 * font.CharWidth(), 0);
+
+ font.DrawString(label, screen, position, 3);
+ font.DrawNumber(number, screen, position + numberOffset, 3);
+}
+
+void StatusMenu::RenderEquipment(SDL_Surface *screen, const Vector<int> &offset) const {
const Hero &hero(*parent->Game().state->party[cursor]);
Vector<int> lineBreak(0, 2 * parent->Res().statusFont->CharHeight());