From 9d6cb93127baed61dad103ef58a38ac683f4d11c Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 31 Oct 2023 03:46:30 -0300 Subject: [PATCH] Cleanup R_DrawPrecipitationVisSprite and fix a warning --- src/r_things.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index e87fccddd..8d6b1d8d4 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -988,21 +988,12 @@ static void R_DrawVisSprite(vissprite_t *vis) // Special precipitation drawer Tails 08-18-2002 static void R_DrawPrecipitationVisSprite(vissprite_t *vis) { - column_t *column; -#ifdef RANGECHECK - INT32 texturecolumn; -#endif - fixed_t frac; - patch_t *patch; - INT64 overflow_test; - - //Fab : R_InitSprites now sets a wad lump number - patch = vis->patch; + patch_t *patch = vis->patch; if (!patch) return; // Check for overflow - overflow_test = (INT64)centeryfrac - (((INT64)vis->texturemid*vis->scale)>>FRACBITS); + INT64 overflow_test = (INT64)centeryfrac - (((INT64)vis->texturemid*vis->scale)>>FRACBITS); if (overflow_test < 0) overflow_test = -overflow_test; if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) return; // fixed point mult would overflow @@ -1018,23 +1009,18 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis) dc_texturemid = vis->texturemid; dc_texheight = 0; - frac = vis->startfrac; spryscale = vis->scale; sprtopscreen = centeryfrac - FixedMul(dc_texturemid,spryscale); windowtop = windowbottom = sprbotscreen = INT32_MAX; if (vis->x1 < 0) vis->x1 = 0; - if (vis->x2 >= vid.width) vis->x2 = vid.width-1; + fixed_t frac = vis->startfrac; for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, frac += vis->xiscale) - { - texturecolumn = frac>>FRACBITS; - column = Patch_GetColumn(patch, texturecolumn); - R_DrawMaskedColumn(column); - } + R_DrawMaskedColumn(Patch_GetColumn(patch, frac>>FRACBITS)); colfunc = colfuncs[BASEDRAWFUNC]; }