- don't allow any ceiling portal that has a lower position than a floor portal in the same sector. The will inevitably lead to problematic situations.

This commit is contained in:
Christoph Oelckers 2016-03-08 10:09:02 +01:00
parent 50d2145ba0
commit f35d966799
1 changed files with 20 additions and 0 deletions

View File

@ -1086,6 +1086,26 @@ void P_CreateLinkedPortals()
sectors[i].lines[j]->flags |= ML_PORTALCONNECT;
}
}
if (sectors[i].PortalIsLinked(sector_t::ceiling) && sectors[i].PortalIsLinked(sector_t::floor))
{
fixed_t cz = sectors[i].SkyBoxes[sector_t::ceiling]->threshold;
fixed_t fz = sectors[i].SkyBoxes[sector_t::floor]->threshold;
if (cz < fz)
{
// This is a fatal condition. We have to remove one of the two portals. Choose the one that doesn't match the current plane
Printf("Error in sector %d: Ceiling portal at z=%d is below floor portal at z=%d\n", i, cz, fz);
fixed_t cp = sectors[i].ceilingplane.Zat0();
fixed_t fp = sectors[i].ceilingplane.Zat0();
if (cp < fp || fz == fp)
{
sectors[i].SkyBoxes[sector_t::ceiling] = NULL;
}
else
{
sectors[i].SkyBoxes[sector_t::floor] = NULL;
}
}
}
}
//BuildBlockmap();
}