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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef CSSPECTATORGUI_H
#define CSSPECTATORGUI_H
#ifdef _WIN32
#pragma once
#endif
#include "spectatorgui.h"
#include "mapoverview.h"
#include "cs_shareddefs.h"
extern ConVar mp_playerid; // in cs_gamerules.h
extern ConVar mp_forcecamera; // in gamevars_shared.h
extern ConVar mp_fadetoblack;
//-----------------------------------------------------------------------------
// Purpose: Cstrike Spectator UI
//-----------------------------------------------------------------------------
class CCSSpectatorGUI : public CSpectatorGUI
{
private:
DECLARE_CLASS_SIMPLE( CCSSpectatorGUI, CSpectatorGUI );
public:
CCSSpectatorGUI( IViewPort *pViewPort );
virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
virtual void UpdateSpectatorPlayerList( void );
virtual void Update( void );
virtual bool NeedsUpdate( void );
//=============================================================================
// HPE_BEGIN:
// [smessick]
//=============================================================================
virtual void ShowPanel( bool bShow );
//=============================================================================
// HPE_END
//=============================================================================
protected:
void UpdateTimer();
void UpdateAccount();
int m_nLastAccount;
int m_nLastTime;
int m_nLastSpecMode;
CBaseEntity *m_nLastSpecTarget;
void StoreWidths( void );
void ResizeControls( void );
bool ControlsPresent( void ) const;
vgui::Label *m_pCTLabel;
vgui::Label *m_pCTScore;
vgui::Label *m_pTerLabel;
vgui::Label *m_pTerScore;
vgui::Label *m_pTimer;
vgui::Label *m_pTimerLabel;
vgui::Panel *m_pDivider;
vgui::Label *m_pExtraInfo;
bool m_modifiedWidths;
int m_scoreWidth;
int m_extraInfoWidth;
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
#define DESIRED_RADAR_RESOLUTION 450
class CCSMapOverview : public CMapOverview
{
DECLARE_CLASS_SIMPLE( CCSMapOverview, CMapOverview );
public:
enum
{
MAP_ICON_T = 0,
MAP_ICON_CT,
MAP_ICON_HOSTAGE,
MAP_ICON_COUNT
};
CCSMapOverview( const char *pElementName );
virtual ~CCSMapOverview();
virtual bool ShouldDraw( void );
vgui::Panel *GetAsPanel(){ return this; }
virtual bool AllowConCommandsWhileAlive(){return false;}
virtual void SetPlayerPreferredMode( int mode );
virtual void SetPlayerPreferredViewSize( float viewSize );
virtual void ApplySchemeSettings( vgui::IScheme *scheme );
protected: // private structures & types
// list of game events the hLTV takes care of
typedef struct {
int xpos;
int ypos;
} FootStep_t;
// Extra stuff in a this-level parallel array
typedef struct CSMapPlayer_s {
int overrideIcon; // if not -1, the icon to use instead
int overrideIconOffscreen; // to use with overrideIcon
float overrideFadeTime; // Time to start fading the override icon
float overrideExpirationTime; // Time to not use the override icon any more
Vector overridePosition; // Where the overridden icon will draw
QAngle overrideAngle; // And at what angle
bool isDead; // Death latch, since client can be behind the times on health messages.
float timeLastSeen; // curtime that we last saw this guy.
float timeFirstSeen; // curtime that we started seeing this guy
bool isHostage; // Not a full player, a hostage. Special icon, different death event
float flashUntilTime;
float nextFlashPeakTime;
int currentFlashAlpha;
} CSMapPlayer_t;
typedef struct CSMapBomb_s
{
Vector position;
enum BombState
{
BOMB_PLANTED, //planted and ticking down
BOMB_DROPPED, //dropped and lying loose
BOMB_CARRIED, //in the arms of a player
BOMB_GONE, //defused or exploded, but was planted
BOMB_INVALID //no bomb
};
BombState state;
float timeLastSeen;
float timeFirstSeen;
float timeFade;
float timeGone;
float currentRingRadius;
float currentRingAlpha;
float maxRingRadius;
float ringTravelTime;
} CSMapBomb_t;
typedef struct CSMapGoal_s
{
Vector position;
int iconToUse;
} CSMapGoal_t;
public: // IViewPortPanel interface:
virtual void Update();
virtual void Init( void );
// both vgui::Frame and IViewPortPanel define these, so explicitly define them here as passthroughs to vgui
vgui::VPANEL GetVPanel( void ) { return BaseClass::GetVPanel(); }
virtual bool IsVisible() { return BaseClass::IsVisible(); }
virtual void SetParent(vgui::VPANEL parent) { BaseClass::SetParent(parent); }
// IGameEventListener
virtual void FireGameEvent( IGameEvent *event);
// VGUI overrides
// Player settings:
void SetPlayerSeen( int index );
void SetBombSeen( bool seen );
// general settings:
virtual void SetMap(const char * map);
virtual void SetMode( int mode );
// Object settings
virtual void FlashEntity( int entityID );
// rules that define if you can see a player on the overview or not
virtual bool CanPlayerBeSeen(MapPlayer_t *player);
virtual int GetIconNumberFromTeamNumber( int teamNumber );
protected:
virtual void DrawCamera();
virtual void DrawMapTexture();
virtual void DrawMapPlayers();
void DrawHostages();
void DrawBomb();
void DrawGoalIcons();
virtual void ResetRound();
virtual void InitTeamColorsAndIcons();
virtual void UpdateSizeAndPosition();
void UpdateGoalIcons();
void ClearGoalIcons();
virtual bool IsRadarLocked();
Vector2D PanelToMap( const Vector2D &panelPos );
bool AdjustPointToPanel(Vector2D *pos);
MapPlayer_t* GetPlayerByEntityID( int entityID );
MapPlayer_t* GetHostageByEntityID( int entityID );
virtual void UpdatePlayers();
void UpdateHostages();///< Update hostages in the MapPlayer list
void UpdateBomb();
void UpdateFlashes();
bool CreateRadarImage(const char *mapName, const char *radarFileName);
virtual bool RunHudAnimations(){ return false; }
private:
bool DrawIconCS( int textureID,
int offscreenTextureID,
Vector pos,
float scale,
float angle,
int alpha,
bool allowRotation = true,
const char *text = NULL,
Color *textColor = NULL,
float status = -1,
Color *statusColor = NULL
);
int GetMasterAlpha( void );// The main alpha that the map part should be, determined by using the mode to look at the right convar
int GetBorderSize( void );// How far in from the edge of the panel we draw, based on mode. Let's the background fancy corners show.
CSMapPlayer_t* GetCSInfoForPlayerIndex( int index );
CSMapPlayer_t* GetCSInfoForPlayer(MapPlayer_t *player);
CSMapPlayer_t* GetCSInfoForHostage(MapPlayer_t *hostage);
bool CanHostageBeSeen(MapPlayer_t *hostage);
CSMapPlayer_t m_PlayersCSInfo[MAX_PLAYERS];
CSMapBomb_t m_bomb;
MapPlayer_t m_Hostages[MAX_HOSTAGES];
CSMapPlayer_t m_HostagesCSInfo[MAX_HOSTAGES];
CUtlVector< CSMapGoal_t > m_goalIcons;
bool m_goalIconsLoaded;
int m_TeamIconsSelf[MAP_ICON_COUNT];
int m_TeamIconsDead[MAP_ICON_COUNT];
int m_TeamIconsOffscreen[MAP_ICON_COUNT];
int m_TeamIconsDeadOffscreen[MAP_ICON_COUNT];
int m_bombIconPlanted;
int m_bombIconDropped;
int m_bombIconCarried;
int m_bombRingPlanted;
int m_bombRingDropped;
int m_bombRingCarried;
int m_bombRingCarriedOffscreen;
int m_radioFlash;
int m_radioFlashOffscreen;
int m_radarTint;
int m_hostageFollowing;
int m_hostageFollowingOffscreen;
int m_playerFacing;
int m_cameraIconFirst;
int m_cameraIconThird;
int m_cameraIconFree;
int m_hostageRescueIcon;
int m_bombSiteIconA;
int m_bombSiteIconB;
int m_nRadarMapTextureID; // texture id for radar version of current overview image
int m_playerPreferredMode; // The mode the player wants to be in for when we aren't being the radar
};
#endif // CSSPECTATORGUI_H
|