X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.h;h=0f51f237cd2a47138ac222127f269a15f477aca8;hb=5228f225de7e2c047d3ddf0b9edfc9a05c4ea167;hp=e002b7c026d8c33816d5bfadf5f213b9606fadf3;hpb=06b6411e5dc8fc6b905530f7adbde8bd0c2bb0ea;p=l2e.git diff --git a/src/battle/BattleState.h b/src/battle/BattleState.h index e002b7c..0f51f23 100644 --- a/src/battle/BattleState.h +++ b/src/battle/BattleState.h @@ -1,10 +1,3 @@ -/* - * BattleState.h - * - * Created on: Aug 5, 2012 - * Author: holy - */ - #ifndef BATTLE_BATTLESTATE_H_ #define BATTLE_BATTLESTATE_H_ @@ -18,6 +11,7 @@ #include "SmallHeroTag.h" #include "../app/fwd.h" #include "../app/State.h" +#include "../common/GameConfig.h" #include "../common/fwd.h" #include "../common/Stats.h" #include "../geometry/Vector.h" @@ -35,11 +29,12 @@ class BattleState : public app::State { public: - BattleState(SDL_Surface *background, const PartyLayout &monstersLayout, const PartyLayout &heroesLayout, const Resources *res) - : background(background) - , monstersLayout(&monstersLayout) - , heroesLayout(&heroesLayout) - , res(res) + BattleState(common::GameConfig *game, SDL_Surface *background, const PartyLayout *monstersLayout) + : game(game) + , background(background) + , monstersLayout(monstersLayout) + , heroesLayout(game->heroesLayout) + , res(game->battleResources) , attackTypeMenu(res->attackIcons) , moveMenu(res->moveIcons) , numHeroes(0) @@ -47,20 +42,13 @@ public: , attackCursor(-1) , expReward(0) , goldReward(0) - , ranAway(false) { assert(background && res); } + , ranAway(false) { assert(background && monstersLayout && game); } public: void AddMonster(const Monster &); void AddHero(const Hero &); public: - virtual void EnterState(app::Application &ctrl, SDL_Surface *screen); - virtual void ExitState(app::Application &ctrl, SDL_Surface *screen); - virtual void ResumeState(app::Application &ctrl, SDL_Surface *screen); - virtual void PauseState(app::Application &ctrl, SDL_Surface *screen); - - virtual void Resize(int width, int height); - virtual void HandleEvents(const app::Input &); virtual void UpdateWorld(float deltaT); virtual void Render(SDL_Surface *); @@ -135,6 +123,14 @@ public: void RenderHeroTags(SDL_Surface *screen, const geometry::Vector &offset); void RenderSmallHeroTags(SDL_Surface *screen, const geometry::Vector &offset); +private: + virtual void OnEnterState(SDL_Surface *screen); + virtual void OnExitState(SDL_Surface *screen); + virtual void OnResumeState(SDL_Surface *screen); + virtual void OnPauseState(SDL_Surface *screen); + + virtual void OnResize(int width, int height); + private: void LoadInventory(); @@ -143,6 +139,7 @@ private: Uint16 CalculateDamage(const common::Stats &attacker, const common::Stats &defender) const; private: + common::GameConfig *game; SDL_Surface *background; const PartyLayout *monstersLayout; const PartyLayout *heroesLayout;