From 24e5ccec0b4d777d4dfe97cf224637ba04a7685f Mon Sep 17 00:00:00 2001
From: toaster <rollerorbital@gmail.com>
Date: Fri, 8 Nov 2019 19:40:40 +0000
Subject: [PATCH] Fix players being launched by slopes and pmomz when dying.

---
 src/p_inter.c | 2 ++
 src/p_mobj.c  | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/p_inter.c b/src/p_inter.c
index 9017f795d3..70ea1324cf 100644
--- a/src/p_inter.c
+++ b/src/p_inter.c
@@ -2482,6 +2482,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
 		P_UnsetThingPosition(target);
 		target->flags |= MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY;
 		P_SetThingPosition(target);
+		target->standingslope = NULL;
+		target->pmomz = 0;
 
 		if (target->player->powers[pw_super])
 		{
diff --git a/src/p_mobj.c b/src/p_mobj.c
index 5735dc27bc..ab29926c7f 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -1861,6 +1861,9 @@ void P_XYMovement(mobj_t *mo)
 	oldy = mo->y;
 
 #ifdef ESLOPE
+	if (mo->flags & MF_NOCLIPHEIGHT)
+		mo->standingslope = NULL;
+
 	// adjust various things based on slope
 	if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8) {
 		if (!P_IsObjectOnGround(mo)) { // We fell off at some point? Do the twisty thing!
@@ -2051,7 +2054,7 @@ void P_XYMovement(mobj_t *mo)
 		return;
 
 #ifdef ESLOPE
-	if (moved && oldslope) { // Check to see if we ran off
+	if (moved && oldslope && !(mo->flags & MF_NOCLIPHEIGHT)) { // Check to see if we ran off
 
 		if (oldslope != mo->standingslope) { // First, compare different slopes
 			angle_t oldangle, newangle;
-- 
GitLab