blob: 7540b99c4ea3eea433b87ac5d57deef1fcef693c (
plain) (
blame)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include <KeyValues.h>
#include <vgui/IScheme.h>
#include <vgui/ISurface.h>
#include <vgui/ISystem.h>
#include <vgui_controls/AnimationController.h>
#include <vgui_controls/EditablePanel.h>
#include <vgui_controls/ImagePanel.h>
#include <vgui/ISurface.h>
#include "c_dod_team.h"
#include "c_dod_playerresource.h"
#include "c_dod_player.h"
#include "weapon_dodfireselect.h"
#include "dodcornercutpanel.h"
#include "dod_hud_playerstatus_fireselect.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CDoDHudFireSelect::CDoDHudFireSelect( vgui::Panel *parent, const char *name ) : vgui::EditablePanel( parent, name )
{
m_pBackground = new CDoDCutEditablePanel( this, "FireSelectBackground" );
m_pIconMP44 = new CIconPanel( this, "Icon_MP44" );
m_pIconBAR = new CIconPanel( this, "Icon_BAR" );
m_pBulletLeft = new CIconPanel( this, "Bullet_Left" );
m_pBulletCenter = new CIconPanel( this, "Bullet_Center" );
m_pBulletRight = new CIconPanel( this, "Bullet_Right" );
m_pBulletRight->SetVisible( true );
}
void CDoDHudFireSelect::ApplySchemeSettings( vgui::IScheme *pScheme )
{
LoadControlSettings( "resource/UI/HudPlayerStatusFireSelect.res" );
BaseClass::ApplySchemeSettings( pScheme );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CDoDHudFireSelect::SetVisible( bool state )
{
if ( m_pBackground && m_pBackground->IsVisible() != state )
{
m_pBackground->SetVisible( state );
}
m_pBulletLeft->SetVisible( state );
m_pBulletCenter->SetVisible( state );
m_pBulletRight->SetVisible( state );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CDoDHudFireSelect::OnThink()
{
BaseClass::OnThink();
C_DODPlayer *pPlayer = C_DODPlayer::GetLocalDODPlayer();
if ( pPlayer )
{
CWeaponDODBase *pWeapon = pPlayer->GetActiveDODWeapon();
if ( pWeapon )
{
bool bSemiAutoWpn = false;
if ( pWeapon->IsA( WEAPON_MP44 ) )
{
m_pIconBAR->SetVisible( false );
m_pIconMP44->SetVisible( true );
bSemiAutoWpn = true;
}
else if ( pWeapon->IsA( WEAPON_BAR ) )
{
m_pIconBAR->SetVisible( true );
m_pIconMP44->SetVisible( false );
bSemiAutoWpn = true;
}
else
{
m_pIconBAR->SetVisible( false );
m_pIconMP44->SetVisible( false );
}
if ( bSemiAutoWpn )
{
SetVisible( true );
CDODFireSelectWeapon *pFireSelect = dynamic_cast<CDODFireSelectWeapon *>(pWeapon);
if ( pFireSelect && pFireSelect->IsSemiAuto() )
{
m_pBulletLeft->SetVisible( false );
m_pBulletCenter->SetVisible( false );
}
else
{
m_pBulletLeft->SetVisible( true );
m_pBulletCenter->SetVisible( true );
}
}
else
{
SetVisible( false );
}
}
}
}
|