mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 04:01:31 +00:00
Exported LinePortals
Added helper functions for lines related to portals
This commit is contained in:
parent
3ea49a66d1
commit
dd7cb8649f
7 changed files with 110 additions and 0 deletions
|
@ -845,11 +845,31 @@ inline line_t *line_t::getPortalDestination() const
|
|||
return portalindex >= GetLevel()->linePortals.Size() ? (line_t*)nullptr : GetLevel()->linePortals[portalindex].mDestination;
|
||||
}
|
||||
|
||||
inline int line_t::getPortalFlags() const
|
||||
{
|
||||
return portalindex >= GetLevel()->linePortals.Size() ? 0 : GetLevel()->linePortals[portalindex].mFlags;
|
||||
}
|
||||
|
||||
inline int line_t::getPortalAlignment() const
|
||||
{
|
||||
return portalindex >= GetLevel()->linePortals.Size() ? 0 : GetLevel()->linePortals[portalindex].mAlign;
|
||||
}
|
||||
|
||||
inline int line_t::getPortalType() const
|
||||
{
|
||||
return portalindex >= GetLevel()->linePortals.Size() ? 0 : GetLevel()->linePortals[portalindex].mType;
|
||||
}
|
||||
|
||||
inline DVector2 line_t::getPortalDisplacement() const
|
||||
{
|
||||
return portalindex >= GetLevel()->linePortals.Size() ? DVector2(0., 0.) : GetLevel()->linePortals[portalindex].mDisplacement;
|
||||
}
|
||||
|
||||
inline DAngle line_t::getPortalAngleDiff() const
|
||||
{
|
||||
return portalindex >= GetLevel()->linePortals.Size() ? DAngle::fromDeg(0.) : GetLevel()->linePortals[portalindex].mAngleDiff;
|
||||
}
|
||||
|
||||
inline bool line_t::hitSkyWall(AActor* mo) const
|
||||
{
|
||||
return backsector &&
|
||||
|
|
|
@ -1504,7 +1504,11 @@ struct line_t : public linebase_t
|
|||
inline bool isLinePortal() const;
|
||||
inline bool isVisualPortal() const;
|
||||
inline line_t *getPortalDestination() const;
|
||||
inline int getPortalFlags() const;
|
||||
inline int getPortalAlignment() const;
|
||||
inline int getPortalType() const;
|
||||
inline DVector2 getPortalDisplacement() const;
|
||||
inline DAngle getPortalAngleDiff() const;
|
||||
inline bool hitSkyWall(AActor* mo) const;
|
||||
|
||||
int Index() const { return linenum; }
|
||||
|
|
|
@ -51,6 +51,17 @@ DEFINE_FIELD(FSectorPortal, mDisplacement);
|
|||
DEFINE_FIELD(FSectorPortal, mPlaneZ);
|
||||
DEFINE_FIELD(FSectorPortal, mSkybox);
|
||||
|
||||
DEFINE_FIELD(FLinePortal, mOrigin);
|
||||
DEFINE_FIELD(FLinePortal, mDestination);
|
||||
DEFINE_FIELD(FLinePortal, mDisplacement);
|
||||
DEFINE_FIELD(FLinePortal, mType);
|
||||
DEFINE_FIELD(FLinePortal, mFlags);
|
||||
DEFINE_FIELD(FLinePortal, mDefFlags);
|
||||
DEFINE_FIELD(FLinePortal, mAlign);
|
||||
DEFINE_FIELD(FLinePortal, mAngleDiff);
|
||||
DEFINE_FIELD(FLinePortal, mSinRot);
|
||||
DEFINE_FIELD(FLinePortal, mCosRot);
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// BuildBlockmap
|
||||
|
|
|
@ -708,6 +708,10 @@ void InitThingdef()
|
|||
sectorportalstruct->Size = sizeof(FSectorPortal);
|
||||
sectorportalstruct->Align = alignof(FSectorPortal);
|
||||
|
||||
auto lineportalstruct = NewStruct("LinePortal", nullptr, true);
|
||||
lineportalstruct->Size = sizeof(FLinePortal);
|
||||
lineportalstruct->Align = alignof(FLinePortal);
|
||||
|
||||
auto playerclassstruct = NewStruct("PlayerClass", nullptr, true);
|
||||
playerclassstruct->Size = sizeof(FPlayerClass);
|
||||
playerclassstruct->Align = alignof(FPlayerClass);
|
||||
|
|
|
@ -1199,12 +1199,36 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset)
|
|||
return self->getPortalAlignment();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Line, getPortalFlags)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(line_t);
|
||||
ACTION_RETURN_INT(self->getPortalFlags());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Line, getPortalAlignment, getPortalAlignment)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(line_t);
|
||||
ACTION_RETURN_INT(self->getPortalAlignment());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Line, getPortalType)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(line_t);
|
||||
ACTION_RETURN_INT(self->getPortalType());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Line, getPortalDisplacement)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(line_t);
|
||||
ACTION_RETURN_VEC2(self->getPortalDisplacement());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Line, getPortalAngleDiff)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(line_t);
|
||||
ACTION_RETURN_FLOAT(self->getPortalAngleDiff().Degrees());
|
||||
}
|
||||
|
||||
static int LineIndex(line_t *self)
|
||||
{
|
||||
return self->Index();
|
||||
|
@ -2719,6 +2743,7 @@ DEFINE_FIELD(FLevelLocals, sectors)
|
|||
DEFINE_FIELD(FLevelLocals, lines)
|
||||
DEFINE_FIELD(FLevelLocals, sides)
|
||||
DEFINE_FIELD(FLevelLocals, vertexes)
|
||||
DEFINE_FIELD(FLevelLocals, linePortals)
|
||||
DEFINE_FIELD(FLevelLocals, sectorPortals)
|
||||
DEFINE_FIELD(FLevelLocals, time)
|
||||
DEFINE_FIELD(FLevelLocals, maptime)
|
||||
|
|
|
@ -409,6 +409,7 @@ struct LevelLocals native
|
|||
native Array<@Line> Lines;
|
||||
native Array<@Side> Sides;
|
||||
native readonly Array<@Vertex> Vertexes;
|
||||
native readonly Array<@LinePortal> LinePortals;
|
||||
native internal Array<@SectorPortal> SectorPortals;
|
||||
|
||||
native readonly int time;
|
||||
|
|
|
@ -28,6 +28,47 @@ struct SectorPortal native play
|
|||
native Actor mSkybox;
|
||||
};
|
||||
|
||||
struct LinePortal native play
|
||||
{
|
||||
enum EType
|
||||
{
|
||||
PORTT_VISUAL,
|
||||
PORTT_TELEPORT,
|
||||
PORTT_INTERACTIVE,
|
||||
PORTT_LINKED,
|
||||
PORTT_LINKEDEE // Eternity compatible definition which uses only one line ID and a different anchor type to link to.
|
||||
};
|
||||
|
||||
enum EFlags
|
||||
{
|
||||
PORTF_VISIBLE = 1,
|
||||
PORTF_PASSABLE = 2,
|
||||
PORTF_SOUNDTRAVERSE = 4,
|
||||
PORTF_INTERACTIVE = 8,
|
||||
PORTF_POLYOBJ = 16,
|
||||
|
||||
PORTF_TYPETELEPORT = PORTF_VISIBLE | PORTF_PASSABLE | PORTF_SOUNDTRAVERSE,
|
||||
PORTF_TYPEINTERACTIVE = PORTF_VISIBLE | PORTF_PASSABLE | PORTF_SOUNDTRAVERSE | PORTF_INTERACTIVE,
|
||||
};
|
||||
|
||||
enum EAlignment
|
||||
{
|
||||
PORG_ABSOLUTE, // does not align at all. z-ccoordinates must match.
|
||||
PORG_FLOOR,
|
||||
PORG_CEILING,
|
||||
};
|
||||
|
||||
native Line mOrigin;
|
||||
native Line mDestination;
|
||||
native Vector2 mDisplacement;
|
||||
native uint8 mType;
|
||||
native uint8 mFlags;
|
||||
native uint8 mDefFlags;
|
||||
native uint8 mAlign;
|
||||
native double mAngleDiff;
|
||||
native double mSinRot;
|
||||
native double mCosRot;
|
||||
}
|
||||
|
||||
struct Vertex native play
|
||||
{
|
||||
|
@ -189,7 +230,11 @@ struct Line native play
|
|||
native clearscope bool isLinePortal() const;
|
||||
native clearscope bool isVisualPortal() const;
|
||||
native clearscope Line getPortalDestination() const;
|
||||
native clearscope int getPortalFlags() const;
|
||||
native clearscope int getPortalAlignment() const;
|
||||
native clearscope int getPortalType() const;
|
||||
native clearscope Vector2 getPortalDisplacement() const;
|
||||
native clearscope double getPortalAngleDiff() const;
|
||||
native clearscope int Index() const;
|
||||
native bool Activate(Actor activator, int side, int type);
|
||||
native bool RemoteActivate(Actor activator, int side, int type, Vector3 pos);
|
||||
|
|
Loading…
Reference in a new issue