unglobalise drawcolumndata

from RRs multithread
will follow up with spandata
This commit is contained in:
Alug committed 2025-06-05 14:48:38 +02:00
1 parent 529b0d643a
commit 33a1540fcd
12 files changed
+481 -473

No files matched your search

+31
View File
@@ -68,6 +68,37 @@ typedef struct
#endif
} extracolormap_t;
typedef struct
{
lighttable_t* colormap;
INT32 x;
INT32 yl;
INT32 yh;
fixed_t iscale;
fixed_t texturemid;
UINT8* source; // first pixel in a column
UINT8* lightmap; // lighting only
// translucency stuff here
UINT8* transmap;
// translation stuff here
UINT8* translation;
struct r_lightlist_s* lightlist;
INT32 numlights;
INT32 maxlights;
//Fix TUTIFRUTI
INT32 texheight;
INT32 sourcelength;
} drawcolumndata_t;
extern drawcolumndata_t g_dc;
//
// INTERNAL MAP TYPES used by play and refresh
//
+2 -27
View File
@@ -45,12 +45,7 @@ UINT8 *renderscreen; // haleyjd
// COLUMN DRAWING CODE STUFF
// =========================================================================
lighttable_t *dc_colormap;
INT32 dc_x = 0, dc_yl = 0, dc_yh = 0;
fixed_t dc_iscale, dc_texturemid;
UINT8 *dc_source;
INT32 dc_sourcelength;
drawcolumndata_t g_dc;
// -----------------------
// translucency stuff here
@@ -60,22 +55,6 @@ INT32 dc_sourcelength;
UINT8 *transtables; // translucency tables
UINT8 *blendtables[NUMBLENDMAPS];
/** \brief R_DrawTransColumn uses this
*/
UINT8 *dc_transmap; // one of the translucency tables
// ----------------------
// translation stuff here
// ----------------------
/** \brief R_DrawTranslatedColumn uses this
*/
UINT8 *dc_translation;
struct r_lightlist_s *dc_lightlist = NULL;
INT32 dc_numlights = 0, dc_maxlights, dc_texheight;
// =========================================================================
// SPAN DRAWING CODE STUFF
// =========================================================================
@@ -92,14 +71,10 @@ floatv3_t *ds_su, *ds_sv, *ds_sz;
floatv3_t *ds_sup, *ds_svp, *ds_szp;
float focallengthf, zeroheight;
/** \brief Variable flat sizes
*/
UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
// For, uh, tilted lighting, duh.
static INT32 *tiltlighting;
UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
// ==========================================================================
// OLD DOOM FUZZY EFFECT
+21 -25
View File
@@ -32,24 +32,21 @@ FUNCINLINE static ATTRINLINE UINT8 *R_Address(INT32 px, INT32 py)
// COLUMN DRAWING CODE STUFF
// -------------------------
extern lighttable_t *dc_colormap;
extern INT32 dc_x, dc_yl, dc_yh;
extern fixed_t dc_iscale, dc_texturemid;
extern void (*wallcolfunc)(drawcolumndata_t*);
extern void (*colfunc)(drawcolumndata_t*);
extern void (*basecolfunc)(drawcolumndata_t*);
extern void (*fuzzcolfunc)(drawcolumndata_t*);
extern void (*transcolfunc)(drawcolumndata_t*);
extern void (*shadecolfunc)(drawcolumndata_t*);
extern void (*transtransfunc)(drawcolumndata_t*);
extern UINT8 *dc_source; // first pixel in a column
extern void (*twosmultipatchfunc)(drawcolumndata_t*);
extern void (*twosmultipatchtransfunc)(drawcolumndata_t*);
// translucency stuff here
extern UINT8 *dc_transmap;
// quick fix for tall/short skies, depending on bytesperpixel
extern void (*walldrawerfunc)(drawcolumndata_t*);
// translation stuff here
extern UINT8 *dc_translation;
extern struct r_lightlist_s *dc_lightlist;
extern INT32 dc_numlights, dc_maxlights;
//Fix TUTIFRUTI
extern INT32 dc_texheight;
void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column);
// -----------------------
// SPAN DRAWING CODE STUFF
@@ -60,7 +57,6 @@ extern lighttable_t *ds_colormap;
extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
extern INT32 ds_waterofs, ds_bgofs;
extern UINT8 *ds_source; // start of a 64*64 tile image
extern INT32 dc_sourcelength;
extern UINT8 *ds_transmap;
extern INT32 ds_bgofs;
@@ -164,20 +160,20 @@ void R_DrawViewBorder(void);
// -----------------
// column drawers
void R_DrawColumn(void);
void R_DrawColumn(drawcolumndata_t* dc);
#define R_DrawWallColumn R_DrawColumn
void R_DrawShadeColumn(void);
void R_DrawColumnShadowed(void);
void R_DrawShadeColumn(drawcolumndata_t* dc);
void R_DrawColumnShadowed(drawcolumndata_t* dc);
void R_DrawTranslucentColumn(void);
void R_DrawTranslucentColumn(drawcolumndata_t* dc);
void R_DrawTranslatedColumn(void);
void R_DrawTranslatedTranslucentColumn(void);
void R_DrawTranslatedColumn(drawcolumndata_t* dc);
void R_DrawTranslatedTranslucentColumn(drawcolumndata_t* dc);
void R_Draw2sMultiPatchColumn(void);
void R_Draw2sMultiPatchTranslucentColumn(void);
void R_Draw2sMultiPatchColumn(drawcolumndata_t* dc);
void R_Draw2sMultiPatchTranslucentColumn(drawcolumndata_t* dc);
void R_DrawFogColumn(void);
void R_DrawFogColumn(drawcolumndata_t* dc);
// span drawers
void R_DrawSpan(void);
+111 -112
View File
@@ -22,14 +22,14 @@
/** \brief The R_DrawColumn function
Experiment to make software go faster. Taken from the Boom source
*/
void R_DrawColumn(void)
void R_DrawColumn(drawcolumndata_t* dc)
{
INT32 count;
UINT8 *restrict dest;
intptr_t frac;
intptr_t fracstep;
count = dc_yh - dc_yl;
count = dc->yh - dc->yl;
if (count < 0) // Zero length, column does not exceed a pixel.
{
@@ -37,33 +37,33 @@ void R_DrawColumn(void)
}
if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height)
if ((unsigned)dc->x >= (unsigned)vid.width || dc->yl < 0 || dc->yh >= vid.height)
{
return;
}
// Framebuffer destination address.
dest = R_Address(dc_x, dc_yl);
dest = R_Address(dc->x, dc->yl);
count++;
// Determine scaling, which is the only mapping to be done.
fracstep = dc_iscale;
frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
fracstep = dc->iscale;
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
// Inner loop that does the actual texture mapping, e.g. a DDA-like scaling.
// This is as fast as it gets.
const UINT8 *restrict source = dc_source;
const lighttable_t *restrict colormap = dc_colormap;
const UINT8 *restrict source = dc->source;
const lighttable_t *restrict colormap = dc->colormap;
intptr_t heightmask = dc_sourcelength-1;
intptr_t heightmask = dc->sourcelength-1;
static const INT32 npow2min = -1;
const INT32 npow2max = dc_sourcelength;
const INT32 npow2max = dc->sourcelength;
if (dc_sourcelength & heightmask) // not a power of 2 -- killough
if (dc->sourcelength & heightmask) // not a power of 2 -- killough
{
heightmask = dc_texheight << FRACBITS;
heightmask = dc->texheight << FRACBITS;
if (frac < 0)
{
@@ -133,48 +133,47 @@ void R_DrawColumn(void)
}
}
void R_Draw2sMultiPatchColumn(void)
void R_Draw2sMultiPatchColumn(drawcolumndata_t* dc)
{
INT32 count;
UINT8 *restrict dest;
intptr_t frac;
intptr_t fracstep;
count = dc_yh - dc_yl;
count = dc->yh - dc->yl;
if (count < 0) // Zero length, column does not exceed a pixel.
{
return;
}
if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height)
if ((unsigned)dc->x >= (unsigned)vid.width || dc->yl < 0 || dc->yh >= vid.height)
{
return;
}
// Framebuffer destination address.
dest = R_Address(dc_x, dc_yl);
dest = R_Address(dc->x, dc->yl);
count++;
// Determine scaling, which is the only mapping to be done.
fracstep = dc_iscale;
frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
fracstep = dc->iscale;
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
// Inner loop that does the actual texture mapping, e.g. a DDA-like scaling.
// This is as fast as it gets.
const UINT8 *restrict source = dc_source;
const lighttable_t *restrict colormap = dc_colormap;
intptr_t heightmask = dc_sourcelength-1;
const UINT8 *restrict source = dc->source;
const lighttable_t *restrict colormap = dc->colormap;
intptr_t heightmask = dc->sourcelength-1;
UINT8 val;
static const INT32 npow2min = -1;
const INT32 npow2max = dc_sourcelength;
const INT32 npow2max = dc->sourcelength;
if (dc_sourcelength & heightmask) // not a power of 2 -- killough
if (dc->sourcelength & heightmask) // not a power of 2 -- killough
{
heightmask = dc_texheight << FRACBITS;
heightmask = dc->texheight << FRACBITS;
if (frac < 0)
{
@@ -252,7 +251,7 @@ void R_Draw2sMultiPatchColumn(void)
if (count & 1)
{
val = source[(frac>>FRACBITS) & heightmask];
val = source[CLAMP(frac >> FRACBITS, -1, dc->sourcelength)];
if (val != TRANSPARENTPIXEL)
{
*dest = colormap[val];
@@ -261,48 +260,48 @@ void R_Draw2sMultiPatchColumn(void)
}
}
void R_Draw2sMultiPatchTranslucentColumn(void)
void R_Draw2sMultiPatchTranslucentColumn(drawcolumndata_t* dc)
{
INT32 count;
UINT8 *restrict dest;
intptr_t frac;
intptr_t fracstep;
count = dc_yh - dc_yl;
count = dc->yh - dc->yl;
if (count < 0) // Zero length, column does not exceed a pixel.
{
return;
}
if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height)
if ((unsigned)dc->x >= (unsigned)vid.width || dc->yl < 0 || dc->yh >= vid.height)
{
return;
}
// Framebuffer destination address.
dest = R_Address(dc_x, dc_yl);
dest = R_Address(dc->x, dc->yl);
count++;
// Determine scaling, which is the only mapping to be done.
fracstep = dc_iscale;
frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
fracstep = dc->iscale;
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
// Inner loop that does the actual texture mapping, e.g. a DDA-like scaling.
// This is as fast as it gets.
const UINT8 *restrict source = dc_source;
const UINT8 *transmap = dc_transmap;
const lighttable_t *restrict colormap = dc_colormap;
intptr_t heightmask = dc_sourcelength-1;
const UINT8 *restrict source = dc->source;
const UINT8 *transmap = dc->transmap;
const lighttable_t *restrict colormap = dc->colormap;
intptr_t heightmask = dc->sourcelength-1;
register UINT8 val;
static const INT32 npow2min = -1;
const INT32 npow2max = dc_sourcelength;
const INT32 npow2max = dc->sourcelength;
if (dc_sourcelength & heightmask) // not a power of 2 -- killough
if (dc->sourcelength & heightmask) // not a power of 2 -- killough
{
heightmask = dc_texheight << FRACBITS;
heightmask = dc->texheight << FRACBITS;
if (frac < 0)
{
@@ -391,39 +390,39 @@ void R_Draw2sMultiPatchTranslucentColumn(void)
/** \brief The R_DrawShadeColumn function
Experiment to make software go faster. Taken from the Boom source
*/
void R_DrawShadeColumn(void)
void R_DrawShadeColumn(drawcolumndata_t* dc)
{
register INT32 count;
register UINT8 *dest;
register fixed_t frac, fracstep;
// check out coords for src*
if ((dc_yl < 0) || (dc_x >= vid.width))
if ((dc->yl < 0) || (dc->x >= vid.width))
return;
count = dc_yh - dc_yl;
count = dc->yh - dc->yl;
if (count < 0) // Zero length, column does not exceed a pixel.
{
return;
}
if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height)
if ((unsigned)dc->x >= (unsigned)vid.width || dc->yl < 0 || dc->yh >= vid.height)
{
return;
}
// Framebuffer destination address.
dest = R_Address(dc_x, dc_yl);
dest = R_Address(dc->x, dc->yl);
// Looks familiar.
fracstep = dc_iscale;
frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
fracstep = dc->iscale;
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
// Here we do an additional index re-mapping.
do
{
*dest = colormaps[(dc_source[frac>>FRACBITS] <<8) + (*dest)];
*dest = colormaps[(dc->source[frac>>FRACBITS] <<8) + (*dest)];
dest += vid.width;
frac += fracstep;
} while (count--);
@@ -434,45 +433,45 @@ void R_DrawShadeColumn(void)
a lot in 640x480 with big sprites (bfg on all screen, or transparent
walls on fullscreen)
*/
void R_DrawTranslucentColumn(void)
void R_DrawTranslucentColumn(drawcolumndata_t* dc)
{
register INT32 count;
UINT8 *restrict dest;
intptr_t frac;
intptr_t fracstep;
count = dc_yh - dc_yl + 1;
count = dc->yh - dc->yl + 1;
if (count <= 0) // Zero length, column does not exceed a pixel.
{
return;
}
if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height)
if ((unsigned)dc->x >= (unsigned)vid.width || dc->yl < 0 || dc->yh >= vid.height)
{
return;
}
// Framebuffer destination address.
dest = R_Address(dc_x, dc_yl);
dest = R_Address(dc->x, dc->yl);
// Looks familiar.
fracstep = dc_iscale;
frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
fracstep = dc->iscale;
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
// Inner loop that does the actual texture mapping, e.g. a DDA-like scaling.
// This is as fast as it gets.
const UINT8 *restrict source = dc_source;
const UINT8 *transmap = dc_transmap;
const lighttable_t *restrict colormap = dc_colormap;
intptr_t heightmask = dc_sourcelength-1;
const UINT8 *restrict source = dc->source;
const UINT8 *transmap = dc->transmap;
const lighttable_t *restrict colormap = dc->colormap;
intptr_t heightmask = dc->sourcelength-1;
static const INT32 npow2min = -1;
const INT32 npow2max = dc_sourcelength;
const INT32 npow2max = dc->sourcelength;
if (dc_sourcelength & heightmask)
if (dc->sourcelength & heightmask)
{
heightmask = dc_texheight << FRACBITS;
heightmask = dc->texheight << FRACBITS;
if (frac < 0)
{
@@ -532,42 +531,42 @@ void R_DrawTranslucentColumn(void)
Spiffy function. Not only does it colormap a sprite, but does translucency as well.
Uber-kudos to Cyan Helkaraxe
*/
void R_DrawTranslatedTranslucentColumn(void)
void R_DrawTranslatedTranslucentColumn(drawcolumndata_t* dc)
{
register INT32 count;
UINT8 *restrict dest;
intptr_t frac;
intptr_t fracstep;
count = dc_yh - dc_yl + 1;
count = dc->yh - dc->yl + 1;
if (count <= 0) // Zero length, column does not exceed a pixel.
{
return;
}
if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height)
if ((unsigned)dc->x >= (unsigned)vid.width || dc->yl < 0 || dc->yh >= vid.height)
{
return;
}
// Framebuffer destination address.
dest = R_Address(dc_x, dc_yl);
dest = R_Address(dc->x, dc->yl);
// Looks familiar.
fracstep = dc_iscale;
frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
fracstep = dc->iscale;
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
// Inner loop that does the actual texture mapping, e.g. a DDA-like scaling.
// This is as fast as it gets.
intptr_t heightmask = dc_sourcelength-1;
intptr_t heightmask = dc->sourcelength-1;
static const INT32 npow2min = -1;
const INT32 npow2max = dc_sourcelength;
const INT32 npow2max = dc->sourcelength;
if (dc_sourcelength & heightmask)
if (dc->sourcelength & heightmask)
{
heightmask = dc_texheight << FRACBITS;
heightmask = dc->texheight << FRACBITS;
if (frac < 0)
{
@@ -592,7 +591,7 @@ void R_DrawTranslatedTranslucentColumn(void)
// -1 is the lower clamp bound because column posts have a "safe" byte before the real data
// and a few bytes after as well
*dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[CLAMP(frac >> FRACBITS, npow2min, npow2max)]]]<<8) + (*dest));
*dest = *(dc->transmap + (dc->colormap[dc->translation[dc->source[CLAMP(frac >> FRACBITS, npow2min, npow2max)]]]<<8) + (*dest));
dest += vid.width;
@@ -607,18 +606,18 @@ void R_DrawTranslatedTranslucentColumn(void)
{
while ((count -= 2) >= 0) // texture height is a power of 2
{
*dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest));
*dest = *(dc->transmap + (dc->colormap[dc->translation[dc->source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest));
dest += vid.width;
frac += fracstep;
*dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest));
*dest = *(dc->transmap + (dc->colormap[dc->translation[dc->source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest));
dest += vid.width;
frac += fracstep;
}
if (count & 1)
{
*dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest));
*dest = *(dc->transmap + (dc->colormap[dc->translation[dc->source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest));
}
}
}
@@ -628,30 +627,30 @@ void R_DrawTranslatedTranslucentColumn(void)
\warning STILL NOT IN ASM, TO DO..
*/
void R_DrawTranslatedColumn(void)
void R_DrawTranslatedColumn(drawcolumndata_t* dc)
{
register INT32 count;
register UINT8 *dest;
register fixed_t frac, fracstep;
count = dc_yh - dc_yl;
count = dc->yh - dc->yl;
if (count < 0)
{
return;
}
if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height)
if ((unsigned)dc->x >= (unsigned)vid.width || dc->yl < 0 || dc->yh >= vid.height)
{
return;
}
// Framebuffer destination address.
dest = R_Address(dc_x, dc_yl);
dest = R_Address(dc->x, dc->yl);
// Looks familiar.
fracstep = dc_iscale;
frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
fracstep = dc->iscale;
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
// Here we do an additional index re-mapping.
do
@@ -661,7 +660,7 @@ void R_DrawTranslatedColumn(void)
// used with PLAY sprites.
// Thus the "green" ramp of the player 0 sprite
// is mapped to gray, red, black/indigo.
*dest = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]];
*dest = dc->colormap[dc->translation[dc->source[frac>>FRACBITS]]];
dest += vid.width;
@@ -672,30 +671,30 @@ void R_DrawTranslatedColumn(void)
/** \brief The R_DrawFogColumn function
Fog wall.
*/
void R_DrawFogColumn(void)
void R_DrawFogColumn(drawcolumndata_t* dc)
{
register INT32 count;
register UINT8 *dest;
count = dc_yh - dc_yl;
count = dc->yh - dc->yl;
// Zero length, column does not exceed a pixel.
if (count < 0)
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height)
I_Error("R_DrawFogColumn: %d to %d at %d", dc_yl, dc_yh, dc_x);
if ((unsigned)dc->x >= (unsigned)vid.width || dc->yl < 0 || dc->yh >= vid.height)
I_Error("R_DrawFogColumn: %d to %d at %d", dc->yl, dc->yh, dc->x);
#endif
// Framebuffer destination address.
dest = R_Address(dc_x, dc_yl);
dest = R_Address(dc->x, dc->yl);
// Determine scaling, which is the only mapping to be done.
do
{
// Simple. Apply the colormap to what's already on the screen.
*dest = dc_colormap[*dest];
*dest = dc->colormap[*dest];
dest += vid.width;
} while (count--);
}
@@ -705,36 +704,36 @@ void R_DrawFogColumn(void)
This function just cuts the column up into sections and calls R_DrawColumn
*/
void R_DrawColumnShadowed(void)
void R_DrawColumnShadowed(drawcolumndata_t* dc)
{
register INT32 count;
INT32 realyh, i, height, bheight = 0, solid = 0;
realyh = dc_yh;
realyh = dc->yh;
count = dc_yh - dc_yl;
count = dc->yh - dc->yl;
// Zero length, column does not exceed a pixel.
if (count < 0)
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height)
I_Error("R_DrawColumnShadowed: %d to %d at %d", dc_yl, dc_yh, dc_x);
if ((unsigned)dc->x >= (unsigned)vid.width || dc->yl < 0 || dc->yh >= vid.height)
I_Error("R_DrawColumnShadowed: %d to %d at %d", dc->yl, dc->yh, dc->x);
#endif
// This runs through the lightlist from top to bottom and cuts up the column accordingly.
for (i = 0; i < dc_numlights; i++)
for (i = 0; i < dc->numlights; i++)
{
// If the height of the light is above the column, get the colormap
// anyway because the lighting of the top should be affected.
solid = dc_lightlist[i].flags & FF_CUTSOLIDS;
solid = dc->lightlist[i].flags & FF_CUTSOLIDS;
height = dc_lightlist[i].height >> LIGHTSCALESHIFT;
height = dc->lightlist[i].height >> LIGHTSCALESHIFT;
if (solid)
{
bheight = dc_lightlist[i].botheight >> LIGHTSCALESHIFT;
bheight = dc->lightlist[i].botheight >> LIGHTSCALESHIFT;
if (bheight < height)
{
// confounded slopes sometimes allow partial invertedness,
@@ -747,32 +746,32 @@ void R_DrawColumnShadowed(void)
}
}
if (height <= dc_yl)
if (height <= dc->yl)
{
dc_colormap = dc_lightlist[i].rcolormap;
dc->colormap = dc->lightlist[i].rcolormap;
if (encoremap)
dc_colormap += COLORMAP_REMAPOFFSET;
if (solid && dc_yl < bheight)
dc_yl = bheight;
dc->colormap += COLORMAP_REMAPOFFSET;
if (solid && dc->yl < bheight)
dc->yl = bheight;
continue;
}
// Found a break in the column!
dc_yh = height;
dc->yh = height;
if (dc_yh > realyh)
dc_yh = realyh;
basecolfunc(); // R_DrawColumn for the appropriate architecture
if (dc->yh > realyh)
dc->yh = realyh;
basecolfunc(dc); // R_DrawColumn for the appropriate architecture
if (solid)
dc_yl = bheight;
dc->yl = bheight;
else
dc_yl = dc_yh + 1;
dc->yl = dc->yh + 1;
dc_colormap = dc_lightlist[i].rcolormap;
dc->colormap = dc->lightlist[i].rcolormap;
if (encoremap)
dc_colormap += COLORMAP_REMAPOFFSET;
dc->colormap += COLORMAP_REMAPOFFSET;
}
dc_yh = realyh;
if (dc_yl <= realyh)
walldrawerfunc(); // R_DrawWallColumn for the appropriate architecture
dc->yh = realyh;
if (dc->yl <= realyh)
walldrawerfunc(dc); // R_DrawWallColumn for the appropriate architecture
}
+1 -1
View File
@@ -304,7 +304,7 @@ void R_DrawFogSpan(void)
register intptr_t count;
colormap = ds_colormap;
dest = R_Address(dc_x, dc_yl);
dest = R_Address(ds_x1, ds_y);
count = ds_x2 - ds_x1 + 1;
+2 -2
View File
@@ -494,8 +494,8 @@ void R_CreateInterpolator_Polyobj(thinker_t *thinker, polyobj_t *polyobj)
interp->polyobj.polyobj = polyobj;
interp->polyobj.vertices_size = polyobj->numVertices;
interp->polyobj.oldvertices = Z_CallocAlign(sizeof(fixed_t) * 2 * polyobj->numVertices, PU_LEVEL, NULL, 32);
interp->polyobj.bakvertices = Z_CallocAlign(sizeof(fixed_t) * 2 * polyobj->numVertices, PU_LEVEL, NULL, 32);
interp->polyobj.oldvertices = Z_Calloc(sizeof(fixed_t) * 2 * polyobj->numVertices, PU_LEVEL, NULL);
interp->polyobj.bakvertices = Z_Calloc(sizeof(fixed_t) * 2 * polyobj->numVertices, PU_LEVEL, NULL);
for (size_t i = 0; i < polyobj->numVertices; i++)
{
interp->polyobj.oldvertices[i * 2 ] = interp->polyobj.bakvertices[i * 2 ] = polyobj->vertices[i]->x;
+14 -13
View File
@@ -719,6 +719,7 @@ static void R_DrawSkyPlane(visplane_t *pl)
{
INT32 x;
INT32 angle;
drawcolumndata_t dc = {0};
if (!newview->sky)
{
@@ -729,33 +730,33 @@ static void R_DrawSkyPlane(visplane_t *pl)
wallcolfunc = walldrawerfunc;
// use correct aspect ratio scale
dc_iscale = skyscale;
dc.iscale = skyscale;
// Sky is always drawn full bright,
// i.e. colormaps[0] is used.
// Because of this hack, sky is not affected
// by INVUL inverse mapping.
dc_colormap = colormaps;
dc.colormap = colormaps;
if (encoremap)
dc_colormap += COLORMAP_REMAPOFFSET;
dc.colormap += COLORMAP_REMAPOFFSET;
dc_texturemid = skytexturemid;
dc_texheight = textureheight[skytexture] >>FRACBITS;
dc_sourcelength = dc_texheight;
dc.texturemid = skytexturemid;
dc.texheight = textureheight[skytexture] >>FRACBITS;
dc.sourcelength = dc.texheight;
for (x = pl->minx; x <= pl->maxx; x++)
{
dc_yl = pl->top[x];
dc_yh = pl->bottom[x];
dc.yl = pl->top[x];
dc.yh = pl->bottom[x];
if (!(dc_yl <= dc_yh))
if (!(dc.yl <= dc.yh))
continue;
angle = (pl->viewangle + xtoviewangle[x])>>ANGLETOSKYSHIFT;
dc_iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x]>>ANGLETOFINESHIFT));
dc_x = x;
dc_source = R_GetColumn(texturetranslation[skytexture], angle);
wallcolfunc();
dc.iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x]>>ANGLETOFINESHIFT));
dc.x = x;
dc.source = R_GetColumn(texturetranslation[skytexture], angle);
wallcolfunc(&dc);
}
}
+189 -183
View File
@@ -87,7 +87,7 @@ static void R_DrawSplatColumn(column_t *column)
fixed_t basetexturemid;
INT32 topdelta, prevdelta = -1;
basetexturemid = dc_texturemid;
basetexturemid = dc->texturemid;
while (column->topdelta != 0xff)
{
@@ -99,17 +99,17 @@ static void R_DrawSplatColumn(column_t *column)
topscreen = sprtopscreen + spryscale*topdelta;
bottomscreen = topscreen + spryscale*column->length;
dc_yl = (topscreen+FRACUNIT-1)>>FRACBITS;
dc_yh = (bottomscreen-1)>>FRACBITS;
dc->yl = (topscreen+FRACUNIT-1)>>FRACBITS;
dc->yh = (bottomscreen-1)>>FRACBITS;
if (dc_yh >= last_floorclip[dc_x])
dc_yh = last_floorclip[dc_x] - 1;
if (dc_yl <= last_ceilingclip[dc_x])
dc_yl = last_ceilingclip[dc_x] + 1;
if (dc_yl <= dc_yh && dl_yh < vid.height && yh > 0)
if (dc->yh >= last_floorclip[dc->x])
dc->yh = last_floorclip[dc->x] - 1;
if (dc->yl <= last_ceilingclip[dc->x])
dc->yl = last_ceilingclip[dc->x] + 1;
if (dc->yl <= dc->yh && dl_yh < vid.height && yh > 0)
{
dc_source = (UINT8 *)column + 3;
dc_texturemid = basetexturemid - (topdelta<<FRACBITS);
dc->source = (UINT8 *)column + 3;
dc->texturemid = basetexturemid - (topdelta<<FRACBITS);
// Drawn by R_DrawColumn.
colfunc();
@@ -117,7 +117,7 @@ static void R_DrawSplatColumn(column_t *column)
column = (column_t *)((UINT8 *)column + column->length + 4);
}
dc_texturemid = basetexturemid;
dc->texturemid = basetexturemid;
}
static void R_DrawWallSplats(void)
@@ -173,11 +173,11 @@ static void R_DrawWallSplats(void)
patch = W_CachePatchNum(splat->patch, PU_SPRITE);
dc_texturemid = splat->top + (patch->height<<(FRACBITS-1)) - viewz;
dc->texturemid = splat->top + (patch->height<<(FRACBITS-1)) - viewz;
if (splat->yoffset)
dc_texturemid += *splat->yoffset;
dc->texturemid += *splat->yoffset;
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
sprtopscreen = centeryfrac - FixedMul(dc->texturemid, spryscale);
// set drawing mode
switch (splat->flags & SPLATDRAWMODE_MASK)
@@ -190,7 +190,7 @@ static void R_DrawWallSplats(void)
colfunc = basecolfunc;
else
{
dc_transmap = R_GetTranslucencyTable(tr_trans50);
dc->transmap = R_GetTranslucencyTable(tr_trans50);
colfunc = fuzzcolfunc;
}
@@ -200,26 +200,26 @@ static void R_DrawWallSplats(void)
break;
}
dc_texheight = 0;
dc->texheight = 0;
// draw the columns
for (dc_x = x1; dc_x <= x2; dc_x++, spryscale += rw_scalestep)
for (dc->x = x1; dc->x <= x2; dc->x++, spryscale += rw_scalestep)
{
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE - 1;
dc_colormap = walllights[pindex];
dc->colormap = walllights[pindex];
if (encoremap && !(seg->linedef->flags & ML_TFERLINE))
dc_colormap += COLORMAP_REMAPOFFSET;
dc->colormap += COLORMAP_REMAPOFFSET;
if (frontsector->extra_colormap)
dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
dc->colormap = frontsector->extra_colormap->colormap + (dc->colormap - colormaps);
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
dc_iscale = 0xffffffffu / (unsigned)spryscale;
sprtopscreen = centeryfrac - FixedMul(dc->texturemid, spryscale);
dc->iscale = 0xffffffffu / (unsigned)spryscale;
// find column of patch, from perspective
angle = (rw_centerangle + xtoviewangle[dc_x])>>ANGLETOFINESHIFT;
angle = (rw_centerangle + xtoviewangle[dc->x])>>ANGLETOFINESHIFT;
texturecolumn = rw_offset2 - splat->offset
- FixedMul(FINETANGENT(angle), rw_distance);
@@ -249,41 +249,41 @@ static void R_DrawWallSplats(void)
// multi-patch textures. They are not normally needed as multi-patch
// textures don't have holes in it. At least not for now.
static void R_Render2sidedMultiPatchColumn(column_t *column)
static void R_Render2sidedMultiPatchColumn(drawcolumndata_t* dc, column_t *column)
{
INT32 topscreen, bottomscreen;
topscreen = sprtopscreen; // + spryscale*column->topdelta; topdelta is 0 for the wall
bottomscreen = topscreen + spryscale * lengthcol;
dc_yl = (sprtopscreen+FRACUNIT-1)>>FRACBITS;
dc_yh = (bottomscreen-1)>>FRACBITS;
dc->yl = (sprtopscreen+FRACUNIT-1)>>FRACBITS;
dc->yh = (bottomscreen-1)>>FRACBITS;
if (windowtop != INT32_MAX && windowbottom != INT32_MAX)
{
dc_yl = ((windowtop + FRACUNIT)>>FRACBITS);
dc_yh = (windowbottom - 1)>>FRACBITS;
dc->yl = ((windowtop + FRACUNIT)>>FRACBITS);
dc->yh = (windowbottom - 1)>>FRACBITS;
}
if (dc_yh >= mfloorclip[dc_x])
dc_yh = mfloorclip[dc_x] - 1;
if (dc_yl <= mceilingclip[dc_x])
dc_yl = mceilingclip[dc_x] + 1;
if (dc->yh >= mfloorclip[dc->x])
dc->yh = mfloorclip[dc->x] - 1;
if (dc->yl <= mceilingclip[dc->x])
dc->yl = mceilingclip[dc->x] + 1;
if (dc_yl >= vid.height || dc_yh < 0)
if (dc->yl >= vid.height || dc->yh < 0)
return;
if (dc_yl <= dc_yh && dc_yh < vid.height && dc_yh > 0)
if (dc->yl <= dc->yh && dc->yh < vid.height && dc->yh > 0)
{
dc_source = (UINT8 *)column + 3;
dc_sourcelength = lengthcol;
dc->source = (UINT8 *)column + 3;
dc->sourcelength = lengthcol;
if (colfunc == wallcolfunc)
twosmultipatchfunc();
twosmultipatchfunc(dc);
else if (colfunc == fuzzcolfunc)
twosmultipatchtransfunc();
twosmultipatchtransfunc(dc);
else
colfunc();
colfunc(dc);
}
}
@@ -300,13 +300,16 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
fixed_t height, realbot;
lightlist_t *light;
r_lightlist_t *rlight;
void (*colfunc_2s)(column_t *);
line_t *ldef;
sector_t *front, *back;
INT32 times, repeats;
INT64 overflow_test;
INT32 range;
drawcolumndata_t *dc = &g_dc;
void (*colfunc_2s)(drawcolumndata_t* dc, column_t *);
// Calculate light table.
// Use different light tables
// for horizontal / vertical / diagonal. Diagonal?
@@ -326,14 +329,14 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (ldef->blendmode)
{
if (ldef->alpha == NUMTRANSMAPS || ldef->blendmode == AST_MODULATE)
dc_transmap = R_GetBlendTable(ldef->blendmode, 0);
dc->transmap = R_GetBlendTable(ldef->blendmode, 0);
else
dc_transmap = R_GetBlendTable(ldef->blendmode, R_GetLinedefTransTable(ldef->alpha));
dc->transmap = R_GetBlendTable(ldef->blendmode, R_GetLinedefTransTable(ldef->alpha));
colfunc = fuzzcolfunc;
}
else if (ldef->alpha > 0 && ldef->alpha < FRACUNIT)
{
dc_transmap = R_GetTranslucencyTable(R_GetLinedefTransTable(ldef->alpha));
dc->transmap = R_GetTranslucencyTable(R_GetLinedefTransTable(ldef->alpha));
colfunc = fuzzcolfunc;
}
else if (ldef->special == 909)
@@ -352,7 +355,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (curline->polyseg->translucency >= NUMTRANSMAPS)
return;
dc_transmap = R_GetTranslucencyTable(curline->polyseg->translucency);
dc->transmap = R_GetTranslucencyTable(curline->polyseg->translucency);
colfunc = fuzzcolfunc;
}
@@ -374,21 +377,21 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
}
// Setup lighting based on the presence/lack-of 3D floors.
dc_numlights = 0;
dc->numlights = 0;
if (frontsector->numlights)
{
dc_numlights = frontsector->numlights;
if (dc_numlights >= dc_maxlights)
dc->numlights = frontsector->numlights;
if (dc->numlights >= dc->maxlights)
{
dc_maxlights = dc_numlights;
dc_lightlist = Z_Realloc(dc_lightlist, sizeof (*dc_lightlist) * dc_maxlights, PU_STATIC, NULL);
dc->maxlights = dc->numlights;
dc->lightlist = Z_Realloc(dc->lightlist, sizeof (*dc->lightlist) * dc->maxlights, PU_STATIC, NULL);
}
for (i = 0; i < dc_numlights; i++)
for (i = 0; i < dc->numlights; i++)
{
fixed_t leftheight, rightheight;
light = &frontsector->lightlist[i];
rlight = &dc_lightlist[i];
rlight = &dc->lightlist[i];
leftheight = P_GetLightZAt(light, ds-> leftpos.x, ds-> leftpos.y);
rightheight = P_GetLightZAt(light, ds->rightpos.x, ds->rightpos.y);
@@ -489,41 +492,41 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
{
rw_scalestep = ds->scalestep;
spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep;
if (dc_numlights)
if (dc->numlights)
{ // reset all lights to their starting heights
for (i = 0; i < dc_numlights; i++)
for (i = 0; i < dc->numlights; i++)
{
rlight = &dc_lightlist[i];
rlight = &dc->lightlist[i];
rlight->height = rlight->startheight;
}
}
}
dc_texheight = textureheight[texnum]>>FRACBITS;
dc->texheight = textureheight[texnum]>>FRACBITS;
// draw the columns
for (dc_x = x1; dc_x <= x2; dc_x++)
for (dc->x = x1; dc->x <= x2; dc->x++)
{
dc_texturemid = ds->maskedtextureheight[dc_x];
dc->texturemid = ds->maskedtextureheight[dc->x];
if (!!(curline->linedef->flags & ML_DONTPEGBOTTOM) ^ !!(curline->linedef->flags & ML_EFFECT3))
dc_texturemid += (textureheight[texnum])*times + textureheight[texnum];
dc->texturemid += (textureheight[texnum])*times + textureheight[texnum];
else
dc_texturemid -= (textureheight[texnum])*times;
dc->texturemid -= (textureheight[texnum])*times;
// calculate lighting
if (maskedtexturecol[dc_x] != INT16_MAX)
if (maskedtexturecol[dc->x] != INT16_MAX)
{
// Check for overflows first
overflow_test = (INT64)centeryfrac - (((INT64)dc_texturemid*spryscale)>>FRACBITS);
overflow_test = (INT64)centeryfrac - (((INT64)dc->texturemid*spryscale)>>FRACBITS);
if (overflow_test < 0) overflow_test = -overflow_test;
if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL)
{
// Eh, no, go away, don't waste our time
if (dc_numlights)
if (dc->numlights)
{
for (i = 0; i < dc_numlights; i++)
for (i = 0; i < dc->numlights; i++)
{
rlight = &dc_lightlist[i];
rlight = &dc->lightlist[i];
rlight->height += rlight->heightstep;
}
}
@@ -531,22 +534,22 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
continue;
}
if (dc_numlights)
if (dc->numlights)
{
lighttable_t **xwalllights;
sprbotscreen = INT32_MAX;
sprtopscreen = windowtop = (centeryfrac - FixedMul(dc_texturemid, spryscale));
sprtopscreen = windowtop = (centeryfrac - FixedMul(dc->texturemid, spryscale));
realbot = windowbottom = FixedMul(textureheight[texnum], spryscale) + sprtopscreen;
dc_iscale = 0xffffffffu / (unsigned)spryscale;
dc->iscale = 0xffffffffu / (unsigned)spryscale;
// draw the texture
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc_x]) - 3);
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc->x]) - 3);
for (i = 0; i < dc_numlights; i++)
for (i = 0; i < dc->numlights; i++)
{
rlight = &dc_lightlist[i];
rlight = &dc->lightlist[i];
if ((rlight->flags & FF_NOSHADE))
continue;
@@ -573,9 +576,9 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (height <= windowtop)
{
dc_colormap = rlight->rcolormap;
dc->colormap = rlight->rcolormap;
if (encoremap && !(ldef->flags & ML_TFERLINE))
dc_colormap += COLORMAP_REMAPOFFSET;
dc->colormap += COLORMAP_REMAPOFFSET;
continue;
}
@@ -583,24 +586,24 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (windowbottom >= realbot)
{
windowbottom = realbot;
colfunc_2s(col);
for (i++; i < dc_numlights; i++)
colfunc_2s(dc, col);
for (i++; i < dc->numlights; i++)
{
rlight = &dc_lightlist[i];
rlight = &dc->lightlist[i];
rlight->height += rlight->heightstep;
}
continue;
}
colfunc_2s(col);
colfunc_2s(dc, col);
windowtop = windowbottom + 1;
dc_colormap = rlight->rcolormap;
dc->colormap = rlight->rcolormap;
if (encoremap && !(ldef->flags & ML_TFERLINE))
dc_colormap += COLORMAP_REMAPOFFSET;
dc->colormap += COLORMAP_REMAPOFFSET;
}
windowbottom = realbot;
if (windowtop < windowbottom)
colfunc_2s(col);
colfunc_2s(dc, col);
spryscale += rw_scalestep;
continue;
@@ -612,20 +615,20 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE - 1;
dc_colormap = walllights[pindex];
dc->colormap = walllights[pindex];
if (encoremap && !(ldef->flags & ML_TFERLINE))
dc_colormap += COLORMAP_REMAPOFFSET;
dc->colormap += COLORMAP_REMAPOFFSET;
if (frontsector->extra_colormap)
dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
dc->colormap = frontsector->extra_colormap->colormap + (dc->colormap - colormaps);
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
dc_iscale = 0xffffffffu / (unsigned)spryscale;
sprtopscreen = centeryfrac - FixedMul(dc->texturemid, spryscale);
dc->iscale = 0xffffffffu / (unsigned)spryscale;
// draw the texture
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc_x]) - 3);
col = (column_t *)((UINT8 *)R_GetColumn(texnum, maskedtexturecol[dc->x]) - 3);
colfunc_2s(col);
colfunc_2s(dc, col);
}
spryscale += rw_scalestep;
}
@@ -634,13 +637,13 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
}
// Loop through R_DrawMaskedColumn calls
static void R_DrawRepeatMaskedColumn(column_t *col)
static void R_DrawRepeatMaskedColumn(drawcolumndata_t* dc, column_t *col)
{
INT64 z;
while (sprtopscreen < sprbotscreen)
{
R_DrawMaskedColumn(col);
z = sprtopscreen + (INT64)dc_texheight*spryscale;
R_DrawMaskedColumn(dc, col);
z = sprtopscreen + (INT64)dc->texheight*spryscale;
if (z > (INT64)INT32_MAX) // prevent overflow
sprtopscreen = INT32_MAX;
else
@@ -690,7 +693,9 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
fixed_t left_top, left_bottom; // needed here for slope skewing
pslope_t *skewslope = NULL;
void (*colfunc_2s) (column_t *);
drawcolumndata_t *dc = &g_dc;
void (*colfunc_2s) (drawcolumndata_t* dc, column_t *);
// Calculate light table.
// Use different light tables
@@ -723,8 +728,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (trans >= 10)
return; // Don't even draw it
if (pfloor->blend) // additive, (reverse) subtractive, modulative
dc_transmap = R_GetBlendTable(pfloor->blend, trans);
else if (!(dc_transmap = R_GetTranslucencyTable(trans)) || trans == 0)
dc->transmap = R_GetBlendTable(pfloor->blend, trans);
else if (!(dc->transmap = R_GetTranslucencyTable(trans)) || trans == 0)
fuzzy = false; // Opaque
}
@@ -739,23 +744,23 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
rw_scalestep = ds->scalestep;
spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep;
dc_numlights = 0;
dc->numlights = 0;
if (frontsector->numlights)
{
dc_numlights = frontsector->numlights;
if (dc_numlights > dc_maxlights)
dc->numlights = frontsector->numlights;
if (dc->numlights > dc->maxlights)
{
dc_maxlights = dc_numlights;
dc_lightlist = Z_Realloc(dc_lightlist, sizeof (*dc_lightlist) * dc_maxlights, PU_STATIC, NULL);
dc->maxlights = dc->numlights;
dc->lightlist = Z_Realloc(dc->lightlist, sizeof (*dc->lightlist) * dc->maxlights, PU_STATIC, NULL);
}
for (i = p = 0; i < dc_numlights; i++)
for (i = p = 0; i < dc->numlights; i++)
{
fixed_t leftheight, rightheight;
fixed_t pfloorleft, pfloorright;
INT64 overflow_test;
light = &frontsector->lightlist[i];
rlight = &dc_lightlist[p];
rlight = &dc->lightlist[p];
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
end1 = P_GetZAt(slope, ds->leftpos.x, ds->leftpos.y, normalheight); \
@@ -769,7 +774,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
SLOPEPARAMS(*pfloor->t_slope, pfloorleft, pfloorright, *pfloor->topheight)
if (leftheight > pfloorleft && rightheight > pfloorright && i+1 < dc_numlights)
if (leftheight > pfloorleft && rightheight > pfloorright && i+1 < dc->numlights)
{
lightlist_t *nextlight = &frontsector->lightlist[i+1];
if ((P_GetLightZAt(nextlight, ds->leftpos.x, ds->leftpos.y) > pfloorleft)
@@ -831,7 +836,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
p++;
}
dc_numlights = p;
dc->numlights = p;
}
else
{
@@ -863,7 +868,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
mfloorclip = ds->sprbottomclip;
mceilingclip = ds->sprtopclip;
dc_texheight = textureheight[texnum]>>FRACBITS;
dc->texheight = textureheight[texnum]>>FRACBITS;
// calculate both left ends
left_top = P_GetFFloorTopZAt (pfloor, ds->leftpos.x, ds->leftpos.y) - viewz;
@@ -880,9 +885,9 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
slopeskew = true;
if (slopeskew)
dc_texturemid = left_top;
dc->texturemid = left_top;
else
dc_texturemid = *pfloor->topheight - viewz;
dc->texturemid = *pfloor->topheight - viewz;
if (newline)
{
@@ -891,7 +896,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
{
skewslope = *pfloor->b_slope; // skew using bottom slope
if (slopeskew)
dc_texturemid = left_bottom;
dc->texturemid = left_bottom;
else
offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
}
@@ -903,7 +908,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
{
skewslope = *pfloor->b_slope; // skew using bottom slope
if (slopeskew)
dc_texturemid = left_bottom;
dc->texturemid = left_bottom;
else
offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
}
@@ -917,7 +922,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
ffloortextureslide = FixedMul(skewslope->zdelta, FINECOSINE((lineangle-skewslope->xydirection)>>ANGLETOFINESHIFT));
}
dc_texturemid += offsetvalue;
dc->texturemid += offsetvalue;
// Texture must be cached before setting colfunc_2s,
// otherwise texture[texnum]->holes may be false when it shouldn't be
@@ -954,16 +959,16 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
}
// draw the columns
for (dc_x = x1; dc_x <= x2; dc_x++)
for (dc->x = x1; dc->x <= x2; dc->x++)
{
if (maskedtexturecol[dc_x] == INT16_MAX)
if (maskedtexturecol[dc->x] == INT16_MAX)
continue;
{
if (ffloortextureslide) { // skew FOF walls
if (oldx != -1)
dc_texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc_x])<<FRACBITS);
oldx = dc_x;
dc->texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc->x])<<FRACBITS);
oldx = dc->x;
}
// Calculate bounds
// clamp the values if necessary to avoid overflows and rendering glitches caused by them
@@ -981,11 +986,11 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
// SoM: If column is out of range, why bother with it??
if (windowbottom < topbounds || windowtop > bottombounds)
{
if (dc_numlights)
if (dc->numlights)
{
for (i = 0; i < dc_numlights; i++)
for (i = 0; i < dc->numlights; i++)
{
rlight = &dc_lightlist[i];
rlight = &dc->lightlist[i];
rlight->height += rlight->heightstep;
if (rlight->flags & FF_CUTLEVEL)
rlight->botheight += rlight->botheightstep;
@@ -995,14 +1000,14 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
continue;
}
dc_iscale = 0xffffffffu / (unsigned)spryscale;
dc->iscale = 0xffffffffu / (unsigned)spryscale;
// Get data for the column
col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc_x]) - 3);
col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc->x]) - 3);
// SoM: New code does not rely on R_DrawColumnShadowed which
// will (hopefully) put less strain on the stack.
if (dc_numlights)
if (dc->numlights)
{
lighttable_t **xwalllights;
fixed_t height;
@@ -1010,11 +1015,11 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
INT32 solid = 0;
INT32 lighteffect = 0;
for (i = 0; i < dc_numlights; i++)
for (i = 0; i < dc->numlights; i++)
{
// Check if the current light effects the colormap/lightlevel
rlight = &dc_lightlist[i];
lighteffect = !(dc_lightlist[i].flags & FF_NOSHADE);
rlight = &dc->lightlist[i];
lighteffect = !(dc->lightlist[i].flags & FF_NOSHADE);
if (lighteffect)
{
@@ -1081,9 +1086,9 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
{
if (lighteffect)
{
dc_colormap = rlight->rcolormap;
dc->colormap = rlight->rcolormap;
if (encoremap && !(curline->linedef->flags & ML_TFERLINE))
dc_colormap += COLORMAP_REMAPOFFSET;
dc->colormap += COLORMAP_REMAPOFFSET;
}
if (solid && windowtop < bheight)
windowtop = bheight;
@@ -1095,10 +1100,10 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
{
windowbottom = sprbotscreen;
// draw the texture
colfunc_2s (col);
for (i++; i < dc_numlights; i++)
colfunc_2s (dc, col);
for (i++; i < dc->numlights; i++)
{
rlight = &dc_lightlist[i];
rlight = &dc->lightlist[i];
rlight->height += rlight->heightstep;
if (rlight->flags & FF_CUTLEVEL)
rlight->botheight += rlight->botheightstep;
@@ -1106,22 +1111,22 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
continue;
}
// draw the texture
colfunc_2s (col);
colfunc_2s (dc, col);
if (solid)
windowtop = bheight;
else
windowtop = windowbottom + 1;
if (lighteffect)
{
dc_colormap = rlight->rcolormap;
dc->colormap = rlight->rcolormap;
if (encoremap && !(curline->linedef->flags & ML_TFERLINE))
dc_colormap += COLORMAP_REMAPOFFSET;
dc->colormap += COLORMAP_REMAPOFFSET;
}
}
windowbottom = sprbotscreen;
// draw the texture, if there is any space left
if (windowtop < windowbottom)
colfunc_2s (col);
colfunc_2s (dc, col);
spryscale += rw_scalestep;
continue;
@@ -1133,18 +1138,18 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE - 1;
dc_colormap = walllights[pindex];
dc->colormap = walllights[pindex];
if (encoremap && !(curline->linedef->flags & ML_TFERLINE))
dc_colormap += COLORMAP_REMAPOFFSET;
dc->colormap += COLORMAP_REMAPOFFSET;
if (pfloor->flags & FF_FOG && pfloor->master->frontsector->extra_colormap)
dc_colormap = pfloor->master->frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
dc->colormap = pfloor->master->frontsector->extra_colormap->colormap + (dc->colormap - colormaps);
else if (frontsector->extra_colormap)
dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
dc->colormap = frontsector->extra_colormap->colormap + (dc->colormap - colormaps);
// draw the texture
colfunc_2s (col);
colfunc_2s (dc, col);
spryscale += rw_scalestep;
}
}
@@ -1185,7 +1190,7 @@ static inline void R_ExpandPlaneY(visplane_t *pl, INT32 x, INT16 top, INT16 bott
#define HEIGHTBITS 12
#define HEIGHTUNIT (1<<HEIGHTBITS)
static void R_RenderSegLoop (void)
static void R_RenderSegLoop(drawcolumndata_t* dc)
{
angle_t angle;
size_t pindex;
@@ -1370,25 +1375,25 @@ static void R_RenderSegLoop (void)
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE-1;
dc_colormap = walllights[pindex];
dc->colormap = walllights[pindex];
if (encoremap && !(curline->linedef->flags & ML_TFERLINE))
dc_colormap += COLORMAP_REMAPOFFSET;
dc_x = rw_x;
dc_iscale = 0xffffffffu / (unsigned)rw_scale;
dc->colormap += COLORMAP_REMAPOFFSET;
dc->x = rw_x;
dc->iscale = 0xffffffffu / (unsigned)rw_scale;
if (frontsector->extra_colormap)
dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
dc->colormap = frontsector->extra_colormap->colormap + (dc->colormap - colormaps);
}
if (dc_numlights)
if (dc->numlights)
{
lighttable_t **xwalllights;
for (i = 0; i < dc_numlights; i++)
for (i = 0; i < dc->numlights; i++)
{
INT32 lightnum;
lightnum = (dc_lightlist[i].lightlevel >> LIGHTSEGSHIFT);
lightnum = (dc->lightlist[i].lightlevel >> LIGHTSEGSHIFT);
if (dc_lightlist[i].extra_colormap)
if (dc->lightlist[i].extra_colormap)
;
else if (P_ApplyLightOffset(lightnum, curline->frontsector))
lightnum += curline->lightOffset;
@@ -1405,10 +1410,10 @@ static void R_RenderSegLoop (void)
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE-1;
if (dc_lightlist[i].extra_colormap)
dc_lightlist[i].rcolormap = dc_lightlist[i].extra_colormap->colormap + (xwalllights[pindex] - colormaps);
if (dc->lightlist[i].extra_colormap)
dc->lightlist[i].rcolormap = dc->lightlist[i].extra_colormap->colormap + (xwalllights[pindex] - colormaps);
else
dc_lightlist[i].rcolormap = xwalllights[pindex];
dc->lightlist[i].rcolormap = xwalllights[pindex];
colfunc = R_DrawColumnShadowed;
}
@@ -1422,13 +1427,13 @@ static void R_RenderSegLoop (void)
// single sided line
if (yl <= yh && yh >= 0 && yl < viewheight)
{
dc_yl = yl;
dc_yh = yh;
dc_texturemid = rw_midtexturemid;
dc_source = R_GetColumn(midtexture,texturecolumn);
dc_texheight = textureheight[midtexture]>>FRACBITS;
dc_sourcelength = dc_texheight;
colfunc();
dc->yl = yl;
dc->yh = yh;
dc->texturemid = rw_midtexturemid;
dc->source = R_GetColumn(midtexture,texturecolumn);
dc->texheight = textureheight[midtexture]>>FRACBITS;
dc->sourcelength = dc->texheight;
colfunc(dc);
// dont draw anything more for this column, since
// a midtexture blocks the view
@@ -1470,13 +1475,13 @@ static void R_RenderSegLoop (void)
}
else if (mid >= 0) // safe to draw top texture
{
dc_yl = yl;
dc_yh = mid;
dc_texturemid = rw_toptexturemid;
dc_source = R_GetColumn(toptexture,texturecolumn);
dc_texheight = textureheight[toptexture]>>FRACBITS;
dc_sourcelength = dc_texheight;
colfunc();
dc->yl = yl;
dc->yh = mid;
dc->texturemid = rw_toptexturemid;
dc->source = R_GetColumn(toptexture,texturecolumn);
dc->texheight = textureheight[toptexture]>>FRACBITS;
dc->sourcelength = dc->texheight;
colfunc(dc);
ceilingclip[rw_x] = (INT16)mid;
}
else if (!rw_ceilingmarked) // entirely off top of screen
@@ -1507,14 +1512,14 @@ static void R_RenderSegLoop (void)
}
else if (mid < viewheight) // safe to draw bottom texture
{
dc_yl = mid;
dc_yh = yh;
dc_texturemid = rw_bottomtexturemid;
dc_source = R_GetColumn(bottomtexture,
dc->yl = mid;
dc->yh = yh;
dc->texturemid = rw_bottomtexturemid;
dc->source = R_GetColumn(bottomtexture,
texturecolumn);
dc_texheight = textureheight[bottomtexture]>>FRACBITS;
dc_sourcelength = dc_texheight;
colfunc();
dc->texheight = textureheight[bottomtexture]>>FRACBITS;
dc->sourcelength = dc->texheight;
colfunc(dc);
floorclip[rw_x] = (INT16)mid;
}
else if (!rw_floormarked) // entirely off bottom of screen
@@ -1539,13 +1544,13 @@ static void R_RenderSegLoop (void)
}
}
if (dc_numlights)
if (dc->numlights)
{
for (i = 0; i < dc_numlights; i++)
for (i = 0; i < dc->numlights; i++)
{
dc_lightlist[i].height += dc_lightlist[i].heightstep;
if (dc_lightlist[i].flags & FF_CUTSOLIDS)
dc_lightlist[i].botheight += dc_lightlist[i].botheightstep;
dc->lightlist[i].height += dc->lightlist[i].heightstep;
if (dc->lightlist[i].flags & FF_CUTSOLIDS)
dc->lightlist[i].botheight += dc->lightlist[i].botheightstep;
}
}
@@ -1636,6 +1641,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
INT32 range;
vertex_t segleft, segright;
fixed_t ceilingfrontslide, floorfrontslide, ceilingbackslide, floorbackslide;
drawcolumndata_t dc = {0};
maskedtextureheight = NULL;
//initialize segleft and segright
@@ -2441,23 +2447,23 @@ void R_StoreWallRange(INT32 start, INT32 stop)
}
}
dc_numlights = 0;
dc.numlights = 0;
if (frontsector->numlights)
{
dc_numlights = frontsector->numlights;
if (dc_numlights >= dc_maxlights)
dc.numlights = frontsector->numlights;
if (dc.numlights >= dc.maxlights)
{
dc_maxlights = dc_numlights;
dc_lightlist = Z_Realloc(dc_lightlist, sizeof (*dc_lightlist) * dc_maxlights, PU_STATIC, NULL);
dc.maxlights = dc.numlights;
dc.lightlist = Z_Realloc(dc.lightlist, sizeof (*dc.lightlist) * dc.maxlights, PU_STATIC, NULL);
}
for (i = p = 0; i < dc_numlights; i++)
for (i = p = 0; i < dc.numlights; i++)
{
fixed_t leftheight, rightheight;
light = &frontsector->lightlist[i];
rlight = &dc_lightlist[p];
rlight = &dc.lightlist[p];
leftheight = P_GetLightZAt(light, segleft.x, segleft.y);
rightheight = P_GetLightZAt(light, segright.x, segright.y);
@@ -2477,7 +2483,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (leftheight < worldbottom && rightheight < worldbottomslope)
continue;
if (leftheight > worldtop && rightheight > worldtopslope && i+1 < dc_numlights && frontsector->lightlist[i+1].height > frontsector->ceilingheight)
if (leftheight > worldtop && rightheight > worldtopslope && i+1 < dc.numlights && frontsector->lightlist[i+1].height > frontsector->ceilingheight)
continue;
}
@@ -2512,7 +2518,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
p++;
}
dc_numlights = p;
dc.numlights = p;
}
if (numffloors)
@@ -2818,7 +2824,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
else
#endif
R_RenderSegLoop();
R_RenderSegLoop(&dc);
colfunc = wallcolfunc;
if (g_portal) // if curline is a portal, set portalrender for drawseg
+96 -84
View File
@@ -612,14 +612,14 @@ INT16 *mceilingclip;
fixed_t spryscale = 0, sprtopscreen = 0, sprbotscreen = 0;
fixed_t windowtop = 0, windowbottom = 0;
void R_DrawMaskedColumn(column_t *column)
void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column)
{
INT32 topscreen;
INT32 bottomscreen;
fixed_t basetexturemid;
INT32 topdelta, prevdelta = 0;
basetexturemid = dc_texturemid;
basetexturemid = dc->texturemid;
while (column->topdelta != 0xff)
{
@@ -632,49 +632,54 @@ void R_DrawMaskedColumn(column_t *column)
topscreen = sprtopscreen + spryscale*topdelta;
bottomscreen = topscreen + spryscale*column->length;
dc_yl = (topscreen+FRACUNIT-1)>>FRACBITS;
dc_yh = (bottomscreen-1)>>FRACBITS;
dc->yl = (topscreen+FRACUNIT-1)>>FRACBITS;
dc->yh = (bottomscreen-1)>>FRACBITS;
if (windowtop != INT32_MAX && windowbottom != INT32_MAX)
{
if (windowtop > topscreen)
dc_yl = (windowtop + FRACUNIT - 1)>>FRACBITS;
dc->yl = (windowtop + FRACUNIT - 1)>>FRACBITS;
if (windowbottom < bottomscreen)
dc_yh = (windowbottom - 1)>>FRACBITS;
dc->yh = (windowbottom - 1)>>FRACBITS;
}
if (dc_yh >= mfloorclip[dc_x])
dc_yh = mfloorclip[dc_x]-1;
if (dc_yl <= mceilingclip[dc_x])
dc_yl = mceilingclip[dc_x]+1;
if (dc->yh >= mfloorclip[dc->x])
dc->yh = mfloorclip[dc->x]-1;
if (dc->yl <= mceilingclip[dc->x])
dc->yl = mceilingclip[dc->x]+1;
if (dc_yl < 0)
dc_yl = 0;
if (dc_yh >= vid.height)
dc_yh = vid.height - 1;
if (dc->yl < 0)
dc->yl = 0;
if (dc->yh >= vid.height)
dc->yh = vid.height - 1;
if (dc_yl <= dc_yh && dc_yh > 0 && column->length != 0)
if (dc->yl <= dc->yh && dc->yh > 0 && column->length != 0)
{
dc_source = (UINT8 *)column + 3;
dc_sourcelength = column->length;
dc_texturemid = basetexturemid - (topdelta<<FRACBITS);
dc->source = (UINT8 *)column + 3;
dc->sourcelength = column->length;
dc->texturemid = basetexturemid - (topdelta<<FRACBITS);
// Drawn by R_DrawColumn.
colfunc();
drawcolumndata_t dc_copy = *dc;
void (*colfunccopy)(drawcolumndata_t*);
colfunccopy = colfunc;
colfunccopy((drawcolumndata_t*)(&dc_copy));
//colfunc();
}
column = (column_t *)((UINT8 *)column + column->length + 4);
}
dc_texturemid = basetexturemid;
dc->texturemid = basetexturemid;
}
INT32 lengthcol; // column->length : for flipped column function pointers and multi-patch on 2sided wall = texture->height
static void R_DrawFlippedMaskedColumn(column_t *column)
static void R_DrawFlippedMaskedColumn(drawcolumndata_t* dc, column_t *column)
{
INT32 topscreen;
INT32 bottomscreen;
fixed_t basetexturemid = dc_texturemid;
fixed_t basetexturemid = dc->texturemid;
INT32 topdelta, prevdelta = -1;
UINT8 *d,*s;
@@ -690,44 +695,49 @@ static void R_DrawFlippedMaskedColumn(column_t *column)
topscreen = sprtopscreen + spryscale*topdelta;
bottomscreen = sprbotscreen == INT32_MAX ? topscreen + spryscale*column->length
: sprbotscreen + spryscale*column->length;
dc_yl = (topscreen+FRACUNIT-1)>>FRACBITS;
dc_yh = (bottomscreen-1)>>FRACBITS;
dc->yl = (topscreen+FRACUNIT-1)>>FRACBITS;
dc->yh = (bottomscreen-1)>>FRACBITS;
if (windowtop != INT32_MAX && windowbottom != INT32_MAX)
{
if (windowtop > topscreen)
dc_yl = (windowtop + FRACUNIT - 1)>>FRACBITS;
dc->yl = (windowtop + FRACUNIT - 1)>>FRACBITS;
if (windowbottom < bottomscreen)
dc_yh = (windowbottom - 1)>>FRACBITS;
dc->yh = (windowbottom - 1)>>FRACBITS;
}
if (dc_yh >= mfloorclip[dc_x])
dc_yh = mfloorclip[dc_x]-1;
if (dc_yl <= mceilingclip[dc_x])
dc_yl = mceilingclip[dc_x]+1;
if (dc_yl < 0)
dc_yl = 0;
if (dc_yh >= vid.height) // dc_yl must be < vid.height, so reduces number of checks in tight loop
dc_yh = vid.height - 1;
if (dc->yh >= mfloorclip[dc->x])
dc->yh = mfloorclip[dc->x]-1;
if (dc->yl <= mceilingclip[dc->x])
dc->yl = mceilingclip[dc->x]+1;
if (dc->yl < 0)
dc->yl = 0;
if (dc->yh >= vid.height) // dc->yl must be < vid.height, so reduces number of checks in tight loop
dc->yh = vid.height - 1;
if (dc_yl <= dc_yh && dc_yh > 0 && column->length != 0)
if (dc->yl <= dc->yh && dc->yh > 0 && column->length != 0)
{
dc_source = ZZ_Alloc(column->length);
dc_sourcelength = column->length;
dc->source = ZZ_Alloc(column->length);
dc->sourcelength = column->length;
for (s = (UINT8 *)column+2+column->length, d = dc_source; d < dc_source+column->length; --s)
for (s = (UINT8 *)column+2+column->length, d = dc->source; d < dc->source+column->length; --s)
*d++ = *s;
dc_texturemid = basetexturemid - (topdelta<<FRACBITS);
dc->texturemid = basetexturemid - (topdelta<<FRACBITS);
// Still drawn by R_DrawColumn.
colfunc();
drawcolumndata_t dc_copy = *dc;
void (*colfunccopy)(drawcolumndata_t*);
colfunccopy = colfunc;
colfunccopy((drawcolumndata_t*)(&dc_copy));
Z_Free(dc_source);
//colfunc();
Z_Free(dc->source);
}
column = (column_t *)((UINT8 *)column + column->length + 4);
}
dc_texturemid = basetexturemid;
dc->texturemid = basetexturemid;
}
//
@@ -737,7 +747,7 @@ static void R_DrawFlippedMaskedColumn(column_t *column)
static void R_DrawVisSprite(vissprite_t *vis)
{
column_t *column;
void (*localcolfunc)(column_t *);
void (*localcolfunc)(drawcolumndata_t*, column_t *);
INT32 texturecolumn;
INT32 pwidth;
fixed_t frac;
@@ -745,6 +755,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
fixed_t this_scale = vis->thingscale;
INT32 x1, x2;
INT64 overflow_test;
drawcolumndata_t dc = {0};
if (!patch)
return;
@@ -771,33 +782,33 @@ static void R_DrawVisSprite(vissprite_t *vis)
}
colfunc = basecolfunc; // hack: this isn't resetting properly somewhere.
dc_colormap = vis->colormap;
dc.colormap = vis->colormap;
if ((vis->mobj->flags & MF_BOSS) && (vis->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
{
// translate certain pixels to white
colfunc = transcolfunc;
if (vis->mobj->type == MT_CYBRAKDEMON)
dc_translation = R_GetTranslationColormap(TC_ALLWHITE, 0, GTC_CACHE);
dc.translation = R_GetTranslationColormap(TC_ALLWHITE, 0, GTC_CACHE);
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
dc_translation = R_GetTranslationColormap(TC_METALSONIC, 0, GTC_CACHE);
dc.translation = R_GetTranslationColormap(TC_METALSONIC, 0, GTC_CACHE);
else
dc_translation = R_GetTranslationColormap(TC_BOSS, 0, GTC_CACHE);
dc.translation = R_GetTranslationColormap(TC_BOSS, 0, GTC_CACHE);
}
else if (vis->mobj->color && vis->transmap) // Color mapping
{
colfunc = transtransfunc;
dc_transmap = vis->transmap;
dc.transmap = vis->transmap;
if (vis->mobj->colorized)
dc_translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
dc.translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
else if (vis->mobj->skin && vis->mobj->sprite == SPR_PLAY) // MT_GHOST LOOKS LIKE A PLAYER SO USE THE PLAYER TRANSLATION TABLES. >_>
dc_translation = R_GetLocalTranslationColormap(vis->mobj->skin, vis->mobj->localskin, vis->mobj->color, GTC_CACHE, vis->mobj->skinlocal);
dc.translation = R_GetLocalTranslationColormap(vis->mobj->skin, vis->mobj->localskin, vis->mobj->color, GTC_CACHE, vis->mobj->skinlocal);
else // Use the defaults
dc_translation = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
dc.translation = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
}
else if (vis->transmap)
{
colfunc = fuzzcolfunc;
dc_transmap = vis->transmap; //Fab : 29-04-98: translucency table
dc.transmap = vis->transmap; //Fab : 29-04-98: translucency table
}
else if (vis->mobj->color)
{
@@ -806,33 +817,33 @@ static void R_DrawVisSprite(vissprite_t *vis)
// New colormap stuff for skins Tails 06-07-2002
if (vis->mobj->colorized)
dc_translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
dc.translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
else if (vis->mobj->skin && vis->mobj->sprite == SPR_PLAY) // This thing is a player!
dc_translation = R_GetLocalTranslationColormap(vis->mobj->skin, vis->mobj->localskin, vis->mobj->color, GTC_CACHE, vis->mobj->skinlocal);
dc.translation = R_GetLocalTranslationColormap(vis->mobj->skin, vis->mobj->localskin, vis->mobj->color, GTC_CACHE, vis->mobj->skinlocal);
else // Use the defaults
dc_translation = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
dc.translation = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
}
else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome.
{
colfunc = transcolfunc;
dc_translation = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_BLUE, GTC_CACHE);
dc.translation = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_BLUE, GTC_CACHE);
}
if (vis->extra_colormap)
{
if (!dc_colormap)
dc_colormap = vis->extra_colormap->colormap;
if (!dc.colormap)
dc.colormap = vis->extra_colormap->colormap;
else
dc_colormap = &vis->extra_colormap->colormap[dc_colormap - colormaps];
dc.colormap = &vis->extra_colormap->colormap[dc.colormap - colormaps];
}
if (!dc_colormap)
dc_colormap = colormaps;
if (!dc.colormap)
dc.colormap = colormaps;
if (encoremap && !vis->mobj->color && !(vis->mobj->flags & MF_DONTENCOREMAP))
dc_colormap += COLORMAP_REMAPOFFSET;
dc.colormap += COLORMAP_REMAPOFFSET;
dc_texturemid = vis->texturemid;
dc_texheight = patch->height;
dc.texturemid = vis->texturemid;
dc.texheight = patch->height;
frac = vis->startfrac;
windowtop = windowbottom = sprbotscreen = INT32_MAX;
@@ -852,15 +863,15 @@ static void R_DrawVisSprite(vissprite_t *vis)
vis->xiscale = FixedDiv(vis->xiscale, this_scale);
vis->isScaled = true;
}
dc_texturemid = FixedDiv(dc_texturemid, this_scale);
dc.texturemid = FixedDiv(dc.texturemid, this_scale);
}
spryscale = vis->scale;
if (!(vis->scalestep))
{
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
dc_iscale = FixedDiv(FRACUNIT, vis->scale);
sprtopscreen = centeryfrac - FixedMul(dc.texturemid, spryscale);
dc.iscale = FixedDiv(FRACUNIT, vis->scale);
}
x1 = vis->x1;
@@ -886,9 +897,9 @@ static void R_DrawVisSprite(vissprite_t *vis)
fixed_t scalestep = FixedMul(vis->scalestep, vis->spriteyscale);
// Papersprite drawing loop
for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, spryscale += scalestep)
for (dc.x = vis->x1; dc.x <= vis->x2; dc.x++, spryscale += scalestep)
{
angle_t angle = ((vis->centerangle + xtoviewangle[dc_x]) >> ANGLETOFINESHIFT) & 0xFFF;
angle_t angle = ((vis->centerangle + xtoviewangle[dc.x]) >> ANGLETOFINESHIFT) & 0xFFF;
texturecolumn = (vis->paperoffset - FixedMul(FINETANGENT(angle), vis->paperdistance)) / horzscale;
if (texturecolumn < 0 || texturecolumn >= pwidth)
@@ -897,23 +908,23 @@ static void R_DrawVisSprite(vissprite_t *vis)
if (vis->xiscale < 0) // Flipped sprite
texturecolumn = pwidth - 1 - texturecolumn;
sprtopscreen = (centeryfrac - FixedMul(dc_texturemid, spryscale));
dc_iscale = (0xffffffffu / (unsigned)spryscale);
sprtopscreen = (centeryfrac - FixedMul(dc.texturemid, spryscale));
dc.iscale = (0xffffffffu / (unsigned)spryscale);
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
localcolfunc (column);
localcolfunc (&dc, column);
}
}
else
{
// Non-paper drawing loop
for (dc_x = vis->x1; dc_x <= vis->x2 && (frac>>FRACBITS) < pwidth; dc_x++, frac += vis->xiscale)
for (dc.x = vis->x1; dc.x <= vis->x2 && (frac>>FRACBITS) < pwidth; dc.x++, frac += vis->xiscale)
{
texturecolumn = CLAMP(frac >> FRACBITS, 0, pwidth - 1);
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
localcolfunc (column);
localcolfunc (&dc, column);
}
}
@@ -932,6 +943,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
patch_t *patch;
fixed_t this_scale = vis->thingscale;
INT64 overflow_test;
drawcolumndata_t dc = {0};
//Fab : R_InitSprites now sets a wad lump number
patch = vis->patch;
@@ -946,20 +958,20 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
if (vis->transmap)
{
colfunc = fuzzcolfunc;
dc_transmap = vis->transmap; //Fab : 29-04-98: translucency table
dc.transmap = vis->transmap; //Fab : 29-04-98: translucency table
}
dc_colormap = colormaps;
dc.colormap = colormaps;
if (encoremap)
dc_colormap += COLORMAP_REMAPOFFSET;
dc.colormap += COLORMAP_REMAPOFFSET;
dc_iscale = FixedDiv(FRACUNIT, vis->scale);
dc_texturemid = FixedDiv(vis->texturemid, this_scale);
dc_texheight = patch->height;
dc.iscale = FixedDiv(FRACUNIT, vis->scale);
dc.texturemid = FixedDiv(vis->texturemid, this_scale);
dc.texheight = patch->height;
frac = vis->startfrac;
spryscale = vis->scale;
sprtopscreen = centeryfrac - FixedMul(dc_texturemid,spryscale);
sprtopscreen = centeryfrac - FixedMul(dc.texturemid,spryscale);
windowtop = windowbottom = sprbotscreen = INT32_MAX;
if (vis->x1 < 0)
@@ -968,7 +980,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
if (vis->x2 >= vid.width)
vis->x2 = vid.width-1;
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)
{
texturecolumn = frac>>FRACBITS;
@@ -980,7 +992,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
R_DrawMaskedColumn(column);
R_DrawMaskedColumn(&dc, column);
}
colfunc = basecolfunc;
@@ -2942,7 +2954,7 @@ void R_DrawMasked(void)
else if (r2->seg && r2->seg->maskedtexturecol != NULL)
{
next = r2->prev;
R_RenderMaskedSegRange(r2->seg, r2->seg->x1, r2->seg->x2);
R_RenderMaskedSegRange( r2->seg, r2->seg->x1, r2->seg->x2);
r2->seg->maskedtexturecol = NULL;
R_DoneWithNode(r2);
r2 = next;
-1
View File
@@ -62,7 +62,6 @@ fixed_t R_GetSpriteDirectionalLighting(angle_t angle);
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope);
void R_DrawMaskedColumn(column_t *column);
void R_SortVisSprites(void);
//faB: find sprites in wadfile, replace existing, add new ones
+14 -12
View File
@@ -36,19 +36,24 @@
// --------------------------------------------
// assembly or c drawer routines for 8bpp/16bpp
// --------------------------------------------
void (*wallcolfunc)(void); // new wall column drawer to draw posts >128 high
void (*colfunc)(void); // standard column, up to 128 high posts
void (*wallcolfunc)(drawcolumndata_t*); // new wall column drawer to draw posts >128 high
void (*colfunc)(drawcolumndata_t*); // standard column, up to 128 high posts
void (*basecolfunc)(drawcolumndata_t*);
void (*fuzzcolfunc)(drawcolumndata_t*); // standard fuzzy effect column drawer
void (*transcolfunc)(drawcolumndata_t*); // translation column drawer
void (*shadecolfunc)(drawcolumndata_t*); // smokie test..
void (*transtransfunc)(drawcolumndata_t*); // translucent translated column drawer
void (*twosmultipatchfunc)(drawcolumndata_t*); // for cols with transparent pixels
void (*twosmultipatchtransfunc)(drawcolumndata_t*); // for cols with transparent pixels AND translucency
// Short and Tall sky drawer, for the current color mode
void (*walldrawerfunc)(drawcolumndata_t*);
void (*basecolfunc)(void);
void (*fuzzcolfunc)(void); // standard fuzzy effect column drawer
void (*transcolfunc)(void); // translation column drawer
void (*shadecolfunc)(void); // smokie test..
void (*spanfunc)(void); // span drawer, use a 64x64 tile
void (*splatfunc)(void); // span drawer w/ transparency
void (*basespanfunc)(void); // default span func for color mode
void (*transtransfunc)(void); // translucent translated column drawer
void (*twosmultipatchfunc)(void); // for cols with transparent pixels
void (*twosmultipatchtransfunc)(void); // for cols with transparent pixels AND translucency
// ------------------
// global video state
@@ -93,9 +98,6 @@ UINT8 *scr_borderpatch; // flat used to fill the reduced view borders set at ST_
// =========================================================================
// Short and Tall sky drawer, for the current color mode
void (*walldrawerfunc)(void);
void SCR_SetMode(void)
{
if (dedicated)
-13
View File
@@ -81,22 +81,9 @@ enum
// ---------------------------------------------
// color mode dependent drawer function pointers
// ---------------------------------------------
extern void (*wallcolfunc)(void);
extern void (*colfunc)(void);
extern void (*basecolfunc)(void);
extern void (*fuzzcolfunc)(void);
extern void (*transcolfunc)(void);
extern void (*shadecolfunc)(void);
extern void (*spanfunc)(void);
extern void (*basespanfunc)(void);
extern void (*splatfunc)(void);
extern void (*transtransfunc)(void);
extern void (*twosmultipatchfunc)(void);
extern void (*twosmultipatchtransfunc)(void);
// quick fix for tall/short skies, depending on bytesperpixel
extern void (*walldrawerfunc)(void);
// ----------------
// screen variables