Merge branch 'fix-256-brightness' into 'master'

Florida man fixes sectors with light level 256 blacking out OpenGL objects; mappers riot.

See merge request STJr/SRB2!840
This commit is contained in:
James R 2020-04-09 19:53:40 -04:00
commit 5f7bd9a947
2 changed files with 12 additions and 9 deletions

View file

@ -4186,6 +4186,9 @@ static void HWR_DrawDropShadow(mobj_t *thing, gr_vissprite_t *spr, fixed_t scale
{ {
light = R_GetPlaneLight(thing->subsector->sector, floorz, false); // Always use the light at the top instead of whatever I was doing before light = R_GetPlaneLight(thing->subsector->sector, floorz, false); // Always use the light at the top instead of whatever I was doing before
if (*thing->subsector->sector->lightlist[light].lightlevel > 255)
lightlevel = 255;
else
lightlevel = *thing->subsector->sector->lightlist[light].lightlevel; lightlevel = *thing->subsector->sector->lightlist[light].lightlevel;
if (*thing->subsector->sector->lightlist[light].extra_colormap) if (*thing->subsector->sector->lightlist[light].extra_colormap)
@ -4392,7 +4395,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
if (h <= temp) if (h <= temp)
{ {
if (!(spr->mobj->frame & FF_FULLBRIGHT)) if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *list[i-1].lightlevel; lightlevel = *list[i-1].lightlevel > 255 ? 255 : *list[i-1].lightlevel;
colormap = *list[i-1].extra_colormap; colormap = *list[i-1].extra_colormap;
break; break;
} }
@ -4400,7 +4403,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
#else #else
i = R_GetPlaneLight(sector, temp, false); i = R_GetPlaneLight(sector, temp, false);
if (!(spr->mobj->frame & FF_FULLBRIGHT)) if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *list[i].lightlevel; lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel;
colormap = *list[i].extra_colormap; colormap = *list[i].extra_colormap;
#endif #endif
@ -4416,7 +4419,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES))
{ {
if (!(spr->mobj->frame & FF_FULLBRIGHT)) if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *list[i].lightlevel; lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel;
colormap = *list[i].extra_colormap; colormap = *list[i].extra_colormap;
} }
@ -4693,7 +4696,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
extracolormap_t *colormap = sector->extra_colormap; extracolormap_t *colormap = sector->extra_colormap;
if (!(spr->mobj->frame & FF_FULLBRIGHT)) if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = sector->lightlevel; lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
if (colormap) if (colormap)
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false); Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
@ -4790,7 +4793,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_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 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 (!(spr->mobj->frame & FF_FULLBRIGHT)) if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *sector->lightlist[light].lightlevel; lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
if (*sector->lightlist[light].extra_colormap) if (*sector->lightlist[light].extra_colormap)
colormap = *sector->lightlist[light].extra_colormap; colormap = *sector->lightlist[light].extra_colormap;
@ -4798,7 +4801,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
else else
{ {
if (!(spr->mobj->frame & FF_FULLBRIGHT)) if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = sector->lightlevel; lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
if (sector->extra_colormap) if (sector->extra_colormap)
colormap = sector->extra_colormap; colormap = sector->extra_colormap;

View file

@ -1221,7 +1221,7 @@ boolean HWR_DrawModel(gr_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 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 (!(spr->mobj->frame & FF_FULLBRIGHT)) if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *sector->lightlist[light].lightlevel; lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
if (*sector->lightlist[light].extra_colormap) if (*sector->lightlist[light].extra_colormap)
colormap = *sector->lightlist[light].extra_colormap; colormap = *sector->lightlist[light].extra_colormap;
@ -1229,7 +1229,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
else else
{ {
if (!(spr->mobj->frame & FF_FULLBRIGHT)) if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = sector->lightlevel; lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
if (sector->extra_colormap) if (sector->extra_colormap)
colormap = sector->extra_colormap; colormap = sector->extra_colormap;