-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No ghost bunnyhopping + landing slowdown rework #857
base: master
Are you sure you want to change the base?
Changes from 4 commits
e2af38b
1012061
b8345de
1490ad1
0ae5d6a
af2a74c
8a8beda
52cfe4e
7950f36
a01b304
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -439,6 +439,7 @@ C_NEO_Player::C_NEO_Player() | |
m_bInThermOpticCamo = m_bInVision = false; | ||
m_bHasBeenAirborneForTooLongToSuperJump = false; | ||
m_bInAim = false; | ||
m_bCarryingGhost = false; | ||
m_bIneligibleForLoadoutPick = false; | ||
m_bInLean = NEO_LEAN_NONE; | ||
|
||
|
@@ -798,15 +799,12 @@ void C_NEO_Player::PlayStepSound( Vector &vecOrigin, | |
BaseClass::PlayStepSound(vecOrigin, psurface, fvol, force); | ||
} | ||
|
||
extern ConVar sv_infinite_aux_power; | ||
extern ConVar glow_outline_effect_enable; | ||
void C_NEO_Player::PreThink( void ) | ||
extern ConVar neo_ghost_bhopping; | ||
void C_NEO_Player::CalculateSpeed(void) | ||
{ | ||
BaseClass::PreThink(); | ||
|
||
float speed = GetNormSpeed(); | ||
static constexpr float DUCK_WALK_SPEED_MODIFIER = 0.75; | ||
if (m_nButtons & IN_DUCK) | ||
if (m_nButtons & IN_DUCK || IsDucked() || IsDucking()) | ||
{ | ||
speed *= DUCK_WALK_SPEED_MODIFIER; | ||
} | ||
|
@@ -816,9 +814,9 @@ void C_NEO_Player::PreThink( void ) | |
} | ||
if (IsSprinting() && !IsAirborne()) | ||
{ | ||
static constexpr float RECON_SPRINT_SPEED_MODIFIER = 0.75; | ||
static constexpr float OTHER_CLASSES_SPRINT_SPEED_MODIFIER = 0.6; | ||
speed /= m_iNeoClass == NEO_CLASS_RECON ? RECON_SPRINT_SPEED_MODIFIER : OTHER_CLASSES_SPRINT_SPEED_MODIFIER; | ||
static constexpr float RECON_SPRINT_SPEED_MODIFIER = 1.35; | ||
static constexpr float OTHER_CLASSES_SPRINT_SPEED_MODIFIER = 1.6; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
speed *= m_iNeoClass == NEO_CLASS_RECON ? RECON_SPRINT_SPEED_MODIFIER : OTHER_CLASSES_SPRINT_SPEED_MODIFIER; | ||
} | ||
if (IsInAim()) | ||
{ | ||
|
@@ -830,17 +828,44 @@ void C_NEO_Player::PreThink( void ) | |
speed *= pNeoWep->GetSpeedScale(); | ||
} | ||
|
||
Vector absoluteVelocity = GetAbsVelocity(); | ||
absoluteVelocity.z = 0.f; | ||
float currentSpeed = absoluteVelocity.Length(); | ||
|
||
if (!neo_ghost_bhopping.GetBool() && GetMoveType() != MOVETYPE_LADDER && currentSpeed > speed && m_bCarryingGhost) | ||
{ | ||
float overSpeed = currentSpeed - speed; | ||
absoluteVelocity.NormalizeInPlace(); | ||
absoluteVelocity *= -overSpeed; | ||
ApplyAbsVelocityImpulse(absoluteVelocity); | ||
} | ||
|
||
// Slowdown after landing | ||
if (!IsAirborne() && m_iNeoClass != NEO_CLASS_RECON) | ||
{ | ||
const float deltaTime = gpGlobals->curtime - m_flLastAirborneJumpOkTime; | ||
const float leeway = 1.0f; | ||
if (deltaTime < leeway) | ||
const float timeSinceLanding = gpGlobals->curtime - m_flLastAirborneJumpOkTime; | ||
constexpr float INITIAL_SLOWDOWN_TIME = 0.25f; | ||
constexpr float IMPAIRED_ACCELERATION_TIME = INITIAL_SLOWDOWN_TIME + (1 / 3.f); | ||
if (timeSinceLanding < INITIAL_SLOWDOWN_TIME) | ||
{ | ||
speed = MIN(speed, 75.f); | ||
} | ||
else if (timeSinceLanding < IMPAIRED_ACCELERATION_TIME) | ||
{ | ||
speed = (speed / 2) + (deltaTime / 2 * (speed)); | ||
speed *= timeSinceLanding / IMPAIRED_ACCELERATION_TIME; | ||
} | ||
} | ||
SetMaxSpeed(MAX(speed, 56)); | ||
|
||
} | ||
|
||
extern ConVar sv_infinite_aux_power; | ||
extern ConVar glow_outline_effect_enable; | ||
void C_NEO_Player::PreThink( void ) | ||
{ | ||
BaseClass::PreThink(); | ||
|
||
CalculateSpeed(); | ||
|
||
CheckThermOpticButtons(); | ||
CheckVisionButtons(); | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -399,6 +399,7 @@ CNEO_Player::CNEO_Player() | |||
m_bInThermOpticCamo = m_bInVision = false; | ||||
m_bHasBeenAirborneForTooLongToSuperJump = false; | ||||
m_bInAim = false; | ||||
m_bCarryingGhost = false; | ||||
m_bInLean = NEO_LEAN_NONE; | ||||
|
||||
m_iLoadoutWepChoice = 0; | ||||
|
@@ -662,18 +663,12 @@ void CNEO_Player::CheckLeanButtons() | |||
} | ||||
} | ||||
|
||||
void CNEO_Player::PreThink(void) | ||||
extern ConVar neo_ghost_bhopping; | ||||
void CNEO_Player::CalculateSpeed(void) | ||||
{ | ||||
BaseClass::PreThink(); | ||||
|
||||
if (!m_bInThermOpticCamo) | ||||
{ | ||||
CloakPower_Update(); | ||||
} | ||||
|
||||
float speed = GetNormSpeed(); | ||||
static constexpr float DUCK_WALK_SPEED_MODIFIER = 0.75; | ||||
if (m_nButtons & IN_DUCK) | ||||
if (m_nButtons & IN_DUCK || IsDucked() || IsDucking()) | ||||
{ | ||||
speed *= DUCK_WALK_SPEED_MODIFIER; | ||||
} | ||||
|
@@ -683,30 +678,60 @@ void CNEO_Player::PreThink(void) | |||
} | ||||
if (IsSprinting() && !IsAirborne()) | ||||
{ | ||||
static constexpr float RECON_SPRINT_SPEED_MODIFIER = 0.75; | ||||
static constexpr float OTHER_CLASSES_SPRINT_SPEED_MODIFIER = 0.6; | ||||
speed /= m_iNeoClass == NEO_CLASS_RECON ? RECON_SPRINT_SPEED_MODIFIER : OTHER_CLASSES_SPRINT_SPEED_MODIFIER; | ||||
static constexpr float RECON_SPRINT_SPEED_MODIFIER = 1.35; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this defined in a header somewhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. technically this is the NEO_SPRINT_MODIFIER which has a value of 1.6, but recons have a different sprint modifier to the other classes NEO_RECON_SPRINT_SPEED has a value of 272 if I'm not mistaken (Edit) perhaps they have the same sprint speed modifier, I'm not going to pretend I know how to dive into the dll of the original game and get the exact values, but following the calculations here https://steamcommunity.com/sharedfiles/filedetails/?id=281690103 and ones ive taken myself I can say with confidence that assuming recons have a different sprint speed modifier is a decent enough way of getting the correct speed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nagrywanie.ekranu.2025-01-29.174832.mp4Here is a recording of the sprint speed of a recon in the original after removing all weapons (hence why the viewmodel is slightly off), the value of 272 is 2 units off and we're currently using the speed with a knife or other very light weapon as the base speed anyway (which despite Agiels protests I don't think is really an issue). |
||||
static constexpr float OTHER_CLASSES_SPRINT_SPEED_MODIFIER = 1.6; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||||
speed *= m_iNeoClass == NEO_CLASS_RECON ? RECON_SPRINT_SPEED_MODIFIER : OTHER_CLASSES_SPRINT_SPEED_MODIFIER; | ||||
} | ||||
if (m_bInAim.Get()) | ||||
if (IsInAim()) | ||||
{ | ||||
static constexpr float AIM_SPEED_MODIFIER = 0.6; | ||||
speed *= AIM_SPEED_MODIFIER; | ||||
} | ||||
if (auto pNeoWep = static_cast<CNEOBaseCombatWeapon *>(GetActiveWeapon())) | ||||
if (auto pNeoWep = static_cast<CNEOBaseCombatWeapon*>(GetActiveWeapon())) | ||||
{ | ||||
speed *= pNeoWep->GetSpeedScale(); | ||||
} | ||||
|
||||
Vector absoluteVelocity = GetAbsVelocity(); | ||||
absoluteVelocity.z = 0.f; | ||||
float currentSpeed = absoluteVelocity.Length(); | ||||
|
||||
if (!neo_ghost_bhopping.GetBool() && GetMoveType() != MOVETYPE_LADDER && currentSpeed > speed && m_bCarryingGhost) | ||||
{ | ||||
float overSpeed = currentSpeed - speed; | ||||
absoluteVelocity.NormalizeInPlace(); | ||||
absoluteVelocity *= -overSpeed; | ||||
ApplyAbsVelocityImpulse(absoluteVelocity); | ||||
} | ||||
|
||||
// Slowdown after landing | ||||
if (!IsAirborne() && m_iNeoClass != NEO_CLASS_RECON) | ||||
{ | ||||
const float deltaTime = gpGlobals->curtime - m_flLastAirborneJumpOkTime; | ||||
const float leeway = 1.0f; | ||||
if (deltaTime < leeway) | ||||
const float timeSinceLanding = gpGlobals->curtime - m_flLastAirborneJumpOkTime; | ||||
constexpr float INITIAL_SLOWDOWN_TIME = 0.25f; | ||||
constexpr float IMPAIRED_ACCELERATION_TIME = INITIAL_SLOWDOWN_TIME + (1 / 3.f); | ||||
if (timeSinceLanding < INITIAL_SLOWDOWN_TIME) | ||||
{ | ||||
speed = (speed / 2) + (deltaTime / 2 * (speed)); | ||||
speed = MIN(speed, 75.f); | ||||
} | ||||
else if (timeSinceLanding < IMPAIRED_ACCELERATION_TIME) | ||||
{ | ||||
speed *= timeSinceLanding / IMPAIRED_ACCELERATION_TIME; | ||||
} | ||||
} | ||||
SetMaxSpeed(MAX(speed, 56)); | ||||
} | ||||
|
||||
void CNEO_Player::PreThink(void) | ||||
{ | ||||
BaseClass::PreThink(); | ||||
|
||||
if (!m_bInThermOpticCamo) | ||||
{ | ||||
CloakPower_Update(); | ||||
} | ||||
|
||||
CalculateSpeed(); | ||||
|
||||
CheckThermOpticButtons(); | ||||
CheckVisionButtons(); | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto