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
1 change: 1 addition & 0 deletions gamedir/ui/scripts/HudLayoutBase.res
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{
"statusbar_ypos" "r45"
"ammohistory_ypos" "r42"
"damage_ypos" "r16"
"weapon_xpos" "150"
}

Expand Down
12 changes: 8 additions & 4 deletions src/game/client/hud/health.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,18 @@ void CHudHealth::Draw(float flTime)
float a;
int HealthWidth;

if (hud_custom.GetBool())
return;

if ((gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) || gEngfuncs.IsSpectateOnly())
return;

if (!m_hSprite)
m_hSprite = LoadSprite(PAIN_NAME);

if (hud_custom.GetBool())
{
DrawDamage(flTime);
DrawPain(flTime);
return;
}

if (!hud_dim.GetBool())
a = MIN_ALPHA + ALPHA_POINTS_MAX;
Expand Down Expand Up @@ -468,7 +472,7 @@ void CHudHealth::UpdateTiles(float flTime, long bitsDamage)
{
// put this one at the bottom
pdmg->x = giDmgWidth / 8;
pdmg->y = ScreenHeight - giDmgHeight * 2;
pdmg->y = (hud_custom.GetBool() ? g_pViewport->GetDamageYPos() : ScreenHeight) - giDmgHeight * 2;
pdmg->fExpire = flTime + DMG_IMAGE_LIFE;

// move everyone else up
Expand Down
7 changes: 7 additions & 0 deletions src/game/client/vgui/client_viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,12 @@ void CClientViewport::ReloadLayout()
{
const char* szStatusBarY = vanillaKV->GetString("statusbar_ypos", "0");
const char* szAmmoHistoryY = vanillaKV->GetString("ammohistory_ypos", "0");
const char* szDamageY = vanillaKV->GetString("damage_ypos", "0");
const char* szWeaponX = vanillaKV->GetString("weapon_xpos", "0");

ComputePos(szStatusBarY, m_iStatusBarYPos, 0, GetTall(), true);
ComputePos(szAmmoHistoryY, m_iAmmoHistoryYPos, 0, GetTall(), true);
ComputePos(szDamageY, m_iDamageYPos, 0, GetTall(), true);
ComputePos(szWeaponX, m_iWeaponXPos, 0, GetWide(), true);
}

Expand Down Expand Up @@ -371,6 +373,11 @@ int CClientViewport::GetStatusBarYPos()
return m_iStatusBarYPos;
}

int CClientViewport::GetDamageYPos()
{
return m_iDamageYPos;
}

int CClientViewport::GetWeaponXPos()
{
return m_iWeaponXPos;
Expand Down
2 changes: 2 additions & 0 deletions src/game/client/vgui/client_viewport.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class CClientViewport : public vgui2::EditablePanel
// Allows to get custom positions to avoid overlapping with other panels
int GetAmmoHistoryYPos();
int GetStatusBarYPos();
int GetDamageYPos();
int GetWeaponXPos();

bool IsScoreBoardVisible();
Expand Down Expand Up @@ -153,6 +154,7 @@ class CClientViewport : public vgui2::EditablePanel
// Custom HUD positions
int m_iStatusBarYPos = 0;
int m_iAmmoHistoryYPos = 0;
int m_iDamageYPos = 0;
int m_iWeaponXPos = 0;

Color m_pTeamColors[5] = {
Expand Down
Loading