Skip to content

Commit

Permalink
Added Var and Var Index support for Picture Tint
Browse files Browse the repository at this point in the history
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 using bitfields
  • Loading branch information
ToolMan2k authored and Ghabry committed Mar 11, 2024
1 parent f31a636 commit a276688
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/game_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2836,6 +2836,14 @@ bool Game_Interpreter::CommandShowPicture(lcf::rpg::EventCommand const& com) { /
params.name = PicPointerPatch::ReplaceName(params.name, var, com.parameters[18]);
}

if (Player::IsPatchManiac()) {
// Color tint using variables
params.red = ValueOrVariableBitfield(com.parameters[17], 3, params.red);
params.green = ValueOrVariableBitfield(com.parameters[17], 3, params.green);
params.blue = ValueOrVariableBitfield(com.parameters[17], 3, params.blue);
params.saturation = ValueOrVariableBitfield(com.parameters[17], 3, params.saturation);
}

params.magnify_width = ValueOrVariableBitfield(com.parameters[20], 0, params.magnify_width);
if (Player::IsPatchManiac() && com.parameters.size() > 31 && com.parameters[20] >= 16 && params.effect_mode == 0) {
// The >= 16 check is needed because this bit is set when independent width/height scaling is used
Expand Down Expand Up @@ -2955,6 +2963,14 @@ bool Game_Interpreter::CommandMovePicture(lcf::rpg::EventCommand const& com) { /
//int chars_to_replace = com.parameters[18];
//int replace_with = com.parameters[19];

if (com.parameters[17] >= 4096 && Player::IsPatchManiac()) {
// Color tint using variables
params.red = ValueOrVariableBitfield(com.parameters[17], 3, params.red);
params.green = ValueOrVariableBitfield(com.parameters[17], 3, params.green);
params.blue = ValueOrVariableBitfield(com.parameters[17], 3, params.blue);
params.saturation = ValueOrVariableBitfield(com.parameters[17], 3, params.saturation);
}

params.magnify_width = ValueOrVariableBitfield(com.parameters[20], 0, params.magnify_width);
if (Player::IsPatchManiac() && com.parameters.size() > 18 && com.parameters[20] >= 16 && params.effect_mode == 0) {
// The >= 16 check is needed because this bit is set when independent width/height scaling is used
Expand Down

0 comments on commit a276688

Please sign in to comment.