diff --git a/src/scene_battle.h b/src/scene_battle.h index 6f80662267..8c7e6ddb2e 100644 --- a/src/scene_battle.h +++ b/src/scene_battle.h @@ -64,6 +64,8 @@ struct BattleArgs { constexpr int option_command_mov = 76; constexpr int option_command_time = 8; +// size of options_window, command window and status window +constexpr int battle_menu_offset_x = MENU_WIDTH + option_command_mov; /** * Scene_Battle class. diff --git a/src/scene_battle_rpg2k.cpp b/src/scene_battle_rpg2k.cpp index d18f5214ad..6df695cea9 100644 --- a/src/scene_battle_rpg2k.cpp +++ b/src/scene_battle_rpg2k.cpp @@ -73,7 +73,7 @@ void Scene_Battle_Rpg2k::CreateUi() { } } - SetCommandWindows(Player::menu_offset_x); + SetCommandWindowsX(); ResetWindows(true); battle_message_window->SetVisible(true); @@ -136,9 +136,8 @@ void Scene_Battle_Rpg2k::CreateBattleCommandWindow() { ToString(lcf::Data::terms.command_item) }; - command_window.reset(new Window_Command(std::move(commands), 76)); + command_window.reset(new Window_Command(std::move(commands), option_command_mov)); command_window->SetHeight(80); - command_window->SetX(Player::screen_width - Player::menu_offset_x - option_command_mov); command_window->SetY(Player::screen_height - Player::menu_offset_y - 80); } @@ -395,7 +394,12 @@ void Scene_Battle_Rpg2k::ResetWindows(bool make_invisible) { help_window->SetVisible(false); } -void Scene_Battle_Rpg2k::SetCommandWindows(int x) { +void Scene_Battle_Rpg2k::SetCommandWindowsX() { + int x = Player::menu_offset_x; + if (Player::screen_width >= battle_menu_offset_x) { + x = std::max((Player::screen_width - battle_menu_offset_x) / 2, 0); + } + options_window->SetX(x); x += options_window->GetWidth(); status_window->SetX(x); @@ -404,6 +408,11 @@ void Scene_Battle_Rpg2k::SetCommandWindows(int x) { } void Scene_Battle_Rpg2k::MoveCommandWindows(int x, int frames) { + if (Player::screen_width >= battle_menu_offset_x) { + // Do not animate as they fit on the screen in widescreen mode + return; + } + options_window->InitMovement(options_window->GetX(), options_window->GetY(), x, options_window->GetY(), frames); @@ -457,7 +466,7 @@ Scene_Battle_Rpg2k::SceneActionReturn Scene_Battle_Rpg2k::ProcessSceneActionFigh if (previous_state == State_SelectCommand) { MoveCommandWindows(Player::menu_offset_x, 8); } else { - SetCommandWindows(Player::menu_offset_x); + SetCommandWindowsX(); } SetSceneActionSubState(eWaitForInput); // Prevent that DECISION from a closed message triggers a battle option in eWaitForInput diff --git a/src/scene_battle_rpg2k.h b/src/scene_battle_rpg2k.h index 8229a9ccbf..2966da420f 100644 --- a/src/scene_battle_rpg2k.h +++ b/src/scene_battle_rpg2k.h @@ -151,10 +151,9 @@ class Scene_Battle_Rpg2k : public Scene_Battle { void RefreshTargetWindow(); bool CheckBattleEndConditions(); - bool RefreshEventsAndCheckBattleEnd(); void ResetWindows(bool make_invisible); - void SetCommandWindows(int x); + void SetCommandWindowsX(); void MoveCommandWindows(int x, int frames); void RefreshCommandWindow();