}
void SelectIkari::ResumeState(Application &ctrl, SDL_Surface *screen) {
- if (battle->ActiveHeroTargets().HasSelected()) {
- battle->SetAttackType(AttackChoice::IKARI);
- battle->ActiveHeroAttackChoice().SetItem(battle->GetIkariMenu().Selected());
+ if (battle->ActiveHero().GetAttackChoice().Selection().HasSelected()) {
+ battle->ActiveHero().GetAttackChoice().SetType(AttackChoice::IKARI);
+ battle->ActiveHero().GetAttackChoice().SetItem(battle->GetIkariMenu().Selected());
ctrl.PopState();
}
}
void SelectIkari::HandleEvents(const Input &input) {
if (input.JustPressed(Input::ACTION_A)) {
if (battle->GetIkariMenu().SelectedIsEnabled() && battle->GetIkariMenu().Selected()->HasIkari()) {
+ AttackChoice &ac(battle->ActiveHero().GetAttackChoice());
const Ikari *ikari(battle->GetIkariMenu().Selected()->GetIkari());
- battle->ActiveHeroTargets().Reset();
+ ac.Selection().Reset();
if (ikari->GetTargetingMode().TargetsAlly()) {
- battle->ActiveHeroTargets().SelectHeroes();
+ ac.Selection().SelectHeroes();
} else {
- battle->ActiveHeroTargets().SelectEnemies();
+ ac.Selection().SelectEnemies();
}
if (ikari->GetTargetingMode().TargetsAll()) {
- battle->SetAttackType(AttackChoice::MAGIC);
+ ac.SetType(AttackChoice::MAGIC);
// TODO: remove item from inventory
- battle->ActiveHeroAttackChoice().SetItem(battle->GetIkariMenu().Selected());
+ ac.SetItem(battle->GetIkariMenu().Selected());
battle->NextHero();
ctrl->PopState();
} else {
if (ikari->GetTargetingMode().TargetsSingle()) {
- battle->ActiveHeroTargets().SetSingle();
+ ac.Selection().SetSingle();
} else {
- battle->ActiveHeroTargets().SetMultiple();
+ ac.Selection().SetMultiple();
}
- ctrl->PushState(new SelectTarget(battle, parent, &battle->ActiveHeroTargets(), ikari->IsMagical() ? battle->Res().magicTargetCursor : battle->Res().weaponTargetCursor));
+ ctrl->PushState(new SelectTarget(battle, parent, &ac.Selection(), ikari->IsMagical() ? battle->Res().magicTargetCursor : battle->Res().weaponTargetCursor));
}
}
}
void SelectIkari::RenderFrame(SDL_Surface *screen, const Vector<int> &offset) {
const Frame *frame(battle->Res().selectFrame);
Point<int> position(frame->BorderWidth(), frame->BorderHeight());
- int width(battle->BackgroundWidth() - 2 * frame->BorderWidth());
+ int width(battle->Width() - 2 * frame->BorderWidth());
int height(battle->Res().normalFont->CharHeight() * 13);
frame->Draw(screen, position + offset, width, height);
}