Update r_plane.c
This commit is contained in:
parent
f51253a0a8
commit
be13f463f0
|
@ -135,6 +135,21 @@ INT32 ds_waterofs;
|
||||||
|
|
||||||
static INT32 wtofs=0;
|
static INT32 wtofs=0;
|
||||||
static boolean itswater;
|
static boolean itswater;
|
||||||
|
static fixed_t ripple_xfrac;
|
||||||
|
static fixed_t ripple_yfrac;
|
||||||
|
|
||||||
|
static void R_PlaneRipple(visplane_t *plane, INT32 y, fixed_t plheight)
|
||||||
|
{
|
||||||
|
fixed_t distance = FixedMul(plheight, yslope[y]);
|
||||||
|
const INT32 yay = (wtofs + (distance>>9) ) & 8191;
|
||||||
|
// ripples da water texture
|
||||||
|
angle_t angle = (plane->viewangle + plane->plangle)>>ANGLETOFINESHIFT;
|
||||||
|
ds_bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
|
||||||
|
|
||||||
|
angle = (angle + 2048) & 8191; // 90 degrees
|
||||||
|
ripple_xfrac = FixedMul(FINECOSINE(angle), (ds_bgofs<<FRACBITS));
|
||||||
|
ripple_yfrac = FixedMul(FINESINE(angle), (ds_bgofs<<FRACBITS));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
|
@ -181,14 +196,8 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
#ifndef NOWATER
|
#ifndef NOWATER
|
||||||
if (itswater)
|
if (itswater)
|
||||||
{
|
{
|
||||||
const INT32 yay = (wtofs + (distance>>9) ) & 8191;
|
// Needed for ds_bgofs
|
||||||
// ripples da water texture
|
R_PlaneRipple(currentplane, y, planeheight);
|
||||||
ds_bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
|
|
||||||
angle = (currentplane->viewangle + currentplane->plangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
|
|
||||||
|
|
||||||
angle = (angle + 2048) & 8191; // 90 degrees
|
|
||||||
ds_xfrac += FixedMul(FINECOSINE(angle), (ds_bgofs<<FRACBITS));
|
|
||||||
ds_yfrac += FixedMul(FINESINE(angle), (ds_bgofs<<FRACBITS));
|
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (currentplane->slope)
|
if (currentplane->slope)
|
||||||
|
@ -197,7 +206,12 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
ds_svp = &ds_sv[y];
|
ds_svp = &ds_sv[y];
|
||||||
ds_szp = &ds_sz[y];
|
ds_szp = &ds_sz[y];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
ds_xfrac += ripple_xfrac;
|
||||||
|
ds_yfrac += ripple_yfrac;
|
||||||
|
}
|
||||||
|
|
||||||
if (y+ds_bgofs>=viewheight)
|
if (y+ds_bgofs>=viewheight)
|
||||||
ds_bgofs = viewheight-y-1;
|
ds_bgofs = viewheight-y-1;
|
||||||
|
@ -842,7 +856,6 @@ static UINT8 *R_GetTextureFlat(levelflat_t *levelflat, boolean leveltexture, boo
|
||||||
return flat;
|
return flat;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lactokaiju
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
static void R_SlopeVectors(visplane_t *pl, INT32 i, float fudge)
|
static void R_SlopeVectors(visplane_t *pl, INT32 i, float fudge)
|
||||||
{
|
{
|
||||||
|
@ -924,7 +937,7 @@ d.z = (v1.x * v2.y) - (v1.y * v2.x)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// I'm essentially multiplying the vectors by FRACUNIT...
|
// Lactozilla: I'm essentially multiplying the vectors by FRACUNIT...
|
||||||
ds_su[i].x *= SFMULT;
|
ds_su[i].x *= SFMULT;
|
||||||
ds_su[i].y *= SFMULT;
|
ds_su[i].y *= SFMULT;
|
||||||
ds_su[i].z *= SFMULT;
|
ds_su[i].z *= SFMULT;
|
||||||
|
@ -1209,6 +1222,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
if (itswater)
|
if (itswater)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
fixed_t plheight = abs(P_GetZAt(pl->slope, pl->viewx, pl->viewy) - pl->viewz);
|
||||||
fixed_t rxoffs = xoffs;
|
fixed_t rxoffs = xoffs;
|
||||||
fixed_t ryoffs = yoffs;
|
fixed_t ryoffs = yoffs;
|
||||||
|
|
||||||
|
@ -1216,18 +1230,9 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
|
|
||||||
for (i = pl->high; i < pl->low; i++)
|
for (i = pl->high; i < pl->low; i++)
|
||||||
{
|
{
|
||||||
// Fuck it
|
R_PlaneRipple(pl, i, plheight);
|
||||||
fixed_t plheight = abs(P_GetZAt(pl->slope, pl->viewx, pl->viewy) - pl->viewz);
|
xoffs = rxoffs + ripple_xfrac;
|
||||||
fixed_t distance = FixedMul(plheight, yslope[i]);
|
yoffs = ryoffs + ripple_yfrac;
|
||||||
const INT32 yay = (wtofs + (distance>>9) ) & 8191;
|
|
||||||
// ripples da water texture
|
|
||||||
ds_bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
|
|
||||||
angle = (pl->viewangle + pl->plangle)>>ANGLETOFINESHIFT;
|
|
||||||
|
|
||||||
angle = (angle + 2048) & 8191; // 90 degrees
|
|
||||||
xoffs = rxoffs + FixedMul(FINECOSINE(angle), (ds_bgofs<<FRACBITS));
|
|
||||||
yoffs = ryoffs + FixedMul(FINESINE(angle), (ds_bgofs<<FRACBITS));
|
|
||||||
|
|
||||||
R_SlopeVectors(pl, i, fudgecanyon);
|
R_SlopeVectors(pl, i, fudgecanyon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue