mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-02-03 17:20:43 +03:00
Added support for map-specific client schemes
This commit is contained in:
parent
0b96d525d5
commit
e27f4df8e5
@ -1180,7 +1180,7 @@ void CHudCommentary::StartCommentary( C_PointCommentaryNode *pNode, char *pszSpe
|
||||
m_pImage->EvictImage();
|
||||
|
||||
// Get our scheme and font information
|
||||
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
|
||||
vgui::HScheme scheme = GetScheme();
|
||||
m_hFont = vgui::scheme()->GetIScheme(scheme)->GetFont( "CommentaryDefault" );
|
||||
if ( !m_hFont )
|
||||
{
|
||||
@ -1253,7 +1253,7 @@ void CHudCommentary::StartTextCommentary( C_PointCommentaryNode *pNode, const ch
|
||||
SetBgColor( m_bUseScriptBGColor ? m_BGOverrideColor : m_TextBackgroundColor );
|
||||
|
||||
// Get our scheme and font information
|
||||
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
|
||||
vgui::HScheme scheme = GetScheme();
|
||||
m_hFont = vgui::scheme()->GetIScheme(scheme)->GetFont( "CommentaryDefault" );
|
||||
if ( !m_hFont )
|
||||
{
|
||||
@ -1326,7 +1326,7 @@ void CHudCommentary::StartImageCommentary( C_PointCommentaryNode *pNode, const c
|
||||
m_pImage->SetWide( m_iBarWide - m_iTextBorderSpace );
|
||||
|
||||
// Get our scheme and font information
|
||||
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
|
||||
vgui::HScheme scheme = GetScheme();
|
||||
m_hFont = vgui::scheme()->GetIScheme(scheme)->GetFont( "CommentaryDefault" );
|
||||
if ( !m_hFont )
|
||||
{
|
||||
@ -1384,7 +1384,7 @@ void CHudCommentary::StartSceneCommentary( C_PointCommentaryNode *pNode, char *p
|
||||
m_pImage->EvictImage();
|
||||
|
||||
// Get our scheme and font information
|
||||
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
|
||||
vgui::HScheme scheme = GetScheme();
|
||||
m_hFont = vgui::scheme()->GetIScheme(scheme)->GetFont( "CommentaryDefault" );
|
||||
if ( !m_hFont )
|
||||
{
|
||||
|
@ -341,7 +341,11 @@ void CHudCredits::DrawOutroCreditsName( void )
|
||||
if ( pCredit == NULL )
|
||||
continue;
|
||||
|
||||
#ifdef MAPBASE
|
||||
vgui::HScheme scheme = GetScheme();
|
||||
#else
|
||||
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
|
||||
#endif
|
||||
vgui::HFont m_hTFont = INVALID_FONT;
|
||||
|
||||
int iFontTall = 1;
|
||||
@ -635,7 +639,11 @@ void CHudCredits::DrawLogo( void )
|
||||
Q_snprintf( szLogoFont, sizeof( szLogoFont ), "WeaponIcons" );
|
||||
}
|
||||
|
||||
#ifdef MAPBASE
|
||||
vgui::HScheme scheme = GetScheme();
|
||||
#else
|
||||
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
|
||||
#endif
|
||||
vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( szLogoFont );
|
||||
|
||||
int iFontTall = surface()->GetFontTall ( m_hTFont );
|
||||
@ -715,8 +723,12 @@ void CHudCredits::DrawIntroCreditsName( void )
|
||||
|
||||
if ( pCredit->bActive == false )
|
||||
continue;
|
||||
|
||||
|
||||
#ifdef MAPBASE
|
||||
vgui::HScheme scheme = GetScheme();
|
||||
#else
|
||||
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
|
||||
#endif
|
||||
vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( pCredit->szFontName );
|
||||
|
||||
float localTime = gpGlobals->curtime - pCredit->flTimeStart;
|
||||
@ -871,7 +883,11 @@ void CHudCredits::PrepareOutroCredits( void )
|
||||
if ( pCredit == NULL )
|
||||
continue;
|
||||
|
||||
#ifdef MAPBASE
|
||||
vgui::HScheme scheme = GetScheme();
|
||||
#else
|
||||
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
|
||||
#endif
|
||||
|
||||
#ifdef MAPBASE
|
||||
if (pCredit->szFontName[0] == '$')
|
||||
@ -1021,7 +1037,11 @@ void CHudCredits::PrepareIntroCredits( void )
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MAPBASE
|
||||
vgui::HScheme scheme = GetScheme();
|
||||
#else
|
||||
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
|
||||
#endif
|
||||
vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( pCredit->szFontName );
|
||||
|
||||
pCredit->flYPos = m_flY + ( iSlot * surface()->GetFontTall ( m_hTFont ) );
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "panelmetaclassmgr.h"
|
||||
#include "c_soundscape.h"
|
||||
#include "hud_macros.h"
|
||||
#include "clientmode_shared.h"
|
||||
#else
|
||||
#include "soundscape_system.h"
|
||||
#include "AI_ResponseSystem.h"
|
||||
@ -66,6 +67,8 @@ static bool g_bMapContainsCustomTalker;
|
||||
// This constant should change with each Mapbase update
|
||||
ConVar mapbase_version_client( "mapbase_version_client", MAPBASE_VERSION, FCVAR_NONE, "The version of Mapbase currently being used in this mod's client.dll" );
|
||||
|
||||
// This is from the vgui_controls library
|
||||
extern vgui::HScheme g_iCustomClientSchemeOverride;
|
||||
#endif
|
||||
|
||||
extern void AddSurfacepropFile( const char *pFileName, IPhysicsSurfaceProps *pProps, IFileSystem *pFileSystem );
|
||||
@ -86,6 +89,7 @@ enum
|
||||
#ifdef CLIENT_DLL
|
||||
MANIFEST_CLOSECAPTION,
|
||||
MANIFEST_VGUI,
|
||||
MANIFEST_CLIENTSCHEME,
|
||||
#else
|
||||
MANIFEST_TALKER,
|
||||
//MANIFEST_SENTENCES,
|
||||
@ -112,16 +116,17 @@ struct ManifestType_t
|
||||
|
||||
// KEEP THS IN SYNC WITH THE ENUM!
|
||||
static const ManifestType_t gm_szManifestFileStrings[MANIFEST_NUM_TYPES] = {
|
||||
{ "soundscripts", "mapbase_load_soundscripts", "Should we load map-specific soundscripts? e.g. \"maps/<mapname>_level_sounds.txt\"" },
|
||||
//{ "propdata", "mapbase_load_propdata", "Should we load map-specific soundscripts? e.g. \"maps/<mapname>_level_sounds.txt\"" },
|
||||
{ "soundscripts", "mapbase_load_soundscripts", "Should we load map-specific soundscripts? e.g. \"maps/<mapname>_level_sounds.txt\"" },
|
||||
//{ "propdata", "mapbase_load_propdata", "Should we load map-specific soundscripts? e.g. \"maps/<mapname>_level_sounds.txt\"" },
|
||||
//{ "soundscapes", "mapbase_load_soundscapes", "Should we load map-specific soundscapes? e.g. \"maps/<mapname>_soundscapes.txt\"" },
|
||||
{ "localization", "mapbase_load_localization", "Should we load map-specific localized text files? e.g. \"maps/<mapname>_english.txt\"" },
|
||||
{ "surfaceprops", "mapbase_load_surfaceprops", "Should we load map-specific surfaceproperties files? e.g. \"maps/<mapname>_surfaceproperties.txt\"" },
|
||||
#ifdef CLIENT_DLL
|
||||
{ "closecaption", "mapbase_load_closecaption", "Should we load map-specific closed captioning? e.g. \"maps/<mapname>_closecaption_english.txt\" and \"maps/<mapname>_closecaption_english.dat\"" },
|
||||
{ "vgui", "mapbase_load_vgui", "Should we load map-specific VGUI screens? e.g. \"maps/<mapname>_screens.txt\"" },
|
||||
{ "clientscheme", "mapbase_load_clientscheme", "Should we load map-specific ClientScheme.res overrides? e.g. \"maps/<mapname>_clientscheme.res\"" },
|
||||
#else
|
||||
{ "talker", "mapbase_load_talker", "Should we load map-specific talker files? e.g. \"maps/<mapname>_talker.txt\"" },
|
||||
{ "talker", "mapbase_load_talker", "Should we load map-specific talker files? e.g. \"maps/<mapname>_talker.txt\"" },
|
||||
//{ "sentences", "mapbase_load_sentences", "Should we load map-specific sentences? e.g. \"maps/<mapname>_sentences.txt\"" },
|
||||
{ "actbusy", "mapbase_load_actbusy", "Should we load map-specific actbusy files? e.g. \"maps/<mapname>_actbusy.txt\"" },
|
||||
#endif
|
||||
@ -259,6 +264,20 @@ public:
|
||||
{
|
||||
hudCloseCaption->RemoveCaptionDictionary( m_CloseCaptionFileNames[i] );
|
||||
}
|
||||
|
||||
if (g_iCustomClientSchemeOverride != 0)
|
||||
{
|
||||
// TODO: We currently have no way of actually cleaning up custom schemes upon level unload.
|
||||
// That may or may not be sustainable if there's a ton of custom schemes loaded at once
|
||||
g_iCustomClientSchemeOverride = 0;
|
||||
|
||||
// Reload scheme
|
||||
ClientModeShared *mode = ( ClientModeShared * )GetClientModeNormal();
|
||||
if ( mode )
|
||||
{
|
||||
mode->ReloadScheme();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -331,6 +350,19 @@ public:
|
||||
m_bInitializedRTs = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Custom scheme loading
|
||||
void LoadCustomScheme( const char *pszFile )
|
||||
{
|
||||
g_iCustomClientSchemeOverride = vgui::scheme()->LoadSchemeFromFile( pszFile, "CustomClientScheme" );
|
||||
|
||||
// Reload scheme
|
||||
ClientModeShared *mode = ( ClientModeShared * )GetClientModeNormal();
|
||||
if ( mode )
|
||||
{
|
||||
mode->ReloadScheme();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get a generic, hardcoded manifest with hardcoded names.
|
||||
@ -389,6 +421,7 @@ public:
|
||||
(GET_HUDELEMENT( CHudCloseCaption ))->AddCustomCaptionFile( value, m_CloseCaptionFileNames );
|
||||
} break;
|
||||
case MANIFEST_VGUI: { PanelMetaClassMgr()->LoadMetaClassDefinitionFile( value ); } break;
|
||||
case MANIFEST_CLIENTSCHEME: { LoadCustomScheme( value ); } break;
|
||||
//case MANIFEST_SOUNDSCAPES: { Soundscape_AddFile(value); } break;
|
||||
#else
|
||||
case MANIFEST_TALKER: {
|
||||
|
@ -64,6 +64,13 @@ static char *CopyString( const char *in )
|
||||
return n;
|
||||
}
|
||||
|
||||
#ifdef MAPBASE
|
||||
ConVar vgui_mapbase_custom_schemes( "vgui_mapbase_custom_schemes", "1" );
|
||||
|
||||
// This is used in mapbase_shared.cpp
|
||||
HScheme g_iCustomClientSchemeOverride;
|
||||
#endif
|
||||
|
||||
#if defined( VGUI_USEDRAGDROP )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@ -1612,17 +1619,31 @@ void Panel::DeletePanel()
|
||||
//-----------------------------------------------------------------------------
|
||||
HScheme Panel::GetScheme()
|
||||
{
|
||||
HScheme iScheme;
|
||||
|
||||
if (m_iScheme)
|
||||
{
|
||||
return m_iScheme; // return our internal scheme
|
||||
iScheme = m_iScheme; // return our internal scheme
|
||||
}
|
||||
|
||||
if (GetVParent()) // recurse down the heirarchy
|
||||
else if (GetVParent()) // recurse down the heirarchy
|
||||
{
|
||||
return ipanel()->GetScheme(GetVParent());
|
||||
iScheme = ipanel()->GetScheme(GetVParent());
|
||||
}
|
||||
else
|
||||
{
|
||||
iScheme = scheme()->GetDefaultScheme();
|
||||
}
|
||||
|
||||
return scheme()->GetDefaultScheme();
|
||||
#ifdef MAPBASE
|
||||
// If a custom client scheme is available, use the custom scheme.
|
||||
// TODO: Need a better way to detect that this panel actually uses ClientScheme.res
|
||||
if (g_iCustomClientSchemeOverride != 0 && iScheme == scheme()->GetScheme( "ClientScheme" ) && vgui_mapbase_custom_schemes.GetBool())
|
||||
{
|
||||
return g_iCustomClientSchemeOverride;
|
||||
}
|
||||
#endif
|
||||
|
||||
return iScheme;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user