From f4081c33a66b06753130c44c31d5d676fdac36d1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 25 Jan 2019 00:42:55 +0100 Subject: [PATCH] - give line_t a GetLevel function. The portal getters need this, even though currently it only gets the global level. --- src/g_levellocals.h | 14 +++++++++----- src/r_defs.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 521fffa0da..06aeea6a28 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 a7cdb5c877..0823251bc8 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;