mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 12:01:05 +00:00
Fix incorrect light level usage on overlapping FOFs in OpenGL
This commit is contained in:
parent
6f2d6e6b06
commit
12e5c3b9ce
2 changed files with 16 additions and 17 deletions
|
@ -335,13 +335,13 @@ static FUINT HWR_BottomLightLevel(side_t *side, UINT8 base_lightlevel)
|
|||
}
|
||||
*/
|
||||
|
||||
static UINT8 HWR_FloorLightLevel(sector_t *sector, INT16 base_lightlevel)
|
||||
static UINT8 HWR_FloorLightLevel(sector_t *sector, UINT8 base_lightlevel)
|
||||
{
|
||||
return max(0, min(255, sector->floorlightlevel +
|
||||
((sector->floorlightabsolute) ? 0 : base_lightlevel)));
|
||||
}
|
||||
|
||||
static UINT8 HWR_CeilingLightLevel(sector_t *sector, INT16 base_lightlevel)
|
||||
static UINT8 HWR_CeilingLightLevel(sector_t *sector, UINT8 base_lightlevel)
|
||||
{
|
||||
return max(0, min(255, sector->ceilinglightlevel +
|
||||
((sector->ceilinglightabsolute) ? 0 : base_lightlevel)));
|
||||
|
@ -2481,9 +2481,6 @@ static void HWR_Subsector(size_t num)
|
|||
{
|
||||
fixed_t bottomCullHeight, topCullHeight, centerHeight;
|
||||
|
||||
INT16 floorlight = HWR_FloorLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel);
|
||||
INT16 ceilinglight = HWR_CeilingLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel);
|
||||
|
||||
if (!(rover->fofflags & FOF_EXISTS) || !(rover->fofflags & FOF_RENDERPLANES))
|
||||
continue;
|
||||
if (sub->validcount == validcount)
|
||||
|
@ -2512,13 +2509,13 @@ static void HWR_Subsector(size_t num)
|
|||
UINT8 alpha;
|
||||
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false);
|
||||
alpha = HWR_FogBlockAlpha(floorlight, rover->master->frontsector->extra_colormap);
|
||||
alpha = HWR_FogBlockAlpha(HWR_FloorLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel), rover->master->frontsector->extra_colormap);
|
||||
|
||||
HWR_AddTransparentFloor(0,
|
||||
&extrasubsectors[num],
|
||||
false,
|
||||
*rover->bottomheight,
|
||||
floorlight,
|
||||
HWR_FloorLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel),
|
||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||
true, false, rover->master->frontsector->extra_colormap);
|
||||
}
|
||||
|
@ -2530,7 +2527,7 @@ static void HWR_Subsector(size_t num)
|
|||
&extrasubsectors[num],
|
||||
false,
|
||||
*rover->bottomheight,
|
||||
floorlight,
|
||||
HWR_FloorLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel),
|
||||
max(0, min(rover->alpha, 255)), rover->master->frontsector,
|
||||
HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent),
|
||||
false, rover->fofflags & FOF_SPLAT, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
|
@ -2539,8 +2536,9 @@ static void HWR_Subsector(size_t num)
|
|||
{
|
||||
HWR_GetLevelFlat(&levelflats[*rover->bottompic], rover->fofflags & FOF_SPLAT);
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, floorlight, &levelflats[*rover->bottompic],
|
||||
rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude,
|
||||
HWR_FloorLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel),
|
||||
&levelflats[*rover->bottompic], rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2557,13 +2555,13 @@ static void HWR_Subsector(size_t num)
|
|||
UINT8 alpha;
|
||||
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false);
|
||||
alpha = HWR_FogBlockAlpha(ceilinglight, rover->master->frontsector->extra_colormap);
|
||||
alpha = HWR_FogBlockAlpha(HWR_CeilingLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel), rover->master->frontsector->extra_colormap);
|
||||
|
||||
HWR_AddTransparentFloor(0,
|
||||
&extrasubsectors[num],
|
||||
true,
|
||||
*rover->topheight,
|
||||
ceilinglight,
|
||||
HWR_CeilingLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel),
|
||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||
true, false, rover->master->frontsector->extra_colormap);
|
||||
}
|
||||
|
@ -2575,7 +2573,7 @@ static void HWR_Subsector(size_t num)
|
|||
&extrasubsectors[num],
|
||||
true,
|
||||
*rover->topheight,
|
||||
ceilinglight,
|
||||
HWR_CeilingLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel),
|
||||
max(0, min(rover->alpha, 255)), rover->master->frontsector,
|
||||
HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent),
|
||||
false, rover->fofflags & FOF_SPLAT, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
|
@ -2584,8 +2582,9 @@ static void HWR_Subsector(size_t num)
|
|||
{
|
||||
HWR_GetLevelFlat(&levelflats[*rover->toppic], rover->fofflags & FOF_SPLAT);
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, ceilinglight, &levelflats[*rover->toppic],
|
||||
rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude,
|
||||
HWR_CeilingLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel),
|
||||
&levelflats[*rover->toppic], rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -230,13 +230,13 @@ static INT32 R_DoorClosed(void)
|
|||
&& (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture);
|
||||
}
|
||||
|
||||
static UINT8 R_FloorLightLevel(sector_t *sector, INT16 base_lightlevel)
|
||||
static UINT8 R_FloorLightLevel(sector_t *sector, UINT8 base_lightlevel)
|
||||
{
|
||||
return max(0, min(255, sector->floorlightlevel +
|
||||
((sector->floorlightabsolute) ? 0 : base_lightlevel)));
|
||||
}
|
||||
|
||||
static UINT8 R_CeilingLightLevel(sector_t *sector, INT16 base_lightlevel)
|
||||
static UINT8 R_CeilingLightLevel(sector_t *sector, UINT8 base_lightlevel)
|
||||
{
|
||||
return max(0, min(255, sector->ceilinglightlevel +
|
||||
((sector->ceilinglightabsolute) ? 0 : base_lightlevel)));
|
||||
|
|
Loading…
Reference in a new issue