| 1417 | } |
| 1418 | |
| 1419 | Scene_Battle_Rpg2k3::SceneActionReturn Scene_Battle_Rpg2k3::ProcessSceneActionCommand() { |
| 1420 | assert(active_actor != nullptr); |
| 1421 | enum SubState { |
| 1422 | eBegin, |
| 1423 | eWaitInput, |
| 1424 | }; |
| 1425 | |
| 1426 | if (scene_action_substate == eBegin) { |
| 1427 | ResetWindows(true); |
| 1428 | target_window->SetIndex(-1); |
| 1429 | |
| 1430 | status_window->SetVisible(true); |
| 1431 | command_window->SetVisible(true); |
| 1432 | if (lcf::Data::battlecommands.battle_type == lcf::rpg::BattleCommands::BattleType_traditional) { |
| 1433 | target_window->SetVisible(true); |
| 1434 | } |
| 1435 | command_window->SetActive(true); |
| 1436 | |
| 1437 | SetSceneActionSubState(eWaitInput); |
| 1438 | } |
| 1439 | |
| 1440 | // If any battler is waiting to attack, immediately interrupt and do the attack. |
| 1441 | if (Main_Data::game_system->GetAtbMode() == lcf::rpg::SaveSystem::AtbMode_atb_active && IsBattleActionPending()) { |
| 1442 | SetState(State_Battle); |
| 1443 | return SceneActionReturn::eContinueThisFrame; |
| 1444 | } |
| 1445 | |
| 1446 | if (scene_action_substate == eWaitInput) { |
| 1447 | if (Input::IsTriggered(Input::DECISION)) { |
| 1448 | int index = command_window->GetIndex(); |
| 1449 | // Row command always uses the last index |
| 1450 | if (!Feature::HasRow() || !lcf::Data::battlecommands.easyrpg_enable_battle_row_command || index < command_window->GetRowMax() - 1) { |
| 1451 | const auto* command = active_actor->GetBattleCommand(index); |
| 1452 | |
| 1453 | if (command) { |
| 1454 | active_actor->SetLastBattleAction(command->ID); |
| 1455 | switch (command->type) { |
| 1456 | case lcf::rpg::BattleCommand::Type_attack: |
| 1457 | AttackSelected(); |
| 1458 | break; |
| 1459 | case lcf::rpg::BattleCommand::Type_defense: |
| 1460 | DefendSelected(); |
| 1461 | break; |
| 1462 | case lcf::rpg::BattleCommand::Type_escape: |
| 1463 | EscapeSelected(); |
| 1464 | break; |
| 1465 | case lcf::rpg::BattleCommand::Type_item: |
| 1466 | Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Decision)); |
| 1467 | SetState(State_SelectItem); |
| 1468 | break; |
| 1469 | case lcf::rpg::BattleCommand::Type_skill: |
| 1470 | Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Decision)); |
| 1471 | skill_window->SetSubsetFilter(0); |
| 1472 | RecreateSpWindow(active_actor); |
| 1473 | SetState(State_SelectSkill); |
| 1474 | break; |
| 1475 | case lcf::rpg::BattleCommand::Type_special: |
| 1476 | Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Decision)); |
nothing calls this directly
no test coverage detected