- use sector_t::GetHeightSec consistently and optimize it.
This was all over the place, with half of it using the function and half doing incomplete checks on the underlying variables. Also did some optimization on the IGNOREHEIGHTSEC flag: Putting it on the destination sector instead of the model sector makes the check even simpler and allows to precalculate the effect of 3D floors on the heightsec, which previously had to be run on every call and made the function too complex for inlining.
This commit is contained in:
parent
3c49804c6c
commit
f49c6cbde2
12 changed files with 35 additions and 40 deletions
|
|
@ -4221,6 +4221,23 @@ void P_SetupLevel (const char *lumpname, int position)
|
|||
AnnounceGameStart ();
|
||||
}
|
||||
|
||||
// This check was previously done at run time each time the heightsec was checked.
|
||||
// However, since 3D floors are static data, we can easily precalculate this and store it in the sector's flags for quick access.
|
||||
for (auto &s : level.sectors)
|
||||
{
|
||||
if (s.heightsec != nullptr)
|
||||
{
|
||||
// If any of these 3D floors render their planes, ignore heightsec.
|
||||
for (auto &ff : s.e->XFloor.ffloors)
|
||||
{
|
||||
if ((ff->flags & (FF_EXISTS | FF_RENDERPLANES)) == (FF_EXISTS | FF_RENDERPLANES))
|
||||
{
|
||||
s.MoreFlags |= SECF_IGNOREHEIGHTSEC; // mark the heightsec inactive.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
P_ResetSightCounters (true);
|
||||
//Printf ("free memory: 0x%x\n", Z_FreeMemory());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue