diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/client/hud_weapon.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/client/hud_weapon.cpp')
| -rw-r--r-- | mp/src/game/client/hud_weapon.cpp | 214 |
1 files changed, 107 insertions, 107 deletions
diff --git a/mp/src/game/client/hud_weapon.cpp b/mp/src/game/client/hud_weapon.cpp index e0c6e639..cf63f337 100644 --- a/mp/src/game/client/hud_weapon.cpp +++ b/mp/src/game/client/hud_weapon.cpp @@ -1,107 +1,107 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//=============================================================================//
-#include "cbase.h"
-#include "hud.h"
-#include "hudelement.h"
-#include "iclientmode.h"
-#include <vgui_controls/Controls.h>
-#include <vgui/ISurface.h>
-#include <vgui_controls/Panel.h>
-#include "hud_crosshair.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-using namespace vgui;
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-class CHudWeapon : public CHudElement, public vgui::Panel
-{
- DECLARE_CLASS_SIMPLE( CHudWeapon, vgui::Panel );
-public:
- CHudWeapon( const char *pElementName );
-
- virtual void ApplySchemeSettings( vgui::IScheme *scheme );
- virtual void Paint( void );
- virtual void PerformLayout();
-
-private:
- CHudCrosshair *m_pCrosshair;
-};
-
-DECLARE_HUDELEMENT( CHudWeapon );
-
-CHudWeapon::CHudWeapon( const char *pElementName ) :
- CHudElement( pElementName ), BaseClass( NULL, "HudWeapon" )
-{
- vgui::Panel *pParent = g_pClientMode->GetViewport();
- SetParent( pParent );
-
- m_pCrosshair = NULL;
-
- SetHiddenBits( HIDEHUD_WEAPONSELECTION );
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-// Input : *scheme -
-//-----------------------------------------------------------------------------
-void CHudWeapon::ApplySchemeSettings( IScheme *scheme )
-{
- BaseClass::ApplySchemeSettings( scheme );
-
- SetPaintBackgroundEnabled( false );
-
- m_pCrosshair = GET_HUDELEMENT( CHudCrosshair );
- //Assert( m_pCrosshair );
-}
-
-
-//-----------------------------------------------------------------------------
-// Performs layout
-//-----------------------------------------------------------------------------
-void CHudWeapon::PerformLayout()
-{
- BaseClass::PerformLayout();
-
- vgui::Panel *pParent = GetParent();
-
- int w, h;
- pParent->GetSize( w, h );
- SetPos( 0, 0 );
- SetSize( w, h );
-}
-
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CHudWeapon::Paint( void )
-{
- C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
-
- if ( !player )
- return;
-
- MDLCACHE_CRITICAL_SECTION();
-
- C_BaseCombatWeapon *pWeapon = player->GetActiveWeapon();
-
- if ( pWeapon )
- {
- pWeapon->Redraw();
- }
- else
- {
- if ( m_pCrosshair )
- {
- m_pCrosshair->ResetCrosshair();
- }
- }
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" +#include "hud.h" +#include "hudelement.h" +#include "iclientmode.h" +#include <vgui_controls/Controls.h> +#include <vgui/ISurface.h> +#include <vgui_controls/Panel.h> +#include "hud_crosshair.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +using namespace vgui; + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +class CHudWeapon : public CHudElement, public vgui::Panel +{ + DECLARE_CLASS_SIMPLE( CHudWeapon, vgui::Panel ); +public: + CHudWeapon( const char *pElementName ); + + virtual void ApplySchemeSettings( vgui::IScheme *scheme ); + virtual void Paint( void ); + virtual void PerformLayout(); + +private: + CHudCrosshair *m_pCrosshair; +}; + +DECLARE_HUDELEMENT( CHudWeapon ); + +CHudWeapon::CHudWeapon( const char *pElementName ) : + CHudElement( pElementName ), BaseClass( NULL, "HudWeapon" ) +{ + vgui::Panel *pParent = g_pClientMode->GetViewport(); + SetParent( pParent ); + + m_pCrosshair = NULL; + + SetHiddenBits( HIDEHUD_WEAPONSELECTION ); +} + +//----------------------------------------------------------------------------- +// Purpose: +// Input : *scheme - +//----------------------------------------------------------------------------- +void CHudWeapon::ApplySchemeSettings( IScheme *scheme ) +{ + BaseClass::ApplySchemeSettings( scheme ); + + SetPaintBackgroundEnabled( false ); + + m_pCrosshair = GET_HUDELEMENT( CHudCrosshair ); + //Assert( m_pCrosshair ); +} + + +//----------------------------------------------------------------------------- +// Performs layout +//----------------------------------------------------------------------------- +void CHudWeapon::PerformLayout() +{ + BaseClass::PerformLayout(); + + vgui::Panel *pParent = GetParent(); + + int w, h; + pParent->GetSize( w, h ); + SetPos( 0, 0 ); + SetSize( w, h ); +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CHudWeapon::Paint( void ) +{ + C_BasePlayer *player = C_BasePlayer::GetLocalPlayer(); + + if ( !player ) + return; + + MDLCACHE_CRITICAL_SECTION(); + + C_BaseCombatWeapon *pWeapon = player->GetActiveWeapon(); + + if ( pWeapon ) + { + pWeapon->Redraw(); + } + else + { + if ( m_pCrosshair ) + { + m_pCrosshair->ResetCrosshair(); + } + } +} |