-
Notifications
You must be signed in to change notification settings - Fork 270
/
Copy pathclientmode_portal.cpp
230 lines (188 loc) · 5.54 KB
/
clientmode_portal.cpp
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include "cbase.h"
#include "ivmodemanager.h"
#include "clientmode_hlnormal.h"
#include "panelmetaclassmgr.h"
#include "c_playerresource.h"
#include "c_portal_player.h"
#include "clientmode_portal.h"
#include "usermessages.h"
#include "prediction.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
// default FOV for HL2
ConVar default_fov( "default_fov", "75", FCVAR_CHEAT );
#ifdef GAMEPADUI
ConVar fov_desired("fov_desired", "75", FCVAR_ARCHIVE | FCVAR_USERINFO, "Sets the base field-of-view.", true, 75.0, true, 120.0);
#else
ConVar fov_desired("fov_desired", "75", FCVAR_ARCHIVE | FCVAR_USERINFO, "Sets the base field-of-view.", true, 75.0, true, 110.0);
#endif // GAMEPADUI
// The current client mode. Always ClientModeNormal in HL.
IClientMode *g_pClientMode = NULL;
//extern EHANDLE g_eKillTarget1;
//extern EHANDLE g_eKillTarget2;
vgui::HScheme g_hVGuiCombineScheme = 0;
#define SCREEN_FILE "scripts/vgui_screens.txt"
//void MsgFunc_KillCam(bf_read &msg)
//{
// C_Portal_Player *pPlayer = C_Portal_Player::GetLocalPortalPlayer();
//
// if ( !pPlayer )
// return;
//
// g_eKillTarget1 = 0;
// g_eKillTarget2 = 0;
// g_nKillCamTarget1 = 0;
// g_nKillCamTarget1 = 0;
//
// long iEncodedEHandle = msg.ReadLong();
//
// if( iEncodedEHandle == INVALID_NETWORKED_EHANDLE_VALUE )
// return;
//
// int iEntity = iEncodedEHandle & ((1 << MAX_EDICT_BITS) - 1);
// int iSerialNum = iEncodedEHandle >> MAX_EDICT_BITS;
//
// EHANDLE hEnt1( iEntity, iSerialNum );
//
// iEncodedEHandle = msg.ReadLong();
//
// if( iEncodedEHandle == INVALID_NETWORKED_EHANDLE_VALUE )
// return;
//
// iEntity = iEncodedEHandle & ((1 << MAX_EDICT_BITS) - 1);
// iSerialNum = iEncodedEHandle >> MAX_EDICT_BITS;
//
// EHANDLE hEnt2( iEntity, iSerialNum );
//
// g_eKillTarget1 = hEnt1;
// g_eKillTarget2 = hEnt2;
//
// if ( g_eKillTarget1.Get() )
// {
// g_nKillCamTarget1 = g_eKillTarget1.Get()->entindex();
// }
//
// if ( g_eKillTarget2.Get() )
// {
// g_nKillCamTarget2 = g_eKillTarget2.Get()->entindex();
// }
//}
//-----------------------------------------------------------------------------
// Purpose: this is the viewport that contains all the hud elements
//-----------------------------------------------------------------------------
class CHudViewport : public CBaseViewport
{
private:
DECLARE_CLASS_SIMPLE( CHudViewport, CBaseViewport );
protected:
virtual void ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
gHUD.InitColors( pScheme );
SetPaintBackgroundEnabled( false );
}
virtual IViewPortPanel *CreatePanelByName( const char *szPanelName );
};
IViewPortPanel* CHudViewport::CreatePanelByName( const char *szPanelName )
{
/*IViewPortPanel* newpanel = NULL;
if ( Q_strcmp( PANEL_SCOREBOARD, szPanelName) == 0 )
{
newpanel = new CHL2MPClientScoreBoardDialog( this );
return newpanel;
}
else if ( Q_strcmp(PANEL_INFO, szPanelName) == 0 )
{
newpanel = new CHL2MPTextWindow( this );
return newpanel;
}*/
return BaseClass::CreatePanelByName( szPanelName );
}
class CHLModeManager : public IVModeManager
{
public:
CHLModeManager( void );
virtual ~CHLModeManager( void );
virtual void Init( void );
virtual void SwitchMode( bool commander, bool force );
virtual void OverrideView( CViewSetup *pSetup );
virtual void CreateMove( float flInputSampleTime, CUserCmd *cmd );
virtual void LevelInit( const char *newmap );
virtual void LevelShutdown( void );
};
CHLModeManager::CHLModeManager( void )
{
}
CHLModeManager::~CHLModeManager( void )
{
}
void CHLModeManager::Init( void )
{
g_pClientMode = GetClientModeNormal();
PanelMetaClassMgr()->LoadMetaClassDefinitionFile( SCREEN_FILE );
}
void CHLModeManager::SwitchMode( bool commander, bool force )
{
}
void CHLModeManager::OverrideView( CViewSetup *pSetup )
{
}
void CHLModeManager::CreateMove( float flInputSampleTime, CUserCmd *cmd )
{
}
void CHLModeManager::LevelInit( const char *newmap )
{
g_pClientMode->LevelInit( newmap );
if ( g_nKillCamMode > OBS_MODE_NONE )
{
g_bForceCLPredictOff = false;
}
g_nKillCamMode = OBS_MODE_NONE;
//g_nKillCamTarget1 = 0;
//g_nKillCamTarget2 = 0;
}
void CHLModeManager::LevelShutdown( void )
{
g_pClientMode->LevelShutdown();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
ClientModePortalNormal::ClientModePortalNormal()
{
}
//-----------------------------------------------------------------------------
// Purpose: If you don't know what a destructor is by now, you are probably going to get fired
//-----------------------------------------------------------------------------
ClientModePortalNormal::~ClientModePortalNormal()
{
}
void ClientModePortalNormal::Init()
{
BaseClass::Init();
//usermessages->HookMessage( "KillCam", MsgFunc_KillCam );
}
void ClientModePortalNormal::InitViewport()
{
m_pViewport = new CHudViewport();
m_pViewport->Start( gameuifuncs, gameeventmanager );
}
ClientModePortalNormal g_ClientModeNormal;
IClientMode *GetClientModeNormal()
{
return &g_ClientModeNormal;
}
ClientModePortalNormal* GetClientModePortalNormal()
{
Assert( dynamic_cast< ClientModePortalNormal* >( GetClientModeNormal() ) );
return static_cast< ClientModePortalNormal* >( GetClientModeNormal() );
}
static CHLModeManager g_HLModeManager;
IVModeManager *modemanager = &g_HLModeManager;