Merge branch 'fix-tripwire-lighting' into 'master'

Force Trip Wires to render at maximum brightness

Closes #318

See merge request KartKrew/Kart!1112
This commit is contained in:
James R 2023-03-30 01:23:04 +00:00 committed by NepDisk
parent 3ca138159f
commit 6603c4e862
2 changed files with 33 additions and 13 deletions

View file

@ -1027,10 +1027,12 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
fixed_t h, l; // 3D sides and 2s middle textures
fixed_t hS, lS;
FUINT lightnum = 255; // shut up compiler
FUINT lightnum = 255;
extracolormap_t *colormap;
FSurfaceInfo Surf;
boolean tripwire;
gl_sidedef = gl_curline->sidedef;
gl_linedef = gl_curline->linedef;
@ -1086,7 +1088,13 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
cliphigh = (float)(texturehpeg + (gl_curline->flength*FRACUNIT));
}
lightnum = HWR_CalcWallLight(gl_frontsector->lightlevel, gl_curline);
tripwire = P_IsLineTripWire(gl_linedef);
if (tripwire == false)
{
lightnum = HWR_CalcWallLight(gl_frontsector->lightlevel, gl_curline);
}
colormap = gl_frontsector->extra_colormap;
if (gl_frontsector)
@ -1462,7 +1470,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// This will cause the midtexture appear on top, if a FOF overlaps with it.
blendmode |= PF_Decal;
if (gl_frontsector->numlights)
if (tripwire == false && gl_frontsector->numlights)
{
if (!(blendmode & PF_Masked))
HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FOF_TRANSLUCENT, NULL, blendmode); // vanilla just uses PF_Masked here - if we run into any issues, maybe change to that

View file

@ -170,8 +170,10 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
texnum = R_GetTextureNum(curline->sidedef->midtexture);
bmnum = R_GetTextureBrightmap(texnum);
windowbottom = windowtop = sprbotscreen = INT32_MAX;
boolean tripwire;
ldef = curline->linedef;
tripwire = P_IsLineTripWire(ldef);
if (!ldef->alpha)
return;
@ -239,7 +241,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
// Setup lighting based on the presence/lack-of 3D floors.
dc_numlights = 0;
if (frontsector->numlights)
if (tripwire == false && frontsector->numlights)
{
dc_numlights = frontsector->numlights;
if (dc_numlights >= dc_maxlights)
@ -286,17 +288,27 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
}
else
{
if ((R_CheckColumnFunc(COLDRAWFUNC_FUZZY) == false)
|| (frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG)))
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
if (tripwire)
{
lightnum = LIGHTLEVELS - 1; // tripwires are full bright
}
else
lightnum = LIGHTLEVELS - 1;
{
if ((R_CheckColumnFunc(COLDRAWFUNC_FUZZY) == false)
|| (frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG)))
{
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
}
else
{
lightnum = LIGHTLEVELS - 1;
if ((R_CheckColumnFunc(COLDRAWFUNC_FOG) == true)
|| (frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG)))
;
else if (P_ApplyLightOffset(lightnum))
lightnum += curline->lightOffset;
if (P_ApplyLightOffset(lightnum))
{
lightnum += curline->lightOffset;
}
}
}
if (lightnum < 0)
walllights = scalelight[0];