Skip to content

Commit

Permalink
PM_CheckWater: Fix for uninitialized waterlevel value for dead player…
Browse files Browse the repository at this point in the history
…s (incorrect waterlevel values from another player movements persisting)
  • Loading branch information
s1lentq committed Jan 31, 2024
1 parent a1af7ca commit b34d564
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions regamedll/pm_shared/pm_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit b34d564

Please sign in to comment.