From 3e9874f83f6c05c9fc22a7e3afb6fa7cd6e46a5a Mon Sep 17 00:00:00 2001 From: Mauro Junior <45118493+jetrotal@users.noreply.github.com> Date: Tue, 17 Dec 2024 19:43:57 -0300 Subject: [PATCH] MoveRoute - Support Variables as Event ID (Maniac patch feature) Tiny update based on @MackValentine's code. In MP, Move Route supports using variables as the target event ID: ```js //TPC SYNTAX: v[1] = 2 @ev[v[1]].setAction .freq 8 .unskippable .act { .moveDown } ``` Co-Authored-By: MackValentine <7922705+MackValentine@users.noreply.github.com> --- src/game_interpreter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/game_interpreter.cpp b/src/game_interpreter.cpp index a36e7b5c21..c39b178968 100644 --- a/src/game_interpreter.cpp +++ b/src/game_interpreter.cpp @@ -3049,7 +3049,9 @@ bool Game_Interpreter::CommandPlayerVisibility(lcf::rpg::EventCommand const& com } bool Game_Interpreter::CommandMoveEvent(lcf::rpg::EventCommand const& com) { // code 11330 - int event_id = com.parameters[0]; + int event_id = ValueOrVariableBitfield(com.parameters[2], 2, com.parameters[0]); + int repeat = ManiacBitmask(com.parameters[2], 0x1); + Game_Character* event = GetCharacter(event_id); if (event != NULL) { // If the event is a vehicle in use, push the commands to the player instead @@ -3065,7 +3067,7 @@ bool Game_Interpreter::CommandMoveEvent(lcf::rpg::EventCommand const& com) { // move_freq = 6; } - route.repeat = com.parameters[2] != 0; + route.repeat = repeat != 0; route.skippable = com.parameters[3] != 0; for (auto it = com.parameters.begin() + 4; it < com.parameters.end(); ) {