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
2 changes: 1 addition & 1 deletion docs/cvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
|sar_hud_ghost_spec|0|Show the name of the ghost you're currently spectating.|
|sar_hud_grounded|0|Draws the state of player being on ground.|
|sar_hud_groundframes|0|Draws the number of ground frames since last landing. Setting it to 2 preserves the value.|
|sar_hud_groundspeed|0|Draw the speed of the player upon leaving the ground.|
|sar_hud_groundspeed|0|Draw the speed of the player upon leaving the ground.<br>0 = Default,<br>1 = Groundspeed,<br>2 = Groundspeed (Gain)|
|sar_hud_hide_text|cmd|sar_hud_hide_text \<id\|all> - hides the nth text value in the HUD|
|sar_hud_inspection|0|Draws entity inspection data.|
|sar_hud_jump|0|Draws current jump distance.|
Expand Down
16 changes: 13 additions & 3 deletions src/Features/Hud/Hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,15 @@ HUD_ELEMENT_MODE2(velang, "0", 0, 2,
ctx->DrawElement("velang: -");
}
}
HUD_ELEMENT2(groundspeed, "0", "Draw the speed of the player upon leaving the ground.\n", HudType_InGame | HudType_Paused | HudType_LoadingScreen) {
HUD_ELEMENT_MODE2(groundspeed, "0", 0, 2, "Draw the speed of the player upon leaving the ground.\n"
"0 = Default\n"
"1 = Groundspeed\n"
"2 = Groundspeed (Gain)\n",
HudType_InGame | HudType_Paused | HudType_LoadingScreen) {
static float speeds[2];
static float drawSpeeds[2];
static bool groundeds[2];
static float lastSpeeds[2] = {0};

auto player = client->GetPlayer(ctx->slot + 1);
if (!player) {
Expand All @@ -779,10 +784,15 @@ HUD_ELEMENT2(groundspeed, "0", "Draw the speed of the player upon leaving the gr
speeds[ctx->slot] = client->GetLocalVelocity(player).Length();
} else if (groundeds[ctx->slot]) {
groundeds[ctx->slot] = false;
lastSpeeds[ctx->slot] = drawSpeeds[ctx->slot];
drawSpeeds[ctx->slot] = speeds[ctx->slot];
}

ctx->DrawElement("groundspeed: %.*f", getPrecision(true), drawSpeeds[ctx->slot]);
if (mode == 2) {
ctx->DrawElement("groundspeed: %.*f (%.*f)", getPrecision(true), drawSpeeds[ctx->slot], getPrecision(true), drawSpeeds[ctx->slot] - lastSpeeds[ctx->slot]);
} else {
ctx->DrawElement("groundspeed: %.*f", getPrecision(true), drawSpeeds[ctx->slot]);
}

}
QAngle g_bluePortalAngles[2];
QAngle g_orangePortalAngles[2];
Expand Down