PMove: Define waterlevels more appropriately. Add WATERLEVEL_{OUTSIDE,KNEE,CHEST,SUBMERGED} types.

This commit is contained in:
Marco Cawthorne 2022-08-05 14:44:42 -07:00
parent 8532f1264f
commit 8729e973ad
Signed by: eukara
GPG key ID: CE2032F0A2882A22
2 changed files with 12 additions and 4 deletions

View file

@ -22,6 +22,14 @@ int trace_endcontentsi;
.vector basevelocity; .vector basevelocity;
.entity groundentity; .entity groundentity;
typedef enum
{
WATERLEVEL_OUTSIDE,
WATERLEVEL_KNEE,
WATERLEVEL_CHEST,
WATERLEVEL_SUBMERGED
} waterlevel_e;
#ifdef SERVER #ifdef SERVER
void PMove_StartFrame(void); void PMove_StartFrame(void);
#endif #endif

View file

@ -131,16 +131,16 @@ PMoveCustom_Categorize(void)
if (PMoveCustom_Contents(self.origin + self.maxs - [0,0,1]) if (PMoveCustom_Contents(self.origin + self.maxs - [0,0,1])
& CONTENTBITS_FLUID) & CONTENTBITS_FLUID)
{ {
self.waterlevel = 3; self.waterlevel = WATERLEVEL_SUBMERGED;
} else { } else {
self.waterlevel = 2; self.waterlevel = WATERLEVEL_CHEST;
} }
} else { } else {
self.waterlevel = 1; self.waterlevel = WATERLEVEL_KNEE;
} }
} else { } else {
self.watertype = CONTENT_EMPTY; self.watertype = CONTENT_EMPTY;
self.waterlevel = 0; self.waterlevel = WATERLEVEL_OUTSIDE;
} }
} }