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
  • Loading branch information
ToolMan2k authored Jan 7, 2024
1 parent a6112a3 commit 7495a1c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/game_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7495a1c

Please sign in to comment.