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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include "cbase.h"
#include "vgui_int.h"
#include "ienginevgui.h"
#include "vgui_rootpanel_tf.h"
#include "vgui/IVGui.h"
#include "tier2/fileutils.h"
#include "icommandline.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
C_TFRootPanel *g_pRootPanel = NULL;
static ConVar tf_ui_version( "tf_ui_version", "1", FCVAR_DEVELOPMENTONLY );
extern const char *COM_GetModDirectory();
void CheckCustomModSearchPaths()
{
const char *pszCustomPathID = "custom_mod";
CUtlVector< CUtlString > searchPaths;
GetSearchPath( searchPaths, pszCustomPathID );
FOR_EACH_VEC( searchPaths, i )
{
const char *pszSearchPath = searchPaths[i].String();
// check each path for version file
char szVersionFile[MAX_PATH];
V_ComposeFileName( pszSearchPath, "info.vdf", szVersionFile, sizeof( szVersionFile ) );
KeyValuesAD versionKV( pszCustomPathID );
if ( versionKV->LoadFromFile( g_pFullFileSystem, szVersionFile ) )
{
// mod must declare this ConVar
if ( tf_ui_version.GetInt() == versionKV->GetInt( "ui_version" ) )
{
continue;
}
DevMsg( "'ui_version' mismatch. expected version %d. Removed search path '%s' from all pathIDs.\n", tf_ui_version.GetInt(), pszSearchPath );
// remove from all path ids
g_pFullFileSystem->RemoveSearchPath( pszSearchPath, pszCustomPathID );
g_pFullFileSystem->RemoveSearchPath( pszSearchPath, "game" );
g_pFullFileSystem->RemoveSearchPath( pszSearchPath, "mod" );
}
else
{
DevMsg( "missing 'info.vdf'. Removed search path '%s' from '%s' pathID.\n", pszSearchPath, pszCustomPathID );
g_pFullFileSystem->RemoveSearchPath( pszSearchPath, pszCustomPathID );
}
}
// only allow to load loose files when using insecure mode
if ( CommandLine()->FindParm( "-insecure" ) )
{
// allow lose files in these search paths
g_pFullFileSystem->AddSearchPath( "tf", "vgui" );
g_pFullFileSystem->AddSearchPath( "hl2", "vgui" );
g_pFullFileSystem->AddSearchPath( "platform", "vgui" );
}
}
//-----------------------------------------------------------------------------
// Global functions.
//-----------------------------------------------------------------------------
void VGUI_CreateClientDLLRootPanel( void )
{
// do this before creating any vgui panels
CheckCustomModSearchPaths();
g_pRootPanel = new C_TFRootPanel( enginevgui->GetPanel( PANEL_CLIENTDLL ) );
}
void VGUI_DestroyClientDLLRootPanel( void )
{
g_pRootPanel->MarkForDeletion();
g_pRootPanel = NULL;
}
vgui::VPANEL VGui_GetClientDLLRootPanel( void )
{
return g_pRootPanel->GetVPanel();
}
//-----------------------------------------------------------------------------
// C_TFRootPanel implementation.
//-----------------------------------------------------------------------------
C_TFRootPanel::C_TFRootPanel( vgui::VPANEL parent )
: BaseClass( NULL, "TF Root Panel" )
{
SetParent( parent );
SetPaintEnabled( false );
SetPaintBorderEnabled( false );
SetPaintBackgroundEnabled( false );
// This panel does post child painting
SetPostChildPaintEnabled( true );
// Make it screen sized
SetBounds( 0, 0, ScreenWidth(), ScreenHeight() );
// Ask for OnTick messages
vgui::ivgui()->AddTickSignal( GetVPanel() );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_TFRootPanel::~C_TFRootPanel( void )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_TFRootPanel::PostChildPaint()
{
BaseClass::PostChildPaint();
// Draw all panel effects
RenderPanelEffects();
}
//-----------------------------------------------------------------------------
// Purpose: For each panel effect, check if it wants to draw and draw it on
// this panel/surface if so
//-----------------------------------------------------------------------------
void C_TFRootPanel::RenderPanelEffects( void )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_TFRootPanel::OnTick( void )
{
}
//-----------------------------------------------------------------------------
// Purpose: Reset effects on level load/shutdown
//-----------------------------------------------------------------------------
void C_TFRootPanel::LevelInit( void )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_TFRootPanel::LevelShutdown( void )
{
}
|