|
34 | 34 | #include "game_party.h" |
35 | 35 | #include "game_enemy.h" |
36 | 36 | #include "game_enemyparty.h" |
| 37 | +#include "game_map.h" |
37 | 38 | #include "game_message.h" |
38 | 39 | #include "game_battle.h" |
39 | 40 | #include "game_interpreter_battle.h" |
40 | 41 | #include "game_battlealgorithm.h" |
41 | 42 | #include "game_screen.h" |
| 43 | +#include "game_switches.h" |
42 | 44 | #include <lcf/reader_util.h> |
43 | 45 | #include "scene_gameover.h" |
44 | 46 | #include "utils.h" |
@@ -971,6 +973,16 @@ void Scene_Battle_Rpg2k3::vUpdate() { |
971 | 973 | break; |
972 | 974 | } |
973 | 975 |
|
| 976 | + if (state != State_Victory && state != State_Defeat) { |
| 977 | + parallel_interpreter.Update(); |
| 978 | + if (!parallel_interpreter.IsRunning()) { |
| 979 | + for (auto common_event : battle_parallel_events) |
| 980 | + { |
| 981 | + parallel_interpreter.Push(common_event); |
| 982 | + } |
| 983 | + } |
| 984 | + } |
| 985 | + |
974 | 986 | // this is checked separately because we want normal events to be processed |
975 | 987 | // just not sub-events called by maniacs battle hooks. |
976 | 988 | if (state != State_Victory && state != State_Defeat && Game_Battle::ManiacProcessSubEvents()) { |
@@ -1113,6 +1125,23 @@ Scene_Battle_Rpg2k3::SceneActionReturn Scene_Battle_Rpg2k3::ProcessSceneAction() |
1113 | 1125 | return SceneActionReturn::eWaitTillNextFrame; |
1114 | 1126 | } |
1115 | 1127 |
|
| 1128 | +void Scene_Battle_Rpg2k3::CallBattleBeginCommonEvents() { |
| 1129 | + for (auto data_common_event : lcf::Data::commonevents) { |
| 1130 | + if ((!data_common_event.switch_flag || Main_Data::game_switches->Get(data_common_event.switch_id))) { |
| 1131 | + if (data_common_event.trigger == data_common_event.Trigger_battle_begin) { |
| 1132 | + Game_CommonEvent* common_event = lcf::ReaderUtil::GetElement(Game_Map::GetCommonEvents(), data_common_event.ID); |
| 1133 | + |
| 1134 | + Game_Battle::GetInterpreterBattle().Push(common_event); |
| 1135 | + } |
| 1136 | + else if (data_common_event.trigger == data_common_event.Trigger_battle_parallel) { |
| 1137 | + Game_CommonEvent* common_event = lcf::ReaderUtil::GetElement(Game_Map::GetCommonEvents(), data_common_event.ID); |
| 1138 | + |
| 1139 | + battle_parallel_events.push_back(common_event); |
| 1140 | + } |
| 1141 | + } |
| 1142 | + } |
| 1143 | +} |
| 1144 | + |
1116 | 1145 | Scene_Battle_Rpg2k3::SceneActionReturn Scene_Battle_Rpg2k3::ProcessSceneActionStart() { |
1117 | 1146 | enum SubState { |
1118 | 1147 | eStartMessage, |
@@ -1152,6 +1181,7 @@ Scene_Battle_Rpg2k3::SceneActionReturn Scene_Battle_Rpg2k3::ProcessSceneActionSt |
1152 | 1181 | EndNotification(); |
1153 | 1182 | UpdateEnemiesDirection(); |
1154 | 1183 | UpdateActorsDirection(); |
| 1184 | + CallBattleBeginCommonEvents(); |
1155 | 1185 | SetSceneActionSubState(eUpdateEvents); |
1156 | 1186 | return SceneActionReturn::eContinueThisFrame; |
1157 | 1187 | } |
|
0 commit comments