Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed|World|Map|Client: Use ConvexSubspaces when building the decorat…
…ed surface list

This fix addresses an problem observed when attempting to play E1M1
of datacore's Endless Torture, Ultimate Doom mod.
See: http://www.doomworld.com/vb/wads-mods/72348-doom-endless-torture/
  • Loading branch information
danij-deng committed Apr 28, 2015
1 parent 1cbb03e commit ee77499
Showing 1 changed file with 45 additions and 13 deletions.
58 changes: 45 additions & 13 deletions doomsday/client/src/world/map.cpp
Expand Up @@ -1920,23 +1920,55 @@ void Map::buildMaterialLists()
{
d->surfaceDecorator().reset();

for(Line *line : d->lines)
for(int i = 0; i < 2; ++i)
for(ConvexSubspace const *subspace : d->subspaces)
{
LineSide &side = line->side(i);
if(!side.hasSections()) continue;
HEdge *base = subspace->poly().hedge();
HEdge *hedge = base;
do
{
if(hedge->hasMapElement())
{
LineSide &side = hedge->mapElementAs<LineSideSegment>().lineSide();
if(side.hasSections())
{
linkInMaterialLists(&side.middle());
linkInMaterialLists(&side.top());
linkInMaterialLists(&side.bottom());
}
if(side.back().hasSections())
{
linkInMaterialLists(&side.back().middle());
linkInMaterialLists(&side.back().top());
linkInMaterialLists(&side.back().bottom());
}
}
} while((hedge = &hedge->next()) != base);

linkInMaterialLists(&side.middle());
linkInMaterialLists(&side.top());
linkInMaterialLists(&side.bottom());
}
subspace->forAllExtraMeshes([this] (Mesh &mesh)
{
for(HEdge *hedge : mesh.hedges())
{
// Is this on the back of a one-sided line?
if(!hedge->hasMapElement()) continue;

for(Sector *sector : d->sectors)
{
// Skip sectors with no lines as their planes will never be drawn.
if(!sector->sideCount()) continue;
LineSide &side = hedge->mapElementAs<LineSideSegment>().lineSide();
if(side.hasSections())
{
linkInMaterialLists(&side.middle());
linkInMaterialLists(&side.top());
linkInMaterialLists(&side.bottom());
}
if(side.back().hasSections())
{
linkInMaterialLists(&side.back().middle());
linkInMaterialLists(&side.back().top());
linkInMaterialLists(&side.back().bottom());
}
}
return LoopContinue;
});

sector->forAllPlanes([this] (Plane &plane)
subspace->sector().forAllPlanes([this] (Plane &plane)
{
linkInMaterialLists(&plane.surface());
return LoopContinue;
Expand Down

0 comments on commit ee77499

Please sign in to comment.