From a9e47008466ff749574539974d32da50841e336e Mon Sep 17 00:00:00 2001 From: Albeleon Date: Tue, 17 Jul 2018 10:46:42 +0200 Subject: [PATCH] Inmediately start call command when called by an EventCommand. Problem: In RPG_RT, when a call menu/shop/etc or battle is done by an eventcommand, it is called inmediately regardless of whether the player is still moving. In EasyRPG, it waits until it's over. Solution: Add a Game_Temp::inmediate_call that is activated when an EventCommand is called. Then, put as a condition in Scene_Map to check the calls if it's active, and disable it in DisableCalls. --- src/game_interpreter_map.cpp | 6 ++++++ src/game_temp.cpp | 2 ++ src/game_temp.h | 1 + src/scene_map.cpp | 3 ++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/game_interpreter_map.cpp b/src/game_interpreter_map.cpp index e03e0f1321..aeea3880b3 100644 --- a/src/game_interpreter_map.cpp +++ b/src/game_interpreter_map.cpp @@ -258,6 +258,7 @@ bool Game_Interpreter_Map::CommandEnemyEncounter(RPG::EventCommand const& com) { Game_Temp::battle_result = Game_Temp::BattleVictory; Game_Temp::battle_calling = true; + Game_Temp::inmediate_call = true; SetContinuation(static_cast(&Game_Interpreter_Map::ContinuationEnemyEncounter)); return false; @@ -345,6 +346,7 @@ bool Game_Interpreter_Map::CommandOpenShop(RPG::EventCommand const& com) { // co Game_Temp::shop_transaction = false; Game_Temp::shop_calling = true; + Game_Temp::inmediate_call = true; SetContinuation(static_cast(&Game_Interpreter_Map::ContinuationOpenShop)); return false; } @@ -562,6 +564,7 @@ bool Game_Interpreter_Map::CommandEnterHeroName(RPG::EventCommand const& com) { } Game_Temp::name_calling = true; + Game_Temp::inmediate_call = true; return true; } @@ -699,17 +702,20 @@ bool Game_Interpreter_Map::CommandPlayMovie(RPG::EventCommand const& com) { // c bool Game_Interpreter_Map::CommandOpenSaveMenu(RPG::EventCommand const& /* com */) { // code 11910 Game_Temp::save_calling = true; + Game_Temp::inmediate_call = true; return true; } bool Game_Interpreter_Map::CommandOpenMainMenu(RPG::EventCommand const& /* com */) { // code 11950 Game_Temp::menu_calling = true; + Game_Temp::inmediate_call = true; SetContinuation(&Game_Interpreter::DefaultContinuation); return false; } bool Game_Interpreter_Map::CommandOpenLoadMenu(RPG::EventCommand const& /* com */) { Game_Temp::load_calling = true; + Game_Temp::inmediate_call = true; return true; } diff --git a/src/game_temp.cpp b/src/game_temp.cpp index 63a8309952..f3c9fc2404 100644 --- a/src/game_temp.cpp +++ b/src/game_temp.cpp @@ -52,6 +52,7 @@ int Game_Temp::battle_defeat_mode; bool Game_Temp::battle_first_strike; int Game_Temp::battle_result; bool Game_Temp::restart_title_cache; +bool Game_Temp::inmediate_call; void Game_Temp::Init() { menu_calling = false; @@ -87,4 +88,5 @@ void Game_Temp::Init() { battle_first_strike = false; battle_result = 0; restart_title_cache = false; + inmediate_call = false; } diff --git a/src/game_temp.h b/src/game_temp.h index c05fc41cc6..b92cf03486 100644 --- a/src/game_temp.h +++ b/src/game_temp.h @@ -43,6 +43,7 @@ class Game_Temp { static bool load_calling; static bool to_title; static bool gameover; + static bool inmediate_call; static bool transition_processing; static Transition::TransitionType transition_type; diff --git a/src/scene_map.cpp b/src/scene_map.cpp index 70cb53e9f3..a572228b45 100644 --- a/src/scene_map.cpp +++ b/src/scene_map.cpp @@ -189,7 +189,7 @@ void Scene_Map::Update() { } } - if (!Main_Data::game_player->IsMoving()) { + if (!Main_Data::game_player->IsMoving() || Game_Temp::inmediate_call) { if (Game_Temp::battle_calling) { CallBattle(); return; @@ -319,4 +319,5 @@ void Scene_Map::DisableCalls() { Game_Temp::shop_calling = false; Game_Temp::save_calling = false; Game_Temp::load_calling = false; + Game_Temp::inmediate_call = false; }