mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-20 19:02:34 +00:00
hHA
This commit is contained in:
parent
a39c52708c
commit
02c3710211
4 changed files with 264 additions and 140 deletions
|
@ -49,12 +49,6 @@ typedef struct
|
|||
|
||||
// for patchflats
|
||||
UINT8 *flatpatch;
|
||||
|
||||
#ifdef ESLOPE
|
||||
// rescaled version of the above
|
||||
UINT8 *resizedflat;
|
||||
UINT16 resizedwidth, resizedheight;
|
||||
#endif
|
||||
} levelflat_t;
|
||||
|
||||
extern size_t numlevelflats;
|
||||
|
|
|
@ -52,11 +52,6 @@ typedef struct
|
|||
{
|
||||
UINT8 *flat;
|
||||
INT16 width, height;
|
||||
|
||||
#ifdef ESLOPE
|
||||
UINT8 *resizedflat;
|
||||
INT16 resizedwidth, resizedheight;
|
||||
#endif
|
||||
} textureflat_t;
|
||||
|
||||
// all loaded and prepared textures from the start of the game
|
||||
|
|
229
src/r_draw8.c
229
src/r_draw8.c
|
@ -724,7 +724,24 @@ void R_DrawTiltedSpan_8(void)
|
|||
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
dest++;
|
||||
iz += ds_sz.x;
|
||||
uz += ds_su.x;
|
||||
|
@ -761,7 +778,24 @@ void R_DrawTiltedSpan_8(void)
|
|||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
|
@ -777,7 +811,24 @@ void R_DrawTiltedSpan_8(void)
|
|||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -798,7 +849,24 @@ void R_DrawTiltedSpan_8(void)
|
|||
for (; width != 0; width--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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
|
||||
*dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]];
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
|
@ -859,7 +927,24 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
|||
v = (INT64)(vz*z) + viewy;
|
||||
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
dest++;
|
||||
iz += ds_sz.x;
|
||||
uz += ds_su.x;
|
||||
|
@ -896,7 +981,24 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
|||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
|
@ -912,7 +1014,24 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
|||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -933,7 +1052,24 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
|||
for (; width != 0; width--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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
|
||||
*dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest);
|
||||
dest++;
|
||||
u += stepu;
|
||||
v += stepv;
|
||||
|
@ -994,9 +1130,28 @@ void R_DrawTiltedSplat_8(void)
|
|||
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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)];
|
||||
}
|
||||
else
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
*dest = colormap[val];
|
||||
|
||||
dest++;
|
||||
iz += ds_sz.x;
|
||||
uz += ds_su.x;
|
||||
|
@ -1033,7 +1188,24 @@ void R_DrawTiltedSplat_8(void)
|
|||
for (i = SPANSIZE-1; i >= 0; i--)
|
||||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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)];
|
||||
}
|
||||
else
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
*dest = colormap[val];
|
||||
dest++;
|
||||
|
@ -1051,7 +1223,24 @@ void R_DrawTiltedSplat_8(void)
|
|||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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)];
|
||||
}
|
||||
else
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
*dest = colormap[val];
|
||||
}
|
||||
|
@ -1075,6 +1264,24 @@ void R_DrawTiltedSplat_8(void)
|
|||
{
|
||||
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (!ds_powersoftwo)
|
||||
{
|
||||
fixed_t x = ((u-viewx) >> FRACBITS);
|
||||
fixed_t y = ((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)];
|
||||
}
|
||||
else
|
||||
val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
|
||||
if (val != TRANSPARENTPIXEL)
|
||||
*dest = colormap[val];
|
||||
dest++;
|
||||
|
|
164
src/r_plane.c
164
src/r_plane.c
|
@ -718,7 +718,6 @@ static void R_GetPatchFlat(levelflat_t *levelflat, boolean leveltexture)
|
|||
{
|
||||
textureflat_t *texflat = &texflats[levelflat->texturenum];
|
||||
patch_t *patch = NULL;
|
||||
UINT8 *tex;
|
||||
boolean texturechanged = (leveltexture ? (levelflat->texturenum != levelflat->lasttexturenum) : false);
|
||||
|
||||
// Check if the texture changed.
|
||||
|
@ -738,11 +737,6 @@ static void R_GetPatchFlat(levelflat_t *levelflat, boolean leveltexture)
|
|||
// If the texture changed, or the patch doesn't exist, convert either of them to a flat.
|
||||
if (levelflat->flatpatch == NULL || texturechanged)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
INT32 resizewidth, resizeheight, newresize;
|
||||
INT32 checkresizewidth, checkresizeheight;
|
||||
#endif // ESLOPE
|
||||
|
||||
if (leveltexture)
|
||||
{
|
||||
texture_t *texture = textures[levelflat->texturenum];
|
||||
|
@ -770,75 +764,6 @@ static void R_GetPatchFlat(levelflat_t *levelflat, boolean leveltexture)
|
|||
|
||||
ds_source = levelflat->flatpatch;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
// Crop the flat, if necessary.
|
||||
if (!R_CheckPowersOfTwo())
|
||||
{
|
||||
// Scale up to nearest power of 2
|
||||
resizewidth = resizeheight = 1;
|
||||
while (resizewidth < ds_flatwidth)
|
||||
resizewidth <<= 1;
|
||||
while (resizeheight < ds_flatheight)
|
||||
resizeheight <<= 1;
|
||||
|
||||
// Scale down to fit in 2048x2048
|
||||
if (resizewidth > 2048)
|
||||
resizewidth = 2048;
|
||||
if (resizeheight > 2048)
|
||||
resizeheight = 2048;
|
||||
|
||||
// A single pixel difference is negligible.
|
||||
checkresizewidth = ds_flatwidth - 1;
|
||||
if (checkresizewidth & (checkresizewidth - 1))
|
||||
{
|
||||
checkresizewidth += 2;
|
||||
if (checkresizewidth & (checkresizewidth - 1))
|
||||
{
|
||||
while (resizewidth > ds_flatwidth)
|
||||
resizewidth >>= 1;
|
||||
}
|
||||
else
|
||||
resizewidth = checkresizewidth;
|
||||
}
|
||||
else
|
||||
resizewidth = checkresizewidth;
|
||||
|
||||
checkresizeheight = ds_flatheight - 1;
|
||||
if (checkresizeheight & (checkresizeheight - 1))
|
||||
{
|
||||
checkresizeheight += 2;
|
||||
if (checkresizeheight & (checkresizeheight - 1))
|
||||
{
|
||||
while (resizeheight > ds_flatheight)
|
||||
resizeheight >>= 1;
|
||||
}
|
||||
else
|
||||
resizeheight = checkresizeheight;
|
||||
}
|
||||
else
|
||||
resizeheight = checkresizeheight;
|
||||
|
||||
// Find smallest size.
|
||||
newresize = min(resizewidth, resizeheight);
|
||||
|
||||
// Allocate texture.
|
||||
tex = Z_Malloc(newresize * newresize, PU_LEVEL, NULL);
|
||||
memset(tex, TRANSPARENTPIXEL, newresize * newresize);
|
||||
R_CropFlat(ds_source, tex, ds_flatwidth, ds_flatheight, min(resizewidth, newresize), min(resizeheight, newresize), newresize, newresize);
|
||||
|
||||
if (leveltexture)
|
||||
{
|
||||
texflat->resizedflat = tex;
|
||||
texflat->resizedwidth = texflat->resizedheight = newresize;
|
||||
}
|
||||
else
|
||||
{
|
||||
levelflat->resizedflat = tex;
|
||||
levelflat->resizedwidth = levelflat->resizedheight = newresize;
|
||||
}
|
||||
}
|
||||
#endif // ESLOPE
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -850,28 +775,6 @@ static void R_GetPatchFlat(levelflat_t *levelflat, boolean leveltexture)
|
|||
yoffs += levelflat->topoffset;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (currentplane->slope)
|
||||
{
|
||||
if (R_CheckPowersOfTwo())
|
||||
{
|
||||
if (leveltexture)
|
||||
{
|
||||
ds_source = texflat->resizedflat;
|
||||
ds_flatwidth = texflat->resizedwidth;
|
||||
ds_flatheight = texflat->resizedheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
ds_source = levelflat->resizedflat;
|
||||
ds_flatwidth = levelflat->resizedwidth;
|
||||
ds_flatheight = levelflat->resizedheight;
|
||||
}
|
||||
}
|
||||
R_CheckFlatLength(ds_flatwidth * ds_flatheight);
|
||||
}
|
||||
#endif // ESLOPE
|
||||
|
||||
levelflat->lasttexturenum = levelflat->texturenum;
|
||||
}
|
||||
|
||||
|
@ -1061,22 +964,32 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
floatv3_t p, m, n;
|
||||
float ang;
|
||||
float vx, vy, vz;
|
||||
float fudge;
|
||||
float fudge = 0;
|
||||
// compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly
|
||||
// use this as a temp var to store P_GetZAt's return value each time
|
||||
fixed_t temp;
|
||||
|
||||
xoffs &= ((1 << (32-nflatshiftup))-1);
|
||||
yoffs &= ((1 << (32-nflatshiftup))-1);
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
// But xoffs and yoffs are zero..... ???!?!?!???!?!?!
|
||||
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 -= (pl->slope->o.x + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1);
|
||||
yoffs += (pl->slope->o.y + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1);
|
||||
|
||||
// Okay, look, don't ask me why this works, but without this setup there's a disgusting-looking misalignment with the textures. -Red
|
||||
fudge = ((1<<nflatshiftup)+1.0f)/(1<<nflatshiftup);
|
||||
// Okay, look, don't ask me why this works, but without this setup there's a disgusting-looking misalignment with the textures. -Red
|
||||
fudge = ((1<<nflatshiftup)+1.0f)/(1<<nflatshiftup);
|
||||
|
||||
xoffs = (fixed_t)(xoffs*fudge);
|
||||
yoffs = (fixed_t)(yoffs/fudge);
|
||||
xoffs = (fixed_t)(xoffs*fudge);
|
||||
yoffs = (fixed_t)(yoffs/fudge);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The origin vector is a vertex from whatever linedef defined this slope
|
||||
xoffs = -pl->slope->o.x;
|
||||
yoffs = pl->slope->o.y;
|
||||
}
|
||||
|
||||
vx = FIXED_TO_FLOAT(pl->viewx+xoffs);
|
||||
vy = FIXED_TO_FLOAT(pl->viewy-yoffs);
|
||||
|
@ -1111,13 +1024,16 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
temp = P_GetZAt(pl->slope, pl->viewx + FLOAT_TO_FIXED(cos(ang)), pl->viewy - FLOAT_TO_FIXED(sin(ang)));
|
||||
n.y = FIXED_TO_FLOAT(temp) - zeroheight;
|
||||
|
||||
m.x /= fudge;
|
||||
m.y /= fudge;
|
||||
m.z /= fudge;
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
m.x /= fudge;
|
||||
m.y /= fudge;
|
||||
m.z /= fudge;
|
||||
|
||||
n.x *= fudge;
|
||||
n.y *= fudge;
|
||||
n.z *= fudge;
|
||||
n.x *= fudge;
|
||||
n.y *= fudge;
|
||||
n.z *= fudge;
|
||||
}
|
||||
|
||||
// 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) \
|
||||
|
@ -1134,14 +1050,26 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
ds_sz.z *= focallengthf;
|
||||
|
||||
// Premultiply the texture vectors with the scale factors
|
||||
if (ds_powersoftwo)
|
||||
{
|
||||
#define SFMULT 65536.f*(1<<nflatshiftup)
|
||||
ds_su.x *= SFMULT;
|
||||
ds_su.y *= SFMULT;
|
||||
ds_su.z *= SFMULT;
|
||||
ds_sv.x *= SFMULT;
|
||||
ds_sv.y *= SFMULT;
|
||||
ds_sv.z *= SFMULT;
|
||||
ds_su.x *= SFMULT;
|
||||
ds_su.y *= SFMULT;
|
||||
ds_su.z *= SFMULT;
|
||||
ds_sv.x *= SFMULT;
|
||||
ds_sv.y *= SFMULT;
|
||||
ds_sv.z *= SFMULT;
|
||||
#undef SFMULT
|
||||
}
|
||||
else
|
||||
{
|
||||
ds_su.x *= 65536.f;
|
||||
ds_su.y *= 65536.f;
|
||||
ds_su.z *= 65536.f;
|
||||
ds_sv.x *= 65536.f;
|
||||
ds_sv.y *= 65536.f;
|
||||
ds_sv.z *= 65536.f;
|
||||
}
|
||||
|
||||
if (spanfunc == R_DrawTranslucentSpan_8)
|
||||
spanfunc = R_DrawTiltedTranslucentSpan_8;
|
||||
|
|
Loading…
Reference in a new issue