From dd521f2d6ad21abe6eac6be5c3c0fc2efb3fc957 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 22 May 2026 23:12:42 +0200 Subject: [PATCH] few more hw_ file cleanups --- src/hardware/hw_main.cpp | 52 ++++++++++++++++++++-------------------- src/hardware/hw_main.h | 2 +- src/hardware/hw_portal.c | 2 +- src/r_bsp.cpp | 2 +- src/v_video.c | 6 ++--- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 82eca5965..3ed4942aa 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -1101,15 +1101,15 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, { bheight = FixedToFloat(P_GetFFloorBottomZAt(list[i].caster, v1x, v1y)); endbheight = FixedToFloat(P_GetFFloorBottomZAt(list[i].caster, v2x, v2y)); - } - if (endheight >= endtop && height >= top) - { - if (solid && top > bheight) - top = bheight; + if (endheight >= endtop && height >= top) + { + if (top > bheight) + top = bheight; - if (solid && endtop > endbheight) - endtop = endbheight; + if (endtop > endbheight) + endtop = endbheight; + } } if (i + 1 < sector->numlights) @@ -2365,11 +2365,11 @@ static void HWR_AddLine(seg_t *line) gl_curline = line; - v1x = gl_curline->v1->x; - v1y = gl_curline->v1->y; + v1x = line->v1->x; + v1y = line->v1->y; - v2x = gl_curline->v2->x; - v2y = gl_curline->v2->y; + v2x = line->v2->x; + v2y = line->v2->y; // OPTIMIZE: quickly reject orthogonal back sides. angle1 = R_PointToAngle64(v1x, v1y); @@ -2405,6 +2405,7 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord) { fixed_t px1, py1, px2, py2; angle_t angle1, angle2; + const INT32* check; // Find the corners of the box // that define the edges from current viewpoint. @@ -2416,10 +2417,12 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord) if (boxpos == 5) return true; - px1 = bspcoord[checkcoord[boxpos][0]]; - py1 = bspcoord[checkcoord[boxpos][1]]; - px2 = bspcoord[checkcoord[boxpos][2]]; - py2 = bspcoord[checkcoord[boxpos][3]]; + check = checkcoord[boxpos]; + + px1 = bspcoord[check[0]]; + py1 = bspcoord[check[1]]; + px2 = bspcoord[check[2]]; + py2 = bspcoord[check[3]]; if (current_bsp_culling_distance) { @@ -3061,15 +3064,12 @@ doaddline: // hurdler: false: we only add the sprites, the walls are drawn first if (line) { - if (sub->sector->validcount != validcount) - { - // draw sprites first, coz they are clipped to the solidsegs of - // subsectors more 'in front' - if (cv_drawdist.value || current_bsp_culling_distance) - HWR_AddSprites(gl_frontsector); - else - HWR_AddSprites(gl_frontsector); - } + // draw sprites first, coz they are clipped to the solidsegs of + // subsectors more 'in front' + if (cv_drawdist.value || current_bsp_culling_distance) + HWR_AddSprites(gl_frontsector); + else + HWR_AddSprites(gl_frontsector); //Hurdler: at this point validcount must be the same, but is not because // gl_frontsector doesn't point anymore to sub->sector due to @@ -5538,8 +5538,8 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool }; extern "C" { - void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, int stencil_level, boolean allow_portals) { - HWR_RenderViewpoint(rootportal, stencil_level, allow_portals); + void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, int stencil_level) { + HWR_RenderViewpoint(rootportal, stencil_level, true); } } diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index c8285c5bd..8147d9d2e 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -102,7 +102,7 @@ void HWR_SetViewSize(void); void HWR_AddCommands(void); void HWR_RenderPlayerView(void); -void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, int stencil_level, boolean allow_portals); +void HWR_RenderPortalViewpoint(gl_portal_t *rootportal, int stencil_level); void HWR_ClearSkyDome(void); void HWR_BuildSkyDome(void); diff --git a/src/hardware/hw_portal.c b/src/hardware/hw_portal.c index e588adea1..117d59725 100644 --- a/src/hardware/hw_portal.c +++ b/src/hardware/hw_portal.c @@ -170,7 +170,7 @@ void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float HWR_PortalFrame(portal); // call HWR_RenderViewpoint - HWR_RenderPortalViewpoint(portal, stencil_level + 1, true); + HWR_RenderPortalViewpoint(portal, stencil_level + 1); // return to current frame if (rootportal) diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index a3e67a5e3..8fd66299c 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -320,7 +320,7 @@ static void R_AddLine(seg_t *line) INT32 x1, x2; angle_t angle1, angle2, span, tspan; static sector_t tempsec; - boolean bothfloorssky = false; + boolean bothfloorssky = false; g_portal = NULL; diff --git a/src/v_video.c b/src/v_video.c index 078e65b3c..585478c3a 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -423,9 +423,9 @@ static void ApplyPaletteDelta(const RGBA_t *pal_in, RGBA_t *pal_out, const INT16 INT16 r = (INT16)pal_in[i].s.red + pal_delta[i][0]; INT16 g = (INT16)pal_in[i].s.green + pal_delta[i][1]; INT16 b = (INT16)pal_in[i].s.blue + pal_delta[i][2]; - pal_out[i].s.red = (UINT8)CLAMP(r, 0 , 255); - pal_out[i].s.green = (UINT8)CLAMP(g, 0 , 255); - pal_out[i].s.blue = (UINT8)CLAMP(b, 0 , 255); + pal_out[i].s.red = (UINT8)CLAMP(r, 0, 255); + pal_out[i].s.green = (UINT8)CLAMP(g, 0, 255); + pal_out[i].s.blue = (UINT8)CLAMP(b, 0, 255); pal_out[i].s.alpha = 0xFF; // pal_in[i].s.alpha } }