diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 521fffa0d..06aeea6a2 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -473,31 +473,35 @@ inline bool sector_t::PortalIsLinked(int plane) return (GetPortalType(plane) == PORTS_LINKEDPORTAL); } +inline FLevelLocals *line_t::GetLevel() const +{ + return &level; +} inline FLinePortal *line_t::getPortal() const { - return portalindex >= level.linePortals.Size() ? (FLinePortal*)NULL : &level.linePortals[portalindex]; + return portalindex >= GetLevel()->linePortals.Size() ? (FLinePortal*)nullptr : &GetLevel()->linePortals[portalindex]; } // returns true if the portal is crossable by actors inline bool line_t::isLinePortal() const { - return portalindex >= level.linePortals.Size() ? false : !!(level.linePortals[portalindex].mFlags & PORTF_PASSABLE); + return portalindex >= GetLevel()->linePortals.Size() ? false : !!(GetLevel()->linePortals[portalindex].mFlags & PORTF_PASSABLE); } // returns true if the portal needs to be handled by the renderer inline bool line_t::isVisualPortal() const { - return portalindex >= level.linePortals.Size() ? false : !!(level.linePortals[portalindex].mFlags & PORTF_VISIBLE); + return portalindex >= GetLevel()->linePortals.Size() ? false : !!(GetLevel()->linePortals[portalindex].mFlags & PORTF_VISIBLE); } inline line_t *line_t::getPortalDestination() const { - return portalindex >= level.linePortals.Size() ? (line_t*)NULL : level.linePortals[portalindex].mDestination; + return portalindex >= GetLevel()->linePortals.Size() ? (line_t*)nullptr : GetLevel()->linePortals[portalindex].mDestination; } inline int line_t::getPortalAlignment() const { - return portalindex >= level.linePortals.Size() ? 0 : level.linePortals[portalindex].mAlign; + return portalindex >= GetLevel()->linePortals.Size() ? 0 : GetLevel()->linePortals[portalindex].mAlign; } inline bool line_t::hitSkyWall(AActor* mo) const diff --git a/src/r_defs.h b/src/r_defs.h index a7cdb5c87..0823251bc 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1408,6 +1408,7 @@ struct line_t FSectorPortal *GetTransferredPortal(); void AdjustLine(); + inline FLevelLocals *GetLevel() const; inline FLinePortal *getPortal() const; inline bool isLinePortal() const; inline bool isVisualPortal() const;