mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-07 02:36:42 +00:00
Fix slope plane rotation and alignment.
A flattened-commit port of the SRB2 repository's software-slope-plane-uv-fix-attempt/merge request 1464 due to the vast, vast refactorings that would intefere with brightmaps and Encore if done one commit at a time.
This commit is contained in:
parent
fab0897800
commit
37e16db41e
7 changed files with 391 additions and 357 deletions
|
|
@ -387,10 +387,10 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||||
float fflatwidth = 64.0f, fflatheight = 64.0f;
|
float fflatwidth = 64.0f, fflatheight = 64.0f;
|
||||||
INT32 flatflag = 63;
|
INT32 flatflag = 63;
|
||||||
boolean texflat = false;
|
boolean texflat = false;
|
||||||
float scrollx = 0.0f, scrolly = 0.0f;
|
float scrollx = 0.0f, scrolly = 0.0f, anglef = 0.0f;
|
||||||
angle_t angle = 0;
|
angle_t angle = 0;
|
||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
fixed_t tempxsow, tempytow;
|
float tempxsow, tempytow;
|
||||||
pslope_t *slope = NULL;
|
pslope_t *slope = NULL;
|
||||||
|
|
||||||
static FOutVector *planeVerts = NULL;
|
static FOutVector *planeVerts = NULL;
|
||||||
|
|
@ -527,21 +527,13 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||||
|
|
||||||
if (angle) // Only needs to be done if there's an altered angle
|
if (angle) // Only needs to be done if there's an altered angle
|
||||||
{
|
{
|
||||||
|
tempxsow = flatxref;
|
||||||
|
tempytow = flatyref;
|
||||||
|
|
||||||
angle = (InvAngle(angle))>>ANGLETOFINESHIFT;
|
anglef = ANG2RAD(InvAngle(angle));
|
||||||
|
|
||||||
// This needs to be done so that it scrolls in a different direction after rotation like software
|
flatxref = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));
|
||||||
/*tempxsow = FLOAT_TO_FIXED(scrollx);
|
flatyref = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));
|
||||||
tempytow = FLOAT_TO_FIXED(scrolly);
|
|
||||||
scrollx = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
|
|
||||||
scrolly = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));*/
|
|
||||||
|
|
||||||
// This needs to be done so everything aligns after rotation
|
|
||||||
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
|
|
||||||
tempxsow = FLOAT_TO_FIXED(flatxref);
|
|
||||||
tempytow = FLOAT_TO_FIXED(flatyref);
|
|
||||||
flatxref = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
|
|
||||||
flatyref = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SETUP3DVERT(vert, vx, vy) {\
|
#define SETUP3DVERT(vert, vx, vy) {\
|
||||||
|
|
@ -560,10 +552,10 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||||
/* Need to rotate before translate */\
|
/* Need to rotate before translate */\
|
||||||
if (angle) /* Only needs to be done if there's an altered angle */\
|
if (angle) /* Only needs to be done if there's an altered angle */\
|
||||||
{\
|
{\
|
||||||
tempxsow = FLOAT_TO_FIXED(vert->s);\
|
tempxsow = vert->s;\
|
||||||
tempytow = FLOAT_TO_FIXED(vert->t);\
|
tempytow = vert->t;\
|
||||||
vert->s = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));\
|
vert->s = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));\
|
||||||
vert->t = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));\
|
vert->t = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
vert->x = (vx);\
|
vert->x = (vx);\
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void);
|
||||||
void R_DrawFogColumn_8(void);
|
void R_DrawFogColumn_8(void);
|
||||||
void R_DrawColumnShadowed_8(void);
|
void R_DrawColumnShadowed_8(void);
|
||||||
|
|
||||||
#define PLANELIGHTFLOAT (BASEVIDWIDTH * BASEVIDWIDTH / vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f * FIXED_TO_FLOAT(fovtan[viewssnum]))
|
#define PLANELIGHTFLOAT (BASEVIDWIDTH * BASEVIDWIDTH / vid.width / zeroheight / 21.0f * FIXED_TO_FLOAT(fovtan[viewssnum]))
|
||||||
|
|
||||||
void R_DrawSpan_8(void);
|
void R_DrawSpan_8(void);
|
||||||
void R_DrawTranslucentSpan_8(void);
|
void R_DrawTranslucentSpan_8(void);
|
||||||
|
|
|
||||||
|
|
@ -924,8 +924,8 @@ void R_DrawTiltedSpan_8(void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double z = 1.f/iz;
|
double z = 1.f/iz;
|
||||||
u = (INT64)(uz*z) + viewx;
|
u = (INT64)(uz*z);
|
||||||
v = (INT64)(vz*z) + viewy;
|
v = (INT64)(vz*z);
|
||||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||||
if (brightmap != NULL && brightmap[bit] == BRIGHTPIXEL)
|
if (brightmap != NULL && brightmap[bit] == BRIGHTPIXEL)
|
||||||
{
|
{
|
||||||
|
|
@ -963,8 +963,8 @@ void R_DrawTiltedSpan_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
|
@ -1016,8 +1016,8 @@ void R_DrawTiltedSpan_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
|
|
@ -1093,8 +1093,8 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double z = 1.f/iz;
|
double z = 1.f/iz;
|
||||||
u = (INT64)(uz*z) + viewx;
|
u = (INT64)(uz*z);
|
||||||
v = (INT64)(vz*z) + viewy;
|
v = (INT64)(vz*z);
|
||||||
|
|
||||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||||
if (brightmap != NULL && brightmap[bit] == BRIGHTPIXEL)
|
if (brightmap != NULL && brightmap[bit] == BRIGHTPIXEL)
|
||||||
|
|
@ -1133,8 +1133,8 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
|
@ -1186,8 +1186,8 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
|
|
@ -1264,8 +1264,8 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double z = 1.f/iz;
|
double z = 1.f/iz;
|
||||||
u = (INT64)(uz*z) + viewx;
|
u = (INT64)(uz*z);
|
||||||
v = (INT64)(vz*z) + viewy;
|
v = (INT64)(vz*z);
|
||||||
|
|
||||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||||
if (brightmap != NULL && brightmap[bit] == BRIGHTPIXEL)
|
if (brightmap != NULL && brightmap[bit] == BRIGHTPIXEL)
|
||||||
|
|
@ -1304,8 +1304,8 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
|
@ -1357,8 +1357,8 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
|
|
@ -1433,8 +1433,8 @@ void R_DrawTiltedSplat_8(void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double z = 1.f/iz;
|
double z = 1.f/iz;
|
||||||
u = (INT64)(uz*z) + viewx;
|
u = (INT64)(uz*z);
|
||||||
v = (INT64)(vz*z) + viewy;
|
v = (INT64)(vz*z);
|
||||||
|
|
||||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||||
val = source[bit];
|
val = source[bit];
|
||||||
|
|
@ -1478,8 +1478,8 @@ void R_DrawTiltedSplat_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
|
@ -1539,8 +1539,8 @@ void R_DrawTiltedSplat_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
|
|
@ -1983,8 +1983,8 @@ void R_DrawTiltedFloorSprite_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
|
@ -2043,8 +2043,8 @@ void R_DrawTiltedFloorSprite_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
|
|
@ -2127,8 +2127,8 @@ void R_DrawTiltedTranslucentFloorSprite_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
|
@ -2187,8 +2187,8 @@ void R_DrawTiltedTranslucentFloorSprite_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -133,15 +133,15 @@ void R_DrawTiltedSpan_NPO2_8(void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double z = 1.f/iz;
|
double z = 1.f/iz;
|
||||||
u = (INT64)(uz*z) + viewx;
|
u = (INT64)(uz*z);
|
||||||
v = (INT64)(vz*z) + viewy;
|
v = (INT64)(vz*z);
|
||||||
|
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
|
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -181,16 +181,16 @@ void R_DrawTiltedSpan_NPO2_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -220,8 +220,8 @@ void R_DrawTiltedSpan_NPO2_8(void)
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -248,16 +248,16 @@ void R_DrawTiltedSpan_NPO2_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -326,14 +326,14 @@ void R_DrawTiltedTranslucentSpan_NPO2_8(void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double z = 1.f/iz;
|
double z = 1.f/iz;
|
||||||
u = (INT64)(uz*z) + viewx;
|
u = (INT64)(uz*z);
|
||||||
v = (INT64)(vz*z) + viewy;
|
v = (INT64)(vz*z);
|
||||||
|
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -373,16 +373,16 @@ void R_DrawTiltedTranslucentSpan_NPO2_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -412,8 +412,8 @@ void R_DrawTiltedTranslucentSpan_NPO2_8(void)
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -440,16 +440,16 @@ void R_DrawTiltedTranslucentSpan_NPO2_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -517,15 +517,15 @@ void R_DrawTiltedSplat_NPO2_8(void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double z = 1.f/iz;
|
double z = 1.f/iz;
|
||||||
u = (INT64)(uz*z) + viewx;
|
u = (INT64)(uz*z);
|
||||||
v = (INT64)(vz*z) + viewy;
|
v = (INT64)(vz*z);
|
||||||
|
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
|
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -569,16 +569,16 @@ void R_DrawTiltedSplat_NPO2_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -610,8 +610,8 @@ void R_DrawTiltedSplat_NPO2_8(void)
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -640,8 +640,8 @@ void R_DrawTiltedSplat_NPO2_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
|
|
@ -649,8 +649,8 @@ void R_DrawTiltedSplat_NPO2_8(void)
|
||||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -1002,14 +1002,14 @@ void R_DrawTiltedFloorSprite_NPO2_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -1040,8 +1040,8 @@ void R_DrawTiltedFloorSprite_NPO2_8(void)
|
||||||
v = (INT64)(startv);
|
v = (INT64)(startv);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -1070,14 +1070,14 @@ void R_DrawTiltedFloorSprite_NPO2_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -1152,14 +1152,14 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -1190,8 +1190,8 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void)
|
||||||
v = (INT64)(startv);
|
v = (INT64)(startv);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -1220,14 +1220,14 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -1429,14 +1429,14 @@ void R_DrawTiltedTranslucentWaterSpan_NPO2_8(void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
double z = 1.f/iz;
|
double z = 1.f/iz;
|
||||||
u = (INT64)(uz*z) + viewx;
|
u = (INT64)(uz*z);
|
||||||
v = (INT64)(vz*z) + viewy;
|
v = (INT64)(vz*z);
|
||||||
|
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -1476,16 +1476,16 @@ void R_DrawTiltedTranslucentWaterSpan_NPO2_8(void)
|
||||||
endv = vz*endz;
|
endv = vz*endz;
|
||||||
stepu = (INT64)((endu - startu) * INVSPAN);
|
stepu = (INT64)((endu - startu) * INVSPAN);
|
||||||
stepv = (INT64)((endv - startv) * INVSPAN);
|
stepv = (INT64)((endv - startv) * INVSPAN);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (i = SPANSIZE-1; i >= 0; i--)
|
for (i = SPANSIZE-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -1515,8 +1515,8 @@ void R_DrawTiltedTranslucentWaterSpan_NPO2_8(void)
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
@ -1543,16 +1543,16 @@ void R_DrawTiltedTranslucentWaterSpan_NPO2_8(void)
|
||||||
left = 1.f/left;
|
left = 1.f/left;
|
||||||
stepu = (INT64)((endu - startu) * left);
|
stepu = (INT64)((endu - startu) * left);
|
||||||
stepv = (INT64)((endv - startv) * left);
|
stepv = (INT64)((endv - startv) * left);
|
||||||
u = (INT64)(startu) + viewx;
|
u = (INT64)(startu);
|
||||||
v = (INT64)(startv) + viewy;
|
v = (INT64)(startv);
|
||||||
|
|
||||||
for (; width != 0; width--)
|
for (; width != 0; width--)
|
||||||
{
|
{
|
||||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||||
// Lactozilla: Non-powers-of-two
|
// Lactozilla: Non-powers-of-two
|
||||||
{
|
{
|
||||||
fixed_t x = (((fixed_t)u-viewx) >> FRACBITS);
|
fixed_t x = (((fixed_t)u) >> FRACBITS);
|
||||||
fixed_t y = (((fixed_t)v-viewy) >> FRACBITS);
|
fixed_t y = (((fixed_t)v) >> FRACBITS);
|
||||||
|
|
||||||
// Carefully align all of my Friends.
|
// Carefully align all of my Friends.
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
|
|
||||||
437
src/r_plane.c
437
src/r_plane.c
|
|
@ -31,13 +31,6 @@
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "p_tick.h"
|
#include "p_tick.h"
|
||||||
|
|
||||||
#ifdef TIMING
|
|
||||||
#include "p5prof.h"
|
|
||||||
INT64 mycount;
|
|
||||||
INT64 mytotal = 0;
|
|
||||||
UINT32 nombre = 100000;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// opening
|
// opening
|
||||||
//
|
//
|
||||||
|
|
@ -104,6 +97,7 @@ fixed_t cachedxstep[MAXVIDHEIGHT];
|
||||||
fixed_t cachedystep[MAXVIDHEIGHT];
|
fixed_t cachedystep[MAXVIDHEIGHT];
|
||||||
|
|
||||||
static fixed_t xoffs, yoffs;
|
static fixed_t xoffs, yoffs;
|
||||||
|
static floatv3_t ds_slope_origin, ds_slope_u, ds_slope_v;
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_InitPlanes
|
// R_InitPlanes
|
||||||
|
|
@ -127,21 +121,20 @@ struct
|
||||||
boolean active;
|
boolean active;
|
||||||
} planeripple;
|
} planeripple;
|
||||||
|
|
||||||
static void R_CalculatePlaneRipple(visplane_t *plane, INT32 y, fixed_t plheight, boolean calcfrac)
|
|
||||||
{
|
|
||||||
fixed_t distance = FixedMul(plheight, yslope[y]);
|
|
||||||
const INT32 yay = (planeripple.offset + (distance>>9)) & 8191;
|
|
||||||
|
|
||||||
// ripples da water texture
|
// ripples da water texture
|
||||||
ds_bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
|
static fixed_t R_CalculateRippleOffset(INT32 y)
|
||||||
|
|
||||||
if (calcfrac)
|
|
||||||
{
|
{
|
||||||
angle_t angle = (plane->viewangle + plane->plangle)>>ANGLETOFINESHIFT;
|
fixed_t distance = FixedMul(planeheight, yslope[y]);
|
||||||
angle = (angle + 2048) & 8191; // 90 degrees
|
const INT32 yay = (planeripple.offset + (distance>>9)) & 8191;
|
||||||
planeripple.xfrac = FixedMul(FINECOSINE(angle), (ds_bgofs<<FRACBITS));
|
return FixedDiv(FINESINE(yay), (1<<12) + (distance>>11));
|
||||||
planeripple.yfrac = FixedMul(FINESINE(angle), (ds_bgofs<<FRACBITS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void R_CalculatePlaneRipple(angle_t angle)
|
||||||
|
{
|
||||||
|
angle >>= ANGLETOFINESHIFT;
|
||||||
|
angle = (angle + 2048) & 8191; // 90 degrees
|
||||||
|
planeripple.xfrac = FixedMul(FINECOSINE(angle), ds_bgofs);
|
||||||
|
planeripple.yfrac = FixedMul(FINESINE(angle), ds_bgofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_UpdatePlaneRipple(void)
|
static void R_UpdatePlaneRipple(void)
|
||||||
|
|
@ -159,7 +152,7 @@ static void R_UpdatePlaneRipple(void)
|
||||||
// baseyscale
|
// baseyscale
|
||||||
// centerx
|
// centerx
|
||||||
|
|
||||||
void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
static void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
{
|
{
|
||||||
angle_t angle, planecos, planesin;
|
angle_t angle, planecos, planesin;
|
||||||
fixed_t distance = 0, span;
|
fixed_t distance = 0, span;
|
||||||
|
|
@ -173,8 +166,6 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
if (x1 >= vid.width)
|
if (x1 >= vid.width)
|
||||||
x1 = vid.width - 1;
|
x1 = vid.width - 1;
|
||||||
|
|
||||||
if (!currentplane->slope)
|
|
||||||
{
|
|
||||||
angle = (currentplane->viewangle + currentplane->plangle)>>ANGLETOFINESHIFT;
|
angle = (currentplane->viewangle + currentplane->plangle)>>ANGLETOFINESHIFT;
|
||||||
planecos = FINECOSINE(angle);
|
planecos = FINECOSINE(angle);
|
||||||
planesin = FINESINE(angle);
|
planesin = FINESINE(angle);
|
||||||
|
|
@ -208,25 +199,61 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
|
|
||||||
ds_xfrac = xoffs + FixedMul(planecos, distance) + (x1 - centerx) * ds_xstep;
|
ds_xfrac = xoffs + FixedMul(planecos, distance) + (x1 - centerx) * ds_xstep;
|
||||||
ds_yfrac = yoffs - FixedMul(planesin, distance) + (x1 - centerx) * ds_ystep;
|
ds_yfrac = yoffs - FixedMul(planesin, distance) + (x1 - centerx) * ds_ystep;
|
||||||
}
|
|
||||||
|
|
||||||
// Water ripple effect
|
// Water ripple effect
|
||||||
if (planeripple.active)
|
if (planeripple.active)
|
||||||
{
|
{
|
||||||
// Needed for ds_bgofs
|
ds_bgofs = R_CalculateRippleOffset(y);
|
||||||
R_CalculatePlaneRipple(currentplane, y, planeheight, (!currentplane->slope));
|
|
||||||
|
|
||||||
if (currentplane->slope)
|
R_CalculatePlaneRipple(currentplane->viewangle + currentplane->plangle);
|
||||||
|
|
||||||
|
ds_xfrac += planeripple.xfrac;
|
||||||
|
ds_yfrac += planeripple.yfrac;
|
||||||
|
ds_bgofs >>= FRACBITS;
|
||||||
|
}
|
||||||
|
|
||||||
|
pindex = distance >> LIGHTZSHIFT;
|
||||||
|
if (pindex >= MAXLIGHTZ)
|
||||||
|
pindex = MAXLIGHTZ - 1;
|
||||||
|
ds_colormap = planezlight[pindex];
|
||||||
|
|
||||||
|
if (currentplane->extra_colormap)
|
||||||
|
ds_colormap = currentplane->extra_colormap->colormap;
|
||||||
|
|
||||||
|
ds_fullbright = colormaps;
|
||||||
|
if (encoremap && !currentplane->noencore)
|
||||||
{
|
{
|
||||||
|
ds_colormap += COLORMAP_REMAPOFFSET;
|
||||||
|
ds_fullbright += COLORMAP_REMAPOFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
ds_y = y;
|
||||||
|
ds_x1 = x1;
|
||||||
|
ds_x2 = x2;
|
||||||
|
|
||||||
|
spanfunc();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_MapTiltedPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
|
{
|
||||||
|
#ifdef RANGECHECK
|
||||||
|
if (x2 < x1 || x1 < 0 || x2 >= viewwidth || y > viewheight)
|
||||||
|
I_Error("R_MapTiltedPlane: %d, %d at %d", x1, x2, y);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (x1 >= vid.width)
|
||||||
|
x1 = vid.width - 1;
|
||||||
|
|
||||||
|
// Water ripple effect
|
||||||
|
if (planeripple.active)
|
||||||
|
{
|
||||||
|
ds_bgofs = R_CalculateRippleOffset(y);
|
||||||
|
|
||||||
ds_sup = &ds_su[y];
|
ds_sup = &ds_su[y];
|
||||||
ds_svp = &ds_sv[y];
|
ds_svp = &ds_sv[y];
|
||||||
ds_szp = &ds_sz[y];
|
ds_szp = &ds_sz[y];
|
||||||
}
|
|
||||||
else
|
ds_bgofs >>= FRACBITS;
|
||||||
{
|
|
||||||
ds_xfrac += planeripple.xfrac;
|
|
||||||
ds_yfrac += planeripple.yfrac;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((y + ds_bgofs) >= viewheight)
|
if ((y + ds_bgofs) >= viewheight)
|
||||||
ds_bgofs = viewheight-y-1;
|
ds_bgofs = viewheight-y-1;
|
||||||
|
|
@ -234,46 +261,23 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
||||||
ds_bgofs = -y;
|
ds_bgofs = -y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentplane->slope)
|
if (currentplane->extra_colormap)
|
||||||
{
|
ds_colormap = currentplane->extra_colormap->colormap;
|
||||||
ds_colormap = colormaps;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
ds_colormap = colormaps;
|
||||||
pindex = distance >> LIGHTZSHIFT;
|
|
||||||
if (pindex >= MAXLIGHTZ)
|
|
||||||
pindex = MAXLIGHTZ - 1;
|
|
||||||
ds_colormap = planezlight[pindex];
|
|
||||||
}
|
|
||||||
|
|
||||||
ds_fullbright = colormaps;
|
ds_fullbright = colormaps;
|
||||||
|
|
||||||
if (encoremap && !currentplane->noencore)
|
if (encoremap && !currentplane->noencore)
|
||||||
{
|
{
|
||||||
ds_colormap += COLORMAP_REMAPOFFSET;
|
ds_colormap += COLORMAP_REMAPOFFSET;
|
||||||
ds_fullbright += COLORMAP_REMAPOFFSET;
|
ds_fullbright += COLORMAP_REMAPOFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentplane->extra_colormap)
|
|
||||||
ds_colormap = currentplane->extra_colormap->colormap + (ds_colormap - colormaps);
|
|
||||||
|
|
||||||
ds_y = y;
|
ds_y = y;
|
||||||
ds_x1 = x1;
|
ds_x1 = x1;
|
||||||
ds_x2 = x2;
|
ds_x2 = x2;
|
||||||
|
|
||||||
// profile drawer
|
|
||||||
#ifdef TIMING
|
|
||||||
ProfZeroTimer();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
spanfunc();
|
spanfunc();
|
||||||
|
|
||||||
#ifdef TIMING
|
|
||||||
RDMSR(0x10, &mycount);
|
|
||||||
mytotal += mycount; // 64bit add
|
|
||||||
if (!(nombre--))
|
|
||||||
I_Error("spanfunc() CPU Spy reports: 0x%d %d\n", *((INT32 *)&mytotal+1), (INT32)mytotal);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_ClearFFloorClips (void)
|
void R_ClearFFloorClips (void)
|
||||||
|
|
@ -374,11 +378,11 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
||||||
if (plangle != 0)
|
if (plangle != 0)
|
||||||
{
|
{
|
||||||
// Add the view offset, rotated by the plane angle.
|
// Add the view offset, rotated by the plane angle.
|
||||||
fixed_t cosinecomponent = FINECOSINE(plangle>>ANGLETOFINESHIFT);
|
float ang = ANG2RAD(plangle);
|
||||||
fixed_t sinecomponent = FINESINE(plangle>>ANGLETOFINESHIFT);
|
float x = FixedToFloat(xoff);
|
||||||
fixed_t oldxoff = xoff;
|
float y = FixedToFloat(yoff);
|
||||||
xoff = FixedMul(xoff,cosinecomponent)+FixedMul(yoff,sinecomponent);
|
xoff = FloatToFixed(x * cos(ang) + y * sin(ang));
|
||||||
yoff = -FixedMul(oldxoff,sinecomponent)+FixedMul(yoff,cosinecomponent);
|
yoff = FloatToFixed(-x * sin(ang) + y * cos(ang));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -591,7 +595,7 @@ void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop)
|
||||||
//
|
//
|
||||||
// R_MakeSpans
|
// R_MakeSpans
|
||||||
//
|
//
|
||||||
void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2)
|
static void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2)
|
||||||
{
|
{
|
||||||
// Alam: from r_splats's R_RasterizeFloorSplat
|
// Alam: from r_splats's R_RasterizeFloorSplat
|
||||||
if (t1 >= vid.height) t1 = vid.height-1;
|
if (t1 >= vid.height) t1 = vid.height-1;
|
||||||
|
|
@ -617,6 +621,32 @@ void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2)
|
||||||
spanstart[b2--] = x;
|
spanstart[b2--] = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void R_MakeTiltedSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2)
|
||||||
|
{
|
||||||
|
// Alam: from r_splats's R_RasterizeFloorSplat
|
||||||
|
if (t1 >= vid.height) t1 = vid.height-1;
|
||||||
|
if (b1 >= vid.height) b1 = vid.height-1;
|
||||||
|
if (t2 >= vid.height) t2 = vid.height-1;
|
||||||
|
if (b2 >= vid.height) b2 = vid.height-1;
|
||||||
|
if (x-1 >= vid.width) x = vid.width;
|
||||||
|
|
||||||
|
while (t1 < t2 && t1 <= b1)
|
||||||
|
{
|
||||||
|
R_MapTiltedPlane(t1, spanstart[t1], x - 1);
|
||||||
|
t1++;
|
||||||
|
}
|
||||||
|
while (b1 > b2 && b1 >= t1)
|
||||||
|
{
|
||||||
|
R_MapTiltedPlane(b1, spanstart[b1], x - 1);
|
||||||
|
b1--;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (t2 < t1 && t2 <= b2)
|
||||||
|
spanstart[t2++] = x;
|
||||||
|
while (b2 > b1 && b2 >= t2)
|
||||||
|
spanstart[b2--] = x;
|
||||||
|
}
|
||||||
|
|
||||||
void R_DrawPlanes(void)
|
void R_DrawPlanes(void)
|
||||||
{
|
{
|
||||||
visplane_t *pl;
|
visplane_t *pl;
|
||||||
|
|
@ -686,69 +716,109 @@ static void R_DrawSkyPlane(visplane_t *pl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Potentially override other stuff for now cus we're mean. :< But draw a slope plane!
|
// Returns the height of the sloped plane at (x, y) as a 32.16 fixed_t
|
||||||
// I copied ZDoom's code and adapted it to SRB2... -Red
|
static INT64 R_GetSlopeZAt(const pslope_t *slope, fixed_t x, fixed_t y)
|
||||||
void R_CalculateSlopeVectors(pslope_t *slope, fixed_t planeviewx, fixed_t planeviewy, fixed_t planeviewz, fixed_t planexscale, fixed_t planeyscale, fixed_t planexoffset, fixed_t planeyoffset, angle_t planeviewangle, angle_t planeangle, float fudge)
|
|
||||||
{
|
{
|
||||||
floatv3_t p, m, n;
|
INT64 x64 = ((INT64)x - (INT64)slope->o.x);
|
||||||
float ang;
|
INT64 y64 = ((INT64)y - (INT64)slope->o.y);
|
||||||
float vx, vy, vz;
|
|
||||||
float xscale = FIXED_TO_FLOAT(planexscale);
|
|
||||||
float yscale = FIXED_TO_FLOAT(planeyscale);
|
|
||||||
// compiler complains when P_GetSlopeZAt is used in FLOAT_TO_FIXED directly
|
|
||||||
// use this as a temp var to store P_GetSlopeZAt's return value each time
|
|
||||||
fixed_t temp;
|
|
||||||
|
|
||||||
vx = FIXED_TO_FLOAT(planeviewx+planexoffset);
|
x64 = (x64 * (INT64)slope->d.x) / FRACUNIT;
|
||||||
vy = FIXED_TO_FLOAT(planeviewy-planeyoffset);
|
y64 = (y64 * (INT64)slope->d.y) / FRACUNIT;
|
||||||
vz = FIXED_TO_FLOAT(planeviewz);
|
|
||||||
|
|
||||||
temp = P_GetSlopeZAt(slope, planeviewx, planeviewy);
|
return (INT64)slope->o.z + ((x64 + y64) * (INT64)slope->zdelta) / FRACUNIT;
|
||||||
zeroheight = FIXED_TO_FLOAT(temp);
|
}
|
||||||
|
|
||||||
|
// Sets the texture origin vector of the sloped plane.
|
||||||
|
static void R_SetSlopePlaneOrigin(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, fixed_t xoff, fixed_t yoff, fixed_t angle)
|
||||||
|
{
|
||||||
|
floatv3_t *p = &ds_slope_origin;
|
||||||
|
|
||||||
|
INT64 vx = (INT64)xpos + (INT64)xoff;
|
||||||
|
INT64 vy = (INT64)ypos - (INT64)yoff;
|
||||||
|
|
||||||
|
float vxf = vx / (float)FRACUNIT;
|
||||||
|
float vyf = vy / (float)FRACUNIT;
|
||||||
|
float ang = ANG2RAD(ANGLE_270 - angle);
|
||||||
|
|
||||||
// p is the texture origin in view space
|
// p is the texture origin in view space
|
||||||
// Don't add in the offsets at this stage, because doing so can result in
|
// Don't add in the offsets at this stage, because doing so can result in
|
||||||
// errors if the flat is rotated.
|
// errors if the flat is rotated.
|
||||||
ang = ANG2RAD(ANGLE_270 - planeviewangle);
|
p->x = vxf * cos(ang) - vyf * sin(ang);
|
||||||
p.x = vx * cos(ang) - vy * sin(ang);
|
p->z = vxf * sin(ang) + vyf * cos(ang);
|
||||||
p.z = vx * sin(ang) + vy * cos(ang);
|
p->y = (R_GetSlopeZAt(slope, -xoff, yoff) - zpos) / (float)FRACUNIT;
|
||||||
temp = P_GetSlopeZAt(slope, -planexoffset, planeyoffset);
|
}
|
||||||
p.y = FIXED_TO_FLOAT(temp) - vz;
|
|
||||||
|
// This function calculates all of the vectors necessary for drawing a sloped plane.
|
||||||
|
void R_SetSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, fixed_t xoff, fixed_t yoff, angle_t angle, angle_t plangle)
|
||||||
|
{
|
||||||
|
// Potentially override other stuff for now cus we're mean. :< But draw a slope plane!
|
||||||
|
// I copied ZDoom's code and adapted it to SRB2... -Red
|
||||||
|
floatv3_t *m = &ds_slope_v, *n = &ds_slope_u;
|
||||||
|
fixed_t height, temp;
|
||||||
|
float ang;
|
||||||
|
|
||||||
|
R_SetSlopePlaneOrigin(slope, xpos, ypos, zpos, xoff, yoff, angle);
|
||||||
|
height = P_GetSlopeZAt(slope, xpos, ypos);
|
||||||
|
zeroheight = FixedToFloat(height - zpos);
|
||||||
|
|
||||||
// m is the v direction vector in view space
|
// m is the v direction vector in view space
|
||||||
ang = ANG2RAD(ANGLE_180 - (planeviewangle + planeangle));
|
ang = ANG2RAD(ANGLE_180 - (angle + plangle));
|
||||||
m.x = yscale * cos(ang);
|
m->x = cos(ang);
|
||||||
m.z = yscale * sin(ang);
|
m->z = sin(ang);
|
||||||
|
|
||||||
// n is the u direction vector in view space
|
// n is the u direction vector in view space
|
||||||
n.x = xscale * sin(ang);
|
n->x = sin(ang);
|
||||||
n.z = -xscale * cos(ang);
|
n->z = -cos(ang);
|
||||||
|
|
||||||
ang = ANG2RAD(planeangle);
|
plangle >>= ANGLETOFINESHIFT;
|
||||||
temp = P_GetSlopeZAt(slope, planeviewx + FLOAT_TO_FIXED(yscale * sin(ang)), planeviewy + FLOAT_TO_FIXED(yscale * cos(ang)));
|
temp = P_GetSlopeZAt(slope, xpos + FINESINE(plangle), ypos + FINECOSINE(plangle));
|
||||||
m.y = FIXED_TO_FLOAT(temp) - zeroheight;
|
m->y = FixedToFloat(temp - height);
|
||||||
temp = P_GetSlopeZAt(slope, planeviewx + FLOAT_TO_FIXED(xscale * cos(ang)), planeviewy - FLOAT_TO_FIXED(xscale * sin(ang)));
|
temp = P_GetSlopeZAt(slope, xpos + FINECOSINE(plangle), ypos - FINESINE(plangle));
|
||||||
n.y = FIXED_TO_FLOAT(temp) - zeroheight;
|
n->y = FixedToFloat(temp - height);
|
||||||
|
|
||||||
if (ds_powersoftwo)
|
|
||||||
{
|
|
||||||
m.x /= fudge;
|
|
||||||
m.y /= fudge;
|
|
||||||
m.z /= fudge;
|
|
||||||
|
|
||||||
n.x *= fudge;
|
|
||||||
n.y *= fudge;
|
|
||||||
n.z *= fudge;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function calculates all of the vectors necessary for drawing a sloped and scaled plane.
|
||||||
|
void R_SetScaledSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, fixed_t xs, fixed_t ys, fixed_t xoff, fixed_t yoff, angle_t angle, angle_t plangle)
|
||||||
|
{
|
||||||
|
floatv3_t *m = &ds_slope_v, *n = &ds_slope_u;
|
||||||
|
fixed_t height, temp;
|
||||||
|
|
||||||
|
float xscale = FixedToFloat(xs);
|
||||||
|
float yscale = FixedToFloat(ys);
|
||||||
|
float ang;
|
||||||
|
|
||||||
|
R_SetSlopePlaneOrigin(slope, xpos, ypos, zpos, xoff, yoff, angle);
|
||||||
|
height = P_GetSlopeZAt(slope, xpos, ypos);
|
||||||
|
zeroheight = FixedToFloat(height - zpos);
|
||||||
|
|
||||||
|
// m is the v direction vector in view space
|
||||||
|
ang = ANG2RAD(ANGLE_180 - (angle + plangle));
|
||||||
|
m->x = yscale * cos(ang);
|
||||||
|
m->z = yscale * sin(ang);
|
||||||
|
|
||||||
|
// n is the u direction vector in view space
|
||||||
|
n->x = xscale * sin(ang);
|
||||||
|
n->z = -xscale * cos(ang);
|
||||||
|
|
||||||
|
ang = ANG2RAD(plangle);
|
||||||
|
temp = P_GetSlopeZAt(slope, xpos + FloatToFixed(yscale * sin(ang)), ypos + FloatToFixed(yscale * cos(ang)));
|
||||||
|
m->y = FixedToFloat(temp - height);
|
||||||
|
temp = P_GetSlopeZAt(slope, xpos + FloatToFixed(xscale * cos(ang)), ypos - FloatToFixed(xscale * sin(ang)));
|
||||||
|
n->y = FixedToFloat(temp - height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_CalculateSlopeVectors(void)
|
||||||
|
{
|
||||||
|
float sfmult = 65536.f;
|
||||||
|
|
||||||
// Eh. I tried making this stuff fixed-point and it exploded on me. Here's a macro for the only floating-point vector function I recall using.
|
// Eh. I tried making this stuff fixed-point and it exploded on me. Here's a macro for the only floating-point vector function I recall using.
|
||||||
#define CROSS(d, v1, v2) \
|
#define CROSS(d, v1, v2) \
|
||||||
d->x = (v1.y * v2.z) - (v1.z * v2.y);\
|
d->x = (v1.y * v2.z) - (v1.z * v2.y);\
|
||||||
d->y = (v1.z * v2.x) - (v1.x * v2.z);\
|
d->y = (v1.z * v2.x) - (v1.x * v2.z);\
|
||||||
d->z = (v1.x * v2.y) - (v1.y * v2.x)
|
d->z = (v1.x * v2.y) - (v1.y * v2.x)
|
||||||
CROSS(ds_sup, p, m);
|
CROSS(ds_sup, ds_slope_origin, ds_slope_v);
|
||||||
CROSS(ds_svp, p, n);
|
CROSS(ds_svp, ds_slope_origin, ds_slope_u);
|
||||||
CROSS(ds_szp, m, n);
|
CROSS(ds_szp, ds_slope_v, ds_slope_u);
|
||||||
#undef CROSS
|
#undef CROSS
|
||||||
|
|
||||||
ds_sup->z *= focallengthf[viewssnum];
|
ds_sup->z *= focallengthf[viewssnum];
|
||||||
|
|
@ -756,27 +826,15 @@ d->z = (v1.x * v2.y) - (v1.y * v2.x)
|
||||||
ds_szp->z *= focallengthf[viewssnum];
|
ds_szp->z *= focallengthf[viewssnum];
|
||||||
|
|
||||||
// Premultiply the texture vectors with the scale factors
|
// Premultiply the texture vectors with the scale factors
|
||||||
#define SFMULT 65536.f
|
|
||||||
if (ds_powersoftwo)
|
if (ds_powersoftwo)
|
||||||
{
|
sfmult *= (1 << nflatshiftup);
|
||||||
ds_sup->x *= (SFMULT * (1<<nflatshiftup));
|
|
||||||
ds_sup->y *= (SFMULT * (1<<nflatshiftup));
|
ds_sup->x *= sfmult;
|
||||||
ds_sup->z *= (SFMULT * (1<<nflatshiftup));
|
ds_sup->y *= sfmult;
|
||||||
ds_svp->x *= (SFMULT * (1<<nflatshiftup));
|
ds_sup->z *= sfmult;
|
||||||
ds_svp->y *= (SFMULT * (1<<nflatshiftup));
|
ds_svp->x *= sfmult;
|
||||||
ds_svp->z *= (SFMULT * (1<<nflatshiftup));
|
ds_svp->y *= sfmult;
|
||||||
}
|
ds_svp->z *= sfmult;
|
||||||
else
|
|
||||||
{
|
|
||||||
// Lactozilla: I'm essentially multiplying the vectors by FRACUNIT...
|
|
||||||
ds_sup->x *= SFMULT;
|
|
||||||
ds_sup->y *= SFMULT;
|
|
||||||
ds_sup->z *= SFMULT;
|
|
||||||
ds_svp->x *= SFMULT;
|
|
||||||
ds_svp->y *= SFMULT;
|
|
||||||
ds_svp->z *= SFMULT;
|
|
||||||
}
|
|
||||||
#undef SFMULT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_SetTiltedSpan(INT32 span)
|
void R_SetTiltedSpan(INT32 span)
|
||||||
|
|
@ -793,10 +851,40 @@ void R_SetTiltedSpan(INT32 span)
|
||||||
ds_szp = &ds_sz[span];
|
ds_szp = &ds_sz[span];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_SetSlopePlaneVectors(visplane_t *pl, INT32 y, fixed_t xoff, fixed_t yoff, float fudge)
|
static void R_SetSlopePlaneVectors(visplane_t *pl, INT32 y, fixed_t xoff, fixed_t yoff)
|
||||||
{
|
{
|
||||||
R_SetTiltedSpan(y);
|
R_SetTiltedSpan(y);
|
||||||
R_CalculateSlopeVectors(pl->slope, pl->viewx, pl->viewy, pl->viewz, FRACUNIT, FRACUNIT, xoff, yoff, pl->viewangle, pl->plangle, fudge);
|
R_SetSlopePlane(pl->slope, pl->viewx, pl->viewy, pl->viewz, xoff, yoff, pl->viewangle, pl->plangle);
|
||||||
|
R_CalculateSlopeVectors();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void R_AdjustSlopeCoordinates(vector3_t *origin)
|
||||||
|
{
|
||||||
|
const fixed_t modmask = ((1 << (32-nflatshiftup)) - 1);
|
||||||
|
|
||||||
|
fixed_t ox = (origin->x & modmask);
|
||||||
|
fixed_t oy = -(origin->y & modmask);
|
||||||
|
|
||||||
|
xoffs &= modmask;
|
||||||
|
yoffs &= modmask;
|
||||||
|
|
||||||
|
xoffs -= (origin->x - ox);
|
||||||
|
yoffs += (origin->y + oy);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void R_AdjustSlopeCoordinatesNPO2(vector3_t *origin)
|
||||||
|
{
|
||||||
|
const fixed_t modmaskw = (ds_flatwidth << FRACBITS);
|
||||||
|
const fixed_t modmaskh = (ds_flatheight << FRACBITS);
|
||||||
|
|
||||||
|
fixed_t ox = (origin->x % modmaskw);
|
||||||
|
fixed_t oy = -(origin->y % modmaskh);
|
||||||
|
|
||||||
|
xoffs %= modmaskw;
|
||||||
|
yoffs %= modmaskh;
|
||||||
|
|
||||||
|
xoffs -= (origin->x - ox);
|
||||||
|
yoffs += (origin->y + oy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawSinglePlane(visplane_t *pl)
|
void R_DrawSinglePlane(visplane_t *pl)
|
||||||
|
|
@ -806,8 +894,8 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
INT32 x;
|
INT32 x;
|
||||||
INT32 stop, angle;
|
INT32 stop, angle;
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
int type;
|
INT32 type;
|
||||||
int spanfunctype = BASEDRAWFUNC;
|
INT32 spanfunctype = BASEDRAWFUNC;
|
||||||
|
|
||||||
if (!(pl->minx <= pl->maxx))
|
if (!(pl->minx <= pl->maxx))
|
||||||
return;
|
return;
|
||||||
|
|
@ -1001,7 +1089,6 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
|
|
||||||
xoffs = pl->xoffs;
|
xoffs = pl->xoffs;
|
||||||
yoffs = pl->yoffs;
|
yoffs = pl->yoffs;
|
||||||
planeheight = abs(pl->height - pl->viewz);
|
|
||||||
|
|
||||||
if (light >= LIGHTLEVELS)
|
if (light >= LIGHTLEVELS)
|
||||||
light = LIGHTLEVELS-1;
|
light = LIGHTLEVELS-1;
|
||||||
|
|
@ -1011,76 +1098,29 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
|
|
||||||
if (pl->slope)
|
if (pl->slope)
|
||||||
{
|
{
|
||||||
float fudgecanyon = 0;
|
if (!pl->plangle)
|
||||||
angle_t hack = (pl->plangle & (ANGLE_90-1));
|
{
|
||||||
|
|
||||||
yoffs *= 1;
|
|
||||||
|
|
||||||
if (ds_powersoftwo)
|
if (ds_powersoftwo)
|
||||||
{
|
R_AdjustSlopeCoordinates(&pl->slope->o);
|
||||||
fixed_t temp;
|
|
||||||
// Okay, look, don't ask me why this works, but without this setup there's a disgusting-looking misalignment with the textures. -Red
|
|
||||||
fudgecanyon = ((1<<nflatshiftup)+1.0f)/(1<<nflatshiftup);
|
|
||||||
if (hack)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Essentially: We can't & the components along the regular axes when the plane is rotated.
|
|
||||||
This is because the distance on each regular axis in order to loop is different.
|
|
||||||
We rotate them, & the components, add them together, & them again, and then rotate them back.
|
|
||||||
These three seperate & operations are done per axis in order to prevent overflows.
|
|
||||||
toast 10/04/17
|
|
||||||
*/
|
|
||||||
const fixed_t cosinecomponent = FINECOSINE(hack>>ANGLETOFINESHIFT);
|
|
||||||
const fixed_t sinecomponent = FINESINE(hack>>ANGLETOFINESHIFT);
|
|
||||||
|
|
||||||
const fixed_t modmask = ((1 << (32-nflatshiftup)) - 1);
|
|
||||||
|
|
||||||
fixed_t ox = (FixedMul(pl->slope->o.x,cosinecomponent) & modmask) - (FixedMul(pl->slope->o.y,sinecomponent) & modmask);
|
|
||||||
fixed_t oy = (-FixedMul(pl->slope->o.x,sinecomponent) & modmask) - (FixedMul(pl->slope->o.y,cosinecomponent) & modmask);
|
|
||||||
|
|
||||||
temp = ox & modmask;
|
|
||||||
oy &= modmask;
|
|
||||||
ox = FixedMul(temp,cosinecomponent)+FixedMul(oy,-sinecomponent); // negative sine for opposite direction
|
|
||||||
oy = -FixedMul(temp,-sinecomponent)+FixedMul(oy,cosinecomponent);
|
|
||||||
|
|
||||||
temp = xoffs;
|
|
||||||
xoffs = (FixedMul(temp,cosinecomponent) & modmask) + (FixedMul(yoffs,sinecomponent) & modmask);
|
|
||||||
yoffs = (-FixedMul(temp,sinecomponent) & modmask) + (FixedMul(yoffs,cosinecomponent) & modmask);
|
|
||||||
|
|
||||||
temp = xoffs & modmask;
|
|
||||||
yoffs &= modmask;
|
|
||||||
xoffs = FixedMul(temp,cosinecomponent)+FixedMul(yoffs,-sinecomponent); // ditto
|
|
||||||
yoffs = -FixedMul(temp,-sinecomponent)+FixedMul(yoffs,cosinecomponent);
|
|
||||||
|
|
||||||
xoffs -= (pl->slope->o.x - ox);
|
|
||||||
yoffs += (pl->slope->o.y + oy);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
R_AdjustSlopeCoordinatesNPO2(&pl->slope->o);
|
||||||
xoffs &= ((1 << (32-nflatshiftup))-1);
|
|
||||||
yoffs &= ((1 << (32-nflatshiftup))-1);
|
|
||||||
xoffs -= (pl->slope->o.x + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1);
|
|
||||||
yoffs += (pl->slope->o.y + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
xoffs = (fixed_t)(xoffs*fudgecanyon);
|
|
||||||
yoffs = (fixed_t)(yoffs/fudgecanyon);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (planeripple.active)
|
if (planeripple.active)
|
||||||
{
|
{
|
||||||
fixed_t plheight = abs(P_GetSlopeZAt(pl->slope, pl->viewx, pl->viewy) - pl->viewz);
|
planeheight = abs(P_GetSlopeZAt(pl->slope, pl->viewx, pl->viewy) - pl->viewz);
|
||||||
|
|
||||||
R_PlaneBounds(pl);
|
R_PlaneBounds(pl);
|
||||||
|
|
||||||
for (x = pl->high; x < pl->low; x++)
|
for (x = pl->high; x < pl->low; x++)
|
||||||
{
|
{
|
||||||
R_CalculatePlaneRipple(pl, x, plheight, true);
|
ds_bgofs = R_CalculateRippleOffset(x);
|
||||||
R_SetSlopePlaneVectors(pl, x, (xoffs + planeripple.xfrac), (yoffs + planeripple.yfrac), fudgecanyon);
|
R_CalculatePlaneRipple(pl->viewangle + pl->plangle);
|
||||||
|
R_SetSlopePlaneVectors(pl, x, (xoffs + planeripple.xfrac), (yoffs + planeripple.yfrac));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
R_SetSlopePlaneVectors(pl, 0, xoffs, yoffs, fudgecanyon);
|
R_SetSlopePlaneVectors(pl, 0, xoffs, yoffs);
|
||||||
|
|
||||||
switch (spanfunctype)
|
switch (spanfunctype)
|
||||||
{
|
{
|
||||||
|
|
@ -1101,7 +1141,11 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
planezlight = scalelight[light];
|
planezlight = scalelight[light];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
planeheight = abs(pl->height - pl->viewz);
|
||||||
planezlight = zlight[light];
|
planezlight = zlight[light];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Use the correct span drawer depending on the powers-of-twoness
|
// Use the correct span drawer depending on the powers-of-twoness
|
||||||
R_SetSpanFunc(spanfunctype, !ds_powersoftwo, ds_brightmap != NULL);
|
R_SetSpanFunc(spanfunctype, !ds_powersoftwo, ds_brightmap != NULL);
|
||||||
|
|
@ -1114,18 +1158,15 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
|
|
||||||
stop = pl->maxx + 1;
|
stop = pl->maxx + 1;
|
||||||
|
|
||||||
if (viewx != pl->viewx || viewy != pl->viewy)
|
if (pl->slope)
|
||||||
{
|
{
|
||||||
viewx = pl->viewx;
|
|
||||||
viewy = pl->viewy;
|
|
||||||
}
|
|
||||||
if (viewz != pl->viewz)
|
|
||||||
viewz = pl->viewz;
|
|
||||||
|
|
||||||
for (x = pl->minx; x <= stop; x++)
|
for (x = pl->minx; x <= stop; x++)
|
||||||
|
R_MakeTiltedSpans(x, pl->top[x-1], pl->bottom[x-1], pl->top[x], pl->bottom[x]);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
R_MakeSpans(x, pl->top[x-1], pl->bottom[x-1],
|
for (x = pl->minx; x <= stop; x++)
|
||||||
pl->top[x], pl->bottom[x]);
|
R_MakeSpans(x, pl->top[x-1], pl->bottom[x-1], pl->top[x], pl->bottom[x]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,6 @@ void R_InitPlanes(void);
|
||||||
void R_ClearPlanes(void);
|
void R_ClearPlanes(void);
|
||||||
void R_ClearFFloorClips (void);
|
void R_ClearFFloorClips (void);
|
||||||
|
|
||||||
void R_MapPlane(INT32 y, INT32 x1, INT32 x2);
|
|
||||||
void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2);
|
|
||||||
void R_DrawPlanes(void);
|
void R_DrawPlanes(void);
|
||||||
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle,
|
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle,
|
||||||
extracolormap_t *planecolormap, ffloor_t *ffloor, polyobj_t *polyobj, pslope_t *slope, boolean noencore,
|
extracolormap_t *planecolormap, ffloor_t *ffloor, polyobj_t *polyobj, pslope_t *slope, boolean noencore,
|
||||||
|
|
@ -99,7 +97,9 @@ boolean R_CheckPowersOfTwo(void);
|
||||||
void R_DrawSinglePlane(visplane_t *pl);
|
void R_DrawSinglePlane(visplane_t *pl);
|
||||||
|
|
||||||
// Calculates the slope vectors needed for tilted span drawing.
|
// Calculates the slope vectors needed for tilted span drawing.
|
||||||
void R_CalculateSlopeVectors(pslope_t *slope, fixed_t planeviewx, fixed_t planeviewy, fixed_t planeviewz, fixed_t planexscale, fixed_t planeyscale, fixed_t planexoffset, fixed_t planeyoffset, angle_t planeviewangle, angle_t planeangle, float fudge);
|
void R_SetSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, fixed_t xoff, fixed_t yoff, angle_t angle, angle_t plangle);
|
||||||
|
void R_SetScaledSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, fixed_t xs, fixed_t ys, fixed_t xoff, fixed_t yoff, angle_t angle, angle_t plangle);
|
||||||
|
void R_CalculateSlopeVectors(void);
|
||||||
|
|
||||||
// Sets the slope vector pointers for the current tilted span.
|
// Sets the slope vector pointers for the current tilted span.
|
||||||
void R_SetTiltedSpan(INT32 span);
|
void R_SetTiltedSpan(INT32 span);
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,8 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
|
||||||
if (pSplat->tilted)
|
if (pSplat->tilted)
|
||||||
{
|
{
|
||||||
R_SetTiltedSpan(0);
|
R_SetTiltedSpan(0);
|
||||||
R_CalculateSlopeVectors(&pSplat->slope, viewx, viewy, viewz, pSplat->xscale, pSplat->yscale, -pSplat->verts[0].x, pSplat->verts[0].y, vis->viewangle, pSplat->angle, 1.0f);
|
R_SetScaledSlopePlane(&pSplat->slope, viewx, viewy, viewz, pSplat->xscale, pSplat->yscale, -pSplat->verts[0].x, pSplat->verts[0].y, vis->viewangle, pSplat->angle);
|
||||||
|
R_CalculateSlopeVectors();
|
||||||
spanfunctype = SPANDRAWFUNC_TILTEDSPRITE;
|
spanfunctype = SPANDRAWFUNC_TILTEDSPRITE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue