Skip to content

Commit 7ed6f65

Browse files
committed
feat: add implicit step speed hud
1 parent 7afee57 commit 7ed6f65

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

docs/cvars.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
|sar_hud_groundframes|0|Draws the number of ground frames since last landing. Setting it to 2 preserves the value.|
268268
|sar_hud_groundspeed|0|Draw the speed of the player upon leaving the ground.<br>0 = Default<br>1 = Groundspeed<br>2 = Groundspeed (Gain)|
269269
|sar_hud_hide_text|cmd|sar_hud_hide_text \<id\|all> - hides the nth text value in the HUD|
270+
|sar_hud_implicit_step_speed|0|Draw the player's implicit vertical step speed (requires sv_cheats).|
270271
|sar_hud_inspection|0|Draws entity inspection data.|
271272
|sar_hud_jump|0|Draws current jump distance.|
272273
|sar_hud_jump_peak|0|Draws longest jump distance.|

src/Features/Hud/Hud.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ std::vector<std::string> elementOrder = {
301301
"frame",
302302
"last_frame",
303303
"inspection",
304+
"implicit_step_speed"
304305
};
305306

306307
void HudElement::IndexAll() {
@@ -907,6 +908,17 @@ HUD_ELEMENT_MODE2(ent_slot_serial, "0", 0, 4096,
907908
ctx->DrawElement("ent slot %d serial: %d", mode, serial);
908909
}
909910

911+
HUD_ELEMENT2(implicit_step_speed, "0", "Draw the player's implicit vertical step speed (requires sv_cheats).\n", HudType_InGame | HudType_Paused | HudType_LoadingScreen) {
912+
auto player = server->GetPlayer(ctx->slot + 1);
913+
if (!player || !sv_cheats.GetBool()) {
914+
ctx->DrawElement("implicit step speed: -");
915+
return;
916+
}
917+
918+
float implicitStepSpeed = player->fieldOff<float>("m_flUseKeyCooldownTime", 8);
919+
ctx->DrawElement("implicit step speed: %f", implicitStepSpeed);
920+
}
921+
910922
HUD_ELEMENT_MODE2(fps, "0", 0, 2, "Show fps (frames per second) on the SAR hud.\n1 - Show fps\n2 - Show fps with fps cap\n", HudType_InGame | HudType_Paused | HudType_Menu) {
911923
if (mode == 1) {
912924
ctx->DrawElement("fps: %.0f", g_cur_fps);

0 commit comments

Comments
 (0)