mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Clean up code duplication around RANGECHECK in r_things.c
This commit is contained in:
parent
cbb1f3c714
commit
da8809c911
1 changed files with 9 additions and 14 deletions
|
|
@ -1034,14 +1034,13 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||||
// Vertically sheared sprite
|
// Vertically sheared sprite
|
||||||
for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, frac += vis->xiscale, dc_texturemid -= vis->shear.tan)
|
for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, frac += vis->xiscale, dc_texturemid -= vis->shear.tan)
|
||||||
{
|
{
|
||||||
#ifdef RANGECHECK
|
|
||||||
texturecolumn = frac>>FRACBITS;
|
texturecolumn = frac>>FRACBITS;
|
||||||
|
|
||||||
|
#ifdef RANGECHECK
|
||||||
if (texturecolumn < 0 || texturecolumn >= pwidth)
|
if (texturecolumn < 0 || texturecolumn >= pwidth)
|
||||||
I_Error("R_DrawSpriteRange: bad texturecolumn at %d from end", vis->x2 - dc_x);
|
I_Error("R_DrawSpriteRange: bad texturecolumn at %d from end", vis->x2 - dc_x);
|
||||||
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
|
|
||||||
#else
|
|
||||||
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[frac>>FRACBITS]));
|
|
||||||
#endif
|
#endif
|
||||||
|
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
|
||||||
|
|
||||||
sprtopscreen = (centeryfrac - FixedMul(dc_texturemid, spryscale));
|
sprtopscreen = (centeryfrac - FixedMul(dc_texturemid, spryscale));
|
||||||
localcolfunc (column, NULL, baseclip);
|
localcolfunc (column, NULL, baseclip);
|
||||||
|
|
@ -1056,14 +1055,13 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||||
// Non-paper drawing loop
|
// Non-paper drawing loop
|
||||||
for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, frac += vis->xiscale, sprtopscreen += vis->shear.tan)
|
for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, frac += vis->xiscale, sprtopscreen += vis->shear.tan)
|
||||||
{
|
{
|
||||||
#ifdef RANGECHECK
|
|
||||||
texturecolumn = frac>>FRACBITS;
|
texturecolumn = frac>>FRACBITS;
|
||||||
|
|
||||||
|
#ifdef RANGECHECK
|
||||||
if (texturecolumn < 0 || texturecolumn >= pwidth)
|
if (texturecolumn < 0 || texturecolumn >= pwidth)
|
||||||
I_Error("R_DrawSpriteRange: bad texturecolumn at %d from end", vis->x2 - dc_x);
|
I_Error("R_DrawSpriteRange: bad texturecolumn at %d from end", vis->x2 - dc_x);
|
||||||
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
|
|
||||||
#else
|
|
||||||
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[frac>>FRACBITS]));
|
|
||||||
#endif
|
#endif
|
||||||
|
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
|
||||||
localcolfunc (column, NULL, baseclip);
|
localcolfunc (column, NULL, baseclip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1079,9 +1077,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||||
static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
||||||
{
|
{
|
||||||
column_t *column;
|
column_t *column;
|
||||||
#ifdef RANGECHECK
|
|
||||||
INT32 texturecolumn;
|
INT32 texturecolumn;
|
||||||
#endif
|
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
patch_t *patch;
|
patch_t *patch;
|
||||||
fixed_t this_scale = vis->thingscale;
|
fixed_t this_scale = vis->thingscale;
|
||||||
|
|
@ -1128,16 +1124,15 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
#ifdef RANGECHECK
|
|
||||||
texturecolumn = frac>>FRACBITS;
|
texturecolumn = frac>>FRACBITS;
|
||||||
|
|
||||||
|
#ifdef RANGECHECK
|
||||||
if (texturecolumn < 0 || texturecolumn >= patch->width)
|
if (texturecolumn < 0 || texturecolumn >= patch->width)
|
||||||
I_Error("R_DrawPrecipitationSpriteRange: bad texturecolumn");
|
I_Error("R_DrawPrecipitationSpriteRange: bad texturecolumn");
|
||||||
|
#endif
|
||||||
|
|
||||||
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
|
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
|
||||||
#else
|
|
||||||
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[frac>>FRACBITS]));
|
|
||||||
#endif
|
|
||||||
R_DrawMaskedColumn(column, NULL, -1);
|
R_DrawMaskedColumn(column, NULL, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue