From 286886e1612bf8f2f27b5349a88ffd2aceea3660 Mon Sep 17 00:00:00 2001 From: Kevin Caccamo Date: Sat, 22 Dec 2018 22:02:20 -0500 Subject: [PATCH] Minor fixes for additive colour ZScript API Sector.SetAdditiveColor actually called Sector.SetSpecialColor Add use boolean property, used to determine whether or not to override the sector's additive wall colour with the side's additive colour. --- src/r_defs.h | 4 ++-- src/scripting/vmthunks.cpp | 9 +++++---- wadsrc/static/zscript/mapdata.txt | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/r_defs.h b/src/r_defs.h index d152bf0e8..c93a240fb 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1304,9 +1304,9 @@ struct side_t return (part.flags & part::UseOwnColors) ? part.SpecialColors[slot] : frontsector->SpecialColors[sector_t::walltop + slot]; } - void SetAdditiveColor(int which, PalEntry rgb) + void SetAdditiveColor(int which, PalEntry rgb, bool use = true) { - rgb.a = 255; + rgb.a = use ? 255 : 0; textures[which].AdditiveColor = rgb; } diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index efee33215..7181375b7 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -555,7 +555,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetAdditiveColor, SetAdditiveColor) PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_COLOR(color); - SetSpecialColor(self, pos, color); + SetAdditiveColor(self, pos, color); return 0; } @@ -1558,11 +1558,11 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, RemoveForceField, RemoveForceField) return 0; } - static void SetSideAdditiveColor(side_t *self, int tier, int color) + static void SetSideAdditiveColor(side_t *self, int tier, int color, bool use) { if (tier >= 0 && tier < 3) { - self->SetAdditiveColor(tier, color); + self->SetAdditiveColor(tier, color, use); } } @@ -1571,7 +1571,8 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, RemoveForceField, RemoveForceField) PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(tier); PARAM_COLOR(color); - SetSideAdditiveColor(self, tier, color); + PARAM_BOOL(use); + SetSideAdditiveColor(self, tier, color, use); return 0; } diff --git a/wadsrc/static/zscript/mapdata.txt b/wadsrc/static/zscript/mapdata.txt index a63c95f0e..155888581 100644 --- a/wadsrc/static/zscript/mapdata.txt +++ b/wadsrc/static/zscript/mapdata.txt @@ -87,7 +87,7 @@ struct Side native play native void MultiplyTextureYScale(int which, double delta); native void SetSpecialColor(int tier, int position, Color scolor); native Color GetAdditiveColor(int tier); - native void SetAdditiveColor(int tier, Color color); + native void SetAdditiveColor(int tier, Color color, bool use = true); //native DInterpolation *SetInterpolation(int position); //native void StopInterpolation(int position);