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.
This commit is contained in:
Kevin Caccamo 2018-12-22 22:02:20 -05:00 committed by Christoph Oelckers
parent 9622ca7517
commit 286886e161
3 changed files with 8 additions and 7 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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);