- give line_t a GetLevel function.

The portal getters need this, even though currently it only gets the global level.
This commit is contained in:
Christoph Oelckers 2019-01-25 00:42:55 +01:00
parent 3cef56249d
commit f4081c33a6
2 changed files with 10 additions and 5 deletions

View file

@ -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

View file

@ -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;