mirror of
https://github.com/nzp-team/quakec.git
synced 2025-03-14 23:12:54 +00:00
CLIENT: first pass at Draw_UPS()
This commit is contained in:
parent
c365c112b1
commit
25c65eaf41
2 changed files with 34 additions and 0 deletions
|
@ -1925,6 +1925,35 @@ void(float width, float height) HUD_RoundStopWatch =
|
|||
Draw_String([width - (getTextWidth(stopwatch, 12)) - 2, 16], stopwatch, [12, 12], [1, 1, 1], 1, 0);
|
||||
}
|
||||
|
||||
/*******************
|
||||
* HUD UPS *
|
||||
*******************/
|
||||
|
||||
void() Draw_UPS =
|
||||
{
|
||||
static float lastupstime;
|
||||
static float lastups;
|
||||
|
||||
if (!cvar("show_speed"))
|
||||
return;
|
||||
|
||||
if ((time - lastupstime) >= 1.0 / 20)
|
||||
{
|
||||
vector vel = [
|
||||
getstatf(STAT_VELOCITY_X),
|
||||
getstatf(STAT_VELOCITY_Y),
|
||||
getstatf(STAT_VELOCITY_Z)
|
||||
];
|
||||
|
||||
lastups = vlen(vel);
|
||||
lastupstime = time;
|
||||
}
|
||||
|
||||
string str = sprintf("%3.1f UPS", lastups);
|
||||
vector pos = [cvar("show_speed_x"), cvar("show_speed_y")];
|
||||
Draw_String(pos, str, [12, 12], [1, 1, 1], 1, 0);
|
||||
};
|
||||
|
||||
/*******************
|
||||
* HUD Draw *
|
||||
*******************/
|
||||
|
@ -1999,6 +2028,8 @@ void(float width, float height) HUD_Draw =
|
|||
HUD_Scores();
|
||||
|
||||
HUD_Achievements(width, height);
|
||||
|
||||
Draw_UPS();
|
||||
|
||||
if (screenflash_duration > time)
|
||||
HUD_Screenflash();
|
||||
|
|
|
@ -175,6 +175,9 @@ noref void(float apiver, string enginename, float enginever) CSQC_Init =
|
|||
autocvar(in_rumbleenabled, 1);
|
||||
autocvar(in_aimassist, 0);
|
||||
|
||||
cvar_set("show_speed_x", ftos(32));
|
||||
cvar_set("show_speed_y", ftos(32));
|
||||
|
||||
// Runtime check if we're running this in WebASM/WebGL.
|
||||
if (cvar_string("sys_platform") == "Web")
|
||||
platform_is_web = true;
|
||||
|
|
Loading…
Reference in a new issue