Skip to content

Commit

Permalink
Integrate battles with normal scene call method
Browse files Browse the repository at this point in the history
* Add eBattle enum values
* Still set Game_Temp::battle_calling to handle transitions correctly
  • Loading branch information
fmatthew5876 committed Mar 4, 2019
1 parent a98562e commit c463dad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/game_interpreter.cpp
Expand Up @@ -3079,8 +3079,7 @@ void Game_Interpreter::ResetSceneCalling() {
}

bool Game_Interpreter::IsImmediateCall() {
return scene_call != Scene::Null
|| Game_Temp::battle_calling;
return scene_call != Scene::Null;
};

// Dummy Continuations
Expand Down
2 changes: 1 addition & 1 deletion src/game_interpreter_map.cpp
Expand Up @@ -258,7 +258,7 @@ bool Game_Interpreter_Map::CommandEnemyEncounter(RPG::EventCommand const& com) {
Game_Battle::SetBattleMode(com.parameters[6]); // 0 normal, 1 initiative, 2 surround, 3 back attack, 4 pincer

Game_Temp::battle_result = Game_Temp::BattleVictory;
Game_Temp::battle_calling = true;
scene_call = Scene::Battle;

SetContinuation(static_cast<ContinuationFunction>(&Game_Interpreter_Map::ContinuationEnemyEncounter));
return false;
Expand Down
12 changes: 7 additions & 5 deletions src/scene_map.cpp
Expand Up @@ -196,6 +196,9 @@ void Scene_Map::Update() {
if (Main_Data::game_data.party_location.menu_calling || force_menu_calling) {
call = Scene::Menu;
}
if (Game_Temp::battle_calling) {
call = Scene::Battle;
}

Game_Interpreter::ResetSceneCalling();
switch (call) {
Expand All @@ -214,14 +217,12 @@ void Scene_Map::Update() {
case Scene::Load:
CallLoad();
break;
case Scene::Battle:
CallBattle();
break;
default:
break;
}

if (Game_Temp::battle_calling) {
CallBattle();
return;
}
}
}

Expand Down Expand Up @@ -255,6 +256,7 @@ void Scene_Map::FinishTeleportPlayer() {
// Scene calling stuff.

void Scene_Map::CallBattle() {
Game_Temp::battle_calling = true;
Main_Data::game_data.system.before_battle_music = Game_System::GetCurrentBGM();
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_BeginBattle));
Game_System::BgmPlay(Game_System::GetSystemBGM(Game_System::BGM_Battle));
Expand Down

0 comments on commit c463dad

Please sign in to comment.