fixed side_t::SetSpecialColor.

This never set the needed flags to make the color appear.
This commit is contained in:
Christoph Oelckers 2020-10-17 12:28:22 +02:00 committed by drfrag
parent 5ed6e07b84
commit b8496b6def
3 changed files with 11 additions and 6 deletions

View file

@ -1295,15 +1295,19 @@ struct side_t
textures[which].yScale *= delta; 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); textures[which].SpecialColors[slot] = PalEntry(255, r, g, b);
if (useown) textures[which].flags |= part::UseOwnSpecialColors;
else textures[which].flags &= ~part::UseOwnSpecialColors;
} }
void SetSpecialColor(int which, int slot, PalEntry rgb) void SetSpecialColor(int which, int slot, PalEntry rgb, bool useown = true)
{ {
rgb.a = 255; rgb.a = 255;
textures[which].SpecialColors[slot] = rgb; textures[which].SpecialColors[slot] = rgb;
if (useown) textures[which].flags |= part::UseOwnSpecialColors;
else textures[which].flags &= ~part::UseOwnSpecialColors;
} }
// Note that the sector being passed in here may not be the actual sector this sidedef belongs to // Note that the sector being passed in here may not be the actual sector this sidedef belongs to

View file

@ -1679,11 +1679,11 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, RemoveForceField, RemoveForceField)
ACTION_RETURN_POINTER(self->V2()); 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) if (tier >= 0 && tier < 3 && position >= 0 && position < 2)
{ {
self->SetSpecialColor(tier, position, color); self->SetSpecialColor(tier, position, color, useown);
} }
} }
@ -1693,7 +1693,8 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, RemoveForceField, RemoveForceField)
PARAM_INT(tier); PARAM_INT(tier);
PARAM_INT(position); PARAM_INT(position);
PARAM_COLOR(color); PARAM_COLOR(color);
SetSideSpecialColor(self, tier, position, color); PARAM_BOOL(useown)
SetSideSpecialColor(self, tier, position, color, useown);
return 0; return 0;
} }

View file

@ -85,7 +85,7 @@ struct Side native play
native void SetTextureYScale(int which, double scale); native void SetTextureYScale(int which, double scale);
native double GetTextureYScale(int which); native double GetTextureYScale(int which);
native void MultiplyTextureYScale(int which, double delta); 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 Color GetAdditiveColor(int tier);
native void SetAdditiveColor(int tier, Color color); native void SetAdditiveColor(int tier, Color color);
native void EnableAdditiveColor(int tier, bool enable); native void EnableAdditiveColor(int tier, bool enable);