From 1e6150e7fe81345033e4e54284b4df426b27fa61 Mon Sep 17 00:00:00 2001
From: MascaraSnake <jonassauer27@gmail.com>
Date: Thu, 24 Nov 2022 22:20:54 +0100
Subject: [PATCH] Dynamic slope vertices: Allow untagged vertices which don't
 move

---
 src/p_slopes.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/p_slopes.c b/src/p_slopes.c
index 8e00d58241..2c0e3d88ba 100644
--- a/src/p_slopes.c
+++ b/src/p_slopes.c
@@ -172,6 +172,9 @@ void T_DynamicSlopeVert (dynvertexplanethink_t* th)
 
 	for (i = 0; i < 3; i++)
 	{
+		if (!th->secs[i])
+			continue;
+
 		if (th->relative & (1 << i))
 			th->vex[i].z = th->origvecheights[i] + (th->secs[i]->floorheight - th->origsecheights[i]);
 		else
@@ -205,16 +208,11 @@ static inline void P_AddDynVertexSlopeThinker (pslope_t* slope, const INT16 tags
 
 	for (i = 0; i < 3; i++) {
 		l = Tag_FindLineSpecial(799, tags[i]);
-		if (l == -1)
-		{
-			Z_Free(th);
-			return;
-		}
-		th->secs[i] = lines[l].frontsector;
+		th->secs[i] = (l == -1) ? NULL : lines[l].frontsector;
 		th->vex[i] = vx[i];
-		th->origsecheights[i] = lines[l].frontsector->floorheight;
+		th->origsecheights[i] = (l == -1) ? 0 : lines[l].frontsector->floorheight;
 		th->origvecheights[i] = vx[i].z;
-		if (lines[l].args[0])
+		if (l != -1 && lines[l].args[0])
 			th->relative |= 1<<i;
 	}
 	P_AddThinker(THINK_DYNSLOPE, &th->thinker);
-- 
GitLab