From ee60e6d76c326a22e57418708dacf0e49203a963 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 26 May 2019 07:44:40 -0400 Subject: [PATCH] Minor touchup to colorization code --- src/hardware/hw_md2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 36d2a606f..02594eb70 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -738,7 +738,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, UINT8 i; // Ignore pure white & pitch black - if (brightness > 246 || brightness < 7) + if (brightness > 253 || brightness < 2) { cur->rgba = image->rgba; cur++; image++; blendimage++; @@ -825,7 +825,11 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, if (skinnum == TC_RAINBOW) { UINT32 tempcolor; - UINT16 colorbright = 127; // an arbitrary value now, since blendcolor is always changing + UINT16 colorbright; + + SETBRIGHTNESS(colorbright,blendcolor.s.red,blendcolor.s.green,blendcolor.s.blue); + if (colorbright == 0) + colorbright = 1; // no dividing by 0 please tempcolor = (brightness * blendcolor.s.red) / colorbright; tempcolor = min(255, tempcolor);