Cleanup R_DrawPrecipitationVisSprite and fix a warning

This commit is contained in:
Lactozilla 2023-10-31 03:46:30 -03:00
parent 379c163bef
commit 9d6cb93127

View file

@ -988,21 +988,12 @@ static void R_DrawVisSprite(vissprite_t *vis)
// Special precipitation drawer Tails 08-18-2002 // Special precipitation drawer Tails 08-18-2002
static void R_DrawPrecipitationVisSprite(vissprite_t *vis) static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
{ {
column_t *column; patch_t *patch = vis->patch;
#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;
if (!patch) if (!patch)
return; return;
// Check for overflow // 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 (overflow_test < 0) overflow_test = -overflow_test;
if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) return; // fixed point mult would overflow 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_texturemid = vis->texturemid;
dc_texheight = 0; dc_texheight = 0;
frac = vis->startfrac;
spryscale = vis->scale; spryscale = vis->scale;
sprtopscreen = centeryfrac - FixedMul(dc_texturemid,spryscale); sprtopscreen = centeryfrac - FixedMul(dc_texturemid,spryscale);
windowtop = windowbottom = sprbotscreen = INT32_MAX; windowtop = windowbottom = sprbotscreen = INT32_MAX;
if (vis->x1 < 0) if (vis->x1 < 0)
vis->x1 = 0; vis->x1 = 0;
if (vis->x2 >= vid.width) if (vis->x2 >= vid.width)
vis->x2 = vid.width-1; vis->x2 = vid.width-1;
fixed_t frac = vis->startfrac;
for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, frac += vis->xiscale) for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, frac += vis->xiscale)
{ R_DrawMaskedColumn(Patch_GetColumn(patch, frac>>FRACBITS));
texturecolumn = frac>>FRACBITS;
column = Patch_GetColumn(patch, texturecolumn);
R_DrawMaskedColumn(column);
}
colfunc = colfuncs[BASEDRAWFUNC]; colfunc = colfuncs[BASEDRAWFUNC];
} }