From 26d231c43acce0519c555865efdf73c524b0f8b8 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Jan 2022 05:09:39 -0800 Subject: [PATCH] Only ignore colormap for fullbright --- src/hardware/hw_main.c | 38 +++++++++++++++++--------------------- src/hardware/hw_md2.c | 9 ++------- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index b6a411e07..80fcbbfed 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3945,26 +3945,21 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) lightset = HWR_OverrideObjectLightLevel(spr->mobj, &lightlevel); - if (!lightset) + for (i = 1; i < sector->numlights; i++) { - for (i = 1; i < sector->numlights; i++) + fixed_t h = P_GetLightZAt(§or->lightlist[i], spr->mobj->x, spr->mobj->y); + if (h <= temp) { - fixed_t h = P_GetLightZAt(§or->lightlist[i], spr->mobj->x, spr->mobj->y); - if (h <= temp) - { + if (!lightset) 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 (!R_ThingIsFullBright(spr->mobj) && !(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++) { @@ -3972,13 +3967,17 @@ 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 (!lightset && !(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) + if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) { - lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel; + if (!lightset) + { + lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel; - if (R_ThingIsSemiBright(spr->mobj)) - lightlevel = 128 + (lightlevel>>1); - else if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) + if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (lightlevel>>1); + } + + if (!R_ThingIsFullBright(spr->mobj) && !(spr->mobj->renderflags & RF_NOCOLORMAPS)) colormap = *list[i].extra_colormap; } @@ -4307,17 +4306,14 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) if (!lightset) lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; - if (*sector->lightlist[light].extra_colormap && !(spr->mobj->renderflags & RF_NOCOLORMAPS)) + if (!R_ThingIsFullBright(spr->mobj) && *sector->lightlist[light].extra_colormap && !(spr->mobj->renderflags & RF_NOCOLORMAPS)) colormap = *sector->lightlist[light].extra_colormap; } else if (!lightset) 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 7d54af5b9..38b151d91 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1335,12 +1335,10 @@ 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 (!R_ThingIsFullBright(spr->mobj) && *sector->lightlist[light].extra_colormap) + colormap = *sector->lightlist[light].extra_colormap; } else if (!lightset) { @@ -1351,10 +1349,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) } if (R_ThingIsSemiBright(spr->mobj)) - { lightlevel = 128 + (lightlevel>>1); - colormap = NULL; - } HWR_Lighting(&Surf, lightlevel, colormap); }