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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef TF_HUD_ESCORT_H
#define TF_HUD_ESCORT_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui_controls/EditablePanel.h>
#include <vgui_controls/ImagePanel.h>
#include "tf_controls.h"
#include "GameEventListener.h"
#include "c_tf_objective_resource.h"
#include "IconPanel.h"
#include "hud_controlpointicons.h"
#include "tf_gamerules.h"
#include "proxyentity.h"
#include "materialsystem/imaterial.h"
#include "materialsystem/imaterialvar.h"
class CEscortHillPanel : public vgui::Panel, public CGameEventListener
{
DECLARE_CLASS_SIMPLE( CEscortHillPanel, vgui::Panel );
public:
CEscortHillPanel( vgui::Panel *parent, const char *name );
virtual void Paint( void );
virtual void PerformLayout( void );
void SetHillNumber( int nHill ){ m_nHill = nHill; }
void SetTeamNumber( int nTeam ){ m_nTeam = nTeam; }
virtual void OnTick( void );
public: // CGameEventListener:
virtual void FireGameEvent( IGameEvent *event );
private:
void UpdateHillAnimations( bool bOnHill );
private:
int m_iTexture;
int m_nHill; // hill number this panel represents
int m_nTeam;
bool m_bOnHill;
bool m_bFadingOut;
float m_flUVScroll;
float m_flUVW;
int m_nPanelWide;
int m_nPanelTall;
int m_bDownhill;
};
class CEscortStatusTeardrop : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CEscortStatusTeardrop, vgui::EditablePanel );
public:
CEscortStatusTeardrop(Panel *parent);
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual bool IsVisible( void );
void SetupForPoint( int iCPIndex );
void UpdateBarText( int iCPIndex );
private:
vgui::Label *m_pBarText;
CIconPanel *m_pTeardrop;
CIconPanel *m_pBlocked;
vgui::ImagePanel *m_pCapping;
int m_iOrgHeight;
int m_iMidGroupIndex;
};
class CTFHudEscortProgressBar : public vgui::ImagePanel
{
public:
DECLARE_CLASS_SIMPLE( CTFHudEscortProgressBar, vgui::ImagePanel );
CTFHudEscortProgressBar( vgui::Panel *parent, const char *name );
virtual void Paint();
void SetPercentage( float flPercentage ){ m_flPercent = flPercentage; }
void SetTeam( int nTeam );
private:
float m_flPercent;
int m_iTexture;
int m_nTeam;
};
class CSimpleControlPoint : public vgui::ImagePanel
{
DECLARE_CLASS_SIMPLE( CSimpleControlPoint, vgui::ImagePanel );
public:
CSimpleControlPoint(Panel *parent, const char *name, int index) : vgui::ImagePanel( parent, name )
{
SetShouldScaleImage( true );
m_iCPIndex = index;
m_bForceOpaque = false;
}
virtual bool IsVisible( void )
{
if ( IsInFreezeCam() == true )
return false;
return BaseClass::IsVisible();
}
void SetCPIndex( int index )
{
m_iCPIndex = index;
}
void UpdateImage( void )
{
int iOwner = ObjectiveResource()->GetOwningTeam( m_iCPIndex );
bool bMultipleTrains = ( TFGameRules() && TFGameRules()->HasMultipleTrains() ) ? true : false;
const char *szMatName = "";
switch ( iOwner )
{
case TF_TEAM_BLUE:
if ( !bMultipleTrains && !m_bForceOpaque )
{
szMatName = "hud/cart_point_blue";
}
else
{
szMatName = "hud/cart_point_blue_opaque";
}
break;
case TF_TEAM_RED:
if ( !bMultipleTrains && !m_bForceOpaque )
{
szMatName = "hud/cart_point_red";
}
else
{
szMatName = "hud/cart_point_red_opaque";
}
break;
default:
if ( !bMultipleTrains && !m_bForceOpaque )
{
szMatName = "hud/cart_point_neutral";
}
else
{
szMatName = "hud/cart_point_neutral_opaque";
}
break;
}
SetImage( VarArgs("..\\%s", szMatName ) );
}
int GetCapIndex( void ) { return m_iCPIndex; }
void SetForceOpaqueImages( bool state )
{
m_bForceOpaque = state;
UpdateImage();
}
private:
int m_iCPIndex;
bool m_bForceOpaque;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CTFHudEscort : public vgui::EditablePanel, public CGameEventListener
{
DECLARE_CLASS_SIMPLE( CTFHudEscort, vgui::EditablePanel );
public:
CTFHudEscort( vgui::Panel *parent, const char *name );
~CTFHudEscort();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void PerformLayout();
virtual bool IsVisible( void );
virtual void Reset(){ m_iCurrentCP = -1; }
void OnTick();
void UpdateCPImages( void );
void UpdateStatusTeardropFor( int iIndex );
void SetTeam( int nTeam )
{
m_nTeam = nTeam;
if ( m_pProgressBar )
{
m_pProgressBar->SetTeam( m_nTeam );
}
}
void SetTopPanel( bool bTopPanel )
{
m_bTopPanel = bTopPanel;
}
public: // CGameEventListener:
virtual void FireGameEvent( IGameEvent *event );
private:
void UpdateAlarmAnimations( void );
private:
int m_iSpeedLevel; // how fast is the escorted object moving
float m_flProgress; // left to right progress percent
CInterpolatedVar<float> m_flProgressHistory;
vgui::EditablePanel *m_pEscortItemPanel;
CUtlVector<CSimpleControlPoint *> m_Icons;
bool m_bHaveValidPointPositions;
vgui::ImagePanel *m_pSpeedBackwards;
vgui::ImagePanel *m_pCapPlayerImage;
CExLabel *m_pCapNumPlayers;
vgui::ImagePanel *m_pBlocked;
vgui::ImagePanel *m_pCPTemplate;
vgui::ImagePanel *m_pLevelBar;
CEscortStatusTeardrop *m_pStatus;
int m_iCurrentCP;
CControlPointIconSwoop *m_pHilightSwoop;
bool m_bShowSwoop;
float m_flRecedeTime;
vgui::ImagePanel *m_pEscortItemImage;
vgui::ImagePanel *m_pEscortItemImageBottom;
vgui::ImagePanel *m_pHomeCPIcon;
int m_nTeam;
bool m_bMultipleTrains; // stored to compare against what TFGamerules says...
int m_iBlueMaterialIndex; // blue material for multiple tracks colored overlay
int m_iRedMaterialIndex; // red material for multiple tracks colored overlay
CTFHudEscortProgressBar *m_pProgressBar;
CEscortHillPanel *m_pHillPanels[TEAM_TRAIN_MAX_HILLS];
vgui::ImagePanel *m_pEscortItemImageAlert;
bool m_bAlarm;
bool m_bTopPanel;
int m_nNumHills;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CTFHudMultipleEscort : public vgui::EditablePanel, public CGameEventListener
{
DECLARE_CLASS_SIMPLE( CTFHudMultipleEscort, vgui::EditablePanel );
public:
CTFHudMultipleEscort( vgui::Panel *parent, const char *name );
~CTFHudMultipleEscort();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void SetVisible( bool state );
virtual void Reset();
public: // IGameEventListener Interface
virtual void FireGameEvent( IGameEvent * event );
private:
CTFHudEscort *m_pBluePanel;
CTFHudEscort *m_pRedPanel;
};
#endif // TF_HUD_ESCORT_H
|