Skip to content

Commit 8942ec4

Browse files
authored
feat: add hud angles modes (#308)
1 parent 32f60b0 commit 8942ec4

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docs/cvars.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
|sar_give_fly|cmd|sar_give_fly [n] - gives the player in slot n (0 by default) preserved crouchfly.|
233233
|sar_groundframes_reset|cmd|sar_groundframes_reset - reset recorded groundframe statistics.|
234234
|sar_groundframes_total|cmd|sar_groundframes_total [slot] - output a summary of groundframe counts for the given player slot.|
235-
|sar_hud_angles|0|Draws absolute view angles of the client.<br>0 = Default,<br>1 = XY,<br>2 = XYZ.|
235+
|sar_hud_angles|0|Draws absolute view angles of the client.<br>0 = Default,<br>1 = XY,<br>2 = XYZ,<br>3 = X,<br>4 = Y.|
236236
|sar_hud_avg|0|Draws calculated average of timer.|
237237
|sar_hud_bg|0|Enable the SAR HUD background.|
238238
|sar_hud_cps|0|Draws latest checkpoint of timer.|

src/Features/Hud/Hud.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,11 +638,13 @@ HUD_ELEMENT_MODE2(position, "0", 0, 2,
638638
ctx->DrawElement("pos: -");
639639
}
640640
}
641-
HUD_ELEMENT_MODE2(angles, "0", 0, 2,
641+
HUD_ELEMENT_MODE2(angles, "0", 0, 4,
642642
"Draws absolute view angles of the client.\n"
643643
"0 = Default,\n"
644644
"1 = XY,\n"
645-
"2 = XYZ.\n",
645+
"2 = XYZ,\n"
646+
"3 = X,\n"
647+
"4 = Y.\n",
646648
HudType_InGame | HudType_Paused | HudType_LoadingScreen) {
647649
// When we're orange (and not splitscreen), for some fucking reason,
648650
// the *engine* thinks we're slot 0, but everything else thinks
@@ -651,8 +653,12 @@ HUD_ELEMENT_MODE2(angles, "0", 0, 2,
651653
int p = getPrecision();
652654
if (mode == 1) {
653655
ctx->DrawElement("ang: %.*f %.*f", p, ang.x, p, ang.y);
654-
} else {
656+
} else if (mode == 2) {
655657
ctx->DrawElement("ang: %.*f %.*f %.*f", p, ang.x, p, ang.y, p, ang.z);
658+
} else if (mode == 3) {
659+
ctx->DrawElement("ang: %.*f", p, ang.x);
660+
} else {
661+
ctx->DrawElement("ang: %.*f", p, ang.y);
656662
}
657663
}
658664
HUD_ELEMENT_MODE2(velocity, "0", 0, 5,

0 commit comments

Comments
 (0)