Merge branch 'software-drawers-refactor' into 'master'

Optimize Software drawers

See merge request STJr/SRB2!533
This commit is contained in:
James R 2019-12-14 16:47:27 -05:00
commit e5714db75c
14 changed files with 1347 additions and 745 deletions

View File

@ -960,6 +960,7 @@ void R_DrawViewBorder(void)
// ==========================================================================
#include "r_draw8.c"
#include "r_draw8_npo2.c"
// ==========================================================================
// INCLUDE 16bpp DRAWING CODE HERE

View File

@ -138,49 +138,59 @@ void R_DrawViewBorder(void);
// -----------------
void R_DrawColumn_8(void);
#define R_DrawWallColumn_8 R_DrawColumn_8
void R_DrawShadeColumn_8(void);
void R_DrawTranslucentColumn_8(void);
void R_DrawTranslatedColumn_8(void);
void R_DrawTranslatedTranslucentColumn_8(void);
void R_Draw2sMultiPatchColumn_8(void);
void R_Draw2sMultiPatchTranslucentColumn_8(void);
void R_DrawFogColumn_8(void);
void R_DrawColumnShadowed_8(void);
void R_DrawSpan_8(void);
void R_DrawSplat_8(void);
void R_DrawTranslucentSpan_8(void);
void R_DrawTranslucentSplat_8(void);
#ifdef ESLOPE
void R_DrawTiltedSpan_8(void);
void R_DrawTiltedTranslucentSpan_8(void);
void R_DrawTiltedSplat_8(void);
void R_CalcTiltedLighting(fixed_t start, fixed_t end);
extern INT32 tiltlighting[MAXVIDWIDTH];
#endif
#ifndef NOWATER
void R_DrawTranslucentWaterSpan_8(void);
extern INT32 ds_bgofs;
extern INT32 ds_waterofs;
#endif
void R_DrawFogSpan_8(void);
// Lactozilla: Non-powers-of-two
void R_DrawSpan_NPO2_8(void);
void R_DrawTranslucentSpan_NPO2_8(void);
void R_DrawSplat_NPO2_8(void);
void R_DrawTranslucentSplat_NPO2_8(void);
#ifdef ESLOPE
void R_DrawTiltedSpan_NPO2_8(void);
void R_DrawTiltedTranslucentSpan_NPO2_8(void);
void R_DrawTiltedSplat_NPO2_8(void);
#endif
#ifndef NOWATER
void R_DrawTranslucentWaterSpan_NPO2_8(void);
#endif
#ifdef USEASM
void ASMCALL R_DrawColumn_8_ASM(void);
#define R_DrawWallColumn_8_ASM R_DrawColumn_8_ASM
void ASMCALL R_DrawShadeColumn_8_ASM(void);
void ASMCALL R_DrawTranslucentColumn_8_ASM(void);
void ASMCALL R_Draw2sMultiPatchColumn_8_ASM(void);
void ASMCALL R_DrawColumn_8_MMX(void);
#define R_DrawWallColumn_8_MMX R_DrawColumn_8_MMX
void ASMCALL R_Draw2sMultiPatchColumn_8_MMX(void);
void ASMCALL R_DrawSpan_8_MMX(void);
#endif
void R_DrawTranslatedColumn_8(void);
void R_DrawTranslatedTranslucentColumn_8(void);
void R_DrawSpan_8(void);
#ifdef ESLOPE
void R_CalcTiltedLighting(fixed_t start, fixed_t end);
void R_DrawTiltedSpan_8(void);
void R_DrawTiltedTranslucentSpan_8(void);
void R_DrawTiltedSplat_8(void);
#endif
void R_DrawSplat_8(void);
void R_DrawTranslucentSplat_8(void);
void R_DrawTranslucentSpan_8(void);
void R_Draw2sMultiPatchColumn_8(void);
void R_Draw2sMultiPatchTranslucentColumn_8(void);
void R_DrawFogSpan_8(void);
void R_DrawFogColumn_8(void);
void R_DrawColumnShadowed_8(void);
#ifndef NOWATER
void R_DrawTranslucentWaterSpan_8(void);
extern INT32 ds_bgofs;
extern INT32 ds_waterofs;
#endif
// ------------------
// 16bpp DRAWING CODE
// ------------------

File diff suppressed because it is too large Load Diff

845
src/r_draw8_npo2.c Normal file
View File

@ -0,0 +1,845 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2019 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file r_draw8_npo2.c
/// \brief 8bpp span drawer functions (for non-powers-of-two flat dimensions)
/// \note no includes because this is included as part of r_draw.c
// ==========================================================================
// SPANS
// ==========================================================================
/** \brief The R_DrawSpan_NPO2_8 function
Draws the actual span.
*/
void R_DrawSpan_NPO2_8 (void)
{
fixed_t xposition;
fixed_t yposition;
fixed_t xstep, ystep;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
size_t count = (ds_x2 - ds_x1 + 1);
xposition = ds_xfrac; yposition = ds_yfrac;
xstep = ds_xstep; ystep = ds_ystep;
source = ds_source;
colormap = ds_colormap;
dest = ylookup[ds_y] + columnofs[ds_x1];
if (dest+8 > deststop)
return;
while (count-- && dest <= deststop)
{
fixed_t x = (xposition >> FRACBITS);
fixed_t y = (yposition >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
*dest++ = colormap[source[((y * ds_flatwidth) + x)]];
xposition += xstep;
yposition += ystep;
}
}
#ifdef ESLOPE
/** \brief The R_DrawTiltedSpan_NPO2_8 function
Draw slopes! Holy sheit!
*/
void R_DrawTiltedSpan_NPO2_8(void)
{
// x1, x2 = ds_x1, ds_x2
int width = ds_x2 - ds_x1;
double iz, uz, vz;
UINT32 u, v;
int i;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
double startz, startu, startv;
double izstep, uzstep, vzstep;
double endz, endu, endv;
UINT32 stepu, stepv;
iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx);
// Lighting is simple. It's just linear interpolation from start to end
{
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
float lightstart, lightend;
lightend = (iz + ds_sz.x*width) * planelightfloat;
lightstart = iz * planelightfloat;
R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
}
uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx);
vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx);
dest = ylookup[ds_y] + columnofs[ds_x1];
source = ds_source;
//colormap = ds_colormap;
#if 0 // The "perfect" reference version of this routine. Pretty slow.
// Use it only to see how things are supposed to look.
i = 0;
do
{
double z = 1.f/iz;
u = (INT64)(uz*z) + viewx;
v = (INT64)(vz*z) + viewy;
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
*dest = colormap[source[((y * ds_flatwidth) + x)]];
}
dest++;
iz += ds_sz.x;
uz += ds_su.x;
vz += ds_sv.x;
} while (--width >= 0);
#else
#define SPANSIZE 16
#define INVSPAN 0.0625f
startz = 1.f/iz;
startu = uz*startz;
startv = vz*startz;
izstep = ds_sz.x * SPANSIZE;
uzstep = ds_su.x * SPANSIZE;
vzstep = ds_sv.x * SPANSIZE;
//x1 = 0;
width++;
while (width >= SPANSIZE)
{
iz += izstep;
uz += uzstep;
vz += vzstep;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
stepu = (INT64)((endu - startu) * INVSPAN);
stepv = (INT64)((endv - startv) * INVSPAN);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (i = SPANSIZE-1; i >= 0; i--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
*dest = colormap[source[((y * ds_flatwidth) + x)]];
}
dest++;
u += stepu;
v += stepv;
}
startu = endu;
startv = endv;
width -= SPANSIZE;
}
if (width > 0)
{
if (width == 1)
{
u = (INT64)(startu);
v = (INT64)(startv);
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
*dest = colormap[source[((y * ds_flatwidth) + x)]];
}
}
else
{
double left = width;
iz += ds_sz.x * left;
uz += ds_su.x * left;
vz += ds_sv.x * left;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
left = 1.f/left;
stepu = (INT64)((endu - startu) * left);
stepv = (INT64)((endv - startv) * left);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (; width != 0; width--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
*dest = colormap[source[((y * ds_flatwidth) + x)]];
}
dest++;
u += stepu;
v += stepv;
}
}
}
#endif
}
/** \brief The R_DrawTiltedTranslucentSpan_NPO2_8 function
Like DrawTiltedSpan_NPO2, but translucent
*/
void R_DrawTiltedTranslucentSpan_NPO2_8(void)
{
// x1, x2 = ds_x1, ds_x2
int width = ds_x2 - ds_x1;
double iz, uz, vz;
UINT32 u, v;
int i;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
double startz, startu, startv;
double izstep, uzstep, vzstep;
double endz, endu, endv;
UINT32 stepu, stepv;
iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx);
// Lighting is simple. It's just linear interpolation from start to end
{
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
float lightstart, lightend;
lightend = (iz + ds_sz.x*width) * planelightfloat;
lightstart = iz * planelightfloat;
R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
}
uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx);
vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx);
dest = ylookup[ds_y] + columnofs[ds_x1];
source = ds_source;
//colormap = ds_colormap;
#if 0 // The "perfect" reference version of this routine. Pretty slow.
// Use it only to see how things are supposed to look.
i = 0;
do
{
double z = 1.f/iz;
u = (INT64)(uz*z) + viewx;
v = (INT64)(vz*z) + viewy;
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
}
dest++;
iz += ds_sz.x;
uz += ds_su.x;
vz += ds_sv.x;
} while (--width >= 0);
#else
#define SPANSIZE 16
#define INVSPAN 0.0625f
startz = 1.f/iz;
startu = uz*startz;
startv = vz*startz;
izstep = ds_sz.x * SPANSIZE;
uzstep = ds_su.x * SPANSIZE;
vzstep = ds_sv.x * SPANSIZE;
//x1 = 0;
width++;
while (width >= SPANSIZE)
{
iz += izstep;
uz += uzstep;
vz += vzstep;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
stepu = (INT64)((endu - startu) * INVSPAN);
stepv = (INT64)((endv - startv) * INVSPAN);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (i = SPANSIZE-1; i >= 0; i--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
}
dest++;
u += stepu;
v += stepv;
}
startu = endu;
startv = endv;
width -= SPANSIZE;
}
if (width > 0)
{
if (width == 1)
{
u = (INT64)(startu);
v = (INT64)(startv);
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
}
}
else
{
double left = width;
iz += ds_sz.x * left;
uz += ds_su.x * left;
vz += ds_sv.x * left;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
left = 1.f/left;
stepu = (INT64)((endu - startu) * left);
stepv = (INT64)((endv - startv) * left);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (; width != 0; width--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
}
dest++;
u += stepu;
v += stepv;
}
}
}
#endif
}
void R_DrawTiltedSplat_NPO2_8(void)
{
// x1, x2 = ds_x1, ds_x2
int width = ds_x2 - ds_x1;
double iz, uz, vz;
UINT32 u, v;
int i;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
UINT8 val;
double startz, startu, startv;
double izstep, uzstep, vzstep;
double endz, endu, endv;
UINT32 stepu, stepv;
iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx);
// Lighting is simple. It's just linear interpolation from start to end
{
float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f;
float lightstart, lightend;
lightend = (iz + ds_sz.x*width) * planelightfloat;
lightstart = iz * planelightfloat;
R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend));
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf);
}
uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx);
vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx);
dest = ylookup[ds_y] + columnofs[ds_x1];
source = ds_source;
//colormap = ds_colormap;
#if 0 // The "perfect" reference version of this routine. Pretty slow.
// Use it only to see how things are supposed to look.
i = 0;
do
{
double z = 1.f/iz;
u = (INT64)(uz*z) + viewx;
v = (INT64)(vz*z) + viewy;
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
val = source[((y * ds_flatwidth) + x)];
}
if (val != TRANSPARENTPIXEL)
*dest = colormap[val];
dest++;
iz += ds_sz.x;
uz += ds_su.x;
vz += ds_sv.x;
} while (--width >= 0);
#else
#define SPANSIZE 16
#define INVSPAN 0.0625f
startz = 1.f/iz;
startu = uz*startz;
startv = vz*startz;
izstep = ds_sz.x * SPANSIZE;
uzstep = ds_su.x * SPANSIZE;
vzstep = ds_sv.x * SPANSIZE;
//x1 = 0;
width++;
while (width >= SPANSIZE)
{
iz += izstep;
uz += uzstep;
vz += vzstep;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
stepu = (INT64)((endu - startu) * INVSPAN);
stepv = (INT64)((endv - startv) * INVSPAN);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (i = SPANSIZE-1; i >= 0; i--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
val = source[((y * ds_flatwidth) + x)];
}
if (val != TRANSPARENTPIXEL)
*dest = colormap[val];
dest++;
u += stepu;
v += stepv;
}
startu = endu;
startv = endv;
width -= SPANSIZE;
}
if (width > 0)
{
if (width == 1)
{
u = (INT64)(startu);
v = (INT64)(startv);
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
val = source[((y * ds_flatwidth) + x)];
}
if (val != TRANSPARENTPIXEL)
*dest = colormap[val];
}
else
{
double left = width;
iz += ds_sz.x * left;
uz += ds_su.x * left;
vz += ds_sv.x * left;
endz = 1.f/iz;
endu = uz*endz;
endv = vz*endz;
left = 1.f/left;
stepu = (INT64)((endu - startu) * left);
stepv = (INT64)((endv - startv) * left);
u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy;
for (; width != 0; width--)
{
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
// Lactozilla: Non-powers-of-two
{
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
val = source[((y * ds_flatwidth) + x)];
}
if (val != TRANSPARENTPIXEL)
*dest = colormap[val];
dest++;
u += stepu;
v += stepv;
}
}
}
#endif
}
#endif // ESLOPE
/** \brief The R_DrawSplat_NPO2_8 function
Just like R_DrawSpan_NPO2_8, but skips transparent pixels.
*/
void R_DrawSplat_NPO2_8 (void)
{
fixed_t xposition;
fixed_t yposition;
fixed_t xstep, ystep;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
size_t count = (ds_x2 - ds_x1 + 1);
UINT32 val;
xposition = ds_xfrac; yposition = ds_yfrac;
xstep = ds_xstep; ystep = ds_ystep;
source = ds_source;
colormap = ds_colormap;
dest = ylookup[ds_y] + columnofs[ds_x1];
while (count-- && dest <= deststop)
{
fixed_t x = (xposition >> FRACBITS);
fixed_t y = (yposition >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
val = source[((y * ds_flatwidth) + x)];
if (val != TRANSPARENTPIXEL)
*dest = colormap[val];
dest++;
xposition += xstep;
yposition += ystep;
}
}
/** \brief The R_DrawTranslucentSplat_NPO2_8 function
Just like R_DrawSplat_NPO2_8, but is translucent!
*/
void R_DrawTranslucentSplat_NPO2_8 (void)
{
fixed_t xposition;
fixed_t yposition;
fixed_t xstep, ystep;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
size_t count = (ds_x2 - ds_x1 + 1);
UINT32 val;
xposition = ds_xfrac; yposition = ds_yfrac;
xstep = ds_xstep; ystep = ds_ystep;
source = ds_source;
colormap = ds_colormap;
dest = ylookup[ds_y] + columnofs[ds_x1];
while (count-- && dest <= deststop)
{
fixed_t x = (xposition >> FRACBITS);
fixed_t y = (yposition >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
val = source[((y * ds_flatwidth) + x)];
if (val != TRANSPARENTPIXEL)
*dest = *(ds_transmap + (colormap[val] << 8) + *dest);
dest++;
xposition += xstep;
yposition += ystep;
}
}
/** \brief The R_DrawTranslucentSpan_NPO2_8 function
Draws the actual span with translucency.
*/
void R_DrawTranslucentSpan_NPO2_8 (void)
{
fixed_t xposition;
fixed_t yposition;
fixed_t xstep, ystep;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
size_t count = (ds_x2 - ds_x1 + 1);
UINT32 val;
xposition = ds_xfrac; yposition = ds_yfrac;
xstep = ds_xstep; ystep = ds_ystep;
source = ds_source;
colormap = ds_colormap;
dest = ylookup[ds_y] + columnofs[ds_x1];
while (count-- && dest <= deststop)
{
fixed_t x = (xposition >> FRACBITS);
fixed_t y = (yposition >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
val = ((y * ds_flatwidth) + x);
*dest = *(ds_transmap + (colormap[source[val]] << 8) + *dest);
dest++;
xposition += xstep;
yposition += ystep;
}
}
#ifndef NOWATER
void R_DrawTranslucentWaterSpan_NPO2_8(void)
{
fixed_t xposition;
fixed_t yposition;
fixed_t xstep, ystep;
UINT8 *source;
UINT8 *colormap;
UINT8 *dest;
UINT8 *dsrc;
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
size_t count = (ds_x2 - ds_x1 + 1);
xposition = ds_xfrac; yposition = (ds_yfrac + ds_waterofs);
xstep = ds_xstep; ystep = ds_ystep;
source = ds_source;
colormap = ds_colormap;
dest = ylookup[ds_y] + columnofs[ds_x1];
dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1;
while (count-- && dest <= deststop)
{
fixed_t x = (xposition >> FRACBITS);
fixed_t y = (yposition >> FRACBITS);
// Carefully align all of my Friends.
if (x < 0)
x = ds_flatwidth - ((UINT32)(ds_flatwidth - x) % ds_flatwidth);
if (y < 0)
y = ds_flatheight - ((UINT32)(ds_flatheight - y) % ds_flatheight);
x %= ds_flatwidth;
y %= ds_flatheight;
*dest++ = colormap[*(ds_transmap + (source[((y * ds_flatwidth) + x)] << 8) + *dsrc++)];
xposition += xstep;
yposition += ystep;
}
}
#endif

View File

@ -587,8 +587,7 @@ void R_DrawPlanes(void)
// Note: are these two lines really needed?
// R_DrawSinglePlane and R_DrawSkyPlane do span/column drawer resets themselves anyway
spanfunc = basespanfunc;
wallcolfunc = walldrawerfunc;
spanfunc = spanfuncs[BASEDRAWFUNC];
for (i = 0; i < MAXVISPLANES; i++, pl++)
{
@ -622,7 +621,7 @@ static void R_DrawSkyPlane(visplane_t *pl)
// 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 = colfuncs[BASEDRAWFUNC];
// use correct aspect ratio scale
dc_iscale = skyscale;
@ -648,7 +647,7 @@ static void R_DrawSkyPlane(visplane_t *pl)
dc_source =
R_GetColumn(texturetranslation[skytexture],
-angle); // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18
wallcolfunc();
colfunc();
}
}
}
@ -842,6 +841,7 @@ void R_DrawSinglePlane(visplane_t *pl)
ffloor_t *rover;
levelflat_t *levelflat;
int type;
int spanfunctype = BASEDRAWFUNC;
if (!(pl->minx <= pl->maxx))
return;
@ -856,11 +856,12 @@ void R_DrawSinglePlane(visplane_t *pl)
#ifndef NOWATER
itswater = false;
#endif
spanfunc = basespanfunc;
spanfunc = spanfuncs[BASEDRAWFUNC];
#ifdef POLYOBJECTS_PLANES
if (pl->polyobj && pl->polyobj->translucency != 0) {
spanfunc = R_DrawTranslucentSpan_8;
if (pl->polyobj && pl->polyobj->translucency != 0)
{
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 >= 10)
@ -868,10 +869,10 @@ void R_DrawSinglePlane(visplane_t *pl)
else if (pl->polyobj->translucency > 0)
ds_transmap = transtables + ((pl->polyobj->translucency-1)<<FF_TRANSSHIFT);
else // Opaque, but allow transparent flat pixels
spanfunc = splatfunc;
spanfunctype = SPANDRAWFUNC_SPLAT;
#ifdef SHITPLANESPARENCY
if ((spanfunc == splatfunc) != (pl->extra_colormap && (pl->extra_colormap->fog & 4)))
if ((spanfunctype == SPANDRAWFUNC_SPLAT) != (pl->extra_colormap && (pl->extra_colormap->fog & 4)))
#else
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
#endif
@ -902,7 +903,7 @@ void R_DrawSinglePlane(visplane_t *pl)
if (pl->ffloor->flags & FF_TRANSLUCENT)
{
spanfunc = R_DrawTranslucentSpan_8;
spanfunctype = SPANDRAWFUNC_TRANS;
// Hacked up support for alpha value in software mode Tails 09-24-2002
if (pl->ffloor->alpha < 12)
@ -926,10 +927,10 @@ void R_DrawSinglePlane(visplane_t *pl)
else if (pl->ffloor->alpha < 243)
ds_transmap = transtables + ((tr_trans10-1)<<FF_TRANSSHIFT);
else // Opaque, but allow transparent flat pixels
spanfunc = splatfunc;
spanfunctype = SPANDRAWFUNC_SPLAT;
#ifdef SHITPLANESPARENCY
if ((spanfunc == splatfunc) != (pl->extra_colormap && (pl->extra_colormap->fog & 4)))
if ((spanfunctype == SPANDRAWFUNC_SPLAT) != (pl->extra_colormap && (pl->extra_colormap->fog & 4)))
#else
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
#endif
@ -939,7 +940,7 @@ void R_DrawSinglePlane(visplane_t *pl)
}
else if (pl->ffloor->flags & FF_FOG)
{
spanfunc = R_DrawFogSpan_8;
spanfunctype = SPANDRAWFUNC_FOG;
light = (pl->lightlevel >> LIGHTSEGSHIFT);
}
else light = (pl->lightlevel >> LIGHTSEGSHIFT);
@ -954,9 +955,9 @@ void R_DrawSinglePlane(visplane_t *pl)
INT32 top, bottom;
itswater = true;
if (spanfunc == R_DrawTranslucentSpan_8)
if (spanfunctype == SPANDRAWFUNC_TRANS)
{
spanfunc = R_DrawTranslucentWaterSpan_8;
spanfunctype = SPANDRAWFUNC_WATER;
// Copy the current scene, ugh
top = pl->high-8;
@ -1007,8 +1008,6 @@ void R_DrawSinglePlane(visplane_t *pl)
R_CheckFlatLength(W_LumpLength(levelflat->u.flat.lumpnum));
// Raw flats always have dimensions that are powers-of-two numbers.
ds_powersoftwo = true;
if (spanfunc == basespanfunc)
spanfunc = mmxspanfunc;
break;
default:
switch (type)
@ -1031,11 +1030,7 @@ void R_DrawSinglePlane(visplane_t *pl)
}
// Check if this texture or patch has power-of-two dimensions.
if (R_CheckPowersOfTwo())
{
R_CheckFlatLength(ds_flatwidth * ds_flatheight);
if (spanfunc == basespanfunc)
spanfunc = mmxspanfunc;
}
}
if (light >= LIGHTLEVELS)
@ -1188,12 +1183,12 @@ void R_DrawSinglePlane(visplane_t *pl)
}
#undef SFMULT
if (spanfunc == R_DrawTranslucentSpan_8)
spanfunc = R_DrawTiltedTranslucentSpan_8;
else if (spanfunc == splatfunc)
spanfunc = R_DrawTiltedSplat_8;
if (spanfunctype == SPANDRAWFUNC_TRANS)
spanfunctype = SPANDRAWFUNC_TILTEDTRANS;
else if (spanfunctype == SPANDRAWFUNC_SPLAT)
spanfunctype = SPANDRAWFUNC_TILTEDSPLAT;
else
spanfunc = R_DrawTiltedSpan_8;
spanfunctype = SPANDRAWFUNC_TILTED;
planezlight = scalelight[light];
} else
@ -1201,6 +1196,17 @@ void R_DrawSinglePlane(visplane_t *pl)
planezlight = zlight[light];
// Use the correct span drawer depending on the powers-of-twoness
if (!ds_powersoftwo)
{
if (spanfuncs_npo2[spanfunctype])
spanfunc = spanfuncs_npo2[spanfunctype];
else
spanfunc = spanfuncs[spanfunctype];
}
else
spanfunc = spanfuncs[spanfunctype];
// set the maximum value for unsigned
pl->top[pl->maxx+1] = 0xffff;
pl->top[pl->minx-1] = 0xffff;
@ -1240,11 +1246,11 @@ a 'smoothing' of the texture while
using the palette colors.
*/
#ifdef QUINCUNX
if (spanfunc == R_DrawSpan_8)
if (spanfunc == spanfuncs[BASEDRAWFUNC])
{
INT32 i;
ds_transmap = transtables + ((tr_trans50-1)<<FF_TRANSSHIFT);
spanfunc = R_DrawTranslucentSpan_8;
spanfunc = spanfuncs[SPANDRAWFUNC_TRANS];
for (i=0; i<4; i++)
{
xoffs = pl->xoffs;

View File

@ -177,20 +177,20 @@ static void R_DrawWallSplats(void)
switch (splat->flags & SPLATDRAWMODE_MASK)
{
case SPLATDRAWMODE_OPAQUE:
colfunc = basecolfunc;
colfunc = colfuncs[BASEDRAWFUNC];
break;
case SPLATDRAWMODE_TRANS:
if (!cv_translucency.value)
colfunc = basecolfunc;
colfunc = colfuncs[BASEDRAWFUNC];
else
{
dc_transmap = transtables + ((tr_trans50 - 1)<<FF_TRANSSHIFT);
colfunc = fuzzcolfunc;
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
}
break;
case SPLATDRAWMODE_SHADE:
colfunc = shadecolfunc;
colfunc = colfuncs[COLDRAWFUNC_SHADE];
break;
}
@ -226,7 +226,7 @@ static void R_DrawWallSplats(void)
}
} // next splat
colfunc = basecolfunc;
colfunc = colfuncs[BASEDRAWFUNC];
}
#endif //WALLSPLATS
@ -270,10 +270,10 @@ static void R_Render2sidedMultiPatchColumn(column_t *column)
{
dc_source = (UINT8 *)column + 3;
if (colfunc == wallcolfunc)
twosmultipatchfunc();
else if (colfunc == fuzzcolfunc)
twosmultipatchtransfunc();
if (colfunc == colfuncs[BASEDRAWFUNC])
(colfuncs[COLDRAWFUNC_TWOSMULTIPATCH])();
else if (colfunc == colfuncs[COLDRAWFUNC_FUZZY])
(colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS])();
else
colfunc();
}
@ -327,15 +327,15 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
case 907:
case 908:
dc_transmap = transtables + ((ldef->special-900)<<FF_TRANSSHIFT);
colfunc = fuzzcolfunc;
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
break;
case 909:
colfunc = R_DrawFogColumn_8;
colfunc = colfuncs[COLDRAWFUNC_FOG];
windowtop = frontsector->ceilingheight;
windowbottom = frontsector->floorheight;
break;
default:
colfunc = wallcolfunc;
colfunc = colfuncs[BASEDRAWFUNC];
break;
}
@ -345,7 +345,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
return;
dc_transmap = transtables + ((curline->polyseg->translucency-1)<<FF_TRANSSHIFT);
colfunc = fuzzcolfunc;
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
}
#ifdef ESLOPE
@ -419,7 +419,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (rlight->flags & FF_FOG || (rlight->extra_colormap && rlight->extra_colormap->fog))
lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT);
else if (colfunc == fuzzcolfunc)
else if (colfunc == colfuncs[COLDRAWFUNC_FUZZY])
lightnum = LIGHTLEVELS - 1;
else
lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT);
@ -436,7 +436,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
}
else
{
if (colfunc == fuzzcolfunc)
if (colfunc == colfuncs[COLDRAWFUNC_FUZZY])
{
if (frontsector->extra_colormap && frontsector->extra_colormap->fog)
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
@ -446,7 +446,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
else
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
if (colfunc == R_DrawFogColumn_8
if (colfunc == colfuncs[COLDRAWFUNC_FOG]
|| (frontsector->extra_colormap && frontsector->extra_colormap->fog))
;
else if (curline->v1->y == curline->v2->y)
@ -718,7 +718,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
spryscale += rw_scalestep;
}
}
colfunc = wallcolfunc;
colfunc = colfuncs[BASEDRAWFUNC];
}
// Loop through R_DrawMaskedColumn calls
@ -789,7 +789,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
frontsector = curline->frontsector == pfloor->target ? curline->backsector : curline->frontsector;
texnum = R_GetTextureNum(sides[pfloor->master->sidenum[0]].midtexture);
colfunc = wallcolfunc;
colfunc = colfuncs[BASEDRAWFUNC];
if (pfloor->master->flags & ML_TFERLINE)
{
@ -827,10 +827,10 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
fuzzy = false; // Opaque
if (fuzzy)
colfunc = fuzzcolfunc;
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
}
else if (pfloor->flags & FF_FOG)
colfunc = R_DrawFogColumn_8;
colfunc = colfuncs[COLDRAWFUNC_FOG];
#ifdef ESLOPE
range = max(ds->x2-ds->x1, 1);
@ -965,7 +965,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
else if (pfloor->flags & FF_FOG)
lightnum = (pfloor->master->frontsector->lightlevel >> LIGHTSEGSHIFT);
else if (colfunc == fuzzcolfunc)
else if (colfunc == colfuncs[COLDRAWFUNC_FUZZY])
lightnum = LIGHTLEVELS-1;
else
lightnum = R_FakeFlat(frontsector, &tempsec, &templight, &templight, false)
@ -1297,7 +1297,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
spryscale += rw_scalestep;
}
}
colfunc = wallcolfunc;
colfunc = colfuncs[BASEDRAWFUNC];
#undef CLAMPMAX
#undef CLAMPMIN
@ -1530,7 +1530,7 @@ static void R_RenderSegLoop (void)
else
dc_lightlist[i].rcolormap = xwalllights[pindex];
colfunc = R_DrawColumnShadowed_8;
colfunc = colfuncs[COLDRAWFUNC_SHADOWED];
}
}
@ -1736,6 +1736,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
memset(&segright, 0x00, sizeof(segright));
#endif
colfunc = colfuncs[BASEDRAWFUNC];
if (ds_p == drawsegs+maxdrawsegs)
{
size_t curpos = curdrawsegs - drawsegs;
@ -3186,7 +3188,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
else
#endif
R_RenderSegLoop();
colfunc = wallcolfunc;
colfunc = colfuncs[BASEDRAWFUNC];
if (portalline) // if curline is a portal, set portalrender for drawseg
ds_p->portalpass = portalrender+1;

View File

@ -512,7 +512,7 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
ds_x1 = x1;
ds_x2 = x2;
ds_transmap = transtables + ((tr_trans50-1)<<FF_TRANSSHIFT);
splatfunc();
(spanfuncs[SPANDRAWFUNC_SPLAT])();
}
// reset for next calls to edge rasterizer

View File

@ -653,11 +653,7 @@ void R_DrawMaskedColumn(column_t *column)
// quick fix... something more proper should be done!!!
if (ylookup[dc_yl])
colfunc();
else if (colfunc == R_DrawColumn_8
#ifdef USEASM
|| colfunc == R_DrawColumn_8_ASM || colfunc == R_DrawColumn_8_MMX
#endif
)
else if (colfunc == colfuncs[COLDRAWFUNC_BASE])
{
static INT32 first = 1;
if (first)
@ -724,11 +720,7 @@ void R_DrawFlippedMaskedColumn(column_t *column, INT32 texheight)
// Still drawn by R_DrawColumn.
if (ylookup[dc_yl])
colfunc();
else if (colfunc == R_DrawColumn_8
#ifdef USEASM
|| colfunc == R_DrawColumn_8_ASM || colfunc == R_DrawColumn_8_MMX
#endif
)
else if (colfunc == colfuncs[COLDRAWFUNC_BASE])
{
static INT32 first = 1;
if (first)
@ -776,12 +768,12 @@ static void R_DrawVisSprite(vissprite_t *vis)
if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) return; // ditto
}
colfunc = basecolfunc; // hack: this isn't resetting properly somewhere.
colfunc = colfuncs[BASEDRAWFUNC]; // hack: this isn't resetting properly somewhere.
dc_colormap = vis->colormap;
if (!(vis->cut & SC_PRECIP) && (vis->mobj->flags & (MF_ENEMY|MF_BOSS)) && (vis->mobj->flags2 & MF2_FRET) && !(vis->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash"
{
// translate certain pixels to white
colfunc = transcolfunc;
colfunc = colfuncs[COLDRAWFUNC_TRANS];
if (vis->mobj->type == MT_CYBRAKDEMON || vis->mobj->colorized)
dc_translation = R_GetTranslationColormap(TC_ALLWHITE, 0, GTC_CACHE);
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
@ -791,7 +783,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
}
else if (vis->mobj->color && vis->transmap) // Color mapping
{
colfunc = transtransfunc;
colfunc = colfuncs[COLDRAWFUNC_TRANSTRANS];
dc_transmap = vis->transmap;
if (!(vis->cut & SC_PRECIP) && vis->mobj->colorized)
dc_translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
@ -815,13 +807,13 @@ static void R_DrawVisSprite(vissprite_t *vis)
}
else if (vis->transmap)
{
colfunc = fuzzcolfunc;
colfunc = colfuncs[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;
colfunc = colfuncs[COLDRAWFUNC_TRANS];
// New colormap stuff for skins Tails 06-07-2002
if (!(vis->cut & SC_PRECIP) && vis->mobj->colorized)
@ -846,7 +838,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;
colfunc = colfuncs[COLDRAWFUNC_TRANS];
dc_translation = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_BLUE, GTC_CACHE);
}
@ -926,7 +918,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
spryscale += vis->scalestep;
}
colfunc = basecolfunc;
colfunc = colfuncs[BASEDRAWFUNC];
dc_hires = 0;
vis->x1 = x1;
@ -956,7 +948,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
if (vis->transmap)
{
colfunc = fuzzcolfunc;
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
dc_transmap = vis->transmap; //Fab : 29-04-98: translucency table
}
@ -992,7 +984,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
R_DrawMaskedColumn(column);
}
colfunc = basecolfunc;
colfunc = colfuncs[BASEDRAWFUNC];
}
//

View File

@ -41,20 +41,12 @@
// --------------------------------------------
// 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 (*colfunc)(void);
void (*colfuncs[COLDRAWFUNC_MAX])(void);
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 (*mmxspanfunc)(void); // span drawer in MMX assembly
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
void (*spanfunc)(void);
void (*spanfuncs[SPANDRAWFUNC_MAX])(void);
void (*spanfuncs_npo2[SPANDRAWFUNC_MAX])(void);
// ------------------
// global video state
@ -113,36 +105,66 @@ void SCR_SetMode(void)
//
if (true)//vid.bpp == 1) //Always run in 8bpp. todo: remove all 16bpp code?
{
spanfunc = basespanfunc = mmxspanfunc = R_DrawSpan_8;
splatfunc = R_DrawSplat_8;
transcolfunc = R_DrawTranslatedColumn_8;
transtransfunc = R_DrawTranslatedTranslucentColumn_8;
colfuncs[BASEDRAWFUNC] = R_DrawColumn_8;
spanfuncs[BASEDRAWFUNC] = R_DrawSpan_8;
colfunc = colfuncs[BASEDRAWFUNC];
spanfunc = spanfuncs[BASEDRAWFUNC];
colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn_8;
colfuncs[COLDRAWFUNC_TRANS] = R_DrawTranslatedColumn_8;
colfuncs[COLDRAWFUNC_SHADE] = R_DrawShadeColumn_8;
colfuncs[COLDRAWFUNC_SHADOWED] = R_DrawColumnShadowed_8;
colfuncs[COLDRAWFUNC_TRANSTRANS] = R_DrawTranslatedTranslucentColumn_8;
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8;
colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS] = R_Draw2sMultiPatchTranslucentColumn_8;
colfuncs[COLDRAWFUNC_FOG] = R_DrawFogColumn_8;
spanfuncs[SPANDRAWFUNC_TRANS] = R_DrawTranslucentSpan_8;
spanfuncs[SPANDRAWFUNC_SPLAT] = R_DrawSplat_8;
spanfuncs[SPANDRAWFUNC_TRANSSPLAT] = R_DrawTranslucentSplat_8;
spanfuncs[SPANDRAWFUNC_FOG] = R_DrawFogSpan_8;
#ifndef NOWATER
spanfuncs[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan_8;
#endif
#ifdef ESLOPE
spanfuncs[SPANDRAWFUNC_TILTED] = R_DrawTiltedSpan_8;
spanfuncs[SPANDRAWFUNC_TILTEDTRANS] = R_DrawTiltedTranslucentSpan_8;
spanfuncs[SPANDRAWFUNC_TILTEDSPLAT] = R_DrawTiltedSplat_8;
#endif
// Lactozilla: Non-powers-of-two
spanfuncs_npo2[BASEDRAWFUNC] = R_DrawSpan_NPO2_8;
spanfuncs_npo2[SPANDRAWFUNC_TRANS] = R_DrawTranslucentSpan_NPO2_8;
spanfuncs_npo2[SPANDRAWFUNC_SPLAT] = R_DrawSplat_NPO2_8;
spanfuncs_npo2[SPANDRAWFUNC_TRANSSPLAT] = R_DrawTranslucentSplat_NPO2_8;
spanfuncs_npo2[SPANDRAWFUNC_FOG] = NULL; // Not needed
#ifndef NOWATER
spanfuncs_npo2[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan_NPO2_8;
#endif
#ifdef ESLOPE
spanfuncs_npo2[SPANDRAWFUNC_TILTED] = R_DrawTiltedSpan_NPO2_8;
spanfuncs_npo2[SPANDRAWFUNC_TILTEDTRANS] = R_DrawTiltedTranslucentSpan_NPO2_8;
spanfuncs_npo2[SPANDRAWFUNC_TILTEDSPLAT] = R_DrawTiltedSplat_NPO2_8;
#endif
colfunc = basecolfunc = R_DrawColumn_8;
shadecolfunc = R_DrawShadeColumn_8;
fuzzcolfunc = R_DrawTranslucentColumn_8;
walldrawerfunc = R_DrawWallColumn_8;
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8;
twosmultipatchtransfunc = R_Draw2sMultiPatchTranslucentColumn_8;
#ifdef RUSEASM
if (R_ASM)
{
if (R_MMX)
{
colfunc = basecolfunc = R_DrawColumn_8_MMX;
//shadecolfunc = R_DrawShadeColumn_8_ASM;
//fuzzcolfunc = R_DrawTranslucentColumn_8_ASM;
walldrawerfunc = R_DrawWallColumn_8_MMX;
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8_MMX;
mmxspanfunc = R_DrawSpan_8_MMX;
colfuncs[BASEDRAWFUNC] = R_DrawColumn_8_MMX;
//colfuncs[COLDRAWFUNC_SHADE] = R_DrawShadeColumn_8_ASM;
//colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn_8_ASM;
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8_MMX;
spanfuncs[BASEDRAWFUNC] = R_DrawSpan_8_MMX;
}
else
{
colfunc = basecolfunc = R_DrawColumn_8_ASM;
//shadecolfunc = R_DrawShadeColumn_8_ASM;
//fuzzcolfunc = R_DrawTranslucentColumn_8_ASM;
walldrawerfunc = R_DrawWallColumn_8_ASM;
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8_ASM;
colfuncs[BASEDRAWFUNC] = R_DrawColumn_8_ASM;
//colfuncs[COLDRAWFUNC_SHADE] = R_DrawShadeColumn_8_ASM;
//colfuncs[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn_8_ASM;
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8_ASM;
}
}
#endif
@ -166,8 +188,6 @@ void SCR_SetMode(void)
CONS_Alert(CONS_WARNING, M_GetText("Resolution is not aspect-correct!\nUse a multiple of %dx%d\n"), BASEVIDWIDTH, BASEVIDHEIGHT);
*/
wallcolfunc = walldrawerfunc;
// set the apprpriate drawer for the sky (tall or INT16)
setmodeneeded = 0;
}

View File

@ -110,19 +110,48 @@ extern vmode_t specialmodes[NUMSPECIALMODES];
// color mode dependent drawer function pointers
// ---------------------------------------------
extern void (*wallcolfunc)(void);
#define BASEDRAWFUNC 0
enum
{
COLDRAWFUNC_BASE = BASEDRAWFUNC,
COLDRAWFUNC_FUZZY,
COLDRAWFUNC_TRANS,
COLDRAWFUNC_SHADE,
COLDRAWFUNC_SHADOWED,
COLDRAWFUNC_TRANSTRANS,
COLDRAWFUNC_TWOSMULTIPATCH,
COLDRAWFUNC_TWOSMULTIPATCHTRANS,
COLDRAWFUNC_FOG,
COLDRAWFUNC_MAX
};
extern void (*colfunc)(void);
extern void (*basecolfunc)(void);
extern void (*fuzzcolfunc)(void);
extern void (*transcolfunc)(void);
extern void (*shadecolfunc)(void);
extern void (*colfuncs[COLDRAWFUNC_MAX])(void);
enum
{
SPANDRAWFUNC_BASE = BASEDRAWFUNC,
SPANDRAWFUNC_TRANS,
SPANDRAWFUNC_SPLAT,
SPANDRAWFUNC_TRANSSPLAT,
SPANDRAWFUNC_FOG,
#ifndef NOWATER
SPANDRAWFUNC_WATER,
#endif
#ifdef ESLOPE
SPANDRAWFUNC_TILTED,
SPANDRAWFUNC_TILTEDTRANS,
SPANDRAWFUNC_TILTEDSPLAT,
#endif
SPANDRAWFUNC_MAX
};
extern void (*spanfunc)(void);
extern void (*basespanfunc)(void);
extern void (*mmxspanfunc)(void);
extern void (*splatfunc)(void);
extern void (*transtransfunc)(void);
extern void (*twosmultipatchfunc)(void);
extern void (*twosmultipatchtransfunc)(void);
extern void (*spanfuncs[SPANDRAWFUNC_MAX])(void);
extern void (*spanfuncs_npo2[SPANDRAWFUNC_MAX])(void);
// -----
// CPUID
@ -148,9 +177,6 @@ extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_fu
// wait for page flipping to end or not
extern consvar_t cv_vidwait;
// quick fix for tall/short skies, depending on bytesperpixel
extern void (*walldrawerfunc)(void);
// Change video mode, only at the start of a refresh.
void SCR_SetMode(void);
// Recalc screen size dependent stuff

View File

@ -438,6 +438,9 @@
<ClCompile Include="..\r_draw8.c">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\r_draw8_npo2.c">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\r_main.c" />
<ClCompile Include="..\r_plane.c" />
<ClCompile Include="..\r_patch.c" />

View File

@ -837,6 +837,9 @@
<ClCompile Include="..\r_draw8.c">
<Filter>R_Rend</Filter>
</ClCompile>
<ClCompile Include="..\r_draw8_npo2.c">
<Filter>R_Rend</Filter>
</ClCompile>
<ClCompile Include="..\r_main.c">
<Filter>R_Rend</Filter>
</ClCompile>

View File

@ -295,6 +295,9 @@
<ClCompile Include="..\r_draw8.c">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\r_draw8_npo2.c">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\r_main.c" />
<ClCompile Include="..\r_plane.c" />
<ClCompile Include="..\r_patch.c" />

View File

@ -369,6 +369,9 @@
<ClCompile Include="..\r_draw16.c">
<Filter>R_Rend</Filter>
</ClCompile>
<ClCompile Include="..\r_draw8_npo2.c">
<Filter>R_Rend</Filter>
</ClCompile>
<ClCompile Include="..\r_main.c">
<Filter>R_Rend</Filter>
</ClCompile>