- Fixed: R_RenderDecal() must save various Wall globals, because the originals

may still be needed. In particular, when drawing a seg with a midtexture is
  split by foreground geometry, the first drawseg generated from it will have
  the correct WallSZ1,2 values, but subsequent ones will have whatever
  R_RenderDecal() left behind. These values are used to calculate the upper
  and lower bounds of the midtexture. (Ironically, my work to Build-ify things
  had done away with these globals, but that's gone now.)


SVN r1938 (trunk)
This commit is contained in:
Randy Heit 2009-10-27 01:53:47 +00:00
parent 5ab4159e76
commit be3bb0093a
2 changed files with 40 additions and 15 deletions

View file

@ -1,3 +1,12 @@
October 26, 2009
- Fixed: R_RenderDecal() must save various Wall globals, because the originals
may still be needed. In particular, when drawing a seg with a midtexture is
split by foreground geometry, the first drawseg generated from it will have
the correct WallSZ1,2 values, but subsequent ones will have whatever
R_RenderDecal() left behind. These values are used to calculate the upper
and lower bounds of the midtexture. (Ironically, my work to Build-ify things
had done away with these globals, but that's gone now.)
October 24, 2009 (Changes by Graf Zahl) October 24, 2009 (Changes by Graf Zahl)
- fixed: sector_t::GetHeightSec checked the wrong MoreFlags. - fixed: sector_t::GetHeightSec checked the wrong MoreFlags.
- made max. view pitch a property of the renderer so that it's overridable without - made max. view pitch a property of the renderer so that it's overridable without

View file

@ -2246,6 +2246,15 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
// to a wall, we use the wall's angle instead of the decal's. This is // to a wall, we use the wall's angle instead of the decal's. This is
// pretty much the same as what R_AddLine() does. // pretty much the same as what R_AddLine() does.
fixed_t savetx1, savetx2, savety1, savety2, savesz1, savesz2;
savetx1 = WallTX1;
savetx2 = WallTX2;
savety1 = WallTY1;
savety2 = WallTY2;
savesz1 = WallSZ1;
savesz2 = WallSZ2;
x2 = WallSpriteTile->GetWidth(); x2 = WallSpriteTile->GetWidth();
x1 = WallSpriteTile->LeftOffset; x1 = WallSpriteTile->LeftOffset;
x2 = x2 - x1; x2 = x2 - x1;
@ -2277,43 +2286,43 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
if (WallTX1 >= -WallTY1) if (WallTX1 >= -WallTY1)
{ {
if (WallTX1 > WallTY1) return; // left edge is off the right side if (WallTX1 > WallTY1) goto done; // left edge is off the right side
if (WallTY1 == 0) return; if (WallTY1 == 0) goto done;
x1 = (centerxfrac + Scale (WallTX1, centerxfrac, WallTY1)) >> FRACBITS; x1 = (centerxfrac + Scale (WallTX1, centerxfrac, WallTY1)) >> FRACBITS;
if (WallTX1 >= 0) x1 = MIN (viewwidth, x1+1); // fix for signed divide if (WallTX1 >= 0) x1 = MIN (viewwidth, x1+1); // fix for signed divide
WallSZ1 = WallTY1; WallSZ1 = WallTY1;
} }
else else
{ {
if (WallTX2 < -WallTY2) return; // wall is off the left side if (WallTX2 < -WallTY2) goto done; // wall is off the left side
fixed_t den = WallTX1 - WallTX2 - WallTY2 + WallTY1; fixed_t den = WallTX1 - WallTX2 - WallTY2 + WallTY1;
if (den == 0) return; if (den == 0) goto done;
x1 = 0; x1 = 0;
WallSZ1 = WallTY1 + Scale (WallTY2 - WallTY1, WallTX1 + WallTY1, den); WallSZ1 = WallTY1 + Scale (WallTY2 - WallTY1, WallTX1 + WallTY1, den);
} }
if (WallSZ1 < TOO_CLOSE_Z) if (WallSZ1 < TOO_CLOSE_Z)
return; goto done;
if (WallTX2 <= WallTY2) if (WallTX2 <= WallTY2)
{ {
if (WallTX2 < -WallTY2) return; // right edge is off the left side if (WallTX2 < -WallTY2) goto done; // right edge is off the left side
if (WallTY2 == 0) return; if (WallTY2 == 0) goto done;
x2 = (centerxfrac + Scale (WallTX2, centerxfrac, WallTY2)) >> FRACBITS; x2 = (centerxfrac + Scale (WallTX2, centerxfrac, WallTY2)) >> FRACBITS;
if (WallTX2 >= 0) x2 = MIN (viewwidth, x2+1); // fix for signed divide if (WallTX2 >= 0) x2 = MIN (viewwidth, x2+1); // fix for signed divide
WallSZ2 = WallTY2; WallSZ2 = WallTY2;
} }
else else
{ {
if (WallTX1 > WallTY1) return; // wall is off the right side if (WallTX1 > WallTY1) goto done; // wall is off the right side
fixed_t den = WallTY2 - WallTY1 - WallTX2 + WallTX1; fixed_t den = WallTY2 - WallTY1 - WallTX2 + WallTX1;
if (den == 0) return; if (den == 0) goto done;
x2 = viewwidth; x2 = viewwidth;
WallSZ2 = WallTY1 + Scale (WallTY2 - WallTY1, WallTX1 - WallTY1, den); WallSZ2 = WallTY1 + Scale (WallTY2 - WallTY1, WallTX1 - WallTY1, den);
} }
if (x1 >= x2 || x1 > clipper->x2 || x2 <= clipper->x1 || WallSZ2 < TOO_CLOSE_Z) if (x1 >= x2 || x1 > clipper->x2 || x2 <= clipper->x1 || WallSZ2 < TOO_CLOSE_Z)
return; goto done;
if (MirrorFlags & RF_XFLIP) if (MirrorFlags & RF_XFLIP)
{ {
@ -2340,7 +2349,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
{ {
if (pass != 0) if (pass != 0)
{ {
return; goto done;
} }
mceilingclip = walltop; mceilingclip = walltop;
mfloorclip = wallbottom; mfloorclip = wallbottom;
@ -2361,7 +2370,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
case RF_CLIPUPPER: case RF_CLIPUPPER:
if (pass != 0) if (pass != 0)
{ {
return; goto done;
} }
mceilingclip = walltop; mceilingclip = walltop;
mfloorclip = ceilingclip; mfloorclip = ceilingclip;
@ -2370,7 +2379,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
case RF_CLIPMID: case RF_CLIPMID:
if (curline->backsector != NULL && pass != 2) if (curline->backsector != NULL && pass != 2)
{ {
return; goto done;
} }
mceilingclip = openings + clipper->sprtopclip - clipper->x1; mceilingclip = openings + clipper->sprtopclip - clipper->x1;
mfloorclip = openings + clipper->sprbottomclip - clipper->x1; mfloorclip = openings + clipper->sprbottomclip - clipper->x1;
@ -2379,7 +2388,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
case RF_CLIPLOWER: case RF_CLIPLOWER:
if (pass != 0) if (pass != 0)
{ {
return; goto done;
} }
mceilingclip = floorclip; mceilingclip = floorclip;
mfloorclip = wallbottom; mfloorclip = wallbottom;
@ -2400,7 +2409,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
} }
if (x1 >= x2) if (x1 >= x2)
{ {
return; goto done;
} }
swap (x1, WallSX1); swap (x1, WallSX1);
@ -2523,6 +2532,13 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
hcolfunc_post4 = rt_map4cols; hcolfunc_post4 = rt_map4cols;
R_FinishSetPatchStyle (); R_FinishSetPatchStyle ();
done:
WallTX1 = savetx1;
WallTX2 = savetx2;
WallTY1 = savety1;
WallTY2 = savety2;
WallSZ1 = savesz1;
WallSZ2 = savesz2;
} }
static void WallSpriteColumn (void (*drawfunc)(const BYTE *column, const FTexture::Span *spans)) static void WallSpriteColumn (void (*drawfunc)(const BYTE *column, const FTexture::Span *spans))