AttackTypeMenu &GetAttackTypeMenu() { return attackTypeMenu; }
MoveMenu &GetMoveMenu() { return moveMenu; }
- graphics::Menu<const common::Spell *> &GetSpellMenu() { assert(activeHero >= 0 && activeHero < NumHeroes()); return heroes[activeHero].SpellMenu(); }
- const graphics::Menu<const common::Spell *> &GetSpellMenu() const { assert(activeHero >= 0 && activeHero < NumHeroes()); return heroes[activeHero].SpellMenu(); }
- graphics::Menu<const common::Item *> &GetIkariMenu() { assert(activeHero >= 0 && activeHero < NumHeroes()); return heroes[activeHero].IkariMenu(); }
- const graphics::Menu<const common::Item *> &GetIkariMenu() const { assert(activeHero >= 0 && activeHero < NumHeroes()); return heroes[activeHero].IkariMenu(); }
graphics::Menu<const common::Item *> &GetItemMenu() { return itemMenu; }
const graphics::Menu<const common::Item *> &GetItemMenu() const { return itemMenu; }
void SelectIkari::ResumeState(Application &ctrl, SDL_Surface *screen) {
if (battle->ActiveHero().GetAttackChoice().Selection().HasSelected()) {
battle->ActiveHero().GetAttackChoice().SetType(AttackChoice::IKARI);
- battle->ActiveHero().GetAttackChoice().SetItem(battle->GetIkariMenu().Selected());
+ battle->ActiveHero().GetAttackChoice().SetItem(battle->ActiveHero().IkariMenu().Selected());
ctrl.PopState();
}
}
void SelectIkari::HandleEvents(const Input &input) {
if (input.JustPressed(Input::ACTION_A)) {
- if (battle->GetIkariMenu().SelectedIsEnabled() && battle->GetIkariMenu().Selected()->HasIkari()) {
+ if (battle->ActiveHero().IkariMenu().SelectedIsEnabled() && battle->ActiveHero().IkariMenu().Selected()->HasIkari()) {
AttackChoice &ac(battle->ActiveHero().GetAttackChoice());
- const Ikari *ikari(battle->GetIkariMenu().Selected()->GetIkari());
+ const Ikari *ikari(battle->ActiveHero().IkariMenu().Selected()->GetIkari());
ac.Selection().Reset();
if (ikari->GetTargetingMode().TargetsAlly()) {
ac.Selection().SelectHeroes();
if (ikari->GetTargetingMode().TargetsAll()) {
ac.SetType(AttackChoice::MAGIC);
// TODO: remove item from inventory
- ac.SetItem(battle->GetIkariMenu().Selected());
+ ac.SetItem(battle->ActiveHero().IkariMenu().Selected());
battle->NextHero();
ctrl->PopState();
} else {
ctrl->PopState(); // return control to parent
}
if (input.JustPressed(Input::PAD_UP)) {
- battle->GetIkariMenu().PreviousRow();
+ battle->ActiveHero().IkariMenu().PreviousRow();
}
if (input.JustPressed(Input::PAD_RIGHT)) {
- battle->GetIkariMenu().NextItem();
+ battle->ActiveHero().IkariMenu().NextItem();
}
if (input.JustPressed(Input::PAD_DOWN)) {
- battle->GetIkariMenu().NextRow();
+ battle->ActiveHero().IkariMenu().NextRow();
}
if (input.JustPressed(Input::PAD_LEFT)) {
- battle->GetIkariMenu().PreviousItem();
+ battle->ActiveHero().IkariMenu().PreviousItem();
}
}
Point<int> position(
2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(),
2 * res.selectFrame->BorderHeight() + 2 * res.normalFont->CharHeight());
- battle->GetIkariMenu().Draw(screen, position + offset);
+ battle->ActiveHero().IkariMenu().Draw(screen, position + offset);
}
}
void SelectSpell::ResumeState(Application &ctrl, SDL_Surface *screen) {
if (battle->ActiveHero().GetAttackChoice().Selection().HasSelected()) {
battle->ActiveHero().GetAttackChoice().SetType(AttackChoice::MAGIC);
- battle->ActiveHero().GetAttackChoice().SetSpell(battle->GetSpellMenu().Selected());
+ battle->ActiveHero().GetAttackChoice().SetSpell(battle->ActiveHero().SpellMenu().Selected());
ctrl.PopState();
}
}
void SelectSpell::HandleEvents(const Input &input) {
if (input.JustPressed(Input::ACTION_A)) {
- if (battle->GetSpellMenu().SelectedIsEnabled()) {
+ if (battle->ActiveHero().SpellMenu().SelectedIsEnabled()) {
AttackChoice &ac(battle->ActiveHero().GetAttackChoice());
- const Spell *spell(battle->GetSpellMenu().Selected());
+ const Spell *spell(battle->ActiveHero().SpellMenu().Selected());
ac.Selection().Reset();
if (spell->GetTargetingMode().TargetsAlly()) {
ac.Selection().SelectHeroes();
ctrl->PopState(); // return control to parent
}
if (input.JustPressed(Input::PAD_UP)) {
- battle->GetSpellMenu().PreviousRow();
+ battle->ActiveHero().SpellMenu().PreviousRow();
}
if (input.JustPressed(Input::PAD_RIGHT)) {
- battle->GetSpellMenu().NextItem();
+ battle->ActiveHero().SpellMenu().NextItem();
}
if (input.JustPressed(Input::PAD_DOWN)) {
- battle->GetSpellMenu().NextRow();
+ battle->ActiveHero().SpellMenu().NextRow();
}
if (input.JustPressed(Input::PAD_LEFT)) {
- battle->GetSpellMenu().PreviousItem();
+ battle->ActiveHero().SpellMenu().PreviousItem();
}
}
Point<int> position(
2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(),
2 * res.selectFrame->BorderHeight() + 2 * res.normalFont->CharHeight());
- battle->GetSpellMenu().Draw(screen, position + offset);
+ battle->ActiveHero().SpellMenu().Draw(screen, position + offset);
}
}