From 5d02afa1a2bcff194239f1f7ac5ab31a67eb808f Mon Sep 17 00:00:00 2001 From: squeek Date: Thu, 19 May 2016 20:12:36 -0700 Subject: [PATCH] Fix various HUD positioning on non-standard resolutions - GetHudSize gets the root panel size when applicable which seems to be more reliable than the raw ScreenSize - See #252 --- cl_dll/ff/c_ff_timers.cpp | 2 +- cl_dll/ff/ff_hud_buildable_messages.cpp | 2 +- cl_dll/ff/ff_hud_crosshairinfo.cpp | 2 +- cl_dll/ff/ff_hud_objectiveicon.cpp | 2 +- cl_dll/ff/ff_hud_radiotag.cpp | 2 +- cl_dll/ff/ff_hud_statusicons.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cl_dll/ff/c_ff_timers.cpp b/cl_dll/ff/c_ff_timers.cpp index 4d9a9b79c..44aff270f 100644 --- a/cl_dll/ff/c_ff_timers.cpp +++ b/cl_dll/ff/c_ff_timers.cpp @@ -27,7 +27,7 @@ C_FFTimer::C_FFTimer( std::string strName, const float flDuration ) SetHiddenBits( 0 ); int iScreenWidth, iScreenHeight; - surface()->GetScreenSize( iScreenWidth, iScreenHeight ); + GetHudSize( iScreenWidth, iScreenHeight ); int iWidth = iScreenWidth / 4 + 2, iHeight = 22; int nTimers = g_FFTimers.Count(); diff --git a/cl_dll/ff/ff_hud_buildable_messages.cpp b/cl_dll/ff/ff_hud_buildable_messages.cpp index 213271c47..8ddb982fb 100644 --- a/cl_dll/ff/ff_hud_buildable_messages.cpp +++ b/cl_dll/ff/ff_hud_buildable_messages.cpp @@ -223,7 +223,7 @@ void CHudBuildableMessages::CalculateWidthHeight( void ) // Get the screen width/height int iScreenWide, iScreenTall; - surface()->GetScreenSize( iScreenWide, iScreenTall ); + GetHudSize( iScreenWide, iScreenTall ); // Get our current x/y position of this 'panel' int x, y; diff --git a/cl_dll/ff/ff_hud_crosshairinfo.cpp b/cl_dll/ff/ff_hud_crosshairinfo.cpp index 835ff5d6f..4d87409df 100644 --- a/cl_dll/ff/ff_hud_crosshairinfo.cpp +++ b/cl_dll/ff/ff_hud_crosshairinfo.cpp @@ -583,7 +583,7 @@ void CHudCrosshairInfo::OnTick( void ) { // Get the screen width/height int iScreenWide, iScreenTall; - surface()->GetScreenSize( iScreenWide, iScreenTall ); + GetHudSize( iScreenWide, iScreenTall ); int iWide = UTIL_ComputeStringWidth( m_hTextFont, m_pText ); int iTall = surface()->GetFontTall( m_hTextFont ); diff --git a/cl_dll/ff/ff_hud_objectiveicon.cpp b/cl_dll/ff/ff_hud_objectiveicon.cpp index 16c4446dc..fe3b5b2fe 100644 --- a/cl_dll/ff/ff_hud_objectiveicon.cpp +++ b/cl_dll/ff/ff_hud_objectiveicon.cpp @@ -103,7 +103,7 @@ void CHudObjectiveIcon::VidInit( void ) // Set up our screen position and stuff before drawing int iWide, iTall; - surface()->GetScreenSize( iWide, iTall ); + GetHudSize( iWide, iTall ); // Set up the panel to take up the WHOLE screen SetPos( 0, 0 ); diff --git a/cl_dll/ff/ff_hud_radiotag.cpp b/cl_dll/ff/ff_hud_radiotag.cpp index b7ffc712b..3e6664ca7 100644 --- a/cl_dll/ff/ff_hud_radiotag.cpp +++ b/cl_dll/ff/ff_hud_radiotag.cpp @@ -87,7 +87,7 @@ void CHudRadioTag::VidInit( void ) // Set up our screen position and stuff before drawing int iWide, iTall; - surface()->GetScreenSize( iWide, iTall ); + GetHudSize( iWide, iTall ); // Set up the panel to take up the WHOLE screen SetPos( 0, 0 ); diff --git a/cl_dll/ff/ff_hud_statusicons.cpp b/cl_dll/ff/ff_hud_statusicons.cpp index 1cfe1db93..8206fc964 100644 --- a/cl_dll/ff/ff_hud_statusicons.cpp +++ b/cl_dll/ff/ff_hud_statusicons.cpp @@ -166,7 +166,7 @@ void CStatusIcons::Init( void ) void CStatusIcons::OnTick( void ) { /* int iWide, iTall; - surface()->GetScreenSize( iWide, iTall ); + GetHudSize( iWide, iTall ); int displayed = 0; for (int i=0; i