summaryrefslogtreecommitdiff
path: root/game/client/cstrike/hud_hostagerescue.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/cstrike/hud_hostagerescue.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/cstrike/hud_hostagerescue.cpp')
-rw-r--r--game/client/cstrike/hud_hostagerescue.cpp80
1 files changed, 80 insertions, 0 deletions
diff --git a/game/client/cstrike/hud_hostagerescue.cpp b/game/client/cstrike/hud_hostagerescue.cpp
new file mode 100644
index 0000000..64556ec
--- /dev/null
+++ b/game/client/cstrike/hud_hostagerescue.cpp
@@ -0,0 +1,80 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#include "cbase.h"
+#include "hudelement.h"
+#include <vgui_controls/Panel.h>
+#include <vgui/ISurface.h>
+#include "clientmode_csnormal.h"
+#include "c_cs_player.h"
+
+class CHudHostageRescueZone : public CHudElement, public vgui::Panel
+{
+public:
+ DECLARE_CLASS_SIMPLE( CHudHostageRescueZone, vgui::Panel );
+
+ CHudHostageRescueZone( const char *name );
+
+ virtual bool ShouldDraw();
+ virtual void Paint();
+
+private:
+ CPanelAnimationVar( Color, m_clrIcon, "IconColor", "IconColor" );
+
+ CHudTexture *m_pIcon;
+};
+
+
+DECLARE_HUDELEMENT( CHudHostageRescueZone );
+
+
+CHudHostageRescueZone::CHudHostageRescueZone( const char *pName ) :
+ vgui::Panel( NULL, "HudHostageRescueZone" ), CHudElement( pName )
+{
+ SetParent( g_pClientMode->GetViewport() );
+ m_pIcon = NULL;
+
+ SetHiddenBits( HIDEHUD_PLAYERDEAD );
+
+ //=============================================================================
+ // HPE_BEGIN:
+ // [tj] Add this to the render group that disappears when the scoreboard is up
+ //=============================================================================
+ RegisterForRenderGroup( "hide_for_scoreboard" );
+ //=============================================================================
+ // HPE_END
+ //=============================================================================
+}
+
+bool CHudHostageRescueZone::ShouldDraw()
+{
+ C_CSPlayer *pPlayer = C_CSPlayer::GetLocalCSPlayer();
+ //=============================================================================
+ // HPE_BEGIN:
+ // [tj] Added base class call
+ //=============================================================================
+ return ( pPlayer && pPlayer->IsInHostageRescueZone() && CHudElement::ShouldDraw());
+ //=============================================================================
+ // HPE_END
+ //=============================================================================
+}
+
+void CHudHostageRescueZone::Paint()
+{
+ if ( !m_pIcon )
+ {
+ m_pIcon = gHUD.GetIcon( "hostage_rescue" );
+ }
+
+ if ( m_pIcon )
+ {
+ int x, y, w, h;
+ GetBounds( x, y, w, h );
+
+ m_pIcon->DrawSelf( 0, 0, w, h, m_clrIcon );
+ }
+}
+