Skip to content

Commit

Permalink
fixed side_t::SetSpecialColor.
Browse files Browse the repository at this point in the history
This never set the needed flags to make the color appear.
  • Loading branch information
coelckers committed Oct 17, 2020
1 parent 38df70f commit 0478838
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/gamedata/r_defs.h
Expand Up @@ -1320,15 +1320,21 @@ struct side_t
textures[which].yScale *= delta;
}

void SetSpecialColor(int which, int slot, int r, int g, int b)
void SetSpecialColor(int which, int slot, int r, int g, int b, bool useown = true)
{
textures[which].SpecialColors[slot] = PalEntry(255, r, g, b);
if (useown) textures[which].flags |= part::UseOwnSpecialColors;
else textures[which].flags &= ~part::UseOwnSpecialColors;
Flags |= WALLF_EXTCOLOR;
}

void SetSpecialColor(int which, int slot, PalEntry rgb)
void SetSpecialColor(int which, int slot, PalEntry rgb, bool useown = true)
{
rgb.a = 255;
textures[which].SpecialColors[slot] = rgb;
if (useown) textures[which].flags |= part::UseOwnSpecialColors;
else textures[which].flags &= ~part::UseOwnSpecialColors;
Flags |= WALLF_EXTCOLOR;
}

// Note that the sector being passed in here may not be the actual sector this sidedef belongs to
Expand Down
7 changes: 4 additions & 3 deletions src/scripting/vmthunks.cpp
Expand Up @@ -1399,11 +1399,11 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset)
ACTION_RETURN_POINTER(self->V2());
}

static void SetSideSpecialColor(side_t *self, int tier, int position, int color)
static void SetSideSpecialColor(side_t *self, int tier, int position, int color, int useown)
{
if (tier >= 0 && tier < 3 && position >= 0 && position < 2)
{
self->SetSpecialColor(tier, position, color);
self->SetSpecialColor(tier, position, color, useown);
}
}

Expand All @@ -1413,7 +1413,8 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset)
PARAM_INT(tier);
PARAM_INT(position);
PARAM_COLOR(color);
SetSideSpecialColor(self, tier, position, color);
PARAM_BOOL(useown)
SetSideSpecialColor(self, tier, position, color, useown);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/mapdata.zs
Expand Up @@ -83,7 +83,7 @@ struct Side native play
native void SetTextureYScale(int which, double scale);
native double GetTextureYScale(int which);
native void MultiplyTextureYScale(int which, double delta);
native void SetSpecialColor(int tier, int position, Color scolor);
native void SetSpecialColor(int tier, int position, Color scolor, bool useowncolor = true);
native Color GetAdditiveColor(int tier);
native void SetAdditiveColor(int tier, Color color);
native void EnableAdditiveColor(int tier, bool enable);
Expand Down

0 comments on commit 0478838

Please sign in to comment.