cleanup software drawer handling stuff
mostly ported from rr is alot more readable and less confusing
This commit is contained in:
1 parent
5f8c77e752
commit
c921945922
10 files changed
+279
-430
No files matched your search
+5
-18
@@ -59,21 +59,9 @@ UINT8 *blendtables[NUMBLENDMAPS];
|
||||
// c drawer routines
|
||||
// --------------------------------------------
|
||||
|
||||
|
||||
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*);
|
||||
coldrawfunc_t *colfunc;
|
||||
coldrawfunc_t *colfuncs[COLDRAWFUNC_MAX];
|
||||
int colfunctype;
|
||||
|
||||
// =========================================================================
|
||||
// SPAN DRAWING CODE STUFF
|
||||
@@ -93,9 +81,8 @@ float focallengthf;
|
||||
// c drawer routines
|
||||
// --------------------------------------------
|
||||
|
||||
void (*spanfunc)(drawspandata_t*); // span drawer, use a 64x64 tile
|
||||
void (*splatfunc)(drawspandata_t*); // span drawer w/ transparency
|
||||
void (*basespanfunc)(drawspandata_t*); // default span func for color mode
|
||||
spandrawfunc_t *spanfunc;
|
||||
spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX];
|
||||
|
||||
// ==========================================================================
|
||||
// OLD DOOM FUZZY EFFECT
|
||||
|
||||
+52
-33
@@ -33,29 +33,6 @@ FUNCINLINE static ATTRINLINE UINT8 *R_Address(INT32 px, INT32 py)
|
||||
return renderscreen + (py + viewwindowy) * linesize + (viewwindowx + px);
|
||||
}
|
||||
|
||||
// -------------------------
|
||||
// COLUMN DRAWING CODE STUFF
|
||||
// -------------------------
|
||||
|
||||
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 void (*twosmultipatchfunc)(drawcolumndata_t*);
|
||||
extern void (*twosmultipatchtransfunc)(drawcolumndata_t*);
|
||||
|
||||
// quick fix for tall/short skies, depending on bytesperpixel
|
||||
extern void (*walldrawerfunc)(drawcolumndata_t*);
|
||||
|
||||
void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column);
|
||||
|
||||
// -----------------------
|
||||
// SPAN DRAWING CODE STUFF
|
||||
// -----------------------
|
||||
|
||||
typedef struct {
|
||||
float x, y, z;
|
||||
@@ -114,10 +91,6 @@ typedef struct
|
||||
|
||||
extern drawspandata_t g_ds;
|
||||
|
||||
extern void (*spanfunc)(drawspandata_t*);
|
||||
extern void (*basespanfunc)(drawspandata_t*);
|
||||
extern void (*splatfunc)(drawspandata_t*);
|
||||
|
||||
// Draws a single visplane.
|
||||
void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_parallel);
|
||||
|
||||
@@ -126,6 +99,54 @@ extern floatv3_t *ds_su, *ds_sv, *ds_sz;
|
||||
|
||||
extern float focallengthf;
|
||||
|
||||
|
||||
typedef void (coldrawfunc_t)(drawcolumndata_t*);
|
||||
typedef void (spandrawfunc_t)(drawspandata_t*);
|
||||
|
||||
#define BASEDRAWFUNC 0
|
||||
|
||||
enum
|
||||
{
|
||||
COLDRAWFUNC_BASE = BASEDRAWFUNC,
|
||||
COLDRAWFUNC_FUZZY,
|
||||
COLDRAWFUNC_TRANS,
|
||||
COLDRAWFUNC_SHADOWED,
|
||||
COLDRAWFUNC_TRANSTRANS,
|
||||
COLDRAWFUNC_TWOSMULTIPATCH,
|
||||
COLDRAWFUNC_TWOSMULTIPATCHTRANS,
|
||||
COLDRAWFUNC_FOG,
|
||||
|
||||
COLDRAWFUNC_MAX
|
||||
};
|
||||
|
||||
extern int colfunctype;
|
||||
extern coldrawfunc_t *colfunc;
|
||||
extern coldrawfunc_t *colfuncs[COLDRAWFUNC_MAX];
|
||||
|
||||
enum
|
||||
{
|
||||
SPANDRAWFUNC_BASE = BASEDRAWFUNC,
|
||||
SPANDRAWFUNC_TRANS,
|
||||
SPANDRAWFUNC_TILTED,
|
||||
SPANDRAWFUNC_TILTEDTRANS,
|
||||
|
||||
SPANDRAWFUNC_SPLAT,
|
||||
SPANDRAWFUNC_TRANSSPLAT,
|
||||
SPANDRAWFUNC_TILTEDSPLAT,
|
||||
|
||||
SPANDRAWFUNC_WATER,
|
||||
SPANDRAWFUNC_TILTEDWATER,
|
||||
|
||||
SPANDRAWFUNC_FOG,
|
||||
|
||||
SPANDRAWFUNC_MAX
|
||||
};
|
||||
|
||||
extern spandrawfunc_t *spanfunc;
|
||||
extern spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX];
|
||||
|
||||
void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column);
|
||||
|
||||
/// \brief Top border
|
||||
#define BRDR_T 0
|
||||
/// \brief Bottom border
|
||||
@@ -211,8 +232,6 @@ void R_DrawViewBorder(void);
|
||||
|
||||
// column drawers
|
||||
void R_DrawColumn(drawcolumndata_t* dc);
|
||||
#define R_DrawWallColumn R_DrawColumn
|
||||
void R_DrawShadeColumn(drawcolumndata_t* dc);
|
||||
void R_DrawColumnShadowed(drawcolumndata_t* dc);
|
||||
|
||||
void R_DrawTranslucentColumn(drawcolumndata_t* dc);
|
||||
@@ -228,16 +247,16 @@ void R_DrawFogColumn(drawcolumndata_t* dc);
|
||||
// span drawers
|
||||
void R_DrawSpan(drawspandata_t* ds);
|
||||
|
||||
void R_DrawTiltedSpan(drawspandata_t* ds);
|
||||
void R_DrawTiltedTranslucentSpan(drawspandata_t* ds);
|
||||
void R_DrawTiltedTranslucentWaterSpan(drawspandata_t* ds);
|
||||
void R_DrawSpan_Tilted(drawspandata_t* ds);
|
||||
void R_DrawTranslucentSpan_Tilted(drawspandata_t* ds);
|
||||
void R_DrawTranslucentWaterSpan_Tilted(drawspandata_t* ds);
|
||||
|
||||
void R_DrawTranslucentSpan(drawspandata_t* ds);
|
||||
void R_DrawTranslucentWaterSpan(drawspandata_t* ds);
|
||||
|
||||
void R_DrawFogSpan(drawspandata_t* ds);
|
||||
|
||||
void R_DrawTiltedSplat(drawspandata_t* ds);
|
||||
void R_DrawSplat_Tilted(drawspandata_t* ds);
|
||||
void R_DrawSplat(drawspandata_t* ds);
|
||||
void R_DrawTranslucentSplat(drawspandata_t* ds);
|
||||
|
||||
|
||||
+6
-45
@@ -420,49 +420,6 @@ void R_Draw2sMultiPatchTranslucentColumn(drawcolumndata_t* dc)
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief The R_DrawShadeColumn function
|
||||
Experiment to make software go faster. Taken from the Boom source
|
||||
*/
|
||||
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))
|
||||
return;
|
||||
|
||||
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)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Framebuffer destination address.
|
||||
dest = R_Address(dc->x, dc->yl);
|
||||
|
||||
// Looks familiar.
|
||||
fracstep = dc->iscale;
|
||||
frac = (dc->texturemid + FixedMul((dc->yl << FRACBITS) - centeryfrac, fracstep));
|
||||
|
||||
register const INT32 stride = vid.width;
|
||||
|
||||
// Here we do an additional index re-mapping.
|
||||
do
|
||||
{
|
||||
*dest = colormaps[(dc->source[frac>>FRACBITS] <<8) + (*dest)];
|
||||
dest += stride;
|
||||
frac += fracstep;
|
||||
} while (count--);
|
||||
}
|
||||
|
||||
/** \brief The R_DrawTranslucentColumn function
|
||||
I've made an asm routine for the transparency, because it slows down
|
||||
a lot in 640x480 with big sprites (bfg on all screen, or transparent
|
||||
@@ -804,7 +761,9 @@ void R_DrawColumnShadowed(drawcolumndata_t* dc)
|
||||
|
||||
if (dc->yh > realyh)
|
||||
dc->yh = realyh;
|
||||
basecolfunc(dc); // R_DrawColumn for the appropriate architecture
|
||||
|
||||
(colfuncs[BASEDRAWFUNC])(dc); // R_DrawColumn_8 for the appropriate architecture
|
||||
|
||||
if (solid)
|
||||
dc->yl = bheight;
|
||||
else
|
||||
@@ -814,7 +773,9 @@ void R_DrawColumnShadowed(drawcolumndata_t* dc)
|
||||
if (encoremap)
|
||||
dc->colormap += COLORMAP_REMAPOFFSET;
|
||||
}
|
||||
|
||||
dc->yh = realyh;
|
||||
|
||||
if (dc->yl <= realyh)
|
||||
walldrawerfunc(dc); // R_DrawWallColumn for the appropriate architecture
|
||||
(colfuncs[BASEDRAWFUNC])(dc); // R_DrawWallColumn_8 for the appropriate architecture
|
||||
}
|
||||
+4
-4
@@ -361,7 +361,7 @@ static void R_CalcTiltedLighting(INT32 *lightbuffer, INT32 x1, INT32 x2, fixed_t
|
||||
/** \brief The R_DrawTiltedSpan function
|
||||
Draw slopes! Holy sheit!
|
||||
*/
|
||||
void R_DrawTiltedSpan(drawspandata_t* ds)
|
||||
void R_DrawSpan_Tilted(drawspandata_t* ds)
|
||||
{
|
||||
int width = ds->x2 - ds->x1;
|
||||
float iz, uz, vz;
|
||||
@@ -508,7 +508,7 @@ void R_DrawTiltedSpan(drawspandata_t* ds)
|
||||
/** \brief The R_DrawTiltedTranslucentSpan function
|
||||
Like DrawTiltedSpan, but translucent
|
||||
*/
|
||||
void R_DrawTiltedTranslucentSpan(drawspandata_t* ds)
|
||||
void R_DrawTranslucentSpan_Tilted(drawspandata_t* ds)
|
||||
{
|
||||
int width = ds->x2 - ds->x1;
|
||||
float iz, uz, vz;
|
||||
@@ -655,7 +655,7 @@ void R_DrawTiltedTranslucentSpan(drawspandata_t* ds)
|
||||
/** \brief The R_DrawTiltedTranslucentWaterSpan function
|
||||
Like DrawTiltedTranslucentSpan, but for water
|
||||
*/
|
||||
void R_DrawTiltedTranslucentWaterSpan(drawspandata_t* ds)
|
||||
void R_DrawTranslucentWaterSpan_Tilted(drawspandata_t* ds)
|
||||
{
|
||||
int width = ds->x2 - ds->x1;
|
||||
float iz, uz, vz;
|
||||
@@ -801,7 +801,7 @@ void R_DrawTiltedTranslucentWaterSpan(drawspandata_t* ds)
|
||||
#endif
|
||||
}
|
||||
|
||||
void R_DrawTiltedSplat(drawspandata_t* ds)
|
||||
void R_DrawSplat_Tilted(drawspandata_t* ds)
|
||||
{
|
||||
// x1, x2 = ds->x1, ds->x2
|
||||
int width = ds->x2 - ds->x1;
|
||||
|
||||
+32
-26
@@ -145,7 +145,6 @@ void R_AllocPlaneMemory(void)
|
||||
// Needs the height of the plane, and the vertical position of the span.
|
||||
// Sets planeripple.xfrac and planeripple.yfrac, added to ds_xfrac and ds_yfrac, if the span is not tilted.
|
||||
//
|
||||
|
||||
static fixed_t R_CalculateRippleOffset(drawspandata_t* ds, INT32 y)
|
||||
{
|
||||
fixed_t distance = FixedMul(ds->planeheight, yslope[y]);
|
||||
@@ -253,7 +252,7 @@ static bool R_CheckMapPlane(const char* funcname, INT32 y, INT32 x1, INT32 x2)
|
||||
// viewsin
|
||||
// viewcos
|
||||
// viewheight
|
||||
static void R_MapPlane(drawspandata_t *ds, void(*spanfunc2)(drawspandata_t*), INT32 y, INT32 x1, INT32 x2, boolean allow_parallel)
|
||||
static void R_MapPlane(drawspandata_t *ds, spandrawfunc_t *localspanfunc, INT32 y, INT32 x1, INT32 x2, boolean allow_parallel)
|
||||
{
|
||||
angle_t angle, planecos, planesin;
|
||||
fixed_t distance = 0, span;
|
||||
@@ -317,10 +316,10 @@ static void R_MapPlane(drawspandata_t *ds, void(*spanfunc2)(drawspandata_t*), IN
|
||||
ds->x1 = x1;
|
||||
ds->x2 = x2;
|
||||
|
||||
spanfunc2(ds);
|
||||
localspanfunc(ds);
|
||||
}
|
||||
|
||||
static void R_MapTiltedPlane(drawspandata_t *ds, void(*spanfunc2)(drawspandata_t*), INT32 y, INT32 x1, INT32 x2, boolean allow_parallel)
|
||||
static void R_MapTiltedPlane(drawspandata_t *ds, spandrawfunc_t *localspanfunc, INT32 y, INT32 x1, INT32 x2, boolean allow_parallel)
|
||||
{
|
||||
(void)allow_parallel;
|
||||
|
||||
@@ -361,7 +360,7 @@ static void R_MapTiltedPlane(drawspandata_t *ds, void(*spanfunc2)(drawspandata_t
|
||||
ds->x1 = x1;
|
||||
ds->x2 = x2;
|
||||
|
||||
spanfunc2(ds);
|
||||
localspanfunc(ds);
|
||||
}
|
||||
|
||||
void R_ClearFFloorClips(void)
|
||||
@@ -686,7 +685,7 @@ void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop)
|
||||
//
|
||||
// R_MakeSpans
|
||||
//
|
||||
static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(drawspandata_t*), INT32, INT32, INT32, boolean), void(*spanfunc2)(drawspandata_t*), drawspandata_t* ds, INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2, boolean allow_parallel)
|
||||
static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(drawspandata_t*), INT32, INT32, INT32, boolean), spandrawfunc_t* localspanfunc, drawspandata_t* ds, INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2, boolean allow_parallel)
|
||||
{
|
||||
// Alam: from r_splats's R_RenderFloorSplat
|
||||
if (t1 >= vid.height) t1 = vid.height-1;
|
||||
@@ -717,7 +716,7 @@ static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(draw
|
||||
auto task = [=]() mutable -> void {
|
||||
for (int i = 0; i < taskspans; i++)
|
||||
{
|
||||
mapfunc(&dc_copy, spanfunc2, t1 + i, spanstartcopy[i], x - 1, false);
|
||||
mapfunc(&dc_copy, localspanfunc, t1 + i, spanstartcopy[i], x - 1, false);
|
||||
}
|
||||
};
|
||||
if (allow_parallel)
|
||||
@@ -746,7 +745,7 @@ static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(draw
|
||||
auto task = [=]() mutable -> void {
|
||||
for (int i = 0; i < taskspans; i++)
|
||||
{
|
||||
mapfunc(&dc_copy, spanfunc2, b1 - i, spanstartcopy[i], x - 1, false);
|
||||
mapfunc(&dc_copy, localspanfunc, b1 - i, spanstartcopy[i], x - 1, false);
|
||||
}
|
||||
};
|
||||
if (allow_parallel)
|
||||
@@ -804,8 +803,7 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b
|
||||
|
||||
// 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)
|
||||
//wallcolfunc = walldrawerfunc;
|
||||
colfunc = basecolfunc;
|
||||
R_SetColumnFunc(BASEDRAWFUNC);
|
||||
|
||||
// use correct aspect ratio scale
|
||||
dc.iscale = skyscale;
|
||||
@@ -870,7 +868,6 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc2)(drawcolumndata_t*), b
|
||||
|
||||
x += kSkyPlaneMacroColumns;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Potentially override other stuff for now cus we're mean. :< But draw a slope plane!
|
||||
@@ -976,6 +973,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
INT32 x;
|
||||
INT32 stop, angle;
|
||||
size_t size;
|
||||
INT32 spanfunctype = BASEDRAWFUNC;
|
||||
ffloor_t *rover;
|
||||
void (*mapfunc)(drawspandata_t*, void(*)(drawspandata_t*), INT32, INT32, INT32, boolean) = R_MapPlane;
|
||||
|
||||
@@ -992,11 +990,11 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
}
|
||||
|
||||
ds->planeripple.active = false;
|
||||
spanfunc = basespanfunc;
|
||||
R_SetSpanFunc(BASEDRAWFUNC);
|
||||
|
||||
if (pl->polyobj && pl->polyobj->translucency != 0)
|
||||
{
|
||||
spanfunc = R_DrawTranslucentSpan;
|
||||
spanfunctype = SPANDRAWFUNC_TRANS;
|
||||
|
||||
// Hacked up support for alpha value in software mode Tails 09-24-2002 (sidenote: ported to polys 10-15-2014, there was no time travel involved -Red)
|
||||
if (pl->polyobj->translucency >= NUMTRANSMAPS)
|
||||
@@ -1004,7 +1002,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
else if (pl->polyobj->translucency > 0)
|
||||
ds->transmap = R_GetTranslucencyTable(pl->polyobj->translucency);
|
||||
else // Opaque, but allow transparent flat pixels
|
||||
spanfunc = splatfunc;
|
||||
spanfunctype = SPANDRAWFUNC_SPLAT;
|
||||
|
||||
#ifdef SHITPLANESPARENCY
|
||||
if (spanfunc == splatfunc || (pl->extra_colormap && pl->extra_colormap->fog))
|
||||
@@ -1014,7 +1012,6 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||
else
|
||||
light = LIGHTLEVELS-1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1036,7 +1033,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
|
||||
if (pl->ffloor->flags & FF_TRANSLUCENT)
|
||||
{
|
||||
spanfunc = R_DrawTranslucentSpan;
|
||||
spanfunctype = SPANDRAWFUNC_TRANS;
|
||||
|
||||
// Hacked up support for alpha value in software mode Tails 09-24-2002
|
||||
// ...unhacked by toaster 04-01-2021, re-hacked a little by sphere 19-11-2021
|
||||
@@ -1048,7 +1045,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
if (pl->ffloor->blend) // additive, (reverse) subtractive, modulative
|
||||
ds->transmap = R_GetBlendTable(pl->ffloor->blend, trans);
|
||||
else if (!(ds->transmap = R_GetTranslucencyTable(trans)) || trans == 0)
|
||||
spanfunc = splatfunc; // Opaque, but allow transparent flat pixels
|
||||
spanfunctype = SPANDRAWFUNC_SPLAT; // Opaque, but allow transparent flat pixels
|
||||
}
|
||||
|
||||
#ifdef SHITPLANESPARENCY
|
||||
@@ -1062,7 +1059,7 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
}
|
||||
else if (pl->ffloor->flags & FF_FOG)
|
||||
{
|
||||
spanfunc = R_DrawFogSpan;
|
||||
spanfunctype = SPANDRAWFUNC_FOG;
|
||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||
}
|
||||
else light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||
@@ -1222,14 +1219,21 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
else
|
||||
R_SetSlopePlaneVectors(ds, pl, 0, ds->xoffs, ds->yoffs, fudgecanyon);
|
||||
|
||||
if (spanfunc == R_DrawTranslucentWaterSpan)
|
||||
spanfunc = R_DrawTiltedTranslucentWaterSpan;
|
||||
else if (spanfunc == R_DrawTranslucentSpan)
|
||||
spanfunc = R_DrawTiltedTranslucentSpan;
|
||||
else if (spanfunc == splatfunc)
|
||||
spanfunc = R_DrawTiltedSplat;
|
||||
else
|
||||
spanfunc = R_DrawTiltedSpan;
|
||||
switch (spanfunctype)
|
||||
{
|
||||
case SPANDRAWFUNC_WATER:
|
||||
spanfunctype = SPANDRAWFUNC_TILTEDWATER;
|
||||
break;
|
||||
case SPANDRAWFUNC_TRANS:
|
||||
spanfunctype = SPANDRAWFUNC_TILTEDTRANS;
|
||||
break;
|
||||
case SPANDRAWFUNC_SPLAT:
|
||||
spanfunctype = SPANDRAWFUNC_TILTEDSPLAT;
|
||||
break;
|
||||
default:
|
||||
spanfunctype = SPANDRAWFUNC_TILTED;
|
||||
break;
|
||||
}
|
||||
|
||||
ds->planezlight = scalelight[light];
|
||||
}
|
||||
@@ -1239,6 +1243,8 @@ void R_DrawSinglePlane(drawspandata_t* ds, visplane_t *pl, boolean allow_paralle
|
||||
ds->planezlight = zlight[light];
|
||||
}
|
||||
|
||||
R_SetSpanFunc(spanfunctype);
|
||||
|
||||
// set the maximum value for unsigned
|
||||
pl->top[pl->maxx+1] = 0xffff;
|
||||
pl->top[pl->minx-1] = 0xffff;
|
||||
|
||||
+100
-274
@@ -76,172 +76,6 @@ static lighttable_t **walllights;
|
||||
static INT16 *maskedtexturecol;
|
||||
static fixed_t *maskedtextureheight = NULL;
|
||||
|
||||
// ==========================================================================
|
||||
// R_Splats Wall Splats Drawer
|
||||
// ==========================================================================
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
static INT16 last_ceilingclip[MAXVIDWIDTH];
|
||||
static INT16 last_floorclip[MAXVIDWIDTH];
|
||||
|
||||
static void R_DrawSplatColumn(column_t *column)
|
||||
{
|
||||
INT32 topscreen, bottomscreen;
|
||||
fixed_t basetexturemid;
|
||||
INT32 topdelta, prevdelta = -1;
|
||||
|
||||
basetexturemid = dc->texturemid;
|
||||
|
||||
while (column->topdelta != 0xff)
|
||||
{
|
||||
// calculate unclipped screen coordinates for post
|
||||
topdelta = column->topdelta;
|
||||
if (topdelta <= prevdelta)
|
||||
topdelta += prevdelta;
|
||||
prevdelta = topdelta;
|
||||
topscreen = sprtopscreen + spryscale*topdelta;
|
||||
bottomscreen = topscreen + spryscale*column->length;
|
||||
|
||||
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)
|
||||
{
|
||||
dc->source = (UINT8 *)column + 3;
|
||||
dc->texturemid = basetexturemid - (topdelta<<FRACBITS);
|
||||
|
||||
// Drawn by R_DrawColumn.
|
||||
colfunc();
|
||||
}
|
||||
column = (column_t *)((UINT8 *)column + column->length + 4);
|
||||
}
|
||||
|
||||
dc->texturemid = basetexturemid;
|
||||
}
|
||||
|
||||
static void R_DrawWallSplats(void)
|
||||
{
|
||||
wallsplat_t *splat;
|
||||
seg_t *seg;
|
||||
angle_t angle, angle1, angle2;
|
||||
INT32 x1, x2;
|
||||
size_t pindex;
|
||||
column_t *col;
|
||||
patch_t *patch;
|
||||
fixed_t texturecolumn;
|
||||
|
||||
splat = (wallsplat_t *)linedef->splats;
|
||||
|
||||
I_Assert(splat != NULL);
|
||||
|
||||
seg = ds_p->curline;
|
||||
|
||||
// draw all splats from the line that touches the range of the seg
|
||||
for (; splat; splat = splat->next)
|
||||
{
|
||||
angle1 = R_PointToAngle(splat->v1.x, splat->v1.y);
|
||||
angle2 = R_PointToAngle(splat->v2.x, splat->v2.y);
|
||||
angle1 = (angle1 - viewangle + ANGLE_90)>>ANGLETOFINESHIFT;
|
||||
angle2 = (angle2 - viewangle + ANGLE_90)>>ANGLETOFINESHIFT;
|
||||
// out of the viewangletox lut
|
||||
/// \todo clip it to the screen
|
||||
if (angle1 > FINEANGLES/2 || angle2 > FINEANGLES/2)
|
||||
continue;
|
||||
x1 = viewangletox[angle1];
|
||||
x2 = viewangletox[angle2];
|
||||
|
||||
if (x1 >= x2)
|
||||
continue; // does not cross a pixel
|
||||
|
||||
// splat is not in this seg range
|
||||
if (x2 < ds_p->x1 || x1 > ds_p->x2)
|
||||
continue;
|
||||
|
||||
if (x1 < ds_p->x1)
|
||||
x1 = ds_p->x1;
|
||||
if (x2 > ds_p->x2)
|
||||
x2 = ds_p->x2;
|
||||
if (x2 <= x1)
|
||||
continue;
|
||||
|
||||
// calculate incremental stepping values for texture edges
|
||||
rw_scalestep = ds_p->scalestep;
|
||||
spryscale = ds_p->scale1 + (x1 - ds_p->x1)*rw_scalestep;
|
||||
mfloorclip = floorclip;
|
||||
mceilingclip = ceilingclip;
|
||||
|
||||
patch = W_CachePatchNum(splat->patch, PU_SPRITE);
|
||||
|
||||
dc->texturemid = splat->top + (patch->height<<(FRACBITS-1)) - viewz;
|
||||
if (splat->yoffset)
|
||||
dc->texturemid += *splat->yoffset;
|
||||
|
||||
sprtopscreen = centeryfrac - FixedMul(dc->texturemid, spryscale);
|
||||
|
||||
// set drawing mode
|
||||
switch (splat->flags & SPLATDRAWMODE_MASK)
|
||||
{
|
||||
case SPLATDRAWMODE_OPAQUE:
|
||||
colfunc = basecolfunc;
|
||||
break;
|
||||
case SPLATDRAWMODE_TRANS:
|
||||
if (!cv_translucency.value)
|
||||
colfunc = basecolfunc;
|
||||
else
|
||||
{
|
||||
dc->transmap = R_GetTranslucencyTable(tr_trans50);
|
||||
colfunc = fuzzcolfunc;
|
||||
}
|
||||
|
||||
break;
|
||||
case SPLATDRAWMODE_SHADE:
|
||||
colfunc = shadecolfunc;
|
||||
break;
|
||||
}
|
||||
|
||||
dc->texheight = 0;
|
||||
|
||||
// draw the columns
|
||||
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];
|
||||
if (encoremap && !(seg->linedef->flags & ML_TFERLINE))
|
||||
dc->colormap += COLORMAP_REMAPOFFSET;
|
||||
|
||||
if (frontsector->extra_colormap)
|
||||
dc->colormap = frontsector->extra_colormap->colormap + (dc->colormap - colormaps);
|
||||
|
||||
sprtopscreen = centeryfrac - FixedMul(dc->texturemid, spryscale);
|
||||
dc->iscale = 0xffffffffu / (unsigned)spryscale;
|
||||
|
||||
// find column of patch, from perspective
|
||||
angle = (rw_centerangle + xtoviewangle[dc->x])>>ANGLETOFINESHIFT;
|
||||
texturecolumn = rw_offset2 - splat->offset
|
||||
- FixedMul(FINETANGENT(angle), rw_distance);
|
||||
|
||||
// FIXME!
|
||||
texturecolumn >>= FRACBITS;
|
||||
if (texturecolumn < 0 || texturecolumn >= patch->width)
|
||||
continue;
|
||||
|
||||
// draw the texture
|
||||
col = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
|
||||
R_DrawSplatColumn(col);
|
||||
}
|
||||
} // next splat
|
||||
|
||||
colfunc = basecolfunc;
|
||||
}
|
||||
|
||||
#endif //WALLSPLATS
|
||||
|
||||
// ==========================================================================
|
||||
// R_RenderMaskedSegRange
|
||||
// ==========================================================================
|
||||
@@ -281,18 +115,19 @@ static void R_Render2sidedMultiPatchColumn(drawcolumndata_t* dc, column_t *colum
|
||||
dc->source = (UINT8 *)column + 3;
|
||||
dc->sourcelength = lengthcol;
|
||||
|
||||
|
||||
// Drawn by R_DrawColumn.
|
||||
drawcolumndata_t dc_copy = *dc;
|
||||
void (*colfunccopy)(drawcolumndata_t*);
|
||||
colfunccopy = colfunc;
|
||||
coldrawfunc_t* colfunccopy = colfunc;
|
||||
|
||||
if (colfunc == wallcolfunc)
|
||||
colfunccopy = twosmultipatchfunc;
|
||||
else if (colfunc == fuzzcolfunc)
|
||||
colfunccopy = twosmultipatchtransfunc;
|
||||
else
|
||||
colfunc(dc);
|
||||
// FIXME: do something better to look these up WITHOUT affecting global state...
|
||||
if (R_CheckColumnFunc(BASEDRAWFUNC) == true)
|
||||
{
|
||||
colfunccopy = colfuncs[COLDRAWFUNC_TWOSMULTIPATCH];
|
||||
}
|
||||
else if (R_CheckColumnFunc(COLDRAWFUNC_FUZZY) == true)
|
||||
{
|
||||
colfunccopy = colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS];
|
||||
}
|
||||
|
||||
colfunccopy((drawcolumndata_t*)(&dc_copy));
|
||||
}
|
||||
@@ -303,6 +138,48 @@ transnum_t R_GetLinedefTransTable(fixed_t alpha)
|
||||
return (20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1);
|
||||
}
|
||||
|
||||
static boolean R_CheckBlendMode(drawcolumndata_t* dc, const line_t *ldef)
|
||||
{
|
||||
if (!ldef->alpha)
|
||||
return false;
|
||||
|
||||
if (ldef->blendmode)
|
||||
{
|
||||
if (ldef->alpha == NUMTRANSMAPS || ldef->blendmode == AST_MODULATE)
|
||||
dc->transmap = R_GetBlendTable(ldef->blendmode, 0);
|
||||
else
|
||||
dc->transmap = R_GetBlendTable(ldef->blendmode, R_GetLinedefTransTable(ldef->alpha));
|
||||
|
||||
R_SetColumnFunc(COLDRAWFUNC_FUZZY);
|
||||
}
|
||||
else if (ldef->alpha > 0 && ldef->alpha < FRACUNIT)
|
||||
{
|
||||
dc->transmap = R_GetTranslucencyTable(R_GetLinedefTransTable(ldef->alpha));
|
||||
R_SetColumnFunc(COLDRAWFUNC_FUZZY);
|
||||
}
|
||||
else if (ldef->special == 909)
|
||||
{
|
||||
R_SetColumnFunc(COLDRAWFUNC_FOG);
|
||||
windowtop = frontsector->ceilingheight;
|
||||
windowbottom = frontsector->floorheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
R_SetColumnFunc(BASEDRAWFUNC);
|
||||
}
|
||||
|
||||
if (curline->polyseg && curline->polyseg->translucency > 0)
|
||||
{
|
||||
if (curline->polyseg->translucency >= NUMTRANSMAPS)
|
||||
return false;
|
||||
|
||||
dc->transmap = R_GetTranslucencyTable(curline->polyseg->translucency);
|
||||
R_SetColumnFunc(COLDRAWFUNC_FUZZY);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void R_RenderMaskedSegRange(drawseg_t *drawseg, INT32 x1, INT32 x2)
|
||||
{
|
||||
size_t pindex;
|
||||
@@ -334,40 +211,9 @@ void R_RenderMaskedSegRange(drawseg_t *drawseg, INT32 x1, INT32 x2)
|
||||
// hack translucent linedef types (900-909 for transtables 1-9)
|
||||
ldef = curline->linedef;
|
||||
|
||||
if (!ldef->alpha)
|
||||
return;
|
||||
|
||||
if (ldef->blendmode)
|
||||
if (R_CheckBlendMode(dc, ldef) == false)
|
||||
{
|
||||
if (ldef->alpha == NUMTRANSMAPS || ldef->blendmode == AST_MODULATE)
|
||||
dc->transmap = R_GetBlendTable(ldef->blendmode, 0);
|
||||
else
|
||||
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));
|
||||
colfunc = fuzzcolfunc;
|
||||
}
|
||||
else if (ldef->special == 909)
|
||||
{
|
||||
colfunc = R_DrawFogColumn;
|
||||
windowtop = frontsector->ceilingheight;
|
||||
windowbottom = frontsector->floorheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
colfunc = wallcolfunc;
|
||||
}
|
||||
|
||||
if (curline->polyseg && curline->polyseg->translucency > 0)
|
||||
{
|
||||
if (curline->polyseg->translucency >= NUMTRANSMAPS)
|
||||
return;
|
||||
|
||||
dc->transmap = R_GetTranslucencyTable(curline->polyseg->translucency);
|
||||
colfunc = fuzzcolfunc;
|
||||
return; // does not render
|
||||
}
|
||||
|
||||
range = max(drawseg->x2-drawseg->x1, 1);
|
||||
@@ -409,20 +255,20 @@ void R_RenderMaskedSegRange(drawseg_t *drawseg, INT32 x1, INT32 x2)
|
||||
leftheight = P_GetLightZAt(light, drawseg-> leftpos.x, drawseg-> leftpos.y);
|
||||
rightheight = P_GetLightZAt(light, drawseg->rightpos.x, drawseg->rightpos.y);
|
||||
|
||||
leftheight -= viewz;
|
||||
leftheight -= viewz;
|
||||
rightheight -= viewz;
|
||||
|
||||
rlight->height = (centeryfrac) - FixedMul(leftheight, drawseg->scale1);
|
||||
rlight->heightstep = (centeryfrac) - FixedMul(rightheight, drawseg->scale2);
|
||||
rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
|
||||
rlight->startheight = rlight->height; // keep starting value here to reset for each repeat
|
||||
rlight->lightlevel = *light->lightlevel;
|
||||
rlight->height = (centeryfrac) - FixedMul(leftheight, drawseg->scale1);
|
||||
rlight->heightstep = (centeryfrac) - FixedMul(rightheight, drawseg->scale2);
|
||||
rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
|
||||
rlight->startheight = rlight->height; // keep starting value here to reset for each repeat
|
||||
rlight->lightlevel = *light->lightlevel;
|
||||
rlight->extra_colormap = light->extra_colormap;
|
||||
rlight->flags = light->flags;
|
||||
|
||||
if (rlight->flags & FF_FOG || (rlight->extra_colormap && rlight->extra_colormap->fog))
|
||||
lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT);
|
||||
else if (colfunc == fuzzcolfunc)
|
||||
else if (R_CheckColumnFunc(COLDRAWFUNC_FUZZY))
|
||||
lightnum = LIGHTLEVELS - 1;
|
||||
else
|
||||
lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT);
|
||||
@@ -437,17 +283,13 @@ void R_RenderMaskedSegRange(drawseg_t *drawseg, INT32 x1, INT32 x2)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (colfunc == fuzzcolfunc)
|
||||
{
|
||||
if (frontsector->extra_colormap && frontsector->extra_colormap->fog)
|
||||
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
|
||||
else
|
||||
lightnum = LIGHTLEVELS - 1;
|
||||
}
|
||||
else
|
||||
if ((R_CheckColumnFunc(COLDRAWFUNC_FUZZY) == false)
|
||||
|| (frontsector->extra_colormap && frontsector->extra_colormap->fog))
|
||||
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
|
||||
else
|
||||
lightnum = LIGHTLEVELS - 1;
|
||||
|
||||
if (colfunc == R_DrawFogColumn
|
||||
if ((R_CheckColumnFunc(COLDRAWFUNC_FOG) == true)
|
||||
|| (frontsector->extra_colormap && frontsector->extra_colormap->fog))
|
||||
;
|
||||
else if (P_ApplyLightOffset(lightnum, frontsector))
|
||||
@@ -646,7 +488,7 @@ void R_RenderMaskedSegRange(drawseg_t *drawseg, INT32 x1, INT32 x2)
|
||||
spryscale += rw_scalestep;
|
||||
}
|
||||
}
|
||||
colfunc = wallcolfunc;
|
||||
}
|
||||
}
|
||||
|
||||
// Loop through R_DrawMaskedColumn calls
|
||||
@@ -720,7 +562,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
frontsector = curline->frontsector == pfloor->target ? curline->backsector : curline->frontsector;
|
||||
texnum = R_GetTextureNum(sides[pfloor->master->sidenum[0]].midtexture);
|
||||
|
||||
colfunc = wallcolfunc;
|
||||
R_SetColumnFunc(BASEDRAWFUNC);
|
||||
|
||||
if (pfloor->master->flags & ML_TFERLINE)
|
||||
{
|
||||
@@ -747,10 +589,14 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
}
|
||||
|
||||
if (fuzzy)
|
||||
colfunc = fuzzcolfunc;
|
||||
{
|
||||
R_SetColumnFunc(COLDRAWFUNC_FUZZY);
|
||||
}
|
||||
}
|
||||
else if (pfloor->flags & FF_FOG)
|
||||
colfunc = R_DrawFogColumn;
|
||||
{
|
||||
R_SetColumnFunc(COLDRAWFUNC_FOG);
|
||||
}
|
||||
|
||||
range = max(drawseg->x2-drawseg->x1, 1);
|
||||
//SoM: Moved these up here so they are available for my lightlist calculations
|
||||
@@ -859,7 +705,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
|
||||
else if (pfloor->flags & FF_FOG)
|
||||
lightnum = (pfloor->master->frontsector->lightlevel >> LIGHTSEGSHIFT);
|
||||
else if (colfunc == fuzzcolfunc)
|
||||
else if (R_CheckColumnFunc(COLDRAWFUNC_FUZZY) == true)
|
||||
lightnum = LIGHTLEVELS-1;
|
||||
else
|
||||
lightnum = R_FakeFlat(frontsector, &tempsec, &templight, &templight, false)
|
||||
@@ -1174,7 +1020,7 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
spryscale += rw_scalestep;
|
||||
}
|
||||
|
||||
colfunc = wallcolfunc;
|
||||
R_SetColumnFunc(BASEDRAWFUNC);
|
||||
|
||||
#undef CLAMPMAX
|
||||
#undef CLAMPMIN
|
||||
@@ -1211,6 +1057,24 @@ static inline void R_ExpandPlaneY(visplane_t *pl, INT32 x, INT16 top, INT16 bott
|
||||
#define HEIGHTBITS 12
|
||||
#define HEIGHTUNIT (1<<HEIGHTBITS)
|
||||
|
||||
static void R_DrawWallColumn(drawcolumndata_t* dc, INT32 yl, INT32 yh, fixed_t mid, fixed_t texturecolumn, INT32 texture, boolean remap)
|
||||
{
|
||||
dc->yl = yl;
|
||||
dc->yh = yh;
|
||||
dc->texturemid = mid;
|
||||
dc->source = R_GetColumn(texture, texturecolumn);
|
||||
dc->texheight = textureheight[texture] >> FRACBITS;
|
||||
dc->sourcelength = dc->texheight;
|
||||
R_SetColumnFunc(colfunctype);
|
||||
coldrawfunc_t* colfunccopy = colfunc;
|
||||
drawcolumndata_t dc_copy = *dc;
|
||||
if (remap)
|
||||
{
|
||||
dc_copy.colormap += COLORMAP_REMAPOFFSET;
|
||||
}
|
||||
colfunccopy((drawcolumndata_t*)(&dc_copy));
|
||||
}
|
||||
|
||||
static boolean didsolidcol; // True if at least one column was marked solid
|
||||
|
||||
static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
@@ -1444,7 +1308,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
else
|
||||
dc->lightlist[i].rcolormap = xwalllights[pindex];
|
||||
|
||||
colfunc = R_DrawColumnShadowed;
|
||||
R_SetColumnFunc(COLDRAWFUNC_SHADOWED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1456,14 +1320,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
// 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);
|
||||
R_DrawWallColumn(dc, yl, yh, rw_midtexturemid, texturecolumn, midtexture, (encoremap && !(curline->linedef->flags & ML_TFERLINE)));
|
||||
|
||||
// dont draw anything more for this column, since
|
||||
// a midtexture blocks the view
|
||||
@@ -1506,15 +1363,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
}
|
||||
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);
|
||||
|
||||
R_DrawWallColumn(dc, yl, mid, rw_toptexturemid, texturecolumn, toptexture, topremap);
|
||||
ceilingclip[rw_x] = (INT16)mid;
|
||||
}
|
||||
else if (!rw_ceilingmarked) // entirely off top of screen
|
||||
@@ -1545,15 +1394,7 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
}
|
||||
else if (mid < viewheight) // safe to draw bottom texture
|
||||
{
|
||||
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);
|
||||
|
||||
R_DrawWallColumn(dc, mid, yh, rw_bottomtexturemid, texturecolumn, bottomtexture, bottomremap);
|
||||
floorclip[rw_x] = (INT16)mid;
|
||||
}
|
||||
else if (!rw_floormarked) // entirely off bottom of screen
|
||||
@@ -1617,9 +1458,6 @@ static void R_RenderSegLoop(drawcolumndata_t* dc)
|
||||
topfrac += topstep;
|
||||
bottomfrac += bottomstep;
|
||||
}
|
||||
|
||||
//colfunc = wallcolfunc;
|
||||
colfunc = wallcolfunc;
|
||||
}
|
||||
|
||||
// Uses precalculated seg->length
|
||||
@@ -2843,21 +2681,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
didsolidcol = false;
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
if (linedef->splats && cv_splats.value)
|
||||
{
|
||||
// Isn't a bit wasteful to copy the ENTIRE array for every drawseg?
|
||||
M_Memcpy(last_ceilingclip + ds_p->x1, ceilingclip + ds_p->x1,
|
||||
sizeof (INT16) * (ds_p->x2 - ds_p->x1 + 1));
|
||||
M_Memcpy(last_floorclip + ds_p->x1, floorclip + ds_p->x1,
|
||||
sizeof (INT16) * (ds_p->x2 - ds_p->x1 + 1));
|
||||
R_RenderSegLoop();
|
||||
R_DrawWallSplats();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
R_RenderSegLoop(&dc);
|
||||
R_SetColumnFunc(BASEDRAWFUNC);
|
||||
|
||||
if (g_portal) // if curline is a portal, set portalrender for drawseg
|
||||
ds_p->portalpass = portalrender+1;
|
||||
@@ -2904,5 +2729,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
ds_p->silhouette |= SIL_BOTTOM;
|
||||
ds_p->bsilheight = (sidedef->midtexture > 0 && sidedef->midtexture < numtextures) ? INT32_MAX: INT32_MIN;
|
||||
}
|
||||
|
||||
ds_p++;
|
||||
}
|
||||
@@ -63,11 +63,6 @@ void R_SetupSkyDraw(void)
|
||||
{
|
||||
// the horizon line in a 256x128 sky texture
|
||||
skytexturemid = (textures[skytexture]->height/2)<<FRACBITS;
|
||||
|
||||
// get the right drawer, it was set by screen.c, depending on the
|
||||
// current video mode bytes per pixel (quick fix)
|
||||
wallcolfunc = walldrawerfunc;
|
||||
|
||||
R_SetSkyScale();
|
||||
}
|
||||
|
||||
|
||||
+10
-14
@@ -782,12 +782,11 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
return;
|
||||
}
|
||||
|
||||
colfunc = basecolfunc; // hack: this isn't resetting properly somewhere.
|
||||
R_SetColumnFunc(BASEDRAWFUNC); // hack: this isn't resetting properly somewhere.
|
||||
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;
|
||||
R_SetColumnFunc(COLDRAWFUNC_TRANS); // translate certain pixels to white
|
||||
if (vis->mobj->type == MT_CYBRAKDEMON)
|
||||
dc.translation = R_GetTranslationColormap(TC_ALLWHITE, SKINCOLOR_NONE, GTC_CACHE);
|
||||
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
|
||||
@@ -797,7 +796,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
}
|
||||
else if (vis->mobj->color && vis->transmap) // Color mapping
|
||||
{
|
||||
colfunc = transtransfunc;
|
||||
R_SetColumnFunc(COLDRAWFUNC_TRANSTRANS);
|
||||
dc.transmap = vis->transmap;
|
||||
if (vis->mobj->colorized)
|
||||
dc.translation = R_GetTranslationColormap(TC_RAINBOW, static_cast<skincolors_t>(vis->mobj->color), GTC_CACHE);
|
||||
@@ -808,13 +807,13 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
}
|
||||
else if (vis->transmap)
|
||||
{
|
||||
colfunc = fuzzcolfunc;
|
||||
R_SetColumnFunc(COLDRAWFUNC_FUZZY);
|
||||
dc.transmap = vis->transmap; //Fab : 29-04-98: translucency table
|
||||
}
|
||||
else if (vis->mobj->color)
|
||||
{
|
||||
// translate green skin to another color
|
||||
colfunc = transcolfunc;
|
||||
R_SetColumnFunc(COLDRAWFUNC_TRANS);
|
||||
|
||||
// New colormap stuff for skins Tails 06-07-2002
|
||||
if (vis->mobj->colorized)
|
||||
@@ -826,7 +825,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
}
|
||||
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;
|
||||
R_SetColumnFunc(COLDRAWFUNC_TRANS);
|
||||
dc.translation = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_BLUE, GTC_CACHE);
|
||||
}
|
||||
|
||||
@@ -930,7 +929,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
}
|
||||
}
|
||||
|
||||
colfunc = basecolfunc;
|
||||
R_SetColumnFunc(BASEDRAWFUNC);
|
||||
|
||||
vis->x1 = x1;
|
||||
vis->x2 = x2;
|
||||
@@ -960,7 +959,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
||||
|
||||
if (vis->transmap)
|
||||
{
|
||||
colfunc = fuzzcolfunc;
|
||||
R_SetColumnFunc(COLDRAWFUNC_FUZZY);
|
||||
dc.transmap = vis->transmap; //Fab : 29-04-98: translucency table
|
||||
}
|
||||
|
||||
@@ -998,7 +997,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
||||
R_DrawMaskedColumn(&dc, column);
|
||||
}
|
||||
|
||||
colfunc = basecolfunc;
|
||||
R_SetColumnFunc(BASEDRAWFUNC);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2658,9 +2657,6 @@ static void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2)
|
||||
(lowscale < spr->sortscale &&
|
||||
!R_PointOnSegSide (spr->gx, spr->gy, ds->curline)))
|
||||
{
|
||||
// masked mid texture?
|
||||
/*if (ds->maskedtexturecol)
|
||||
R_RenderMaskedSegRange (ds, r1, r2);*/
|
||||
// seg is behind sprite
|
||||
continue;
|
||||
}
|
||||
@@ -2976,7 +2972,7 @@ static void R_DrawMaskedList(drawnode_t* head)
|
||||
next = r2->prev;
|
||||
|
||||
// Tails 08-18-2002
|
||||
if (r2->sprite->precip == true)
|
||||
if (r2->sprite->precip)
|
||||
{
|
||||
R_DrawPrecipitationSprite(r2->sprite);
|
||||
}
|
||||
|
||||
+66
-11
@@ -78,6 +78,36 @@ UINT8 *scr_borderpatch; // flat used to fill the reduced view borders set at ST_
|
||||
|
||||
// =========================================================================
|
||||
|
||||
static void SCR_SetDrawFuncs(void)
|
||||
{
|
||||
//
|
||||
// setup the right draw routines
|
||||
//
|
||||
|
||||
spanfuncs[BASEDRAWFUNC] = R_DrawSpan;
|
||||
spanfuncs[SPANDRAWFUNC_TRANS] = R_DrawTranslucentSpan;
|
||||
spanfuncs[SPANDRAWFUNC_TILTED] = R_DrawSpan_Tilted;
|
||||
spanfuncs[SPANDRAWFUNC_TILTEDTRANS] = R_DrawTranslucentSpan_Tilted;
|
||||
spanfuncs[SPANDRAWFUNC_SPLAT] = R_DrawSplat;
|
||||
spanfuncs[SPANDRAWFUNC_TRANSSPLAT] = R_DrawTranslucentSplat;
|
||||
spanfuncs[SPANDRAWFUNC_TILTEDSPLAT] = R_DrawSplat_Tilted;
|
||||
spanfuncs[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan;
|
||||
spanfuncs[SPANDRAWFUNC_TILTEDWATER] = R_DrawTranslucentWaterSpan_Tilted;
|
||||
spanfuncs[SPANDRAWFUNC_FOG] = R_DrawFogSpan;
|
||||
|
||||
colfuncs[BASEDRAWFUNC] = R_DrawColumn;
|
||||
colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn;
|
||||
colfuncs[COLDRAWFUNC_TRANS] = R_DrawTranslatedColumn;
|
||||
colfuncs[COLDRAWFUNC_SHADOWED] = R_DrawColumnShadowed;
|
||||
colfuncs[COLDRAWFUNC_TRANSTRANS] = R_DrawTranslatedTranslucentColumn;
|
||||
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn;
|
||||
colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS] = R_Draw2sMultiPatchTranslucentColumn;
|
||||
colfuncs[COLDRAWFUNC_FOG] = R_DrawFogColumn;
|
||||
|
||||
R_SetColumnFunc(BASEDRAWFUNC);
|
||||
R_SetSpanFunc(BASEDRAWFUNC);
|
||||
}
|
||||
|
||||
void SCR_SetMode(void)
|
||||
{
|
||||
if (dedicated)
|
||||
@@ -90,22 +120,47 @@ void SCR_SetMode(void)
|
||||
|
||||
V_SetPalette(0);
|
||||
|
||||
spanfunc = basespanfunc = R_DrawSpan;
|
||||
splatfunc = R_DrawSplat;
|
||||
transcolfunc = R_DrawTranslatedColumn;
|
||||
transtransfunc = R_DrawTranslatedTranslucentColumn;
|
||||
|
||||
colfunc = basecolfunc = R_DrawColumn;
|
||||
shadecolfunc = R_DrawShadeColumn;
|
||||
fuzzcolfunc = R_DrawTranslucentColumn;
|
||||
walldrawerfunc = R_DrawWallColumn;
|
||||
twosmultipatchfunc = R_Draw2sMultiPatchColumn;
|
||||
twosmultipatchtransfunc = R_Draw2sMultiPatchTranslucentColumn;
|
||||
SCR_SetDrawFuncs();
|
||||
|
||||
// set the apprpriate drawer for the sky (tall or INT16)
|
||||
setmodeneeded = 0;
|
||||
}
|
||||
|
||||
void R_SetColumnFunc(size_t id)
|
||||
{
|
||||
I_Assert(id < COLDRAWFUNC_MAX);
|
||||
|
||||
colfunctype = id;
|
||||
colfunc = colfuncs[id];
|
||||
}
|
||||
|
||||
void R_SetSpanFunc(size_t id)
|
||||
{
|
||||
I_Assert(id < SPANDRAWFUNC_MAX);
|
||||
spanfunc = spanfuncs[id];
|
||||
}
|
||||
|
||||
boolean R_CheckColumnFunc(size_t id)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (colfunc == NULL)
|
||||
{
|
||||
// Shouldn't happen.
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; i < COLDRAWFUNC_MAX; i++)
|
||||
{
|
||||
if (colfunc == colfuncs[id])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// do some initial settings for the game loading screen
|
||||
//
|
||||
void SCR_Startup(void)
|
||||
|
||||
@@ -98,6 +98,10 @@ extern consvar_t cv_alwaysgrabmouse;
|
||||
|
||||
extern consvar_t cv_votebgscaling;
|
||||
|
||||
void R_SetColumnFunc(size_t id);
|
||||
void R_SetSpanFunc(size_t id);
|
||||
boolean R_CheckColumnFunc(size_t id);
|
||||
|
||||
// Change video mode, only at the start of a refresh.
|
||||
void SCR_SetMode(void);
|
||||
// Recalc screen size dependent stuff
|
||||
|
||||
Reference in new issue
Block a user