MCPcopy Create free account
hub / github.com/EasyRPG/Player / ProcessSceneActionFightAutoEscape

Method ProcessSceneActionFightAutoEscape

src/scene_battle_rpg2k.cpp:434–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434Scene_Battle_Rpg2k::SceneActionReturn Scene_Battle_Rpg2k::ProcessSceneActionFightAutoEscape() {
435 enum SubState {
436 eBegin,
437 eCheckEvents,
438 eMoveWindow,
439 eWaitForInput,
440 };
441
442 if (scene_action_substate == eBegin) {
443 ResetWindows(true);
444 battle_message_window->SetVisible(true);
445
446 SetSceneActionSubState(eCheckEvents);
447 }
448
449 if (scene_action_substate == eCheckEvents) {
450 if (!CheckBattleEndAndScheduleEvents()) {
451 return SceneActionReturn::eContinueThisFrame;
452 }
453
454 // No Auto battle/Escape when all actors are sleeping or similar
455 if (!Main_Data::game_party->IsAnyControllable()) {
456 SetState(State_SelectActor);
457 return SceneActionReturn::eContinueThisFrame;
458 }
459
460 SetSceneActionSubState(eMoveWindow);
461 }
462
463 if (scene_action_substate == eMoveWindow) {
464 options_window->SetVisible(true);
465 status_window->SetVisible(true);
466 status_window->SetIndex(-1);
467 command_window->SetIndex(-1);
468 command_window->SetVisible(true);
469 battle_message_window->SetVisible(false);
470 status_window->Refresh();
471
472 if (previous_state == State_SelectCommand) {
473 MoveCommandWindows(Player::menu_offset_x, 8);
474 } else {
475 SetCommandWindowsX();
476 }
477 SetSceneActionSubState(eWaitForInput);
478 // Prevent that DECISION from a closed message triggers a battle option in eWaitForInput
479 Input::ResetTriggerKeys();
480 return SceneActionReturn::eContinueThisFrame;
481 }
482
483 if (scene_action_substate == eWaitForInput) {
484 options_window->SetActive(true);
485
486 if (Input::IsTriggered(Input::DECISION)) {
487 if (!message_window->IsVisible()) {
488 switch (battle_options[options_window->GetIndex()]) {
489 case Battle: // Battle
490 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Decision));
491 RefreshTargetWindow();

Callers

nothing calls this directly

Calls 10

IsAnyControllableMethod · 0.80
SePlayMethod · 0.80
GetEnemiesMethod · 0.80
KillMethod · 0.80
SetVisibleMethod · 0.45
SetIndexMethod · 0.45
RefreshMethod · 0.45
SetActiveMethod · 0.45
IsVisibleMethod · 0.45
GetIndexMethod · 0.45

Tested by

no test coverage detected