summaryrefslogtreecommitdiff
path: root/game/client/cstrike/VGUI/cstrikeclientscoreboard.h
blob: 2a2e4098303372583012f872997058499c51a2a4 (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
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef CSTRIKECLIENTSCOREBOARDDIALOG_H
#define CSTRIKECLIENTSCOREBOARDDIALOG_H
#ifdef _WIN32
#pragma once
#endif

#include <clientscoreboarddialog.h>
#include <vgui_controls/ImagePanel.h>
#include "cs_shareddefs.h"
#include <vgui_controls/Frame.h>
#include "vgui_avatarimage.h"


const int cMaxScoreLines = 32;  // This value must be > 2


//-----------------------------------------------------------------------------
// Purpose: Game ScoreBoard
//-----------------------------------------------------------------------------
class CCSClientScoreBoardDialog : public CClientScoreBoardDialog
{
private:
    DECLARE_CLASS_SIMPLE( CCSClientScoreBoardDialog, CClientScoreBoardDialog );

public:
    CCSClientScoreBoardDialog( IViewPort *pViewPort );
    ~CCSClientScoreBoardDialog();

    virtual void Update();

    // vgui overrides for rounded corner background
    void UpdateMvpElements();
    virtual void ApplySchemeSettings( vgui::IScheme *pScheme );

	virtual void ResetFromGameOverState();

    // [tj] Hook in here to hide other UI
    virtual void ShowPanel( bool state ); 

    // [tj] So we can do processing every frame
    virtual void OnThink();

protected:

	struct PlayerScoreInfo
	{
		const char*		szName;
		const char*		szClanTag;
		int				playerIndex;
		int				frags;
		int				deaths;
		int				ping;
		const char*		szStatus;
		bool			bStatusPlayerColor;
	};

	struct PlayerDisplay
	{
		vgui::Label*			pNameLabel;
		vgui::Label*			pClanLabel;
		vgui::Label*			pScoreLabel;
		vgui::Label*			pDeathsLabel;
		vgui::Label*			pPingLabel;
		vgui::Label*			pMVPCountLabel;
		CAvatarImagePanel*		pAvatar;
		vgui::ImagePanel*		pStatusImage;
		vgui::ImagePanel*		pMVPImage;
		vgui::ImagePanel*		pSelect;
	};

	struct TeamDisplayInfo
	{
		Color					playerDataColor;
		Color					playerClanColor;
		PlayerDisplay			playerDisplay[cMaxScoreLines];
		CUtlVector<PlayerScoreInfo*>  playerScores;		// For sorting team members outside of the listboxes
		int						scoreAreaInnerHeight;
		int						scoreAreaLineHeight;
		int						scoreAreaLinePreferredLeading;
		int						scoreAreaStartY;
		int						scoreAreaMinX;
		int						scoreAreaMaxX;
		int						maxPlayersVisible;
	};

	bool GetPlayerScoreInfo( int playerIndex, PlayerScoreInfo& playerScoreInfo );
	void UpdateTeamPlayerDisplay( TeamDisplayInfo& teamDisplay );
	void SetupTeamDisplay( TeamDisplayInfo& teamDisplay, const char* szTeamPrefix );

	void UpdateTeamInfo();
	void UpdatePlayerList();

	bool ForceLocalPlayerVisible( TeamDisplayInfo& teamDisplay );
	void UpdateSpectatorList();
	void UpdateHLTVList( void );
	void UpdateMatchEndText();

	bool ShouldShowAsSpectator( int iPlayerIndex );
	void FireGameEvent( IGameEvent *event );

	void UpdatePlayerColors( void );
	void AdjustFontToFit( const char *pString, vgui::Label *pLabel );

	static int PlayerSortFunction( PlayerScoreInfo* const* pPS1, PlayerScoreInfo* const* pPS2 );

private:
    vgui::HFont					m_listItemFont;
    vgui::HFont                 m_listItemFontSmaller;
    vgui::HFont                 m_listItemFontSmallest;
    vgui::HFont                 m_MVPFont;

    int			m_iImageDead;
    int			m_iImageMVP; // Not used in the section list explicitly.  Drawn over it
    int			m_iImageDominated;
    int			m_iImageNemesis;
    int			m_iImageBomb;
    int			m_iImageVIP;
    int			m_iImageFriend;
    int         m_iImageNemesisDead;
    int         m_iImageDominationDead;

	Color			m_DeadPlayerDataColor;
	Color			m_PlayerDataBgColor;
	Color			m_DeadPlayerClanColor;

	vgui::Label*	m_pWinConditionLabel;
	vgui::Label*	m_pClockLabel;
	vgui::Label*	m_pLabelMapName;
	vgui::Label*	m_pServerLabel;

    bool			m_gameOver;

    wchar_t			m_pMapName[256];
    wchar_t			m_pServerName[256];
    wchar_t			m_pStatsEnabled[256];
    wchar_t			m_pStatsDisabled[256];

    int m_LocalPlayerItemID;
	int m_MVPXOffset;

	TeamDisplayInfo	m_teamDisplayT;
	TeamDisplayInfo	m_teamDisplayCT;
};


#endif // CSTRIKECLIENTSCOREBOARDDIALOG_H