Ignore colormap when overriding thing brightness

This commit is contained in:
James R 2022-01-20 03:45:40 -08:00
parent ff70bd0d83
commit ecc3d031df
3 changed files with 30 additions and 22 deletions

View file

@ -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(&sector->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(&sector->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);
}

View file

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

View file

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