From c5b60b4f374d9d83cf9181c65c78957f7d203f0e Mon Sep 17 00:00:00 2001 From: Mauro Junior <45118493+jetrotal@users.noreply.github.com> Date: Tue, 7 Jan 2025 20:29:15 -0300 Subject: [PATCH] FlashEvent - Maniac Patch Parameters Supporting usage of variables when game uses maniac patch and parameters size is bigger than 7. --- src/game_interpreter_map.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/game_interpreter_map.cpp b/src/game_interpreter_map.cpp index b74a1a970f..cb93b8c999 100644 --- a/src/game_interpreter_map.cpp +++ b/src/game_interpreter_map.cpp @@ -712,11 +712,17 @@ bool Game_Interpreter_Map::CommandShowBattleAnimation(lcf::rpg::EventCommand con } bool Game_Interpreter_Map::CommandFlashSprite(lcf::rpg::EventCommand const& com) { // code 11320 - int event_id = com.parameters[0]; - int r = com.parameters[1]; - int g = com.parameters[2]; - int b = com.parameters[3]; - int p = com.parameters[4]; + auto getFlashParam = [&](int index) { + return (com.parameters.size() <= 8 && Player::IsPatchManiac()) + ? ValueOrVariableBitfield(com.parameters[7], index, com.parameters[index]) + : com.parameters[index]; + }; + + const int event_id = getFlashParam(0); + const int r = getFlashParam(1); + const int g = getFlashParam(2); + const int b = getFlashParam(3); + const int p = getFlashParam(4); int tenths = com.parameters[5]; bool wait = com.parameters[6] > 0;