summaryrefslogtreecommitdiff
path: root/game/client/tf/clientmode_tf.h
blob: fe98814464afacd6e6c6866f886a013caf84e3c5 (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
154
155
156
157
158
159
160
161
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================

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

#include "clientmode_shared.h"
#include "tf_viewport.h"
#include "GameUI/IGameUI.h"
#include "halloween/tf_weapon_spellbook.h"
#include "tf_hud_teamgoal_tournament.h"

class CHudMenuEngyBuild;
class CHudMenuEngyDestroy;
class CHudMenuSpyDisguise;
class CTFFreezePanel;
class CItemQuickSwitchPanel;
class CHudEurekaEffectTeleportMenu;
class CHudMenuTauntSelection;
class CHudInspectPanel;
class CHudUpgradePanel;
#ifdef STAGING_ONLY
class CHudMenuSpyBuild;
#endif // STAGING_ONLY
#if defined( _X360 )
class CTFClientScoreBoardDialog;
#endif

class ClientModeTFNormal : public ClientModeShared 
{
DECLARE_CLASS( ClientModeTFNormal, ClientModeShared );

private:

// IClientMode overrides.
public:

					ClientModeTFNormal();
	virtual			~ClientModeTFNormal();

	virtual void	Init();
	virtual void	InitViewport();
	virtual void	Shutdown();

	virtual void	LevelInit( const char *newmap ) OVERRIDE;

//	virtual int		KeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );

	virtual float	GetViewModelFOV( void );
	virtual bool	ShouldDrawViewModel();
	virtual bool	ShouldDrawCrosshair( void );
	virtual bool	ShouldBlackoutAroundHUD() OVERRIDE;
	virtual HeadtrackMovementMode_t ShouldOverrideHeadtrackControl() OVERRIDE;

	int				GetDeathMessageStartHeight( void );

	virtual void	FireGameEvent( IGameEvent *event );
	virtual void	PostRenderVGui();

	virtual bool	CreateMove( float flInputSampleTime, CUserCmd *cmd );

	virtual int		HudElementKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
	virtual int		HandleSpectatorKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );

	virtual bool	DoPostScreenSpaceEffects( const CViewSetup *pSetup );
	virtual void	Update();
	virtual void	ComputeVguiResConditions( KeyValues *pkvConditions ) OVERRIDE;

	virtual bool	IsInfoPanelAllowed() OVERRIDE;
	virtual void	InfoPanelDisplayed() OVERRIDE;
	virtual bool	IsHTMLInfoPanelAllowed() OVERRIDE;

	IGameUI			*GameUI( void ) { return m_pGameUI; }

	const char		*GetLastConnectedServerName( void ) const;		// return the name of the last server we have connected to
	uint32			GetLastConnectedServerIP( void ) const;			// return the IP of the last server we have connected to
	int				GetLastConnectedServerPort( void ) const;		// return the port of the last server we have connected to

	void			PrintTextToChat( const char *pText, KeyValues *pKeyValues = NULL );
	void			PrintTextToChatPlayer( int iPlayerIndex, const char *pText, KeyValues *pKeyValues = NULL );

#if !defined(NO_STEAM)
	STEAM_CALLBACK_MANUAL( ClientModeTFNormal, OnScreenshotRequested, ScreenshotRequested_t, m_CallbackScreenshotRequested );
#endif

	bool IsEngyBuildVisible() const;
	bool IsEngyDestroyVisible() const;
	bool IsEngyEurekaTeleportVisible() const;
	bool IsSpyDisguiseVisible() const;
	bool IsUpgradePanelVisible() const;
	bool IsTauntSelectPanelVisible() const;

	virtual void OnDemoRecordStart( char const* pDemoBaseName ) OVERRIDE;
	virtual void OnDemoRecordStop() OVERRIDE;
	
private:
	//	void	UpdateSpectatorMode( void );

private:
	CHudMenuEngyBuild		*m_pMenuEngyBuild;
	CHudMenuEngyDestroy 	*m_pMenuEngyDestroy;
	CHudMenuSpyDisguise 	*m_pMenuSpyDisguise;
	CHudMenuTauntSelection	*m_pMenuTauntSelection;
	CHudUpgradePanel		*m_pMenuUpgradePanel;
#ifdef STAGING_ONLY
	CHudMenuSpyBuild		*m_pMenuSpyBuild;
#endif // STAGING_ONLY
	CHudSpellMenu			*m_pMenuSpell;
	CHudEurekaEffectTeleportMenu *m_pEurekaTeleportMenu;
	CHudTeamGoalTournament	*m_pTeamGoalTournament;

	CTFFreezePanel			*m_pFreezePanel;
	CItemQuickSwitchPanel	*m_pQuickSwitch;
	CHudInspectPanel		*m_pInspectPanel;
	IGameUI					*m_pGameUI;
	bool					m_wasConnectedLastUpdate;

	char					*m_lastServerName;
	uint32					m_lastServerIP;
	int						m_lastServerPort;
	uint32					m_lastServerConnectTime;

	float					m_flNextAllowedHighFiveHintTime;

	bool					m_bInfoPanelShown;
	bool					m_bRestrictInfoPanel;

	void					AskFavoriteOrBlacklist() const;

#if defined( _X360 )
	CTFClientScoreBoardDialog	*m_pScoreboard;
#endif
};

inline const char *ClientModeTFNormal::GetLastConnectedServerName( void ) const
{
	return m_lastServerName;
}

inline uint32 ClientModeTFNormal::GetLastConnectedServerIP( void ) const
{
	return m_lastServerIP;
}

inline int ClientModeTFNormal::GetLastConnectedServerPort( void ) const
{
	return m_lastServerPort;
}

extern IClientMode *GetClientModeNormal();
extern ClientModeTFNormal* GetClientModeTFNormal();

void PlayOutOfGameSound( const char *pszSound );
float PlaySoundEntry( const char* pszSoundEntryName ); // Returns the duration of the sound
#endif // TF_CLIENTMODE_H