aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/client/sdk/sdk_hud_health.cpp
diff options
context:
space:
mode:
authorJørgen P. Tjernø <[email protected]>2013-12-02 19:31:46 -0800
committerJørgen P. Tjernø <[email protected]>2013-12-02 19:46:31 -0800
commitf56bb35301836e56582a575a75864392a0177875 (patch)
treede61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/client/sdk/sdk_hud_health.cpp
parentMark some more files as text. (diff)
downloadsource-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz
source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/client/sdk/sdk_hud_health.cpp')
-rw-r--r--mp/src/game/client/sdk/sdk_hud_health.cpp338
1 files changed, 169 insertions, 169 deletions
diff --git a/mp/src/game/client/sdk/sdk_hud_health.cpp b/mp/src/game/client/sdk/sdk_hud_health.cpp
index f60e4d1d..9f984a0d 100644
--- a/mp/src/game/client/sdk/sdk_hud_health.cpp
+++ b/mp/src/game/client/sdk/sdk_hud_health.cpp
@@ -1,170 +1,170 @@
-//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//
-//=============================================================================//
-//
-// Health.cpp
-//
-// implementation of CHudHealth class
-//
-#include "cbase.h"
-#include "hud.h"
-#include "hud_macros.h"
-#include "view.h"
-
-#include "iclientmode.h"
-
-#include <KeyValues.h>
-#include <vgui/ISurface.h>
-#include <vgui/ISystem.h>
-#include <vgui_controls/AnimationController.h>
-
-#include <vgui/ILocalize.h>
-
-using namespace vgui;
-
-#include "hudelement.h"
-#include "hud_numericdisplay.h"
-
-#include "ConVar.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-#define INIT_HEALTH -1
-
-//-----------------------------------------------------------------------------
-// Purpose: Health panel
-//-----------------------------------------------------------------------------
-class CHudHealth : public CHudElement, public CHudNumericDisplay
-{
- DECLARE_CLASS_SIMPLE( CHudHealth, CHudNumericDisplay );
-
-public:
- CHudHealth( const char *pElementName );
- virtual void Init( void );
- virtual void VidInit( void );
- virtual void Reset( void );
- virtual void OnThink();
- void MsgFunc_Damage( bf_read &msg );
-
-private:
- // old variables
- int m_iHealth;
-
- int m_bitsDamage;
-};
-
-DECLARE_HUDELEMENT( CHudHealth );
-DECLARE_HUD_MESSAGE( CHudHealth, Damage );
-
-//-----------------------------------------------------------------------------
-// Purpose: Constructor
-//-----------------------------------------------------------------------------
-CHudHealth::CHudHealth( const char *pElementName ) : CHudElement( pElementName ), CHudNumericDisplay(NULL, "HudHealth")
-{
- SetHiddenBits( HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD | HIDEHUD_NEEDSUIT );
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CHudHealth::Init()
-{
- HOOK_HUD_MESSAGE( CHudHealth, Damage );
- Reset();
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CHudHealth::Reset()
-{
- m_iHealth = INIT_HEALTH;
- m_bitsDamage = 0;
-
- wchar_t *tempString = g_pVGuiLocalize->Find("#Valve_Hud_HEALTH");
-
- if (tempString)
- {
- SetLabelText(tempString);
- }
- else
- {
- SetLabelText(L"HEALTH");
- }
- SetDisplayValue(m_iHealth);
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CHudHealth::VidInit()
-{
- Reset();
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CHudHealth::OnThink()
-{
- int newHealth = 0;
- C_BasePlayer *local = C_BasePlayer::GetLocalPlayer();
- if ( local )
- {
- // Never below zero
- newHealth = MAX( local->GetHealth(), 0 );
- }
-
- // Only update the fade if we've changed health
- if ( newHealth == m_iHealth )
- {
- return;
- }
-
- m_iHealth = newHealth;
-
- if ( m_iHealth >= 20 )
- {
- g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthIncreasedAbove20");
- }
- else if ( m_iHealth > 0 )
- {
- g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthIncreasedBelow20");
- g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthLow");
- }
-
- SetDisplayValue(m_iHealth);
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CHudHealth::MsgFunc_Damage( bf_read &msg )
-{
-
- int armor = msg.ReadByte(); // armor
- int damageTaken = msg.ReadByte(); // health
- long bitsDamage = msg.ReadLong(); // damage bits
- bitsDamage; // variable still sent but not used
-
- Vector vecFrom;
-
- vecFrom.x = msg.ReadBitCoord();
- vecFrom.y = msg.ReadBitCoord();
- vecFrom.z = msg.ReadBitCoord();
-
- // Actually took damage?
- if ( damageTaken > 0 || armor > 0 )
- {
- if ( damageTaken > 0 )
- {
- // start the animation
- g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthDamageTaken");
- }
- }
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+//
+// Health.cpp
+//
+// implementation of CHudHealth class
+//
+#include "cbase.h"
+#include "hud.h"
+#include "hud_macros.h"
+#include "view.h"
+
+#include "iclientmode.h"
+
+#include <KeyValues.h>
+#include <vgui/ISurface.h>
+#include <vgui/ISystem.h>
+#include <vgui_controls/AnimationController.h>
+
+#include <vgui/ILocalize.h>
+
+using namespace vgui;
+
+#include "hudelement.h"
+#include "hud_numericdisplay.h"
+
+#include "ConVar.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+#define INIT_HEALTH -1
+
+//-----------------------------------------------------------------------------
+// Purpose: Health panel
+//-----------------------------------------------------------------------------
+class CHudHealth : public CHudElement, public CHudNumericDisplay
+{
+ DECLARE_CLASS_SIMPLE( CHudHealth, CHudNumericDisplay );
+
+public:
+ CHudHealth( const char *pElementName );
+ virtual void Init( void );
+ virtual void VidInit( void );
+ virtual void Reset( void );
+ virtual void OnThink();
+ void MsgFunc_Damage( bf_read &msg );
+
+private:
+ // old variables
+ int m_iHealth;
+
+ int m_bitsDamage;
+};
+
+DECLARE_HUDELEMENT( CHudHealth );
+DECLARE_HUD_MESSAGE( CHudHealth, Damage );
+
+//-----------------------------------------------------------------------------
+// Purpose: Constructor
+//-----------------------------------------------------------------------------
+CHudHealth::CHudHealth( const char *pElementName ) : CHudElement( pElementName ), CHudNumericDisplay(NULL, "HudHealth")
+{
+ SetHiddenBits( HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD | HIDEHUD_NEEDSUIT );
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CHudHealth::Init()
+{
+ HOOK_HUD_MESSAGE( CHudHealth, Damage );
+ Reset();
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CHudHealth::Reset()
+{
+ m_iHealth = INIT_HEALTH;
+ m_bitsDamage = 0;
+
+ wchar_t *tempString = g_pVGuiLocalize->Find("#Valve_Hud_HEALTH");
+
+ if (tempString)
+ {
+ SetLabelText(tempString);
+ }
+ else
+ {
+ SetLabelText(L"HEALTH");
+ }
+ SetDisplayValue(m_iHealth);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CHudHealth::VidInit()
+{
+ Reset();
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CHudHealth::OnThink()
+{
+ int newHealth = 0;
+ C_BasePlayer *local = C_BasePlayer::GetLocalPlayer();
+ if ( local )
+ {
+ // Never below zero
+ newHealth = MAX( local->GetHealth(), 0 );
+ }
+
+ // Only update the fade if we've changed health
+ if ( newHealth == m_iHealth )
+ {
+ return;
+ }
+
+ m_iHealth = newHealth;
+
+ if ( m_iHealth >= 20 )
+ {
+ g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthIncreasedAbove20");
+ }
+ else if ( m_iHealth > 0 )
+ {
+ g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthIncreasedBelow20");
+ g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthLow");
+ }
+
+ SetDisplayValue(m_iHealth);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CHudHealth::MsgFunc_Damage( bf_read &msg )
+{
+
+ int armor = msg.ReadByte(); // armor
+ int damageTaken = msg.ReadByte(); // health
+ long bitsDamage = msg.ReadLong(); // damage bits
+ bitsDamage; // variable still sent but not used
+
+ Vector vecFrom;
+
+ vecFrom.x = msg.ReadBitCoord();
+ vecFrom.y = msg.ReadBitCoord();
+ vecFrom.z = msg.ReadBitCoord();
+
+ // Actually took damage?
+ if ( damageTaken > 0 || armor > 0 )
+ {
+ if ( damageTaken > 0 )
+ {
+ // start the animation
+ g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("HealthDamageTaken");
+ }
+ }
} \ No newline at end of file