Modify to have one GetVertexZ rather than IsVertexZSet / GetVertexZ

This commit is contained in:
ZZYZX 2022-09-04 11:25:00 +03:00 committed by Rachael Alexanderson
parent a58acfc625
commit f049421831
2 changed files with 19 additions and 22 deletions

View file

@ -443,30 +443,28 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetVertexZ)
PARAM_UINT(vertex); PARAM_UINT(vertex);
PARAM_INT(planeval); PARAM_INT(planeval);
if (vertex < self->Level->vertexes.Size() && vertex < self->loader->vertexdatas.Size()) double value = 0;
{ bool isset = false;
vertexdata_t& data = self->loader->vertexdatas[vertex];
double value = planeval ? data.zFloor : data.zCeiling;
ACTION_RETURN_FLOAT(value);
}
ACTION_RETURN_FLOAT(0);
}
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, IsVertexZSet)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_UINT(vertex);
PARAM_INT(planeval);
if (vertex < self->Level->vertexes.Size() && vertex < self->loader->vertexdatas.Size()) if (vertex < self->Level->vertexes.Size() && vertex < self->loader->vertexdatas.Size())
{ {
vertexdata_t& data = self->loader->vertexdatas[vertex]; vertexdata_t& data = self->loader->vertexdatas[vertex];
bool value = data.flags & (planeval ? VERTEXFLAG_ZFloorEnabled : VERTEXFLAG_ZCeilingEnabled); value = planeval ? data.zFloor : data.zCeiling;
ACTION_RETURN_BOOL(value); isset = data.flags & (planeval ? VERTEXFLAG_ZFloorEnabled : VERTEXFLAG_ZCeilingEnabled);
} }
ACTION_RETURN_BOOL(false); if (numret > 1)
{
numret = 2;
ret[1].SetInt(isset);
}
if (numret > 0)
{
ret[0].SetFloat(value);
}
return numret;
} }
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetVertexZ) DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetVertexZ)
@ -493,7 +491,7 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetVertexZ)
return 0; return 0;
} }
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, UnsetVertexZ) DEFINE_ACTION_FUNCTION(DLevelPostProcessor, RemoveVertexZ)
{ {
PARAM_SELF_PROLOGUE(DLevelPostProcessor); PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_UINT(vertex); PARAM_UINT(vertex);

View file

@ -47,10 +47,9 @@ class LevelPostProcessor native play
protected native void SetThingStringArgument(uint thing, Name value); protected native void SetThingStringArgument(uint thing, Name value);
protected native void SetVertex(uint vertex, double x, double y); protected native void SetVertex(uint vertex, double x, double y);
protected native double GetVertexZ(uint vertex, int plane); protected native double, bool GetVertexZ(uint vertex, int plane);
protected native bool IsVertexZSet(uint vertex, int plane);
protected native void SetVertexZ(uint vertex, int plane, double z); 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 SetLineVertexes(uint Line, uint v1, uint v2);
protected native void FlipLineSideRefs(uint Line); protected native void FlipLineSideRefs(uint Line);
protected native void SetLineSectorRef(uint line, uint side, uint sector); protected native void SetLineSectorRef(uint line, uint side, uint sector);