#include "battle/Monster.h"
#include "battle/PartyLayout.h"
#include "battle/Resources.h"
+#include "common/GameConfig.h"
#include "common/GameState.h"
#include "common/Hero.h"
#include "common/Ikari.h"
using battle::BattleState;
using battle::Monster;
using battle::PartyLayout;
+using common::GameConfig;
using common::GameState;
using common::Hero;
using common::Ikari;
gameState.party[2] = &gameState.heroes[2];
gameState.party[3] = &gameState.heroes[3];
+ GameConfig gameConfig;
+ gameConfig.state = &gameState;
+ gameConfig.heroesLayout = caster.GetPartyLayout("heroesLayout");
+ gameConfig.battleResources = caster.GetBattleResources("battleResources");
+
// temporary test data
SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
PartyLayout monstersLayout(*caster.GetPartyLayout("monstersLayout"));
- PartyLayout heroesLayout(*caster.GetPartyLayout("heroesLayout"));
Monster monster(*caster.GetMonster("lizard"));
- battle::Resources *battleRes(caster.GetBattleResources("battleResources"));
-
gameState.heroes[0].AddSpell(caster.GetSpell("resetSpell"));
Spell *strongSpell(caster.GetSpell("strongSpell"));
gameState.heroes[0].AddSpell(strongSpell);
gameState.heroes[0].AddSpell(valorSpell);
gameState.heroes[1].AddSpell(valorSpell);
- Inventory inventory;
- inventory.Add(caster.GetItem("antidoteItem"), 9);
- inventory.Add(caster.GetItem("magicJarItem"), 4);
- inventory.Add(caster.GetItem("hiPotionItem"), 4);
- inventory.Add(caster.GetItem("powerPotionItem"), 4);
- inventory.Add(caster.GetItem("escapeItem"), 2);
- inventory.Add(caster.GetItem("sleepBallItem"), 1);
- battleRes->inventory = &inventory;
+ gameState.inventory.Add(caster.GetItem("antidoteItem"), 9);
+ gameState.inventory.Add(caster.GetItem("magicJarItem"), 4);
+ gameState.inventory.Add(caster.GetItem("hiPotionItem"), 4);
+ gameState.inventory.Add(caster.GetItem("powerPotionItem"), 4);
+ gameState.inventory.Add(caster.GetItem("escapeItem"), 2);
+ gameState.inventory.Add(caster.GetItem("sleepBallItem"), 1);
gameState.heroes[0].SetWeapon(caster.GetItem("zircoSwordItem"));
gameState.heroes[0].SetArmor(caster.GetItem("zirconArmorItem"));
map1.SetTileset(&tileset);
map1.SetTriggers(triggers1, 1);
map1.SetWidth(2);
+ map1.SetBattleBackground(bg);
Tile tiles3[64];
map2.SetTileset(&tileset);
map2.SetTriggers(triggers2, 1);
map2.SetWidth(1);
+ map2.SetBattleBackground(bg);
triggers1[0].map = &map2;
triggers1[0].target = Vector<int>(6, 2);
mapMonster.SetAnimation(&mapMonsterAnimation);
mapMonster.Position() = Vector<float>(64, 32);
mapMonster.SetOrientation(Entity::ORIENTATION_SOUTH);
+ mapMonster.SetPartyLayout(&monstersLayout);
+ mapMonster.SetMonsters(&monster, 1);
map1.SetEntities(&mapMonster, 1);
InitScreen screen(width, height);
app::State *state(0);
if (battle) {
- BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, battleRes));
+ BattleState *battleState(new BattleState(&gameConfig, bg, &monstersLayout));
battleState->AddMonster(monster);
battleState->AddMonster(monster);
battleState->AddMonster(monster);
battleState->AddHero(gameState.heroes[3]);
state = battleState;
} else {
- MapState *mapState(new MapState(&map1));
+ MapState *mapState(new MapState(&gameConfig, &map1));
mapState->ControlEntity(&gameState.heroes[0].MapEntity());
mapState->SetWalkingSpeed(walkSpeed);