diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/tf/vgui/vgui_rootpanel_tf.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/tf/vgui/vgui_rootpanel_tf.cpp')
| -rw-r--r-- | game/client/tf/vgui/vgui_rootpanel_tf.cpp | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/game/client/tf/vgui/vgui_rootpanel_tf.cpp b/game/client/tf/vgui/vgui_rootpanel_tf.cpp new file mode 100644 index 0000000..fbd0768 --- /dev/null +++ b/game/client/tf/vgui/vgui_rootpanel_tf.cpp @@ -0,0 +1,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 ) +{ +} + |