From f56bb35301836e56582a575a75864392a0177875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20P=2E=20Tjern=C3=B8?= Date: Mon, 2 Dec 2013 19:31:46 -0800 Subject: Fix line endings. WHAMMY. --- mp/src/game/client/hud_bitmapnumericdisplay.cpp | 334 ++++++++++++------------ 1 file changed, 167 insertions(+), 167 deletions(-) (limited to 'mp/src/game/client/hud_bitmapnumericdisplay.cpp') diff --git a/mp/src/game/client/hud_bitmapnumericdisplay.cpp b/mp/src/game/client/hud_bitmapnumericdisplay.cpp index 92d38a3e..e2a17681 100644 --- a/mp/src/game/client/hud_bitmapnumericdisplay.cpp +++ b/mp/src/game/client/hud_bitmapnumericdisplay.cpp @@ -1,168 +1,168 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -//=============================================================================// - -#include "cbase.h" -#include "hud_bitmapnumericdisplay.h" -#include "iclientmode.h" - -#include -#include -#include -#include -#include - -// memdbgon must be the last include file in a .cpp file!!! -#include "tier0/memdbgon.h" - -using namespace vgui; - -//----------------------------------------------------------------------------- -// Purpose: constructor -//----------------------------------------------------------------------------- -CHudBitmapNumericDisplay::CHudBitmapNumericDisplay(vgui::Panel *parent, const char *name) : vgui::Panel(parent, name) -{ - vgui::Panel *pParent = g_pClientMode->GetViewport(); - SetParent( pParent ); - - m_iValue = 0; - m_bDisplayValue = true; - memset( m_pNumbers, 0, 10*sizeof(CHudTexture *) ); -} - -//----------------------------------------------------------------------------- -// Purpose: data accessor -//----------------------------------------------------------------------------- -void CHudBitmapNumericDisplay::SetDisplayValue(int value) -{ - m_iValue = value; -} - - -//----------------------------------------------------------------------------- -// Purpose: renders the vgui panel -//----------------------------------------------------------------------------- -void CHudBitmapNumericDisplay::Paint() -{ - float alpha = m_flAlphaOverride / 255; - Color fgColor = GetFgColor(); - fgColor[3] *= alpha; - SetFgColor( fgColor ); - - if (m_bDisplayValue) - { - // draw our numbers - // surface()->DrawSetTextColor(GetFgColor()); - PaintNumbers(digit_xpos, digit_ypos, m_iValue, GetFgColor()); - - // draw the overbright blur - for (float fl = m_flBlur; fl > 0.0f; fl -= 1.0f) - { - if (fl >= 1.0f) - { - PaintNumbers(digit_xpos, digit_ypos, m_iValue, GetFgColor()); - } - else - { - // draw a percentage of the last one - Color col = GetFgColor(); - col[3] *= fl; - PaintNumbers(digit_xpos, digit_ypos, m_iValue, col); - } - } - } -} - -//----------------------------------------------------------------------------- -// Purpose: data accessor -//----------------------------------------------------------------------------- -void CHudBitmapNumericDisplay::SetShouldDisplayValue(bool state) -{ - m_bDisplayValue = state; -} - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -void CHudBitmapNumericDisplay::PaintBackground( void ) -{ - int alpha = m_flAlphaOverride / 255; - Color bgColor = GetBgColor(); - bgColor[3] *= alpha; - SetBgColor( bgColor ); - - BaseClass::PaintBackground(); -} - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -void CHudBitmapNumericDisplay::PaintNumbers(int xpos, int ypos, int value, Color col, int numSigDigits ) -{ - if( !m_pNumbers[0] ) - { - int i; - char a[16]; - - for( i=0;i<10;i++ ) - { - sprintf( a, "number_%d", i ); - - m_pNumbers[i] = gHUD.GetIcon( a ); - } - - if( !m_pNumbers[0] ) - return; - } - - if( value > 100000 ) - { - value = 99999; - } - - int pos = 10000; - - float scale = ( digit_height / (float)m_pNumbers[0]->Height()); - - int digit; - Color color = GetFgColor(); - int width = m_pNumbers[0]->Width() * scale; - int height = m_pNumbers[0]->Height() * scale; - bool bStart = false; - - //right align to xpos - - int numdigits = 1; - - int x = pos; - while( x >= 10 ) - { - if( value >= x ) - numdigits++; - - x /= 10; - } - - if( numdigits < numSigDigits ) - numdigits = numSigDigits; - - xpos -= numdigits * width; - - //draw the digits - while( pos >= 1 ) - { - digit = value / pos; - value = value % pos; - - if( bStart || digit > 0 || pos <= pow(10.0f,numSigDigits-1) ) - { - bStart = true; - m_pNumbers[digit]->DrawSelf( xpos, ypos, width, height, col ); - xpos += width; - } - - pos /= 10; - } +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#include "cbase.h" +#include "hud_bitmapnumericdisplay.h" +#include "iclientmode.h" + +#include +#include +#include +#include +#include + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +using namespace vgui; + +//----------------------------------------------------------------------------- +// Purpose: constructor +//----------------------------------------------------------------------------- +CHudBitmapNumericDisplay::CHudBitmapNumericDisplay(vgui::Panel *parent, const char *name) : vgui::Panel(parent, name) +{ + vgui::Panel *pParent = g_pClientMode->GetViewport(); + SetParent( pParent ); + + m_iValue = 0; + m_bDisplayValue = true; + memset( m_pNumbers, 0, 10*sizeof(CHudTexture *) ); +} + +//----------------------------------------------------------------------------- +// Purpose: data accessor +//----------------------------------------------------------------------------- +void CHudBitmapNumericDisplay::SetDisplayValue(int value) +{ + m_iValue = value; +} + + +//----------------------------------------------------------------------------- +// Purpose: renders the vgui panel +//----------------------------------------------------------------------------- +void CHudBitmapNumericDisplay::Paint() +{ + float alpha = m_flAlphaOverride / 255; + Color fgColor = GetFgColor(); + fgColor[3] *= alpha; + SetFgColor( fgColor ); + + if (m_bDisplayValue) + { + // draw our numbers + // surface()->DrawSetTextColor(GetFgColor()); + PaintNumbers(digit_xpos, digit_ypos, m_iValue, GetFgColor()); + + // draw the overbright blur + for (float fl = m_flBlur; fl > 0.0f; fl -= 1.0f) + { + if (fl >= 1.0f) + { + PaintNumbers(digit_xpos, digit_ypos, m_iValue, GetFgColor()); + } + else + { + // draw a percentage of the last one + Color col = GetFgColor(); + col[3] *= fl; + PaintNumbers(digit_xpos, digit_ypos, m_iValue, col); + } + } + } +} + +//----------------------------------------------------------------------------- +// Purpose: data accessor +//----------------------------------------------------------------------------- +void CHudBitmapNumericDisplay::SetShouldDisplayValue(bool state) +{ + m_bDisplayValue = state; +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CHudBitmapNumericDisplay::PaintBackground( void ) +{ + int alpha = m_flAlphaOverride / 255; + Color bgColor = GetBgColor(); + bgColor[3] *= alpha; + SetBgColor( bgColor ); + + BaseClass::PaintBackground(); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CHudBitmapNumericDisplay::PaintNumbers(int xpos, int ypos, int value, Color col, int numSigDigits ) +{ + if( !m_pNumbers[0] ) + { + int i; + char a[16]; + + for( i=0;i<10;i++ ) + { + sprintf( a, "number_%d", i ); + + m_pNumbers[i] = gHUD.GetIcon( a ); + } + + if( !m_pNumbers[0] ) + return; + } + + if( value > 100000 ) + { + value = 99999; + } + + int pos = 10000; + + float scale = ( digit_height / (float)m_pNumbers[0]->Height()); + + int digit; + Color color = GetFgColor(); + int width = m_pNumbers[0]->Width() * scale; + int height = m_pNumbers[0]->Height() * scale; + bool bStart = false; + + //right align to xpos + + int numdigits = 1; + + int x = pos; + while( x >= 10 ) + { + if( value >= x ) + numdigits++; + + x /= 10; + } + + if( numdigits < numSigDigits ) + numdigits = numSigDigits; + + xpos -= numdigits * width; + + //draw the digits + while( pos >= 1 ) + { + digit = value / pos; + value = value % pos; + + if( bStart || digit > 0 || pos <= pow(10.0f,numSigDigits-1) ) + { + bStart = true; + m_pNumbers[digit]->DrawSelf( xpos, ypos, width, height, col ); + xpos += width; + } + + pos /= 10; + } } \ No newline at end of file -- cgit v1.2.3