mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
- optimized sector portal checks.
All the PortalBlocks* functions were turned into real function calls which for such a frequent check should be avoided. So now any linked portal sets a flag in the attached sectors so that it isn't necessary to check the skybox pointer each time which makes the functions subject to inlining again.
This commit is contained in:
parent
42e88ef120
commit
961a4c8524
2 changed files with 9 additions and 8 deletions
|
@ -932,7 +932,7 @@ void P_CreateLinkedPortals()
|
|||
{
|
||||
// The engine cannot deal with portals on a sloped plane.
|
||||
sectors[i].SkyBoxes[j] = NULL;
|
||||
Printf("Portal on %s of sector %d is sloped and will be disabled\n", j == 0 ? "floor" : "ceiling", i);
|
||||
Printf("Portal on %s of sector %d is sloped and will be disabled\n", j == 0 ? "floor" : "ceiling", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1057,7 +1057,7 @@ void P_CreateLinkedPortals()
|
|||
// 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=%f is below floor portal at z=%f\n", i, cz, fz);
|
||||
double cp = -sectors[i].ceilingplane.fD();
|
||||
double fp = -sectors[i].ceilingplane.fD();
|
||||
double fp = sectors[i].floorplane.fD();
|
||||
if (cp < fp || fz == fp)
|
||||
{
|
||||
sectors[i].SkyBoxes[sector_t::ceiling] = NULL;
|
||||
|
@ -1068,6 +1068,9 @@ void P_CreateLinkedPortals()
|
|||
}
|
||||
}
|
||||
}
|
||||
// mark all sector planes that check out ok for everything.
|
||||
if (sectors[i].PortalIsLinked(sector_t::floor)) sectors[i].planes[sector_t::floor].Flags |= PLANEF_LINKED;
|
||||
if (sectors[i].PortalIsLinked(sector_t::ceiling)) sectors[i].planes[sector_t::ceiling].Flags |= PLANEF_LINKED;
|
||||
}
|
||||
if (linkedPortals.Size() > 0)
|
||||
{
|
||||
|
|
10
src/r_defs.h
10
src/r_defs.h
|
@ -484,6 +484,7 @@ enum
|
|||
PLANEF_BLOCKSOUND = 32,
|
||||
PLANEF_DISABLED = 64,
|
||||
PLANEF_OBSTRUCTED = 128, // if the portal plane is beyond the sector's floor or ceiling.
|
||||
PLANEF_LINKED = 256 // plane is flagged as a linked portal
|
||||
};
|
||||
|
||||
// Internal sector flags
|
||||
|
@ -936,20 +937,17 @@ public:
|
|||
|
||||
bool PortalBlocksSight(int plane)
|
||||
{
|
||||
if (SkyBoxes[plane] == NULL || SkyBoxes[plane]->special1 != SKYBOX_LINKEDPORTAL) return true;
|
||||
return !!(planes[plane].Flags & (PLANEF_NORENDER | PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED));
|
||||
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_NORENDER | PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||
}
|
||||
|
||||
bool PortalBlocksMovement(int plane)
|
||||
{
|
||||
if (SkyBoxes[plane] == NULL || SkyBoxes[plane]->special1 != SKYBOX_LINKEDPORTAL) return true;
|
||||
return !!(planes[plane].Flags & (PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED));
|
||||
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||
}
|
||||
|
||||
bool PortalBlocksSound(int plane)
|
||||
{
|
||||
if (SkyBoxes[plane] == NULL || SkyBoxes[plane]->special1 != SKYBOX_LINKEDPORTAL) return true;
|
||||
return !!(planes[plane].Flags & (PLANEF_BLOCKSOUND | PLANEF_DISABLED | PLANEF_OBSTRUCTED));
|
||||
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_BLOCKSOUND | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||
}
|
||||
|
||||
bool PortalIsLinked(int plane)
|
||||
|
|
Loading…
Reference in a new issue