+ Vector<int> offset(CalculateScreenOffset(screen));
+ RenderBackground(screen, offset);
+ RenderMonsters(screen, offset);
+}
+
+void BattleState::RenderBackground(SDL_Surface *screen, const Vector<int> &offset) {
+ // black for now
+ SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 0, 0));
+ SDL_Rect destRect;
+ destRect.x = offset.X();
+ destRect.y = offset.Y();
+ destRect.w = background->w;
+ destRect.h = background->h;
+ SDL_BlitSurface(background, 0, screen, &destRect);
+}
+
+void BattleState::RenderMonsters(SDL_Surface *screen, const Vector<int> &offset) {
+ for (vector<Monster>::size_type i(0), end(monsters.size()); i < end; ++i) {
+ monsters[i].Sprite()->DrawCenterBottom(screen, monsterPositions[i] + offset);
+ }
+}
+
+void BattleState::RenderHeroes(SDL_Surface *screen, const Vector<int> &offset) {
+ for (int i(0); i < numHeroes; ++i) {
+ if (heroes[i].AttackAnimation() && heroes[i].AttackAnimation()->Running()) {
+ heroes[i].AttackAnimation()->DrawCenterBottom(screen, heroesPositions[i] + offset);
+ } else if (heroes[i].SpellAnimation() && heroes[i].SpellAnimation()->Running()) {
+ heroes[i].SpellAnimation()->DrawCenterBottom(screen, heroesPositions[i] + offset);
+ } else {
+ int row(heroes[i].Health() > 0 ? 0 : 2);
+ heroes[i].Sprite()->DrawCenterBottom(screen, heroesPositions[i] + offset, 1, row);
+ }
+ }
+}
+
+void BattleState::RenderHeroTags(SDL_Surface *screen, const Vector<int> &offset) {
+ int tagHeight(attackTypeMenu.Height());
+ int tagWidth(attackTypeMenu.Width() * 2 + attackTypeMenu.Width() / 2);
+
+ for (int i(0); i < numHeroes; ++i) {
+ heroTags[i].Render(screen, tagWidth, tagHeight, heroTagPositions[i] + offset, (int)i == activeHero);
+ }
+}
+
+void BattleState::RenderSmallHeroTags(SDL_Surface *screen, const Vector<int> &offset) {
+ int tagHeight(res->normalFont->CharHeight() * 4 + res->smallHeroTagFrame->BorderHeight() * 2);
+ int tagWidth(res->normalFont->CharWidth() * 6 + res->smallHeroTagFrame->BorderWidth() * 2);
+
+ SDL_Rect rect;
+ rect.x = offset.X();
+ rect.y = offset.Y() + BackgroundHeight() - tagHeight;
+ rect.w = BackgroundWidth();
+ rect.h = tagHeight;
+ SDL_FillRect(screen, &rect, SDL_MapRGB(screen->format, 0, 0, 0));
+ rect.y += res->normalFont->CharHeight() / 8;
+ rect.h -= res->normalFont->CharHeight() / 4;
+ SDL_FillRect(screen, &rect, res->heroesBgColor);
+
+ for (int i(0); i < numHeroes; ++i) {
+ smallHeroTags[i].Render(screen, tagWidth, tagHeight, smallHeroTagPositions[i] + offset);
+ }