diff --git a/src/Cheats.cpp b/src/Cheats.cpp index 00fd55d2..41f69926 100644 --- a/src/Cheats.cpp +++ b/src/Cheats.cpp @@ -30,7 +30,7 @@ Variable sar_autorecord("sar_autorecord", "0", -1, 1, "Enables or disables autom Variable sar_autojump("sar_autojump", "0", "Enables automatic jumping on the server.\n"); Variable sar_autostrafe("sar_autostrafe", "0", "Automatically strafes in your current wishdir.\n"); Variable sar_ensure_slope_boost("sar_ensure_slope_boost", "0", "Ensures a successful slope boost."); - Variable sar_jumpboost("sar_jumpboost", "0", 0, +Variable sar_jumpboost("sar_jumpboost", "0", 0, "Enables special game movement on the server.\n" "0 = Default,\n" "1 = Orange Box Engine,\n" @@ -444,13 +444,17 @@ void Cheats::EnsureSlopeBoost(const CHLMoveData *move, void *player, CGameTrace if (!server->AllowsMovementChanges() || !sar_ensure_slope_boost.GetBool()) { return; } + + Vector velocity = move->m_vecVelocity; + Vector hitNormal = (*tr)->plane.normal; - bool goingDown = move->m_vecVelocity.z < 0; + bool goingDown = velocity.z < 0; bool isntAlreadyGrounded = !(SE(player)->ground_entity()); - bool landedOnSlope = (*tr)->plane.normal.z < 1.0f; + bool landedOnSlope = hitNormal.z < 1.0f; bool wantsToSnapToGround = (*tr)->fraction >= 0.000001f; + bool boostingTowardsVelocity = hitNormal.x * velocity.x + hitNormal.y * velocity.y >= 0; - if (goingDown && isntAlreadyGrounded && landedOnSlope && wantsToSnapToGround) { + if (goingDown && isntAlreadyGrounded && landedOnSlope && wantsToSnapToGround && boostingTowardsVelocity) { // Nulling out pointer by reference, so that it's passed in CGameMovement::SetGroundEntity, // preventing being grounded on this call, letting the player to boost off slope *tr = NULL;