From b34d564e3cd9a4283de6c59ea36783714f2f18e3 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 31 Jan 2024 17:52:38 +0700 Subject: [PATCH] PM_CheckWater: Fix for uninitialized waterlevel value for dead players (incorrect waterlevel values from another player movements persisting) --- regamedll/pm_shared/pm_shared.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index 9aac4254..ed681976 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -1345,27 +1345,27 @@ qboolean PM_InWater() // Sets pmove->waterlevel and pmove->watertype values. qboolean PM_CheckWater() { -#ifdef REGAMEDLL_FIXES - // do not check for dead - if (pmove->dead || pmove->deadflag != DEAD_NO) - return FALSE; -#endif - vec3_t point; int cont; int truecont; float height; float heightover2; + // Assume that we are not in water at all. + pmove->waterlevel = 0; + pmove->watertype = CONTENTS_EMPTY; + +#ifdef REGAMEDLL_FIXES + // do not check for dead + if (pmove->dead || pmove->deadflag != DEAD_NO) + return FALSE; +#endif + // Pick a spot just above the players feet. point[0] = pmove->origin[0] + (pmove->player_mins[pmove->usehull][0] + pmove->player_maxs[pmove->usehull][0]) * 0.5f; point[1] = pmove->origin[1] + (pmove->player_mins[pmove->usehull][1] + pmove->player_maxs[pmove->usehull][1]) * 0.5f; point[2] = pmove->origin[2] + pmove->player_mins[pmove->usehull][2] + 1; - // Assume that we are not in water at all. - pmove->waterlevel = 0; - pmove->watertype = CONTENTS_EMPTY; - // Grab point contents. cont = pmove->PM_PointContents(point, &truecont);