From 7495a1cf7c96d2bb08796a21d5b015764872496d Mon Sep 17 00:00:00 2001 From: Tool Man Date: Sun, 7 Jan 2024 05:45:35 +0000 Subject: [PATCH] Added Var and Var Index support for Picture Tint While testing, I found out the following things: - You cannot mix multiple Variable types for each parameters - When using Variables for Picture Tint, parameter 17 is set to 4096 (0x100), - When using Var Indexes for Picture Tint, parameter 17 is set to 8192 (0x200), - Before, parameters for red, green, blue and saturation were always constants. - Surprisingly this feature doesn't work with ShowStringPicture Added: - Variable and VarIndex support for Tinting using ShowPicture and MovePicture --- src/game_interpreter.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/game_interpreter.cpp b/src/game_interpreter.cpp index 73303e59b86..a9afb32c787 100644 --- a/src/game_interpreter.cpp +++ b/src/game_interpreter.cpp @@ -2833,6 +2833,20 @@ bool Game_Interpreter::CommandShowPicture(lcf::rpg::EventCommand const& com) { / } params.name = PicPointerPatch::ReplaceName(params.name, var, com.parameters[18]); } + if (com.parameters[17] & 0x1000 && Player::IsPatchManiac()) { + // Color tint using variables + params.red = ValueOrVariable(1, params.red); + params.green = ValueOrVariable(1, params.green); + params.blue = ValueOrVariable(1, params.blue); + params.saturation = ValueOrVariable(1, params.saturation); + } + if (com.parameters[17] & 0x2000 && Player::IsPatchManiac()) { + // Color tint using variables indexes + params.red = ValueOrVariable(2, params.red); + params.green = ValueOrVariable(2, params.green); + params.blue = ValueOrVariable(2, params.blue); + params.saturation = ValueOrVariable(2, params.saturation); + } params.magnify = ValueOrVariable(com.parameters[20], params.magnify); params.top_trans = ValueOrVariable(com.parameters[21], params.top_trans); if (com.parameters[22] > 0) { @@ -2948,6 +2962,21 @@ bool Game_Interpreter::CommandMovePicture(lcf::rpg::EventCommand const& com) { / // RPG2k and RPG2k3 1.10 do not support this option params.bottom_trans = params.top_trans; + if (com.parameters[17] & 0x1000 && Player::IsPatchManiac()) { + // Color tint using variables + params.red = ValueOrVariable(1, params.red); + params.green = ValueOrVariable(1, params.green); + params.blue = ValueOrVariable(1, params.blue); + params.saturation = ValueOrVariable(1, params.saturation); + } + if (com.parameters[17] & 0x2000 && Player::IsPatchManiac()) { + // Color tint using variables indexes + params.red = ValueOrVariable(2, params.red); + params.green = ValueOrVariable(2, params.green); + params.blue = ValueOrVariable(2, params.blue); + params.saturation = ValueOrVariable(2, params.saturation); + } + if (Player::IsPatchManiac() && param_size > 16) { int flags = com.parameters[16] >> 8; int blend_mode = flags & 3;