- Fixed: PrepWall() and PrepLWall() did not understand negative walxrepeats, which should cause

them to flip the texture horizontally.

SVN r3849 (trunk)
This commit is contained in:
Randy Heit 2012-08-23 01:34:19 +00:00
parent 6645121519
commit 980202a18f
2 changed files with 21 additions and 6 deletions

View File

@ -832,11 +832,11 @@ struct side_t
void SetTextureXScale(int which, fixed_t scale)
{
textures[which].xscale = scale <= 0? FRACUNIT : scale;
textures[which].xscale = scale == 0 ? FRACUNIT : scale;
}
void SetTextureXScale(fixed_t scale)
{
textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale <= 0? FRACUNIT : scale;
textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale == 0 ? FRACUNIT : scale;
}
fixed_t GetTextureXScale(int which) const
{

View File

@ -2769,6 +2769,7 @@ int WallMost (short *mostbuf, const secplane_t &plane)
static void PrepWallRoundFix(fixed_t *lwall, fixed_t walxrepeat)
{
// fix for rounding errors
walxrepeat = abs(walxrepeat);
fixed_t fix = (MirrorFlags & RF_XFLIP) ? walxrepeat-1 : 0;
int x;
@ -2803,7 +2804,7 @@ static void PrepWallRoundFix(fixed_t *lwall, fixed_t walxrepeat)
void PrepWall (fixed_t *swall, fixed_t *lwall, fixed_t walxrepeat)
{ // swall = scale, lwall = texturecolumn
double top, bot, i;
double xrepeat = walxrepeat;
double xrepeat = fabs((double)walxrepeat);
i = WallSX1 - centerx;
top = WallUoverZorg + WallUoverZstep * i;
@ -2812,7 +2813,14 @@ void PrepWall (fixed_t *swall, fixed_t *lwall, fixed_t walxrepeat)
for (int x = WallSX1; x < WallSX2; x++)
{
double frac = top / bot;
lwall[x] = xs_RoundToInt(frac * xrepeat);
if (walxrepeat < 0)
{
lwall[x] = xs_RoundToInt(xrepeat - frac * xrepeat);
}
else
{
lwall[x] = xs_RoundToInt(frac * xrepeat);
}
swall[x] = xs_RoundToInt(frac * WallDepthScale + WallDepthOrg);
top += WallUoverZstep;
bot += WallInvZstep;
@ -2823,7 +2831,7 @@ void PrepWall (fixed_t *swall, fixed_t *lwall, fixed_t walxrepeat)
void PrepLWall (fixed_t *lwall, fixed_t walxrepeat)
{ // lwall = texturecolumn
double top, bot, i;
double xrepeat = walxrepeat;
double xrepeat = fabs((double)walxrepeat);
double topstep;
i = WallSX1 - centerx;
@ -2835,7 +2843,14 @@ void PrepLWall (fixed_t *lwall, fixed_t walxrepeat)
for (int x = WallSX1; x < WallSX2; x++)
{
lwall[x] = xs_RoundToInt(top / bot);
if (walxrepeat < 0)
{
lwall[x] = xs_RoundToInt(xrepeat - top / bot);
}
else
{
lwall[x] = xs_RoundToInt(top / bot);
}
top += topstep;
bot += WallInvZstep;
}