diff --git a/src/gamedata/r_defs.h b/src/gamedata/r_defs.h index a5e73a186..4540ab805 100644 --- a/src/gamedata/r_defs.h +++ b/src/gamedata/r_defs.h @@ -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 diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index 3b796bf7b..bde617aa0 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -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); } } @@ -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; } diff --git a/wadsrc/static/zscript/mapdata.zs b/wadsrc/static/zscript/mapdata.zs index b681711d4..23181ef47 100644 --- a/wadsrc/static/zscript/mapdata.zs +++ b/wadsrc/static/zscript/mapdata.zs @@ -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);