Skip to content

Commit

Permalink
Map Renderer|Fixed: Ignore the front ceiling when comparing sky-maske…
Browse files Browse the repository at this point in the history
…d planes

Closer inspection revealed that doom.exe's column renderer does in
fact extend the lower wall section up to the height of the back
sector plane when both are sky-masked.

This fix addresses issues seen in ksutra.wad MAP01 and MAP05, which
are slight variations on the same construct.

Todo: There remains an issue with the Y texture coordinates on some
of the buildings in the start area of ksutra MAP01.
  • Loading branch information
danij-deng committed Apr 25, 2012
1 parent 390b58d commit d97041d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/r_world.c
Expand Up @@ -772,7 +772,7 @@ void GameMap_UpdateSkyFixForSector(GameMap* map, Sector* sec)
boolean skyFloor, skyCeil;
assert(map);

if(!sec || 0 == sec->lineDefCount || sec->SP_ceilvisheight <= sec->SP_floorvisheight) return;
if(!sec || 0 == sec->lineDefCount) return;

skyFloor = Surface_IsSkyMasked(&sec->SP_floorsurface);
skyCeil = Surface_IsSkyMasked(&sec->SP_ceilsurface);
Expand Down
11 changes: 7 additions & 4 deletions doomsday/engine/portable/src/rend_main.c
Expand Up @@ -2040,15 +2040,18 @@ boolean R_FindBottomTop(LineDef* lineDef, int side, SideDefSection section,
break;

case SS_BOTTOM: {
float t = bfloor->visHeight;
coord_t t = bfloor->visHeight;

*bottom = ffloor->visHeight;
// Can't go over the back ceiling, would induce polygon flaws.
if(bfloor->visHeight > bceil->visHeight)
t = bceil->visHeight;

// Can't go over front ceiling, would induce polygon flaws.
if(t > fceil->visHeight)
// In the special case of a sky masked upper we must extend the bottom
// section up to the height of the back floor.
if(t > fceil->visHeight &&
!(Surface_IsSkyMasked(&fceil->surface) && Surface_IsSkyMasked(&bceil->surface) && fceil->visHeight < bceil->visHeight))
t = fceil->visHeight;
*top = t;

Expand Down Expand Up @@ -2482,11 +2485,11 @@ static void skyFixZCoords(HEdge* hedge, int skyCap, coord_t* bottom, coord_t* to
if(skyCap & SKYCAP_UPPER)
{
if(top) *top = skyFixCeilZ(fceil, bceil);
if(bottom) *bottom = MAX_OF((backSec && Surface_IsSkyMasked(&bceil->surface) && bfloor->visHeight < fceil->visHeight )? bceil->visHeight : fceil->visHeight, ffloor->visHeight);
if(bottom) *bottom = MAX_OF((backSec && Surface_IsSkyMasked(&bceil->surface) )? bceil->visHeight : fceil->visHeight, ffloor->visHeight);
}
else
{
if(top) *top = MIN_OF((backSec && Surface_IsSkyMasked(&bfloor->surface) && bceil->visHeight > ffloor->visHeight)? bfloor->visHeight : ffloor->visHeight, fceil->visHeight);
if(top) *top = MIN_OF((backSec && Surface_IsSkyMasked(&bfloor->surface))? bfloor->visHeight : ffloor->visHeight, fceil->visHeight);
if(bottom) *bottom = skyFixFloorZ(ffloor, bfloor);
}
}
Expand Down

0 comments on commit d97041d

Please sign in to comment.