forked from ValveSoftware/source-sdk-2013
-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathclientmode_shared.h
More file actions
189 lines (147 loc) · 6.03 KB
/
clientmode_shared.h
File metadata and controls
189 lines (147 loc) · 6.03 KB
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//=============================================================================//
#if !defined( CLIENTMODE_NORMAL_H )
#define CLIENTMODE_NORMAL_H
#ifdef _WIN32
#pragma once
#endif
#include "iclientmode.h"
#include "GameEventListener.h"
#include <baseviewport.h>
class CBaseHudChat;
class CBaseHudWeaponSelection;
class CViewSetup;
class C_BaseEntity;
class C_BasePlayer;
namespace vgui
{
class Panel;
}
//=============================================================================
// HPE_BEGIN:
// [tj] Moved this from the .cpp file so derived classes could access it
//=============================================================================
#define ACHIEVEMENT_ANNOUNCEMENT_MIN_TIME 10
//=============================================================================
// HPE_END
//=============================================================================
class CReplayReminderPanel;
#define USERID2PLAYER(i) ToBasePlayer( ClientEntityList().GetEnt( engine->GetPlayerForUserID( i ) ) )
#ifdef MAPBASE
#define DEMO_AUTORECORD 1
#endif
extern IClientMode *GetClientModeNormal(); // must be implemented
// This class implements client mode functionality common to HL2 and TF2.
class ClientModeShared : public IClientMode, public CGameEventListener
{
// IClientMode overrides.
public:
DECLARE_CLASS_NOBASE( ClientModeShared );
ClientModeShared();
virtual ~ClientModeShared();
virtual void Init();
virtual void InitViewport();
virtual void VGui_Shutdown();
virtual void Shutdown();
virtual void LevelInit( const char *newmap );
virtual void LevelShutdown( void );
#ifdef DEMO_AUTORECORD
virtual void AutoRecord( const char *map );
#endif
virtual void Enable();
virtual void Disable();
virtual void Layout();
virtual void ReloadScheme( void );
virtual void OverrideView( CViewSetup *pSetup );
virtual bool ShouldDrawDetailObjects( );
virtual bool ShouldDrawEntity(C_BaseEntity *pEnt);
virtual bool ShouldDrawLocalPlayer( C_BasePlayer *pPlayer );
virtual bool ShouldDrawViewModel();
virtual bool ShouldDrawParticles( );
virtual bool ShouldDrawCrosshair( void );
virtual bool ShouldBlackoutAroundHUD() OVERRIDE;
virtual HeadtrackMovementMode_t ShouldOverrideHeadtrackControl() OVERRIDE;
virtual void AdjustEngineViewport( int& x, int& y, int& width, int& height );
virtual void PreRender(CViewSetup *pSetup);
virtual void PostRender();
virtual void PostRenderVGui();
virtual void ProcessInput(bool bActive);
virtual bool CreateMove( float flInputSampleTime, CUserCmd *cmd );
virtual void Update();
#ifdef MAPBASE // From Alien Swarm SDK
virtual void OnColorCorrectionWeightsReset( void );
virtual float GetColorCorrectionScale( void ) const;
virtual void ClearCurrentColorCorrection() { m_pCurrentColorCorrection = NULL; }
#endif
// Input
virtual int KeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
virtual int HudElementKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
virtual void OverrideMouseInput( float *x, float *y );
virtual void StartMessageMode( int iMessageModeType );
virtual vgui::Panel *GetMessagePanel();
virtual void ActivateInGameVGuiContext( vgui::Panel *pPanel );
virtual void DeactivateInGameVGuiContext();
// The mode can choose to not draw fog
virtual bool ShouldDrawFog( void );
virtual float GetViewModelFOV( void );
virtual vgui::Panel* GetViewport() { return m_pViewport; }
// Gets at the viewports vgui panel animation controller, if there is one...
virtual vgui::AnimationController *GetViewportAnimationController()
{ return m_pViewport->GetAnimationController(); }
virtual void FireGameEvent( IGameEvent *event );
virtual bool CanRecordDemo( char *errorMsg, int length ) const { return true; }
virtual int HandleSpectatorKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
virtual void ComputeVguiResConditions( KeyValues *pkvConditions ) OVERRIDE;
//=============================================================================
// HPE_BEGIN:
// [menglish] Save server information shown to the client in a persistent place
//=============================================================================
virtual wchar_t* GetServerName() { return NULL; }
virtual void SetServerName(wchar_t* name) {};
virtual wchar_t* GetMapName() { return NULL; }
virtual void SetMapName(wchar_t* name) {};
//=============================================================================
// HPE_END
//=============================================================================
virtual bool DoPostScreenSpaceEffects( const CViewSetup *pSetup );
#ifdef MAPBASE
virtual bool DoPostScreenSpaceEffectsPostViewModel( const CViewSetup *pSetup );
#endif
virtual void DisplayReplayMessage( const char *pLocalizeName, float flDuration, bool bUrgent,
const char *pSound, bool bDlg );
virtual bool IsInfoPanelAllowed() OVERRIDE { return true; }
virtual void InfoPanelDisplayed() OVERRIDE { }
virtual bool IsHTMLInfoPanelAllowed() OVERRIDE { return true; }
protected:
CBaseViewport *m_pViewport;
void DisplayReplayReminder();
private:
virtual void UpdateReplayMessages();
void ClearReplayMessageList();
#if defined( REPLAY_ENABLED )
float m_flReplayStartRecordTime;
float m_flReplayStopRecordTime;
CReplayReminderPanel *m_pReplayReminderPanel;
#endif
// Message mode handling
// All modes share a common chat interface
CBaseHudChat *m_pChatElement;
vgui::HCursor m_CursorNone;
CBaseHudWeaponSelection *m_pWeaponSelection;
int m_nRootSize[2];
#ifdef MAPBASE // From Alien Swarm SDK
void UpdatePostProcessingEffects();
const C_PostProcessController* m_pCurrentPostProcessController;
PostProcessParameters_t m_CurrentPostProcessParameters;
PostProcessParameters_t m_LerpStartPostProcessParameters, m_LerpEndPostProcessParameters;
CountdownTimer m_PostProcessLerpTimer;
CHandle<C_ColorCorrection> m_pCurrentColorCorrection;
#endif
};
#endif // CLIENTMODE_NORMAL_H