From bcd0b044883a18eeeda61897bb01a2a731951264 Mon Sep 17 00:00:00 2001
From: James <jameshall.yahoosucks@gmail.com>
Date: Thu, 29 Aug 2019 17:17:58 -0400
Subject: [PATCH] Forgot to account for z axis -- thanks James R

---
 src/p_user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/p_user.c b/src/p_user.c
index b93cf5b441..2903e546f3 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -11578,7 +11578,7 @@ void P_PlayerAfterThink(player_t *player)
 	if (splitscreen && player == &players[secondarydisplayplayer])
 	{
 		thiscam = &camera2;
-		if (P_AproxDistance(player->mo->x-thiscam->x-thiscam->momx, player->mo->y-thiscam->y-thiscam->momy) > ((player->speed+cv_cam2_dist.value)*2))
+		if ((P_AproxDistance(player->mo->x-thiscam->x-thiscam->momx, player->mo->y-thiscam->y-thiscam->momy) > ((player->speed+cv_cam2_dist.value)*2)) || (abs(thiscam->z - player->mo->z) > ((player->speed+cv_cam2_dist.value)*2)))
 		{
 			P_ResetCamera(player, thiscam);
 		}
@@ -11586,7 +11586,7 @@ void P_PlayerAfterThink(player_t *player)
 	else if (player == &players[displayplayer])
 	{
 		thiscam = &camera;
-		if (P_AproxDistance(player->mo->x-thiscam->x-thiscam->momx, player->mo->y-thiscam->y-thiscam->momy) > ((player->speed+cv_cam_dist.value)*2))
+		if ((P_AproxDistance(player->mo->x-thiscam->x-thiscam->momx, player->mo->y-thiscam->y-thiscam->momy) > ((player->speed+cv_cam_dist.value)*2)) || (abs(thiscam->z - player->mo->z) > ((player->speed+cv_cam_dist.value)*2)))
 		{
 			P_ResetCamera(player, thiscam);
 		}
-- 
GitLab