Skip to content

Commit

Permalink
Inmediately start call command when called by an EventCommand.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Albeleon authored and Ghabry committed Oct 29, 2018
1 parent deeab4e commit a9e4700
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/game_interpreter_map.cpp
Expand Up @@ -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<ContinuationFunction>(&Game_Interpreter_Map::ContinuationEnemyEncounter));
return false;
Expand Down Expand Up @@ -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<ContinuationFunction>(&Game_Interpreter_Map::ContinuationOpenShop));
return false;
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions src/game_temp.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -87,4 +88,5 @@ void Game_Temp::Init() {
battle_first_strike = false;
battle_result = 0;
restart_title_cache = false;
inmediate_call = false;
}
1 change: 1 addition & 0 deletions src/game_temp.h
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/scene_map.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

0 comments on commit a9e4700

Please sign in to comment.