mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-27 22:52:41 +00:00
Fix light level issue with walls and FOF planes
This commit is contained in:
parent
8e7cce8b61
commit
32bbc48be5
3 changed files with 28 additions and 28 deletions
|
@ -309,39 +309,39 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, angle_t dir, fixed_t delta)
|
||||||
return (FUINT)finallight;
|
return (FUINT)finallight;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FUINT HWR_SideLightLevel(side_t *side, UINT8 base_lightlevel)
|
static UINT8 HWR_SideLightLevel(side_t *side, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return side->light +
|
return max(0, min(255, side->light +
|
||||||
((side->lightabsolute) ? 0 : base_lightlevel);
|
((side->lightabsolute) ? 0 : base_lightlevel)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: implement per-texture lighting
|
/* TODO: implement per-texture lighting
|
||||||
static FUINT HWR_TopLightLevel(side_t *side, UINT8 base_lightlevel)
|
static UINT8 HWR_TopLightLevel(side_t *side, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return side->light_top +
|
return max(0, min(255, side->light_top +
|
||||||
((side->lightabsolute_top) ? 0 : HWR_SideLightLevel(side, base_lightlevel));
|
((side->lightabsolute_top) ? 0 : HWR_SideLightLevel(side, base_lightlevel))));
|
||||||
}
|
}
|
||||||
|
|
||||||
static FUINT HWR_MidLightLevel(side_t *side, UINT8 base_lightlevel)
|
static UINT8 HWR_MidLightLevel(side_t *side, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return side->light_mid +
|
return max(0, min(255, side->light_mid +
|
||||||
((side->lightabsolute_mid) ? 0 : HWR_SideLightLevel(side, base_lightlevel));
|
((side->lightabsolute_mid) ? 0 : HWR_SideLightLevel(side, base_lightlevel))));
|
||||||
}
|
}
|
||||||
|
|
||||||
static FUINT HWR_BottomLightLevel(side_t *side, UINT8 base_lightlevel)
|
static UINT8 HWR_BottomLightLevel(side_t *side, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return side->light_bottom +
|
return max(0, min(255, side->light_bottom +
|
||||||
((side->lightabsolute_bottom) ? 0 : HWR_SideLightLevel(side, base_lightlevel));
|
((side->lightabsolute_bottom) ? 0 : HWR_SideLightLevel(side, base_lightlevel))));
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static UINT8 HWR_FloorLightLevel(sector_t *sector, UINT8 base_lightlevel)
|
static UINT8 HWR_FloorLightLevel(sector_t *sector, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return max(0, min(255, sector->floorlightlevel +
|
return max(0, min(255, sector->floorlightlevel +
|
||||||
((sector->floorlightabsolute) ? 0 : base_lightlevel)));
|
((sector->floorlightabsolute) ? 0 : base_lightlevel)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT8 HWR_CeilingLightLevel(sector_t *sector, UINT8 base_lightlevel)
|
static UINT8 HWR_CeilingLightLevel(sector_t *sector, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return max(0, min(255, sector->ceilinglightlevel +
|
return max(0, min(255, sector->ceilinglightlevel +
|
||||||
((sector->ceilinglightabsolute) ? 0 : base_lightlevel)));
|
((sector->ceilinglightabsolute) ? 0 : base_lightlevel)));
|
||||||
|
|
|
@ -230,13 +230,13 @@ static INT32 R_DoorClosed(void)
|
||||||
&& (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture);
|
&& (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT8 R_FloorLightLevel(sector_t *sector, UINT8 base_lightlevel)
|
static UINT8 R_FloorLightLevel(sector_t *sector, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return max(0, min(255, sector->floorlightlevel +
|
return max(0, min(255, sector->floorlightlevel +
|
||||||
((sector->floorlightabsolute) ? 0 : base_lightlevel)));
|
((sector->floorlightabsolute) ? 0 : base_lightlevel)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT8 R_CeilingLightLevel(sector_t *sector, UINT8 base_lightlevel)
|
static UINT8 R_CeilingLightLevel(sector_t *sector, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return max(0, min(255, sector->ceilinglightlevel +
|
return max(0, min(255, sector->ceilinglightlevel +
|
||||||
((sector->ceilinglightabsolute) ? 0 : base_lightlevel)));
|
((sector->ceilinglightabsolute) ? 0 : base_lightlevel)));
|
||||||
|
|
24
src/r_segs.c
24
src/r_segs.c
|
@ -94,29 +94,29 @@ transnum_t R_GetLinedefTransTable(fixed_t alpha)
|
||||||
return (20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1);
|
return (20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT16 R_SideLightLevel(side_t *side, UINT8 base_lightlevel)
|
static UINT8 R_SideLightLevel(side_t *side, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return side->light +
|
return max(0, min(255, side->light +
|
||||||
((side->lightabsolute) ? 0 : base_lightlevel);
|
((side->lightabsolute) ? 0 : base_lightlevel)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: implement per-texture lighting
|
/* TODO: implement per-texture lighting
|
||||||
static INT16 R_TopLightLevel(side_t *side, UINT8 base_lightlevel)
|
static UINT8 R_TopLightLevel(side_t *side, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return side->light_top +
|
return max(0, min(255, side->light_top +
|
||||||
((side->lightabsolute_top) ? 0 : R_SideLightLevel(side, base_lightlevel));
|
((side->lightabsolute_top) ? 0 : R_SideLightLevel(side, base_lightlevel))));
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT16 R_MidLightLevel(side_t *side, UINT8 base_lightlevel)
|
static UINT8 R_MidLightLevel(side_t *side, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return side->light_mid +
|
return max(0, min(255, side->light_mid +
|
||||||
((side->lightabsolute_mid) ? 0 : R_SideLightLevel(side, base_lightlevel));
|
((side->lightabsolute_mid) ? 0 : R_SideLightLevel(side, base_lightlevel))));
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT16 R_BottomLightLevel(side_t *side, UINT8 base_lightlevel)
|
static UINT8 R_BottomLightLevel(side_t *side, INT16 base_lightlevel)
|
||||||
{
|
{
|
||||||
return side->light_bottom +
|
return max(0, min(255, side->light_bottom +
|
||||||
((side->lightabsolute_bottom) ? 0 : R_SideLightLevel(side, base_lightlevel));
|
((side->lightabsolute_bottom) ? 0 : R_SideLightLevel(side, base_lightlevel))));
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue