Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add hud_jumpspeed_height and hud_speedometer_height cvars #146

Merged
merged 1 commit into from
Oct 8, 2021
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
3 changes: 3 additions & 0 deletions cl_dll/hud_jumpspeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ int CHudJumpspeed::Init()

hud_jumpspeed = CVAR_CREATE("hud_jumpspeed", "0", FCVAR_ARCHIVE);
hud_jumpspeed_below_cross = CVAR_CREATE("hud_jumpspeed_below_cross", "0", FCVAR_ARCHIVE);
hud_jumpspeed_height = CVAR_CREATE("hud_jumpspeed_height", "0", FCVAR_ARCHIVE);

gHUD.AddHudElem(this);
return 0;
Expand All @@ -36,6 +37,8 @@ int CHudJumpspeed::Draw(float flTime)
int y;
if (hud_jumpspeed_below_cross->value != 0.0f)
y = ScreenHeight / 2 + gHUD.m_iFontHeight / 2 + gHUD.m_iFontHeight;
else if (hud_jumpspeed_height->value != 0.0f)
y = hud_jumpspeed_height->value;
else
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;

Expand Down
1 change: 1 addition & 0 deletions cl_dll/hud_jumpspeed.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class CHudJumpspeed : public CHudBase

cvar_t* hud_jumpspeed;
cvar_t* hud_jumpspeed_below_cross;
cvar_t* hud_jumpspeed_height;

int fadingFrom[3];
float prevVel[3] = { 0.0f, 0.0f, 0.0f };
Expand Down
5 changes: 4 additions & 1 deletion cl_dll/hud_speedometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ int CHudSpeedometer::Init()

hud_speedometer = CVAR_CREATE("hud_speedometer", "0", FCVAR_ARCHIVE);
hud_speedometer_below_cross = CVAR_CREATE("hud_speedometer_below_cross", "0", FCVAR_ARCHIVE);
hud_speedometer_height = CVAR_CREATE("hud_speedometer_height", "0", FCVAR_ARCHIVE);

gHUD.AddHudElem(this);
return 0;
Expand All @@ -31,8 +32,10 @@ int CHudSpeedometer::Draw(float time)
UnpackRGB(r, g, b, gHUD.m_iDefaultHUDColor);

int y;
if (hud_speedometer_below_cross->value != 0)
if (hud_speedometer_below_cross->value != 0.0f)
y = ScreenHeight / 2 + gHUD.m_iFontHeight / 2;
else if (hud_speedometer_height->value != 0.0f)
y = hud_speedometer_height->value;
else
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2 - gHUD.m_iFontHeight;

Expand Down
1 change: 1 addition & 0 deletions cl_dll/hud_speedometer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class CHudSpeedometer : public CHudBase

cvar_t* hud_speedometer;
cvar_t* hud_speedometer_below_cross;
cvar_t* hud_speedometer_height;

public:
virtual int Init();
Expand Down