Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erase Event - Erase By ID + Recreate Event Option (Maniac Patch Feature) #3313

Merged
merged 2 commits into from
Dec 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/game_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3850,11 +3850,21 @@ bool Game_Interpreter::CommandEndLoop(lcf::rpg::EventCommand const& com) { // co
return true;
}

bool Game_Interpreter::CommandEraseEvent(lcf::rpg::EventCommand const& /* com */) { // code 12320
bool Game_Interpreter::CommandEraseEvent(lcf::rpg::EventCommand const& com) { // code 12320
int event_id = 0; // default rm values
bool is_active = 0; // In Vanilla RM event is always itself and it always becomes inactive

if (Player::IsPatchManiac() && com.parameters.size() >= 3) {
event_id = ValueOrVariableBitfield(com.parameters[0], 1, com.parameters[2]);
is_active = com.parameters[1];
}

auto& frame = GetFrame();
auto& index = frame.current_command;

auto event_id = GetThisEventId();
if (event_id == 0) {
event_id = GetThisEventId();
}

// When a common event and not RPG2k3E engine ignore the call, otherwise
// operate on last map_event
Expand All @@ -3863,7 +3873,7 @@ bool Game_Interpreter::CommandEraseEvent(lcf::rpg::EventCommand const& /* com */

Game_Event* evnt = Game_Map::GetEvent(event_id);
if (evnt) {
evnt->SetActive(false);
evnt->SetActive(is_active);

// Parallel map events shall stop immediately
if (!main_flag) {
Expand Down
Loading