Skip to content

Commit 2bf6dae

Browse files
authored
Merge pull request #3313 from EasyRPG-NewFeatures/maniacs-EraseEventUpdates
Erase Event - Erase By ID + Recreate Event Option (Maniac Patch Feature)
2 parents b7dcfe6 + a2e0cf2 commit 2bf6dae

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/game_interpreter.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3852,11 +3852,21 @@ bool Game_Interpreter::CommandEndLoop(lcf::rpg::EventCommand const& com) { // co
38523852
return true;
38533853
}
38543854

3855-
bool Game_Interpreter::CommandEraseEvent(lcf::rpg::EventCommand const& /* com */) { // code 12320
3855+
bool Game_Interpreter::CommandEraseEvent(lcf::rpg::EventCommand const& com) { // code 12320
3856+
int event_id = 0; // default rm values
3857+
bool is_active = 0; // In Vanilla RM event is always itself and it always becomes inactive
3858+
3859+
if (Player::IsPatchManiac() && com.parameters.size() >= 3) {
3860+
event_id = ValueOrVariableBitfield(com.parameters[0], 1, com.parameters[2]);
3861+
is_active = com.parameters[1];
3862+
}
3863+
38563864
auto& frame = GetFrame();
38573865
auto& index = frame.current_command;
38583866

3859-
auto event_id = GetThisEventId();
3867+
if (event_id == 0) {
3868+
event_id = GetThisEventId();
3869+
}
38603870

38613871
// When a common event and not RPG2k3E engine ignore the call, otherwise
38623872
// operate on last map_event
@@ -3865,7 +3875,7 @@ bool Game_Interpreter::CommandEraseEvent(lcf::rpg::EventCommand const& /* com */
38653875

38663876
Game_Event* evnt = Game_Map::GetEvent(event_id);
38673877
if (evnt) {
3868-
evnt->SetActive(false);
3878+
evnt->SetActive(is_active);
38693879

38703880
// Parallel map events shall stop immediately
38713881
if (!main_flag) {

0 commit comments

Comments
 (0)