Skip to content

Commit

Permalink
Modify to have one GetVertexZ rather than IsVertexZSet / GetVertexZ
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZYZX authored and madame-rachelle committed Sep 20, 2022
1 parent a58acfc commit f049421
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
30 changes: 14 additions & 16 deletions src/maploader/postprocessor.cpp
Expand Up @@ -443,30 +443,28 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetVertexZ)
PARAM_UINT(vertex);
PARAM_INT(planeval);

double value = 0;
bool isset = false;

if (vertex < self->Level->vertexes.Size() && vertex < self->loader->vertexdatas.Size())
{
vertexdata_t& data = self->loader->vertexdatas[vertex];
double value = planeval ? data.zFloor : data.zCeiling;
ACTION_RETURN_FLOAT(value);
value = planeval ? data.zFloor : data.zCeiling;
isset = data.flags & (planeval ? VERTEXFLAG_ZFloorEnabled : VERTEXFLAG_ZCeilingEnabled);
}

ACTION_RETURN_FLOAT(0);
}

DEFINE_ACTION_FUNCTION(DLevelPostProcessor, IsVertexZSet)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_UINT(vertex);
PARAM_INT(planeval);
if (numret > 1)
{
numret = 2;
ret[1].SetInt(isset);
}

if (vertex < self->Level->vertexes.Size() && vertex < self->loader->vertexdatas.Size())
if (numret > 0)
{
vertexdata_t& data = self->loader->vertexdatas[vertex];
bool value = data.flags & (planeval ? VERTEXFLAG_ZFloorEnabled : VERTEXFLAG_ZCeilingEnabled);
ACTION_RETURN_BOOL(value);
ret[0].SetFloat(value);
}

ACTION_RETURN_BOOL(false);
return numret;
}

DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetVertexZ)
Expand All @@ -493,7 +491,7 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetVertexZ)
return 0;
}

DEFINE_ACTION_FUNCTION(DLevelPostProcessor, UnsetVertexZ)
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, RemoveVertexZ)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_UINT(vertex);
Expand Down
5 changes: 2 additions & 3 deletions wadsrc/static/zscript/level_postprocessor.zs
Expand Up @@ -47,10 +47,9 @@ class LevelPostProcessor native play
protected native void SetThingStringArgument(uint thing, Name value);

protected native void SetVertex(uint vertex, double x, double y);
protected native double GetVertexZ(uint vertex, int plane);
protected native bool IsVertexZSet(uint vertex, int plane);
protected native double, bool GetVertexZ(uint vertex, int plane);
protected native void SetVertexZ(uint vertex, int plane, double z);
protected native void UnsetVertexZ(uint vertex, int plane);
protected native void RemoveVertexZ(uint vertex, int plane);
protected native void SetLineVertexes(uint Line, uint v1, uint v2);
protected native void FlipLineSideRefs(uint Line);
protected native void SetLineSectorRef(uint line, uint side, uint sector);
Expand Down

0 comments on commit f049421

Please sign in to comment.