-
Notifications
You must be signed in to change notification settings - Fork 270
/
Copy pathhl1_clientmode.cpp
160 lines (122 loc) · 3.94 KB
/
hl1_clientmode.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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include "cbase.h"
#include "ivmodemanager.h"
#include "clientmode_hlnormal.h"
#include "hl1_clientmode.h"
#include "hl1_clientscoreboard.h"
// default FOV for HL1
ConVar default_fov( "default_fov", "110", FCVAR_CHEAT );
ConVar fov_desired( "fov_desired", "90", FCVAR_ARCHIVE | FCVAR_USERINFO, "Sets the base field-of-view.", true, 75.0, true, 130.0 );
// The current client mode. Always ClientModeNormal in HL.
IClientMode *g_pClientMode = NULL;
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 ) = default;
CHLModeManager::~CHLModeManager( void ) = default;
void CHLModeManager::Init( void )
{
g_pClientMode = GetClientModeNormal();
}
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 );
}
void CHLModeManager::LevelShutdown( void )
{
g_pClientMode->LevelShutdown();
}
static CHLModeManager g_HLModeManager;
IVModeManager *modemanager = &g_HLModeManager;
//-----------------------------------------------------------------------------
// 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 void CreateDefaultPanels( void )
{
CBaseViewport::CreateDefaultPanels();
}
virtual IViewPortPanel *CreatePanelByName( const char *szPanelName );
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
ClientModeHL1Normal::ClientModeHL1Normal() = default;
//-----------------------------------------------------------------------------
// Purpose: If you don't know what a destructor is by now, you are probably going to get fired
//-----------------------------------------------------------------------------
ClientModeHL1Normal::~ClientModeHL1Normal() = default;
void ClientModeHL1Normal::InitViewport()
{
m_pViewport = new CHudViewport();
m_pViewport->Start( gameuifuncs, gameeventmanager );
}
float ClientModeHL1Normal::GetViewModelFOV( void )
{
return 90.0f;
}
int ClientModeHL1Normal::GetDeathMessageStartHeight( void )
{
return m_pViewport->GetDeathMessageStartHeight();
}
ClientModeHL1Normal g_ClientModeNormal;
IClientMode *GetClientModeNormal()
{
return &g_ClientModeNormal;
}
ClientModeHL1Normal* GetClientModeHL1Normal()
{
Assert( dynamic_cast< ClientModeHL1Normal* >( GetClientModeNormal() ) );
return static_cast< ClientModeHL1Normal* >( GetClientModeNormal() );
}
IViewPortPanel* CHudViewport::CreatePanelByName( const char *szPanelName )
{
#ifdef HL1MP_CLIENT_DLL
IViewPortPanel* newpanel = NULL;
if ( Q_strcmp( PANEL_SCOREBOARD, szPanelName) == 0 )
{
newpanel = new CHL1MPClientScoreBoardDialog( this );
return newpanel;
}
#endif
/* else if ( Q_strcmp(PANEL_INFO, szPanelName) == 0 )
{
newpanel = new CHL2MPTextWindow( this );
return newpanel;
}*/
return BaseClass::CreatePanelByName( szPanelName );
}