Skip to content

Commit

Permalink
Use waterlevel constans in the remaining places
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeSlave committed Dec 13, 2024
1 parent fc52b30 commit 203a69e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions dlls/crossbow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void CCrossbowBolt::BubbleThink( void )
{
pev->nextthink = gpGlobals->time + 0.1f;

if( pev->waterlevel == 0 )
if( pev->waterlevel == WL_NotInWater )
return;

UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1f, pev->origin, 1 );
Expand Down Expand Up @@ -409,7 +409,7 @@ void CCrossbow::FireBolt()
pBolt->pev->angles = anglesAim;
pBolt->pev->owner = m_pPlayer->edict();

if( m_pPlayer->pev->waterlevel == 3 )
if( m_pPlayer->pev->waterlevel == WL_Eyes )
{
pBolt->pev->velocity = vecDir * BOLT_WATER_VELOCITY;
pBolt->pev->speed = BOLT_WATER_VELOCITY;
Expand Down
4 changes: 2 additions & 2 deletions dlls/rpg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void CRpgRocket::FollowThink( void )
if( gpGlobals->time - m_flIgniteTime < 1.0f )
{
pev->velocity = pev->velocity * 0.2f + vecTarget * ( flSpeed * 0.8f + 400.0f );
if( pev->waterlevel == 3 )
if( pev->waterlevel == WL_Eyes )
{
// go slow underwater
if( pev->velocity.Length() > 300.0f )
Expand All @@ -308,7 +308,7 @@ void CRpgRocket::FollowThink( void )
StopSoundScript(rocketIgniteSoundScript);
}
pev->velocity = pev->velocity * 0.2f + vecTarget * flSpeed * 0.798f;
if( pev->waterlevel == 0 && pev->velocity.Length() < 1500.0f )
if( pev->waterlevel == WL_NotInWater && pev->velocity.Length() < 1500.0f )
Detonate();
}
// ALERT( at_console, "%.0f\n", flSpeed );
Expand Down
4 changes: 2 additions & 2 deletions dlls/satchel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ void CSatchelCharge::SatchelThink( void )
return;
}

if( pev->waterlevel == 3 )
if( pev->waterlevel == WL_Eyes )
{
pev->movetype = MOVETYPE_FLY;
pev->velocity = pev->velocity * 0.8f;
pev->avelocity = pev->avelocity * 0.9f;
pev->velocity.z += 8;
}
else if( pev->waterlevel == 0 )
else if( pev->waterlevel == WL_NotInWater )
{
pev->movetype = MOVETYPE_BOUNCE;
}
Expand Down
2 changes: 1 addition & 1 deletion dlls/squeakgrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void CSqueakGrenade::HuntThink( void )
}

// float
if( pev->waterlevel != 0 )
if( pev->waterlevel != WL_NotInWater )
{
if( pev->movetype == MOVETYPE_BOUNCE )
{
Expand Down
26 changes: 13 additions & 13 deletions pm_shared/pm_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ void PM_WalkMove( void )
}

// Don't walk up stairs if not on ground.
if( oldonground == -1 && pmove->waterlevel == 0 )
if( oldonground == -1 && pmove->waterlevel == WL_NotInWater )
return;

if( pmove->waterjumptime ) // If we are jumping out of water, don't do anything more.
Expand Down Expand Up @@ -1234,7 +1234,7 @@ void PM_AirMove( void )

qboolean PM_InWater( void )
{
return ( pmove->waterlevel > 1 );
return ( pmove->waterlevel > WL_Feet );
}

/*
Expand All @@ -1258,7 +1258,7 @@ qboolean PM_CheckWater( void )
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->waterlevel = WL_NotInWater;
pmove->watertype = CONTENTS_EMPTY;

// Grab point contents.
Expand All @@ -1270,7 +1270,7 @@ qboolean PM_CheckWater( void )
pmove->watertype = cont;

// We are at least at level one
pmove->waterlevel = 1;
pmove->waterlevel = WL_Feet;

height = ( pmove->player_mins[pmove->usehull][2] + pmove->player_maxs[pmove->usehull][2] );
heightover2 = height * 0.5f;
Expand All @@ -1282,14 +1282,14 @@ qboolean PM_CheckWater( void )
if( cont <= CONTENTS_WATER && cont > CONTENTS_TRANSLUCENT )
{
// Set a higher water level.
pmove->waterlevel = 2;
pmove->waterlevel = WL_Waist;

// Now check the eye position. (view_ofs is relative to the origin)
point[2] = pmove->origin[2] + pmove->view_ofs[2];

cont = pmove->PM_PointContents( point, NULL );
if( cont <= CONTENTS_WATER && cont > CONTENTS_TRANSLUCENT )
pmove->waterlevel = 3; // In over our eyes
pmove->waterlevel = WL_Eyes; // In over our eyes
}

// Adjust velocity based on water current, if any.
Expand All @@ -1310,7 +1310,7 @@ qboolean PM_CheckWater( void )
}
}

return pmove->waterlevel > 1;
return pmove->waterlevel > WL_Feet;
}

/*
Expand Down Expand Up @@ -1359,7 +1359,7 @@ void PM_CatagorizePosition( void )
// Then we are not in water jump sequence
pmove->waterjumptime = 0;
// If we could make the move, drop us down that 1 pixel
if( pmove->waterlevel < 2 && !tr.startsolid && !tr.allsolid )
if( pmove->waterlevel < WL_Waist && !tr.startsolid && !tr.allsolid )
VectorCopy( tr.endpos, pmove->origin );
}

Expand Down Expand Up @@ -2251,7 +2251,7 @@ void PM_Jump( void )
}

// If we are in the water most of the way...
if( pmove->waterlevel >= 2 )
if( pmove->waterlevel >= WL_Waist )
{
// swimming, not jumping
pmove->onground = -1;
Expand Down Expand Up @@ -2436,7 +2436,7 @@ void PM_CheckFalling( void )
{
float fvol = 0.5f;

if( pmove->waterlevel > 0 )
if( pmove->waterlevel > WL_NotInWater )
{
}
else if( pmove->flFallVelocity > PLAYER_MAX_SAFE_FALL_SPEED )
Expand Down Expand Up @@ -2506,7 +2506,7 @@ PM_PlayWaterSounds
void PM_PlayWaterSounds( void )
{
// Did we enter or leave water?
if( ( pmove->oldwaterlevel == 0 && pmove->waterlevel != 0 ) || ( pmove->oldwaterlevel != 0 && pmove->waterlevel == 0 ) )
if( ( pmove->oldwaterlevel == WL_NotInWater && pmove->waterlevel != WL_NotInWater ) || ( pmove->oldwaterlevel != WL_NotInWater && pmove->waterlevel == WL_NotInWater ) )
{
switch( pmove->RandomLong( 0, 3 ) )
{
Expand Down Expand Up @@ -2835,9 +2835,9 @@ void PM_PlayerMove( qboolean server )

// If we are swimming in the water, see if we are nudging against a place we can jump up out
// of, and, if so, start out jump. Otherwise, if we are not moving up, then reset jump timer to 0
if( pmove->waterlevel >= 2 )
if( pmove->waterlevel >= WL_Waist )
{
if( pmove->waterlevel == 2 )
if( pmove->waterlevel == WL_Waist )
{
PM_CheckWaterJump();
}
Expand Down

0 comments on commit 203a69e

Please sign in to comment.