From 10822d06181b3d289aca0ac8c0ffae7ca55f924f Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 29 Jun 2025 11:42:58 +0200 Subject: [PATCH] those can be const --- src/r_main.cpp | 5 ++--- src/r_plane.cpp | 10 ++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/r_main.cpp b/src/r_main.cpp index 836fb66e8..ebea32638 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -491,7 +491,7 @@ boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixe // Returns search dimensions within a blockmap, in the direction of viewangle and out to a certain distance. void R_GetRenderBlockMapDimensions(fixed_t drawdist, INT32 *xl, INT32 *xh, INT32 *yl, INT32 *yh) { - const angle_t left = viewangle - clipangle; + const angle_t left = viewangle - clipangle; const angle_t right = viewangle + clipangle; const fixed_t vxleft = viewx + FixedMul(drawdist, FCOS(left)); @@ -657,7 +657,6 @@ void R_CheckViewMorph(void) rollangle >>= ANGLETOFINESHIFT; rollangle = ((rollangle+2) & ~3) & FINEMASK; // Limit the distinct number of angles to reduce recalcs from angles changing a lot. - if (rollangle == viewmorph.rollangle && viewmorph.scrmapsize == vid.width*vid.height) return; // No change @@ -1363,7 +1362,7 @@ void R_RenderPlayerView(player_t *player) // load previous saved value of skyVisible for the player skyVisible = skyVisiblePerPlayer[viewssnum]; - fixed_t fov = R_GetPlayerFov(player); + const fixed_t fov = R_GetPlayerFov(player); if (viewfov[viewssnum] != fov) { diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 5cb48b355..54a0f04da 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -149,7 +149,7 @@ void R_AllocPlaneMemory(void) // static fixed_t R_CalculateRippleOffset(drawspandata_t* ds, INT32 y) { - fixed_t distance = FixedMul(ds->planeheight, yslope[y]); + const fixed_t distance = FixedMul(ds->planeheight, yslope[y]); const INT32 yay = (ds->planeripple.offset + (distance>>9)) & 8191; return FixedDiv(FINESINE(yay), (1<<12) + (distance>>11)); } @@ -559,6 +559,7 @@ visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop) else /* Cannot use existing plane; create a new one */ { visplane_t *new_pl; + if (pl->ffloor) { new_pl = new_visplane(MAXVISPLANES - 1); @@ -782,7 +783,6 @@ void R_DrawSkyPlanes(void) static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), boolean allow_parallel) { INT32 x; - drawcolumndata_t dc = {}; if (!(pl->minx <= pl->maxx)) return; @@ -794,6 +794,8 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b return; } + drawcolumndata_t dc = {}; + // Reset column drawer function (note: couldn't we just call walldrawerfunc directly?) // (that is, unless we'll need to switch drawers in future for some reason) R_SetColumnFunc(BASEDRAWFUNC); @@ -1006,8 +1008,8 @@ static inline void R_AdjustSlopeCoordinates(drawspandata_t* ds, vector3_t *origi { const fixed_t modmask = ((1 << (32-ds->nflatshiftup)) - 1); - fixed_t ox = (origin->x & modmask); - fixed_t oy = -(origin->y & modmask); + const fixed_t ox = (origin->x & modmask); + const fixed_t oy = -(origin->y & modmask); ds->xoffs &= modmask; ds->yoffs &= modmask;