1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "hudelement.h"
#include <vgui_controls/Panel.h>
#include <vgui/ISurface.h>
#include "c_dod_player.h"
#include "iclientmode.h"
class CHudAreaCapIcon : public CHudElement, public vgui::Panel
{
public:
DECLARE_CLASS_SIMPLE( CHudAreaCapIcon, vgui::Panel );
CHudAreaCapIcon( const char *name );
virtual void Paint();
virtual void Init();
virtual bool ShouldDraw();
private:
int m_iAreaTexture;
int m_iPrevMaterialIndex;
Color m_clrIcon;
};
// DECLARE_HUDELEMENT( CHudAreaCapIcon );
CHudAreaCapIcon::CHudAreaCapIcon( const char *pName ) :
vgui::Panel( NULL, "HudAreaCapIcon" ), CHudElement( pName )
{
SetParent( g_pClientMode->GetViewport() );
m_clrIcon = Color(255,255,255,255);
m_iPrevMaterialIndex = 0;
SetHiddenBits( HIDEHUD_PLAYERDEAD );
}
void CHudAreaCapIcon::Init()
{
m_iAreaTexture = vgui::surface()->CreateNewTextureID();
}
bool CHudAreaCapIcon::ShouldDraw()
{
return false;
}
void CHudAreaCapIcon::Paint()
{
/*
C_DODPlayer *pPlayer = C_DODPlayer::GetLocalDODPlayer();
if( !pPlayer )
return;
int x,y,w,h;
GetBounds( x,y,w,h );
// The player knows what material to show as our area icon
int iMaterialIndex = pPlayer->m_Shared.GetAreaIconMaterial();
if( iMaterialIndex <= 0 )
return;
// if the icon is changed from last draw, force the texture to reload
bool bForceReload = ( m_iPrevMaterialIndex != iMaterialIndex );
// get the material name from the material string table
const char *szMatName = GetMaterialNameFromIndex( iMaterialIndex );
// draw the icon
vgui::surface()->DrawSetTextureFile( m_iAreaTexture, szMatName , true, bForceReload);
vgui::surface()->DrawSetColor( m_clrIcon );
vgui::surface()->DrawTexturedRect( 0, 0, w, h );
// store the previous material index to compare next frame
m_iPrevMaterialIndex = iMaterialIndex;*/
}
|