summaryrefslogtreecommitdiff
path: root/game/client/tf2/minimap_resourcezone.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/tf2/minimap_resourcezone.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/tf2/minimap_resourcezone.cpp')
-rw-r--r--game/client/tf2/minimap_resourcezone.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/game/client/tf2/minimap_resourcezone.cpp b/game/client/tf2/minimap_resourcezone.cpp
new file mode 100644
index 0000000..56bbdc9
--- /dev/null
+++ b/game/client/tf2/minimap_resourcezone.cpp
@@ -0,0 +1,95 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+#include "cbase.h"
+#include "hud.h"
+#include "c_func_resource.h"
+#include "vgui_bitmapimage.h"
+#include <KeyValues.h>
+#include "minimap_trace.h"
+#include "techtree.h"
+#include "shareddefs.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+class CMinimapResourceZonePanel : public CMinimapTracePanel
+{
+ DECLARE_CLASS( CMinimapResourceZonePanel, CMinimapTracePanel );
+
+public:
+ CMinimapResourceZonePanel( vgui::Panel *parent, const char *panelName );
+ virtual ~CMinimapResourceZonePanel();
+
+ virtual bool Init( KeyValues* pKeyValues, MinimapInitData_t* pInitData );
+ virtual void Paint( );
+
+private:
+ BitmapImage *m_ppImage;
+};
+
+DECLARE_MINIMAP_FACTORY( CMinimapResourceZonePanel, "minimap_resource_zone_panel" );
+
+
+CMinimapResourceZonePanel::CMinimapResourceZonePanel( vgui::Panel *parent, const char *panelName )
+: BaseClass( parent, "CMinimapResourceZonePanel" )
+{
+ m_ppImage = NULL;
+}
+
+CMinimapResourceZonePanel::~CMinimapResourceZonePanel()
+{
+ if ( m_ppImage )
+ {
+ delete m_ppImage;
+ m_ppImage = NULL;
+ }
+}
+
+bool CMinimapResourceZonePanel::Init( KeyValues* pKeyValues, MinimapInitData_t* pInitData )
+{
+ // Can only be applied to resource zones...
+ C_ResourceZone* pResource = dynamic_cast<C_ResourceZone*>( pInitData->m_pEntity );
+ if (!pResource)
+ return false;
+
+ if (!BaseClass::Init(pKeyValues, pInitData))
+ return false;
+
+ // Read in the images for the resource zone...
+ // Default to null
+ m_ppImage = NULL;
+
+ char const* pMaterialName = pKeyValues->GetString( "material" );
+ if ( !pMaterialName || !pMaterialName[ 0 ] )
+ return false;
+
+ // modulation color
+ Color color;
+ if (!ParseRGBA( pKeyValues, "color", color ))
+ color.SetColor( 255, 255, 255, 255 );
+
+ // hook in the bitmap
+ m_ppImage = new BitmapImage( GetVPanel(), pMaterialName );
+ m_ppImage->SetColor( color );
+
+ return true;
+}
+
+void CMinimapResourceZonePanel::Paint( )
+{
+ if ( gHUD.IsHidden( HIDEHUD_MISCSTATUS ) )
+ return;
+
+ // Paint the image for the zone type
+ if ( m_ppImage )
+ {
+ m_ppImage->Paint();
+ }
+}
+
+
+