mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 20:41:25 +00:00
Merge branch 'slope-fog-fix' into 'next'
Fix slope planes not being able to render fog (fixes #664) Closes #664 See merge request STJr/SRB2!1637
This commit is contained in:
commit
90489de517
7 changed files with 173 additions and 154 deletions
33
src/r_draw.c
33
src/r_draw.c
|
@ -886,6 +886,39 @@ void R_DrawViewBorder(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// R_CalcTiltedLighting
|
||||||
|
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
|
||||||
|
static INT32 tiltlighting[MAXVIDWIDTH];
|
||||||
|
|
||||||
|
static void R_CalcTiltedLighting(fixed_t start, fixed_t end)
|
||||||
|
{
|
||||||
|
// ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version
|
||||||
|
// of this function. Here's my own.
|
||||||
|
INT32 left = ds_x1, right = ds_x2;
|
||||||
|
fixed_t step = (end-start)/(ds_x2-ds_x1+1);
|
||||||
|
INT32 i;
|
||||||
|
|
||||||
|
// I wanna do some optimizing by checking for out-of-range segments on either side to fill in all at once,
|
||||||
|
// but I'm too bad at coding to not crash the game trying to do that. I guess this is fast enough for now...
|
||||||
|
|
||||||
|
for (i = left; i <= right; i++) {
|
||||||
|
tiltlighting[i] = (start += step) >> FRACBITS;
|
||||||
|
if (tiltlighting[i] < 0)
|
||||||
|
tiltlighting[i] = 0;
|
||||||
|
else if (tiltlighting[i] >= MAXLIGHTSCALE)
|
||||||
|
tiltlighting[i] = MAXLIGHTSCALE-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lighting is simple. It's just linear interpolation from start to end
|
||||||
|
#define CALC_SLOPE_LIGHT { \
|
||||||
|
float planelightfloat = PLANELIGHTFLOAT; \
|
||||||
|
float lightstart, lightend; \
|
||||||
|
lightend = (iz + ds_szp->x*width) * planelightfloat; \
|
||||||
|
lightstart = iz * planelightfloat; \
|
||||||
|
R_CalcTiltedLighting(FloatToFixed(lightstart), FloatToFixed(lightend)); \
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// INCLUDE 8bpp DRAWING CODE HERE
|
// INCLUDE 8bpp DRAWING CODE HERE
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
|
@ -194,13 +194,11 @@ void R_DrawTranslucentFloorSprite_8(void);
|
||||||
void R_DrawTiltedFloorSprite_8(void);
|
void R_DrawTiltedFloorSprite_8(void);
|
||||||
void R_DrawTiltedTranslucentFloorSprite_8(void);
|
void R_DrawTiltedTranslucentFloorSprite_8(void);
|
||||||
|
|
||||||
void R_CalcTiltedLighting(fixed_t start, fixed_t end);
|
|
||||||
extern INT32 tiltlighting[MAXVIDWIDTH];
|
|
||||||
|
|
||||||
void R_DrawTranslucentWaterSpan_8(void);
|
void R_DrawTranslucentWaterSpan_8(void);
|
||||||
void R_DrawTiltedTranslucentWaterSpan_8(void);
|
void R_DrawTiltedTranslucentWaterSpan_8(void);
|
||||||
|
|
||||||
void R_DrawFogSpan_8(void);
|
void R_DrawFogSpan_8(void);
|
||||||
|
void R_DrawTiltedFogSpan_8(void);
|
||||||
|
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
void R_DrawSpan_NPO2_8(void);
|
void R_DrawSpan_NPO2_8(void);
|
||||||
|
|
|
@ -656,29 +656,6 @@ void R_DrawSpan_8 (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// R_CalcTiltedLighting
|
|
||||||
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
|
|
||||||
INT32 tiltlighting[MAXVIDWIDTH];
|
|
||||||
void R_CalcTiltedLighting(fixed_t start, fixed_t end)
|
|
||||||
{
|
|
||||||
// ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version
|
|
||||||
// of this function. Here's my own.
|
|
||||||
INT32 left = ds_x1, right = ds_x2;
|
|
||||||
fixed_t step = (end-start)/(ds_x2-ds_x1+1);
|
|
||||||
INT32 i;
|
|
||||||
|
|
||||||
// I wanna do some optimizing by checking for out-of-range segments on either side to fill in all at once,
|
|
||||||
// but I'm too bad at coding to not crash the game trying to do that. I guess this is fast enough for now...
|
|
||||||
|
|
||||||
for (i = left; i <= right; i++) {
|
|
||||||
tiltlighting[i] = (start += step) >> FRACBITS;
|
|
||||||
if (tiltlighting[i] < 0)
|
|
||||||
tiltlighting[i] = 0;
|
|
||||||
else if (tiltlighting[i] >= MAXLIGHTSCALE)
|
|
||||||
tiltlighting[i] = MAXLIGHTSCALE-1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief The R_DrawTiltedSpan_8 function
|
/** \brief The R_DrawTiltedSpan_8 function
|
||||||
Draw slopes! Holy sheit!
|
Draw slopes! Holy sheit!
|
||||||
*/
|
*/
|
||||||
|
@ -701,17 +678,7 @@ void R_DrawTiltedSpan_8(void)
|
||||||
|
|
||||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||||
|
|
||||||
// Lighting is simple. It's just linear interpolation from start to end
|
CALC_SLOPE_LIGHT
|
||||||
{
|
|
||||||
float planelightfloat = PLANELIGHTFLOAT;
|
|
||||||
float lightstart, lightend;
|
|
||||||
|
|
||||||
lightend = (iz + ds_szp->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_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||||
|
@ -834,17 +801,7 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
||||||
|
|
||||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||||
|
|
||||||
// Lighting is simple. It's just linear interpolation from start to end
|
CALC_SLOPE_LIGHT
|
||||||
{
|
|
||||||
float planelightfloat = PLANELIGHTFLOAT;
|
|
||||||
float lightstart, lightend;
|
|
||||||
|
|
||||||
lightend = (iz + ds_szp->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_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||||
|
@ -967,17 +924,7 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||||
|
|
||||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||||
|
|
||||||
// Lighting is simple. It's just linear interpolation from start to end
|
CALC_SLOPE_LIGHT
|
||||||
{
|
|
||||||
float planelightfloat = PLANELIGHTFLOAT;
|
|
||||||
float lightstart, lightend;
|
|
||||||
|
|
||||||
lightend = (iz + ds_szp->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_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||||
|
@ -1099,17 +1046,7 @@ void R_DrawTiltedSplat_8(void)
|
||||||
|
|
||||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||||
|
|
||||||
// Lighting is simple. It's just linear interpolation from start to end
|
CALC_SLOPE_LIGHT
|
||||||
{
|
|
||||||
float planelightfloat = PLANELIGHTFLOAT;
|
|
||||||
float lightstart, lightend;
|
|
||||||
|
|
||||||
lightend = (iz + ds_szp->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_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||||
|
@ -2067,6 +2004,27 @@ void R_DrawFogSpan_8(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \brief The R_DrawTiltedFogSpan_8 function
|
||||||
|
Draws a tilted span with fogging.
|
||||||
|
*/
|
||||||
|
void R_DrawTiltedFogSpan_8(void)
|
||||||
|
{
|
||||||
|
int width = ds_x2 - ds_x1;
|
||||||
|
|
||||||
|
UINT8 *dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||||
|
|
||||||
|
double iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||||
|
|
||||||
|
CALC_SLOPE_LIGHT
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
UINT8 *colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
|
*dest = colormap[*dest];
|
||||||
|
dest++;
|
||||||
|
} while (--width >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief The R_DrawFogColumn_8 function
|
/** \brief The R_DrawFogColumn_8 function
|
||||||
Fog wall.
|
Fog wall.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -111,17 +111,7 @@ void R_DrawTiltedSpan_NPO2_8(void)
|
||||||
|
|
||||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||||
|
|
||||||
// Lighting is simple. It's just linear interpolation from start to end
|
CALC_SLOPE_LIGHT
|
||||||
{
|
|
||||||
float planelightfloat = PLANELIGHTFLOAT;
|
|
||||||
float lightstart, lightend;
|
|
||||||
|
|
||||||
lightend = (iz + ds_szp->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_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||||
|
@ -311,17 +301,7 @@ void R_DrawTiltedTranslucentSpan_NPO2_8(void)
|
||||||
|
|
||||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||||
|
|
||||||
// Lighting is simple. It's just linear interpolation from start to end
|
CALC_SLOPE_LIGHT
|
||||||
{
|
|
||||||
float planelightfloat = PLANELIGHTFLOAT;
|
|
||||||
float lightstart, lightend;
|
|
||||||
|
|
||||||
lightend = (iz + ds_szp->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_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||||
|
@ -509,17 +489,7 @@ void R_DrawTiltedSplat_NPO2_8(void)
|
||||||
|
|
||||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||||
|
|
||||||
// Lighting is simple. It's just linear interpolation from start to end
|
CALC_SLOPE_LIGHT
|
||||||
{
|
|
||||||
float planelightfloat = PLANELIGHTFLOAT;
|
|
||||||
float lightstart, lightend;
|
|
||||||
|
|
||||||
lightend = (iz + ds_szp->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_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||||
|
@ -1438,17 +1408,7 @@ void R_DrawTiltedTranslucentWaterSpan_NPO2_8(void)
|
||||||
|
|
||||||
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx);
|
||||||
|
|
||||||
// Lighting is simple. It's just linear interpolation from start to end
|
CALC_SLOPE_LIGHT
|
||||||
{
|
|
||||||
float planelightfloat = PLANELIGHTFLOAT;
|
|
||||||
float lightstart, lightend;
|
|
||||||
|
|
||||||
lightend = (iz + ds_szp->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_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||||
|
|
|
@ -262,6 +262,61 @@ static void R_MapTiltedPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
spanfunc();
|
spanfunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void R_MapFogPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
|
{
|
||||||
|
fixed_t distance;
|
||||||
|
size_t pindex;
|
||||||
|
|
||||||
|
#ifdef RANGECHECK
|
||||||
|
if (x2 < x1 || x1 < 0 || x2 >= viewwidth || y > viewheight)
|
||||||
|
I_Error("R_MapFogPlane: %d, %d at %d", x1, x2, y);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (x1 >= vid.width)
|
||||||
|
x1 = vid.width - 1;
|
||||||
|
|
||||||
|
if (planeheight != cachedheight[y])
|
||||||
|
distance = FixedMul(planeheight, yslope[y]);
|
||||||
|
else
|
||||||
|
distance = cacheddistance[y];
|
||||||
|
|
||||||
|
pindex = distance >> LIGHTZSHIFT;
|
||||||
|
if (pindex >= MAXLIGHTZ)
|
||||||
|
pindex = MAXLIGHTZ - 1;
|
||||||
|
|
||||||
|
ds_colormap = planezlight[pindex];
|
||||||
|
if (currentplane->extra_colormap)
|
||||||
|
ds_colormap = currentplane->extra_colormap->colormap + (ds_colormap - colormaps);
|
||||||
|
|
||||||
|
ds_y = y;
|
||||||
|
ds_x1 = x1;
|
||||||
|
ds_x2 = x2;
|
||||||
|
|
||||||
|
spanfunc();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_MapTiltedFogPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
|
{
|
||||||
|
#ifdef RANGECHECK
|
||||||
|
if (x2 < x1 || x1 < 0 || x2 >= viewwidth || y > viewheight)
|
||||||
|
I_Error("R_MapTiltedFogPlane: %d, %d at %d", x1, x2, y);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (x1 >= vid.width)
|
||||||
|
x1 = vid.width - 1;
|
||||||
|
|
||||||
|
if (currentplane->extra_colormap)
|
||||||
|
ds_colormap = currentplane->extra_colormap->colormap;
|
||||||
|
else
|
||||||
|
ds_colormap = colormaps;
|
||||||
|
|
||||||
|
ds_y = y;
|
||||||
|
ds_x1 = x1;
|
||||||
|
ds_x2 = x2;
|
||||||
|
|
||||||
|
spanfunc();
|
||||||
|
}
|
||||||
|
|
||||||
void R_ClearFFloorClips (void)
|
void R_ClearFFloorClips (void)
|
||||||
{
|
{
|
||||||
INT32 i, p;
|
INT32 i, p;
|
||||||
|
@ -791,11 +846,11 @@ static inline void R_AdjustSlopeCoordinatesNPO2(vector3_t *origin)
|
||||||
|
|
||||||
void R_DrawSinglePlane(visplane_t *pl)
|
void R_DrawSinglePlane(visplane_t *pl)
|
||||||
{
|
{
|
||||||
levelflat_t *levelflat;
|
|
||||||
INT32 light = 0;
|
INT32 light = 0;
|
||||||
INT32 x, stop;
|
INT32 x, stop;
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
INT32 type, spanfunctype = BASEDRAWFUNC;
|
boolean fog = false;
|
||||||
|
INT32 spanfunctype = BASEDRAWFUNC;
|
||||||
void (*mapfunc)(INT32, INT32, INT32) = R_MapPlane;
|
void (*mapfunc)(INT32, INT32, INT32) = R_MapPlane;
|
||||||
|
|
||||||
if (!(pl->minx <= pl->maxx))
|
if (!(pl->minx <= pl->maxx))
|
||||||
|
@ -873,6 +928,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
}
|
}
|
||||||
else if (pl->ffloor->fofflags & FOF_FOG)
|
else if (pl->ffloor->fofflags & FOF_FOG)
|
||||||
{
|
{
|
||||||
|
fog = true;
|
||||||
spanfunctype = SPANDRAWFUNC_FOG;
|
spanfunctype = SPANDRAWFUNC_FOG;
|
||||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||||
}
|
}
|
||||||
|
@ -880,28 +936,28 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
|
|
||||||
if (pl->ffloor->fofflags & FOF_RIPPLE)
|
if (pl->ffloor->fofflags & FOF_RIPPLE)
|
||||||
{
|
{
|
||||||
INT32 top, bottom;
|
|
||||||
|
|
||||||
planeripple.active = true;
|
planeripple.active = true;
|
||||||
|
|
||||||
if (spanfunctype == SPANDRAWFUNC_TRANS)
|
if (spanfunctype == SPANDRAWFUNC_TRANS)
|
||||||
{
|
{
|
||||||
spanfunctype = SPANDRAWFUNC_WATER;
|
|
||||||
|
|
||||||
// Copy the current scene, ugh
|
// Copy the current scene, ugh
|
||||||
top = pl->high-8;
|
INT32 top = pl->high-8;
|
||||||
bottom = pl->low+8;
|
INT32 bottom = pl->low+8;
|
||||||
|
|
||||||
if (top < 0)
|
if (top < 0)
|
||||||
top = 0;
|
top = 0;
|
||||||
if (bottom > vid.height)
|
if (bottom > vid.height)
|
||||||
bottom = vid.height;
|
bottom = vid.height;
|
||||||
|
|
||||||
|
spanfunctype = SPANDRAWFUNC_WATER;
|
||||||
|
|
||||||
// Only copy the part of the screen we need
|
// Only copy the part of the screen we need
|
||||||
VID_BlitLinearScreen((splitscreen && viewplayer == &players[secondarydisplayplayer]) ? screens[0] + (top+(vid.height>>1))*vid.width : screens[0]+((top)*vid.width), screens[1]+((top)*vid.width),
|
VID_BlitLinearScreen((splitscreen && viewplayer == &players[secondarydisplayplayer]) ? screens[0] + (top+(vid.height>>1))*vid.width : screens[0]+((top)*vid.width), screens[1]+((top)*vid.width),
|
||||||
vid.width, bottom-top,
|
vid.width, bottom-top,
|
||||||
vid.width, vid.width);
|
vid.width, vid.width);
|
||||||
}
|
}
|
||||||
|
else if (fog)
|
||||||
|
planeripple.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -909,11 +965,13 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
}
|
}
|
||||||
|
|
||||||
currentplane = pl;
|
currentplane = pl;
|
||||||
levelflat = &levelflats[pl->picnum];
|
|
||||||
|
if (!fog)
|
||||||
|
{
|
||||||
|
levelflat_t *levelflat = &levelflats[pl->picnum];
|
||||||
|
|
||||||
/* :james: */
|
/* :james: */
|
||||||
type = levelflat->type;
|
switch (levelflat->type)
|
||||||
switch (type)
|
|
||||||
{
|
{
|
||||||
case LEVELFLAT_NONE:
|
case LEVELFLAT_NONE:
|
||||||
return;
|
return;
|
||||||
|
@ -938,6 +996,9 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
memset(cachedheight, 0, sizeof (cachedheight));
|
memset(cachedheight, 0, sizeof (cachedheight));
|
||||||
viewangle = pl->viewangle+pl->plangle;
|
viewangle = pl->viewangle+pl->plangle;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mapfunc = R_MapFogPlane;
|
||||||
|
|
||||||
xoffs = pl->xoffs;
|
xoffs = pl->xoffs;
|
||||||
yoffs = pl->yoffs;
|
yoffs = pl->yoffs;
|
||||||
|
@ -949,6 +1010,10 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
light = 0;
|
light = 0;
|
||||||
|
|
||||||
if (pl->slope)
|
if (pl->slope)
|
||||||
|
{
|
||||||
|
if (fog)
|
||||||
|
mapfunc = R_MapTiltedFogPlane;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
mapfunc = R_MapTiltedPlane;
|
mapfunc = R_MapTiltedPlane;
|
||||||
|
|
||||||
|
@ -959,6 +1024,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
else
|
else
|
||||||
R_AdjustSlopeCoordinatesNPO2(&pl->slope->o);
|
R_AdjustSlopeCoordinatesNPO2(&pl->slope->o);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (planeripple.active)
|
if (planeripple.active)
|
||||||
{
|
{
|
||||||
|
@ -987,6 +1053,9 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
case SPANDRAWFUNC_SPLAT:
|
case SPANDRAWFUNC_SPLAT:
|
||||||
spanfunctype = SPANDRAWFUNC_TILTEDSPLAT;
|
spanfunctype = SPANDRAWFUNC_TILTEDSPLAT;
|
||||||
break;
|
break;
|
||||||
|
case SPANDRAWFUNC_FOG:
|
||||||
|
spanfunctype = SPANDRAWFUNC_TILTEDFOG;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
spanfunctype = SPANDRAWFUNC_TILTED;
|
spanfunctype = SPANDRAWFUNC_TILTED;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -144,6 +144,7 @@ void SCR_SetDrawFuncs(void)
|
||||||
spanfuncs[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan_8;
|
spanfuncs[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan_8;
|
||||||
spanfuncs[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedTranslucentWaterSpan_8;
|
spanfuncs[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedTranslucentWaterSpan_8;
|
||||||
spanfuncs[SPANDRAWFUNC_FOG] = R_DrawFogSpan_8;
|
spanfuncs[SPANDRAWFUNC_FOG] = R_DrawFogSpan_8;
|
||||||
|
spanfuncs[SPANDRAWFUNC_TILTEDFOG] = R_DrawTiltedFogSpan_8;
|
||||||
|
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
spanfuncs_npo2[BASEDRAWFUNC] = R_DrawSpan_NPO2_8;
|
spanfuncs_npo2[BASEDRAWFUNC] = R_DrawSpan_NPO2_8;
|
||||||
|
@ -159,7 +160,6 @@ void SCR_SetDrawFuncs(void)
|
||||||
spanfuncs_npo2[SPANDRAWFUNC_TILTEDTRANSSPRITE] = R_DrawTiltedTranslucentFloorSprite_NPO2_8;
|
spanfuncs_npo2[SPANDRAWFUNC_TILTEDTRANSSPRITE] = R_DrawTiltedTranslucentFloorSprite_NPO2_8;
|
||||||
spanfuncs_npo2[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan_NPO2_8;
|
spanfuncs_npo2[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan_NPO2_8;
|
||||||
spanfuncs_npo2[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedTranslucentWaterSpan_NPO2_8;
|
spanfuncs_npo2[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedTranslucentWaterSpan_NPO2_8;
|
||||||
spanfuncs_npo2[SPANDRAWFUNC_FOG] = NULL; // Not needed
|
|
||||||
|
|
||||||
#ifdef RUSEASM
|
#ifdef RUSEASM
|
||||||
if (R_ASM)
|
if (R_ASM)
|
||||||
|
|
|
@ -156,6 +156,7 @@ enum
|
||||||
SPANDRAWFUNC_TILTEDWATER,
|
SPANDRAWFUNC_TILTEDWATER,
|
||||||
|
|
||||||
SPANDRAWFUNC_FOG,
|
SPANDRAWFUNC_FOG,
|
||||||
|
SPANDRAWFUNC_TILTEDFOG,
|
||||||
|
|
||||||
SPANDRAWFUNC_MAX
|
SPANDRAWFUNC_MAX
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue