Merge branch 'dye-fix' into 'next'

Fix players not properly decolorizing via linedef action

See merge request STJr/SRB2!1127
This commit is contained in:
Lachlan Wright 2020-09-25 08:54:16 -04:00
commit f1d2992f51
2 changed files with 12 additions and 11 deletions

View file

@ -8839,25 +8839,26 @@ void A_Dye(mobj_t *actor)
INT32 locvar2 = var2;
mobj_t *target = ((locvar1 && actor->target) ? actor->target : actor);
UINT8 color = (UINT8)locvar2;
UINT16 color = (UINT16)locvar2;
if (LUA_CallAction("A_Dye", actor))
return;
if (color >= numskincolors)
return;
if (!color)
target->colorized = false;
else
target->colorized = true;
// What if it's a player?
if (target->player)
{
target->player->powers[pw_dye] = color;
return;
}
target->color = color;
if (!color)
{
target->colorized = false;
target->color = target->player ? target->player->skincolor : SKINCOLOR_NONE;
}
else if (!(target->player))
{
target->colorized = true;
target->color = color;
}
}
// Function: A_MoveRelative

View file

@ -1934,7 +1934,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
case 336: // object dye - once
{
INT32 triggercolor = (INT32)sides[triggerline->sidenum[0]].toptexture;
UINT8 color = (actor->player ? actor->player->powers[pw_dye] : actor->color);
UINT16 color = (actor->player ? actor->player->powers[pw_dye] : actor->color);
boolean invert = (triggerline->flags & ML_NOCLIMB ? true : false);
if (invert ^ (triggercolor != color))