From ecc3d031df33bfa7624d5b4308ae2c58437f15b5 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Jan 2022 03:45:40 -0800 Subject: [PATCH] Ignore colormap when overriding thing brightness --- src/hardware/hw_main.c | 36 ++++++++++++++++++++---------------- src/hardware/hw_md2.c | 14 +++++++++----- src/r_things.c | 2 +- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 113b9588e..b6a411e07 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3945,21 +3945,26 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) lightset = HWR_OverrideObjectLightLevel(spr->mobj, &lightlevel); - for (i = 1; i < sector->numlights; i++) + if (!lightset) { - fixed_t h = P_GetLightZAt(§or->lightlist[i], spr->mobj->x, spr->mobj->y); - if (h <= temp) + for (i = 1; i < sector->numlights; i++) { - if (!lightset) + fixed_t h = P_GetLightZAt(§or->lightlist[i], spr->mobj->x, spr->mobj->y); + if (h <= temp) + { lightlevel = *list[i-1].lightlevel > 255 ? 255 : *list[i-1].lightlevel; - if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) - colormap = *list[i-1].extra_colormap; - break; + if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) + colormap = *list[i-1].extra_colormap; + break; + } } } if (R_ThingIsSemiBright(spr->mobj)) + { lightlevel = 128 + (lightlevel>>1); + colormap = NULL; + } for (i = 0; i < sector->numlights; i++) { @@ -3967,17 +3972,13 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) return; // even if we aren't changing colormap or lightlevel, we still need to continue drawing down the sprite - if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) + if (!lightset && !(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) { - if (!lightset) - { - lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel; + lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel; - if (R_ThingIsSemiBright(spr->mobj)) - lightlevel = 128 + (lightlevel>>1); - } - - if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) + if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (lightlevel>>1); + else if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) colormap = *list[i].extra_colormap; } @@ -4313,7 +4314,10 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; if (R_ThingIsSemiBright(spr->mobj)) + { lightlevel = 128 + (lightlevel>>1); + colormap = NULL; + } HWR_Lighting(&Surf, lightlevel, colormap); } diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index c2b593f06..7d54af5b9 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1335,22 +1335,26 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before if (!lightset) + { lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; - if (*sector->lightlist[light].extra_colormap) - colormap = *sector->lightlist[light].extra_colormap; + if (*sector->lightlist[light].extra_colormap) + colormap = *sector->lightlist[light].extra_colormap; + } } - else + else if (!lightset) { - if (!lightset) - lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; + lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; if (sector->extra_colormap) colormap = sector->extra_colormap; } if (R_ThingIsSemiBright(spr->mobj)) + { lightlevel = 128 + (lightlevel>>1); + colormap = NULL; + } HWR_Lighting(&Surf, lightlevel, colormap); } diff --git a/src/r_things.c b/src/r_things.c index 4779e4df8..6ca07c3b3 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -861,7 +861,7 @@ static void R_DrawVisSprite(vissprite_t *vis) else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome. R_SetColumnFunc(COLDRAWFUNC_TRANS, false); - if (vis->extra_colormap && !(vis->renderflags & RF_NOCOLORMAPS)) + if (!(vis->cut & (SC_FULLBRIGHT|SC_SEMIBRIGHT)) && vis->extra_colormap && !(vis->renderflags & RF_NOCOLORMAPS)) { if (!dc_colormap) dc_colormap = vis->extra_colormap->colormap;