Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions src/game/client/neo/c_neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,6 @@ void C_NEO_Player::PlayStepSound( Vector &vecOrigin,
BaseClass::PlayStepSound(vecOrigin, psurface, fvol, force);
}

extern ConVar neo_ghost_bhopping;
void C_NEO_Player::CalculateSpeed(void)
{
float speed = GetNormSpeed();
Expand Down Expand Up @@ -877,17 +876,6 @@ void C_NEO_Player::CalculateSpeed(void)
speed = MIN(GetFlags() & FL_DUCKING ? NEO_CROUCH_WALK_SPEED : NEO_WALK_SPEED, speed);
}

Vector absoluteVelocity = GetAbsVelocity();
absoluteVelocity.z = 0.f;
float currentSpeed = absoluteVelocity.Length();

if (((!neo_ghost_bhopping.GetBool() && m_bCarryingGhost) || m_iNeoClass == NEO_CLASS_JUGGERNAUT) && GetMoveType() == MOVETYPE_WALK && currentSpeed > speed)
{
float overSpeed = currentSpeed - speed;
absoluteVelocity.NormalizeInPlace();
absoluteVelocity *= -overSpeed;
ApplyAbsVelocityImpulse(absoluteVelocity);
}
speed = MAX(speed, 55);

// Slowdown after jumping
Expand Down Expand Up @@ -1770,6 +1758,11 @@ bool C_NEO_Player::IsCarryingGhost(void) const
return GetNeoWepWithBits(this, NEO_WEP_GHOST) != NULL;
}

bool C_NEO_Player::IsObjective(void) const
{
return IsCarryingGhost() || GetClass() == NEO_CLASS_VIP || GetClass() == NEO_CLASS_JUGGERNAUT;
}

const Vector C_NEO_Player::GetPlayerMins(void) const
{
return VEC_DUCK_HULL_MIN_SCALED(this);
Expand Down
1 change: 1 addition & 0 deletions src/game/client/neo/c_neo_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class C_NEO_Player : public C_HL2MP_Player
int GetDisplayedHealth(bool asPercent) const;

bool IsCarryingGhost(void) const;
bool IsObjective(void) const;

virtual void SetLocalViewAngles( const QAngle &viewAngles ) OVERRIDE
{
Expand Down
17 changes: 5 additions & 12 deletions src/game/server/neo/neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,6 @@ void CNEO_Player::CheckLeanButtons()
}
}

extern ConVar neo_ghost_bhopping;
void CNEO_Player::CalculateSpeed(void)
{
float speed = GetNormSpeed();
Expand Down Expand Up @@ -729,17 +728,6 @@ void CNEO_Player::CalculateSpeed(void)
speed = MIN(GetFlags() & FL_DUCKING ? NEO_CROUCH_WALK_SPEED : NEO_WALK_SPEED, speed);
}

Vector absoluteVelocity = GetAbsVelocity();
absoluteVelocity.z = 0.f;
float currentSpeed = absoluteVelocity.Length();

if (((!neo_ghost_bhopping.GetBool() && m_bCarryingGhost) || m_iNeoClass == NEO_CLASS_JUGGERNAUT) && GetMoveType() == MOVETYPE_WALK && currentSpeed > speed)
{
float overSpeed = currentSpeed - speed;
absoluteVelocity.NormalizeInPlace();
absoluteVelocity *= -overSpeed;
ApplyAbsVelocityImpulse(absoluteVelocity);
}
speed = MAX(speed, 55);

// Slowdown after jumping
Expand Down Expand Up @@ -2398,6 +2386,11 @@ bool CNEO_Player::IsCarryingGhost(void) const
return GetNeoWepWithBits(this, NEO_WEP_GHOST) != NULL;
}

bool CNEO_Player::IsObjective(void) const
{
return IsCarryingGhost() || GetClass() == NEO_CLASS_VIP || GetClass() == NEO_CLASS_JUGGERNAUT;
}

void CNEO_Player::Weapon_Drop( CBaseCombatWeapon *pWeapon,
const Vector *pvecTarget, const Vector *pVelocity )
{
Expand Down
1 change: 1 addition & 0 deletions src/game/server/neo/neo_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class CNEO_Player : public CHL2MP_Player
virtual bool CanHearAndReadChatFrom(CBasePlayer *pPlayer) OVERRIDE;

bool IsCarryingGhost(void) const;
bool IsObjective(void) const;

void Weapon_AimToggle(CNEOBaseCombatWeapon *pWep, const NeoWeponAimToggleE toggleType);

Expand Down
82 changes: 81 additions & 1 deletion src/game/shared/gamemovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,68 @@ void CGameMovement::Friction( void )
mv->m_outWishVel -= (1.f-newspeed) * mv->m_vecVelocity;
}

#ifdef NEO
ConVar sv_airfriction("sv_neo_airfriction", "0", FCVAR_NOTIFY | FCVAR_REPLICATED, "Air friction.", true, 0, false, 0);
ConVar sv_airfriction_objective("sv_neo_airfriction_objective", "0.5", FCVAR_NOTIFY | FCVAR_REPLICATED, "Air friction for ghost carrier, VIP and juggernaut.", true, 0, false, 0);
ConVar sv_airstopspeed("sv_neo_airstopspeed", "0", FCVAR_NOTIFY | FCVAR_REPLICATED, "Minimum stopping speed when in the air.", true, 0, false, 0);
ConVar sv_jumpbuffer("sv_neo_jumpbuffer", "0", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_CHEAT, "Allow Quake style jump buffering.", true, 0, true, 1);

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CGameMovement::AirFriction( void )
{
float speed, newspeed, control;
float friction;
float drop;

// Friction only works horizontally so zero out the z component
float z = mv->m_vecVelocity.z;
mv->m_vecVelocity.z = 0;
speed = VectorLength( mv->m_vecVelocity );

// If too slow, return
auto neoplayer = ToNEOPlayer(player);
float overspeed = speed - neoplayer->GetNormSpeed_WithActiveWepEncumberment();
if (overspeed < 0.1f)
{
// Restore z component
mv->m_vecVelocity.z = z;
return;
}

drop = 0;

// apply air friction
friction = neoplayer->IsObjective() ? sv_airfriction_objective.GetFloat() : sv_airfriction.GetFloat();

// Bleed off some speed, but if we have less than the bleed
// threshold, bleed the threshold amount.
control = (overspeed < sv_airstopspeed.GetFloat()) ? sv_airstopspeed.GetFloat() : overspeed;

// Add the amount to the drop amount.
drop += control*friction*gpGlobals->frametime;

// scale the velocity
newspeed = speed - drop;
if (newspeed < 0)
newspeed = 0;

if ( newspeed != speed )
{
// Determine proportion of old speed we are using.
newspeed /= speed;
// Adjust velocity according to proportion.
VectorScale( mv->m_vecVelocity, newspeed, mv->m_vecVelocity );
}

// Restore z component
mv->m_vecVelocity.z = z;

mv->m_outWishVel -= (1.f-newspeed) * mv->m_vecVelocity;
}
#endif

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -2145,6 +2207,12 @@ void CGameMovement::FullWalkMove( )
mv->m_vecVelocity[2] = 0.0;
Friction();
}
#ifdef NEO
else
{
AirFriction();
}
#endif

// Make sure velocity is valid.
CheckVelocity();
Expand Down Expand Up @@ -2442,7 +2510,19 @@ bool CGameMovement::CheckJumpButton( void )
// No more effect
if (player->GetGroundEntity() == NULL)
{
mv->m_nOldButtons |= IN_JUMP;
#ifdef NEO
if (sv_jumpbuffer.GetBool())
{
if (!(mv->m_nOldButtons & IN_JUMP))
{
mv->m_nButtons &= ~IN_JUMP;
}
}
else
#endif
{
mv->m_nOldButtons |= IN_JUMP;
}
return false; // in air, so no effect
}

Expand Down
4 changes: 4 additions & 0 deletions src/game/shared/gamemovement.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ class CGameMovement : public IGameMovement
// Handles both ground friction and water friction
void Friction( void );

#ifdef NEO
void AirFriction( void );
#endif

virtual void AirAccelerate( Vector& wishdir, float wishspeed, float accel );

virtual void AirMove( void );
Expand Down
1 change: 0 additions & 1 deletion src/game/shared/neo/neo_player_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ConVar cl_autoreload_when_empty("cl_autoreload_when_empty", "1", FCVAR_USERINFO
ConVar neo_aim_hold("neo_aim_hold", "0", FCVAR_USERINFO | FCVAR_ARCHIVE, "Hold to aim as opposed to toggle aim.", true, 0.0f, true, 1.0f);
#endif

ConVar neo_ghost_bhopping("neo_ghost_bhopping", "0", FCVAR_REPLICATED, "Allow ghost bunnyhopping", true, 0, true, 1);
ConVar sv_neo_dev_loadout("sv_neo_dev_loadout", "0", FCVAR_CHEAT | FCVAR_REPLICATED | FCVAR_HIDDEN | FCVAR_DONTRECORD, "", true, 0.0f, true, 1.0f);

bool IsAllowedToZoom(CNEOBaseCombatWeapon *pWep)
Expand Down
Loading