diff --git a/src/engine/enginetool.cpp b/src/engine/enginetool.cpp index 460838723..6fee58081 100644 --- a/src/engine/enginetool.cpp +++ b/src/engine/enginetool.cpp @@ -444,7 +444,7 @@ void CEngineTool::SetGamePaused( bool paused ) float CEngineTool::GetTimescale() { - return host_timescale.GetFloat(); + return host_timescale.GetFloat() ? host_timescale.GetFloat() : 1.0f; } void CEngineTool::SetTimescale( float scale ) diff --git a/src/engine/host.cpp b/src/engine/host.cpp index 0ff16bb23..ab7984e86 100644 --- a/src/engine/host.cpp +++ b/src/engine/host.cpp @@ -585,7 +585,7 @@ static ConVar host_profile( "host_profile","0" ); ConVar host_limitlocal( "host_limitlocal", "0", 0, "Apply cl_cmdrate and cl_updaterate to loopback connection" ); ConVar host_framerate( "host_framerate","0", 0, "Set to lock per-frame time elapse." ); -ConVar host_timescale( "host_timescale","1.0", FCVAR_REPLICATED, "Prescale the clock by this amount." ); +ConVar host_timescale( "host_timescale","0.0", FCVAR_REPLICATED, "Prescale the clock by this amount." ); ConVar host_speeds( "host_speeds","0", 0, "Show general system running times." ); // set for running times ConVar host_flush_threshold( "host_flush_threshold", "20", 0, "Memory threshold below which the host should flush caches between server instances" ); @@ -1758,7 +1758,10 @@ void Host_ReadPreStartupConfiguration() { "sv_unlockedchapters", // needed to display the startup graphic while loading "snd_legacy_surround", // needed to init the sound system +#if defined( _X360 ) || defined( STAGING_ONLY ) "gameui_xbox", // needed to initialize the correct UI +#endif + "cl_hud_minmode", // needed to initialize the correct UI "save_in_memory" // needed to preread data from the correct location in UI }; diff --git a/src/engine/host.h b/src/engine/host.h index 473a6abd5..4059ea441 100644 --- a/src/engine/host.h +++ b/src/engine/host.h @@ -149,10 +149,10 @@ extern int host_currentframetick; // PERFORMANCE INFO #define MIN_FPS 0.1 // Host minimum fps value for maxfps. -#define MAX_FPS 1000.0 // Upper limit for maxfps. +#define MAX_FPS 10000.0 // Upper limit for maxfps. #define MAX_FRAMETIME 0.1 -#define MIN_FRAMETIME 0.001 +#define MIN_FRAMETIME 0.0001 #define TIME_TO_TICKS( dt ) ( (int)( 0.5f + (float)(dt) / host_state.interval_per_tick ) ) #define TICKS_TO_TIME( dt ) ( host_state.interval_per_tick * (float)(dt) ) diff --git a/src/engine/l_studio.cpp b/src/engine/l_studio.cpp index a3ab707c0..aaeeea989 100644 --- a/src/engine/l_studio.cpp +++ b/src/engine/l_studio.cpp @@ -2785,11 +2785,11 @@ struct rbatch_t // ---------------------------------------- */ -inline int FindModel( const CUtlVector &list, const model_t *pModel ) +inline int FindModel( const rmodel_t* pList, int listCount, const model_t* pModel ) { - for ( int j = list.Count(); --j >= 0 ; ) + for ( int j = listCount; --j >= 0 ; ) { - if ( list[j].pModel == pModel ) + if ( pList[j].pModel == pModel ) return j; } return -1; @@ -2806,13 +2806,13 @@ int CModelRender::DrawStaticPropArrayFast( StaticPropRenderInfo_t *pProps, int c #ifndef SWDS MDLCACHE_CRITICAL_SECTION_( g_pMDLCache ); CMatRenderContextPtr pRenderContext( materials ); - const int MAX_OBJECTS = 1024; + const int MAX_OBJECTS = 2048; CUtlSortVector objectList(0, MAX_OBJECTS); - CUtlVector modelList(0,256); - CUtlVector lightObjects(0,256); - CUtlVector shadowObjects(0,64); - CUtlVector decalObjects(0,64); - CUtlVector lightStates(0,256); + CUtlVectorFixedGrowable modelList; + CUtlVectorFixedGrowable lightObjects; + CUtlVectorFixedGrowable shadowObjects; + CUtlVectorFixedGrowable decalObjects; + CUtlVectorFixedGrowable lightStates; bool bForceCubemap = r_showenvcubemap.GetBool(); int drawnCount = 0; int forcedLodSetting = r_lod.GetInt(); @@ -2826,7 +2826,7 @@ int CModelRender::DrawStaticPropArrayFast( StaticPropRenderInfo_t *pProps, int c { drawnCount++; // UNDONE: This is a perf hit in some scenes! Use a hash? - int modelIndex = FindModel( modelList, pProps[i].pModel ); + int modelIndex = FindModel( modelList.Base(), modelList.Count(), pProps[i].pModel ); if ( modelIndex < 0 ) { modelIndex = modelList.AddToTail(); diff --git a/src/engine/modelloader.cpp b/src/engine/modelloader.cpp index 4835fea06..77c379286 100644 --- a/src/engine/modelloader.cpp +++ b/src/engine/modelloader.cpp @@ -62,13 +62,7 @@ ConVar mat_loadtextures( "mat_loadtextures", "1", FCVAR_CHEAT ); -// OS X and Linux are blowing up right now due to this. Benefits vs possible regressions on DX less clear. -#if defined( DX_TO_GL_ABSTRACTION ) || defined( STAGING_ONLY ) - #define CONVAR_DEFAULT_MOD_OFFLINE_HDR_SWITCH "1" -#else - #define CONVAR_DEFAULT_MOD_OFFLINE_HDR_SWITCH "0" -#endif -static ConVar mod_offline_hdr_switch( "mod_offline_hdr_switch", CONVAR_DEFAULT_MOD_OFFLINE_HDR_SWITCH, FCVAR_INTERNAL_USE, +static ConVar mod_offline_hdr_switch( "mod_offline_hdr_switch", "1", FCVAR_INTERNAL_USE, "Re-order the HDR/LDR mode switch to do most of the material system " "reloading with the device offline. This reduces unnecessary device " "resource uploads and may drastically reduce load time and memory pressure " diff --git a/src/engine/net_ws.cpp b/src/engine/net_ws.cpp index 3c49ab6cd..5ae945fc0 100644 --- a/src/engine/net_ws.cpp +++ b/src/engine/net_ws.cpp @@ -2960,7 +2960,15 @@ void NET_SetTime( double flRealtime ) } // adjust network time so fakelag works with host_timescale - net_time += frametime * host_timescale.GetFloat(); + const float timescale = host_timescale.GetFloat(); + if (timescale > 0) + { + net_time += frametime * timescale; + } + else + { + net_time += frametime; + } } /* diff --git a/src/engine/vgui_baseui_interface.cpp b/src/engine/vgui_baseui_interface.cpp index 368485a4d..7bdd077d3 100644 --- a/src/engine/vgui_baseui_interface.cpp +++ b/src/engine/vgui_baseui_interface.cpp @@ -124,7 +124,9 @@ IGameConsole *staticGameConsole = NULL; bool s_bWindowsInputEnabled = true; ConVar r_drawvgui( "r_drawvgui", "1", FCVAR_CHEAT, "Enable the rendering of vgui panels" ); +#if defined( _X360 ) || defined( STAGING_ONLY ) ConVar gameui_xbox( "gameui_xbox", "0", 0 ); +#endif void Con_CreateConsolePanel( vgui::Panel *parent ); void CL_CreateEntityReportPanel( vgui::Panel *parent ); @@ -2142,11 +2144,11 @@ void VGui_FindNamedPanels( CUtlVector< vgui::VPANEL >& panelList, char const *pa VGui_RecursiveFindPanels( panelList, embedded, panelname ); } -CON_COMMAND( vgui_togglepanel, "show/hide vgui panel by name." ) +CON_COMMAND_F( vgui_togglepanel, "show/hide vgui panel by name.", FCVAR_CHEAT ) { if ( args.ArgC() < 2 ) { - ConMsg( "Usage: vgui_showpanel panelname\n" ); + ConMsg( "Usage: vgui_togglepanel panelname\n" ); return; } diff --git a/src/game/client/c_vguiscreen.cpp b/src/game/client/c_vguiscreen.cpp index 1be470248..34aada843 100644 --- a/src/game/client/c_vguiscreen.cpp +++ b/src/game/client/c_vguiscreen.cpp @@ -650,6 +650,8 @@ C_BaseEntity *FindNearbyVguiScreen( const Vector &viewPosition, const QAngle &vi // X360TBD: Turn this on if feature actually used return NULL; } + // Feature not used, causes crashes if entity exists anyway... + return NULL; C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer(); diff --git a/src/game/client/game_controls/MapOverview.cpp b/src/game/client/game_controls/MapOverview.cpp index 0deb535ca..8b574aed4 100644 --- a/src/game/client/game_controls/MapOverview.cpp +++ b/src/game/client/game_controls/MapOverview.cpp @@ -1019,7 +1019,7 @@ void CMapOverview::SetMode(int mode) { ShowPanel( false ); - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "MapOff" ); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "MapOff", true, true ); } else if ( mode == MAP_MODE_INSET ) { @@ -1041,7 +1041,7 @@ void CMapOverview::SetMode(int mode) if ( mode != m_nMode && RunHudAnimations() ) { - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "MapZoomToSmall" ); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "MapZoomToSmall", true, true ); } } else if ( mode == MAP_MODE_FULL ) @@ -1061,7 +1061,7 @@ void CMapOverview::SetMode(int mode) if ( mode != m_nMode && RunHudAnimations() ) { - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "MapZoomToLarge" ); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "MapZoomToLarge", true, true ); } } diff --git a/src/game/client/game_controls/baseviewport.cpp b/src/game/client/game_controls/baseviewport.cpp index 181b0d333..90dab0849 100644 --- a/src/game/client/game_controls/baseviewport.cpp +++ b/src/game/client/game_controls/baseviewport.cpp @@ -79,7 +79,7 @@ void hud_autoreloadscript_callback( IConVar *var, const char *pOldValue, float f static ConVar cl_leveloverviewmarker( "cl_leveloverviewmarker", "0", FCVAR_CHEAT ); -CON_COMMAND( showpanel, "Shows a viewport panel " ) +CON_COMMAND_F( showpanel, "Shows a viewport panel ", FCVAR_CHEAT ) { if ( !gViewPortInterface ) return; @@ -90,7 +90,7 @@ CON_COMMAND( showpanel, "Shows a viewport panel " ) gViewPortInterface->ShowPanel( args[ 1 ], true ); } -CON_COMMAND( hidepanel, "Hides a viewport panel " ) +CON_COMMAND_F( hidepanel, "Hides a viewport panel ", FCVAR_CHEAT ) { if ( !gViewPortInterface ) return; diff --git a/src/game/client/hud_base_account.cpp b/src/game/client/hud_base_account.cpp index 9d99a2c3c..0ec27e0ca 100644 --- a/src/game/client/hud_base_account.cpp +++ b/src/game/client/hud_base_account.cpp @@ -28,7 +28,7 @@ void CHudBaseAccount::LevelInit( void ) m_pszLastAnimationName = NULL; m_pszQueuedAnimationName = NULL; - GetAnimationController()->StartAnimationSequence("AccountMoneyInvisible"); + GetAnimationController()->StartAnimationSequence(this, "AccountMoneyInvisible", true, true); } void CHudBaseAccount::ApplySchemeSettings(vgui::IScheme *pScheme) @@ -91,14 +91,14 @@ void CHudBaseAccount::Paint() { m_pszLastAnimationName = "AccountMoneyAdded"; } - GetAnimationController()->StartAnimationSequence( m_pszLastAnimationName ); + GetAnimationController()->StartAnimationSequence( this, m_pszLastAnimationName, true, true ); m_flLastAnimationEnd = gpGlobals->curtime + GetAnimationController()->GetAnimationSequenceLength( m_pszLastAnimationName ); m_iPreviousAccount = account; } else if ( m_pszQueuedAnimationName ) { - GetAnimationController()->StartAnimationSequence( m_pszQueuedAnimationName ); + GetAnimationController()->StartAnimationSequence( this, m_pszQueuedAnimationName, true, true ); m_pszQueuedAnimationName = NULL; } diff --git a/src/game/client/hud_controlpointicons.cpp b/src/game/client/hud_controlpointicons.cpp index b18ab4491..0c1372732 100644 --- a/src/game/client/hud_controlpointicons.cpp +++ b/src/game/client/hud_controlpointicons.cpp @@ -551,7 +551,7 @@ void CControlPointIcon::PerformLayout( void ) if ( m_pCapNumPlayers ) { m_pCapNumPlayers->SetVisible( (iPlayers>1) ); - SetDialogVariable( "numcappers", iPlayers ); + SetDialogVariable( "numcappers", iPlayers, false ); m_pCapNumPlayers->SetFgColor( Color(0,0,0,255) ); } diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp index f5ee31692..1174fa2cd 100644 --- a/src/game/client/menu.cpp +++ b/src/game/client/menu.cpp @@ -256,12 +256,12 @@ void CHudMenu::SelectMenuItem( int menu_item ) m_nSelectedItem = menu_item; // Pulse the selection - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuPulse"); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuPulse", true, true); // remove the menu quickly m_bMenuTakesInput = false; m_flShutoffTime = gpGlobals->realtime + m_flOpenCloseTime; - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuClose"); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuClose", true, true); } } @@ -365,7 +365,7 @@ void CHudMenu::HideMenu( void ) { m_bMenuTakesInput = false; m_flShutoffTime = gpGlobals->realtime + m_flOpenCloseTime; - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuClose"); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuClose", true, true); } //----------------------------------------------------------------------------- @@ -384,7 +384,7 @@ void CHudMenu::ShowMenu( const char * menuName, int validSlots ) Q_strncpy( g_szPrelocalisedMenuString, menuName, sizeof( g_szPrelocalisedMenuString ) ); - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuOpen"); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuOpen", true, true); m_nSelectedItem = -1; // we have the whole string, so we can localise it now @@ -409,7 +409,7 @@ void CHudMenu::ShowMenu_KeyValueItems( KeyValues *pKV ) m_fWaitingForMore = 0; m_bitsValidSlots = 0; - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuOpen"); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuOpen", true, true); m_nSelectedItem = -1; g_szMenuString[0] = '\0'; @@ -489,7 +489,7 @@ void CHudMenu::MsgFunc_ShowMenu( bf_read &msg) if ( !NeedMore ) { - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("MenuOpen"); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, "MenuOpen", true, true); m_nSelectedItem = -1; // we have the whole string, so we can localise it now diff --git a/src/game/client/tf/c_tf_player.cpp b/src/game/client/tf/c_tf_player.cpp index d43b0c3da..c5396cce3 100644 --- a/src/game/client/tf/c_tf_player.cpp +++ b/src/game/client/tf/c_tf_player.cpp @@ -2922,7 +2922,9 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy } C_BaseEntity *pBaseEntity = pRend->GetIClientUnknown()->GetBaseEntity(); - const CEconItemView *pItem = dynamic_cast< CEconItemView* >( pRend ); + CEconItemView *pItem = dynamic_cast< CEconItemView* >( pRend ); + + CEconItemViewDataCacher itemDataCacher(pItem); uint32 unAttrValue = 0; uint32 unEffectValue = 0; @@ -2974,6 +2976,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy if ( pWearable ) { pItem = pWearable->GetAttributeContainer()->GetItem(); + itemDataCacher.SetItem(pItem); pTFPlayer = ToTFPlayer( pWearable->GetOwnerEntity() ); break; } @@ -2983,6 +2986,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy if ( pModel->GetOuter() ) { pItem = pModel->GetOuter()->GetAttributeContainer()->GetItem(); + itemDataCacher.SetItem(pItem); pBaseEntity = pBaseEntity->GetOwnerEntity(); if ( pItem ) { @@ -3005,6 +3009,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy if ( pWeapon ) { pItem = pWeapon->GetAttributeContainer()->GetItem(); + itemDataCacher.SetItem(pItem); pBaseEntity = pWeapon; } bIsFirstPerson = true; @@ -3017,6 +3022,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy if ( pWeapon ) { pItem = pWeapon->GetAttributeContainer()->GetItem(); + itemDataCacher.SetItem(pItem); pBaseEntity = pWeapon; } } @@ -3025,6 +3031,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy else { pItem = pWeapon->GetAttributeContainer()->GetItem(); + itemDataCacher.SetItem(pItem); pBaseEntity = pWeapon; pTFPlayer = ToTFPlayer( pWeapon->GetOwner() ); } @@ -3046,6 +3053,7 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy if ( pTFPlayer && pTFPlayer->m_Shared.GetDisguiseWeapon() ) { pItem = pTFPlayer->m_Shared.GetDisguiseWeapon()->GetAttributeContainer()->GetItem(); + itemDataCacher.SetItem(pItem); pBaseEntity = pTFPlayer->m_Shared.GetDisguiseWeapon(); } } @@ -3170,11 +3178,13 @@ class CProxyAnimatedWeaponSheen : public CBaseAnimatedTextureProxy int iShaderIndex = sheenParams.m_iShaderIndex; // Australium weapons always use iShaderIndex 1 + pItem->CacheSOCData(); const CEconStyleInfo *pStyle = pItem->GetStaticData()->GetStyleInfo( pItem->GetItemStyle() ); if ( pStyle && !pStyle->IsSelectable() ) { iShaderIndex = 1; } + pItem->UncacheSOCData(); #ifdef STAGING_ONLY if ( tf_sheen_shader_override.GetInt() > 0 ) @@ -3728,6 +3738,8 @@ class CWeaponSkinProxy : public IMaterialProxy if ( !pItem ) return; + CEconItemViewDataCacher dataCacher(pItem); + C_TFPlayer *pOwner = GetOwnerFromProxyEntity( pC_BaseEntity ); int desiredW = m_pBaseTextureOrig->GetActualWidth(); int desiredH = m_pBaseTextureOrig->GetActualHeight(); @@ -7493,8 +7505,8 @@ void C_TFPlayer::UpdateIDTarget() trace_t tr; Vector vecStart, vecEnd; - VectorMA( MainViewOrigin(), MAX_TRACE_LENGTH, MainViewForward(), vecEnd ); - VectorMA( MainViewOrigin(), 10, MainViewForward(), vecStart ); + VectorMA( MainViewOrigin(), 8192.0f, MainViewForward(), vecEnd ); + VectorMA( MainViewOrigin(), 10.0f, MainViewForward(), vecStart ); // If we're in observer mode, ignore our observer target. Otherwise, ignore ourselves. if ( IsObserver() ) @@ -7511,7 +7523,11 @@ void C_TFPlayer::UpdateIDTarget() iReviveMedic = 1; } - int nMask = MASK_SOLID | CONTENTS_DEBRIS; + int nMask = MASK_SOLID; + if ( iReviveMedic == 1) + { + nMask |= CONTENTS_DEBRIS; + } UTIL_TraceLine( vecStart, vecEnd, nMask, this, COLLISION_GROUP_NONE, &tr ); } diff --git a/src/game/client/tf/tf_hud_arena_vs_panel.cpp b/src/game/client/tf/tf_hud_arena_vs_panel.cpp index d2df4f395..cee248151 100644 --- a/src/game/client/tf/tf_hud_arena_vs_panel.cpp +++ b/src/game/client/tf/tf_hud_arena_vs_panel.cpp @@ -121,7 +121,7 @@ void CHudArenaVsPanel::FireGameEvent( IGameEvent * event ) if ( m_bVisible ) { - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "ArenaVsPanelOnShow" ); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "ArenaVsPanelOnShow", true, true ); m_flHideTime = gpGlobals->curtime + 10.0f; diff --git a/src/game/client/tf/tf_hud_escort.cpp b/src/game/client/tf/tf_hud_escort.cpp index 68c4ca740..233fb12b9 100644 --- a/src/game/client/tf/tf_hud_escort.cpp +++ b/src/game/client/tf/tf_hud_escort.cpp @@ -696,7 +696,7 @@ void CTFHudEscort::UpdateAlarmAnimations( void ) void CTFHudEscort::OnTick() { // don't need to do this on non-escort maps (unless we're trying to override the HUD type) - if ( TFGameRules() && ( TFGameRules()->GetGameType() != TF_GAMETYPE_ESCORT ) && ( TFGameRules()->GetHUDType() != TF_HUDTYPE_ESCORT ) ) + if ( !TFGameRules() || ( TFGameRules()->GetGameType() != TF_GAMETYPE_ESCORT ) && ( TFGameRules()->GetHUDType() != TF_HUDTYPE_ESCORT ) ) return; if ( !BaseClass::IsVisible() ) // intentionally skipping our version of IsVisible() to bypass the !m_bHaveValidPointPositions check @@ -831,14 +831,14 @@ void CTFHudEscort::OnTick() if ( flSecondsToRecede > 0.0f && flSecondsToRecede <= TF_ESCORT_RECEDE_COUNTDOWN ) { int iDisplaySeconds = (int)( flSecondsToRecede ) + 1; - m_pEscortItemPanel->SetDialogVariable( "recede", VarArgs( "%d", iDisplaySeconds ) ); + m_pEscortItemPanel->SetDialogVariable( "recede", VarArgs( "%d", iDisplaySeconds ), false ); // we should not be showing the blocked image if we're showing the countdown m_pBlocked->SetVisible( false ); } else { - m_pEscortItemPanel->SetDialogVariable( "recede", "" ); + m_pEscortItemPanel->SetDialogVariable( "recede", "", false ); } // Debug string diff --git a/src/game/client/tf/tf_hud_flagstatus.cpp b/src/game/client/tf/tf_hud_flagstatus.cpp index c851ca162..1cefa8398 100644 --- a/src/game/client/tf/tf_hud_flagstatus.cpp +++ b/src/game/client/tf/tf_hud_flagstatus.cpp @@ -507,7 +507,7 @@ void CTFHudFlagObjectives::ApplySchemeSettings( IScheme *pScheme ) //----------------------------------------------------------------------------- void CTFHudFlagObjectives::Reset() { - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "FlagOutlineHide" ); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "FlagOutlineHide", true, true ); UpdateStatus(); } @@ -641,37 +641,37 @@ void CTFHudFlagObjectives::OnTick() } // are we playing captures for rounds? - if ( !TFGameRules() || ( !TFGameRules()->IsPlayingHybrid_CTF_CP() && !TFGameRules()->IsPlayingSpecialDeliveryMode() && !TFGameRules()->IsMannVsMachineMode() ) ) + if ( TFGameRules() && ( !TFGameRules()->IsPlayingHybrid_CTF_CP() && !TFGameRules()->IsPlayingSpecialDeliveryMode() && !TFGameRules()->IsMannVsMachineMode() ) ) { if ( tf_flag_caps_per_round.GetInt() > 0 ) { C_TFTeam *pTeam = GetGlobalTFTeam( TF_TEAM_BLUE ); if ( pTeam ) { - SetDialogVariable( "bluescore", pTeam->GetFlagCaptures() ); + SetDialogVariable( "bluescore", pTeam->GetFlagCaptures(), false ); } pTeam = GetGlobalTFTeam( TF_TEAM_RED ); if ( pTeam ) { - SetDialogVariable( "redscore", pTeam->GetFlagCaptures() ); + SetDialogVariable( "redscore", pTeam->GetFlagCaptures(), false ); } SetPlayingToLabelVisible( true ); - SetDialogVariable( "rounds", tf_flag_caps_per_round.GetInt() ); + SetDialogVariable( "rounds", tf_flag_caps_per_round.GetInt(), false ); } else // we're just playing straight score { C_TFTeam *pTeam = GetGlobalTFTeam( TF_TEAM_BLUE ); if ( pTeam ) { - SetDialogVariable( "bluescore", pTeam->Get_Score() ); + SetDialogVariable( "bluescore", pTeam->Get_Score(), false ); } pTeam = GetGlobalTFTeam( TF_TEAM_RED ); if ( pTeam ) { - SetDialogVariable( "redscore", pTeam->Get_Score() ); + SetDialogVariable( "redscore", pTeam->Get_Score(), false ); } SetPlayingToLabelVisible( false ); @@ -834,7 +834,7 @@ void CTFHudFlagObjectives::UpdateStatus( C_BasePlayer *pNewOwner /*= NULL*/, C_B if ( !m_bFlagAnimationPlayed ) { m_bFlagAnimationPlayed = true; - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "FlagOutline" ); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "FlagOutline", true, true ); } if ( m_pCapturePoint && !m_pCapturePoint->IsVisible() ) @@ -864,7 +864,7 @@ void CTFHudFlagObjectives::UpdateStatus( C_BasePlayer *pNewOwner /*= NULL*/, C_B if ( m_bCarryingFlag ) { m_bCarryingFlag = false; - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "FlagOutline" ); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "FlagOutline", true, true ); } m_bFlagAnimationPlayed = false; diff --git a/src/game/client/tf/tf_hud_itemeffectmeter.cpp b/src/game/client/tf/tf_hud_itemeffectmeter.cpp index 6f9bb2b42..f16d3b2fb 100644 --- a/src/game/client/tf/tf_hud_itemeffectmeter.cpp +++ b/src/game/client/tf/tf_hud_itemeffectmeter.cpp @@ -451,11 +451,11 @@ void CHudItemEffectMeter::Update( C_TFPlayer* pPlayer, const char* pSoundScript { if ( ShowPercentSymbol() ) { - SetDialogVariable( "progresscount", VarArgs( "%d%%", iCount ) ); + SetDialogVariable( "progresscount", VarArgs( "%d%%", iCount ), false ); } else { - SetDialogVariable( "progresscount", iCount ); + SetDialogVariable( "progresscount", iCount, false ); } } diff --git a/src/game/client/tf/tf_hud_mann_vs_machine_status.cpp b/src/game/client/tf/tf_hud_mann_vs_machine_status.cpp index b05c77992..d969ce6a5 100644 --- a/src/game/client/tf/tf_hud_mann_vs_machine_status.cpp +++ b/src/game/client/tf/tf_hud_mann_vs_machine_status.cpp @@ -1123,7 +1123,7 @@ void CInWorldCurrencyStatus::OnTick( void ) char szTmp[16]; Q_snprintf( szTmp, ARRAYSIZE( szTmp ), "$%d", nWorldMoney ); - SetDialogVariable( "currency", szTmp ); + SetDialogVariable( "currency", szTmp, false ); } //----------------------------------------------------------------------------- // Purpose: diff --git a/src/game/client/tf/tf_hud_match_status.cpp b/src/game/client/tf/tf_hud_match_status.cpp index ed0dac2cb..acd7bc892 100644 --- a/src/game/client/tf/tf_hud_match_status.cpp +++ b/src/game/client/tf/tf_hud_match_status.cpp @@ -41,7 +41,7 @@ static ConVar tf_use_match_hud("tf_use_match_hud", "1", FCVAR_ARCHIVE); //----------------------------------------------------------------------------- bool ShouldUseMatchHUD() { - if ((TFGameRules()->IsMannVsMachineMode())) + if (!TFGameRules() || (TFGameRules()->IsMannVsMachineMode())) return false; return tf_use_match_hud.GetBool(); diff --git a/src/game/client/tf/tf_hud_passtime.cpp b/src/game/client/tf/tf_hud_passtime.cpp index 6181fedba..4b2a0435d 100644 --- a/src/game/client/tf/tf_hud_passtime.cpp +++ b/src/game/client/tf/tf_hud_passtime.cpp @@ -218,8 +218,8 @@ void CTFHudTeamScore::OnTick() tf_passtime_scores_per_round.GetInt() ); } - SetDialogVariable( "bluescore", iBlueScore ); - SetDialogVariable( "redscore", iRedScore ); + SetDialogVariable( "bluescore", iBlueScore, false ); + SetDialogVariable( "redscore", iRedScore, false ); } //----------------------------------------------------------------------------- diff --git a/src/game/client/tf/tf_hud_playerstatus.cpp b/src/game/client/tf/tf_hud_playerstatus.cpp index 26723ce15..806ceb5fd 100644 --- a/src/game/client/tf/tf_hud_playerstatus.cpp +++ b/src/game/client/tf/tf_hud_playerstatus.cpp @@ -866,11 +866,11 @@ void CTFHudPlayerHealth::SetHealth( int iNewHealth, int iMaxHealth, int iMaxBuff // set our health display value if ( m_nHealth > 0 ) { - SetDialogVariable( "Health", m_nHealth ); + SetDialogVariable( "Health", m_nHealth, false ); } else { - SetDialogVariable( "Health", "" ); + SetDialogVariable( "Health", "", false ); } } diff --git a/src/game/client/tf/tf_hud_pve_winpanel.cpp b/src/game/client/tf/tf_hud_pve_winpanel.cpp index a8ab8efc6..3f70a4411 100644 --- a/src/game/client/tf/tf_hud_pve_winpanel.cpp +++ b/src/game/client/tf/tf_hud_pve_winpanel.cpp @@ -167,7 +167,7 @@ void CTFPVEWinPanel::OnTick() // Do this only once if ( bRespecVisible && !m_pRespecBackground->IsVisible() ) { - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "RespecEarnedPulseLoss" ); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( m_pRespecContainerPanel, "RespecEarnedPulseLoss", true, true ); C_TFPlayer *pLocalTFPlayer = C_TFPlayer::GetLocalTFPlayer(); if ( pLocalTFPlayer ) diff --git a/src/game/client/tf/tf_hud_robot_destruction_status.cpp b/src/game/client/tf/tf_hud_robot_destruction_status.cpp index 115f708d3..4b88ebcf2 100644 --- a/src/game/client/tf/tf_hud_robot_destruction_status.cpp +++ b/src/game/client/tf/tf_hud_robot_destruction_status.cpp @@ -14,6 +14,7 @@ #include "tf_logic_player_destruction.h" #include "c_tf_objective_resource.h" #include "c_func_capture_zone.h" +#include "tf_hud_objectivestatus.h" #define ATTACK_BLINK_TIME 2.f @@ -516,7 +517,8 @@ void CTFHUDRobotDestruction::PerformRobotLayout( RobotVector_t& vecRobots, int n //----------------------------------------------------------------------------- void CTFHUDRobotDestruction::Reset() { - g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "FlagOutlineHide" ); + CTFHudObjectiveStatus *pStatus = GET_HUDELEMENT( CTFHudObjectiveStatus ); + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( pStatus, "FlagOutlineHide" ); } //----------------------------------------------------------------------------- @@ -562,8 +564,8 @@ void CTFHUDRobotDestruction::OnTick() if ( !pRoboLogic ) return; - m_pRedScoreValueContainer->SetDialogVariable( "score", pRoboLogic->GetScore( TF_TEAM_RED ) ); - m_pBlueScoreValueContainer->SetDialogVariable( "score", pRoboLogic->GetScore( TF_TEAM_BLUE ) ); + m_pRedScoreValueContainer->SetDialogVariable( "score", pRoboLogic->GetScore( TF_TEAM_RED ), false ); + m_pBlueScoreValueContainer->SetDialogVariable( "score", pRoboLogic->GetScore( TF_TEAM_BLUE ), false ); #ifdef STAGING_ONLY if ( rd_hud_test_bars.GetBool() ) @@ -574,8 +576,8 @@ void CTFHUDRobotDestruction::OnTick() m_pBlueProgressBarEscrow->SetProgress( 0.f, true ); m_pRedProgressBarEscrow->SetProgress( 0.f, true ); - m_pRedScoreValueContainer->SetDialogVariable( "score", flProgress ); - m_pBlueScoreValueContainer->SetDialogVariable( "score", flProgress ); + m_pRedScoreValueContainer->SetDialogVariable( "score", flProgress, false ); + m_pBlueScoreValueContainer->SetDialogVariable( "score", flProgress, false ); } else #endif @@ -599,8 +601,8 @@ void CTFHUDRobotDestruction::OnTick() if ( m_pProgressBarsContainer ) { - m_pProgressBarsContainer->SetDialogVariable( "red_escrow", nRedEscrow ); - m_pProgressBarsContainer->SetDialogVariable( "blue_escrow", nBlueEscrow ); + m_pProgressBarsContainer->SetDialogVariable( "red_escrow", nRedEscrow, false ); + m_pProgressBarsContainer->SetDialogVariable( "blue_escrow", nBlueEscrow, false ); } // update the team leader image @@ -778,7 +780,7 @@ void CTFHUDRobotDestruction::OnTick() } SetPlayingToLabelVisible( true ); - SetDialogVariable( "rounds", pRoboLogic->GetMaxPoints() ); + SetDialogVariable( "rounds", pRoboLogic->GetMaxPoints(), false ); // HACK! Fix the events UpdateCarriedFlagStatus( NULL, NULL ); } @@ -865,7 +867,7 @@ void CTFHUDRobotDestruction::UpdateStolenPoints( int nTeam, EditablePanel* pCont } // Show the stolen panels if the stolen score is anything pContainer->SetVisible( nStolenPoints > 0 ); - pContainer->SetDialogVariable( "intelvalue", nStolenPoints ); + pContainer->SetDialogVariable( "intelvalue", nStolenPoints, false ); } // Find our stolen flag @@ -947,7 +949,7 @@ void CTFHUDRobotDestruction::UpdateCarriedFlagStatus( C_BasePlayer *pNewOwner /* if ( pPlayerFlag && !pPlayerFlag->IsMarkedForDeletion() && !pPlayerFlag->IsDormant() ) { m_pCarriedContainer->SetVisible( true ); - m_pCarriedContainer->SetDialogVariable( "flagvalue", pPlayerFlag->GetPointValue() ); + m_pCarriedContainer->SetDialogVariable( "flagvalue", pPlayerFlag->GetPointValue(), false ); // make sure the panels are on, set the initial alpha values, // set the color of the flag we're carrying, and start the animations if ( m_pCarriedImage && !m_pCarriedImage->IsVisible() ) diff --git a/src/game/client/tf/tf_hud_scope.cpp b/src/game/client/tf/tf_hud_scope.cpp index 686c68ff7..e071292df 100644 --- a/src/game/client/tf/tf_hud_scope.cpp +++ b/src/game/client/tf/tf_hud_scope.cpp @@ -242,6 +242,7 @@ class CHudScope : public vgui::Panel, public CHudElement virtual void ApplySchemeSettings(vgui::IScheme *scheme); virtual void Paint( void ); virtual bool ShouldDraw( void ); + virtual bool CanAnimate() const override { return false; }; private: int m_iScopeTexture[4]; diff --git a/src/game/client/tf/tf_hud_target_id.cpp b/src/game/client/tf/tf_hud_target_id.cpp index dd41b296b..8dddb7060 100644 --- a/src/game/client/tf/tf_hud_target_id.cpp +++ b/src/game/client/tf/tf_hud_target_id.cpp @@ -1016,7 +1016,7 @@ void CTargetID::UpdateID( void ) if ( m_pMoveableSubPanel->IsVisible() ) { const char *pBoundKey = engine->Key_LookupBinding( pszActionCommand ); - m_pMoveableSubPanel->SetDialogVariable( "movekey", pBoundKey ); + m_pMoveableSubPanel->SetDialogVariable( "movekey", pBoundKey, false ); } if ( m_pMoveableIcon ) @@ -1060,7 +1060,7 @@ void CTargetID::UpdateID( void ) m_pTargetNameLabel->SetFgColor( colorName ); // TODO: Support if( hud_centerid.GetInt() == 0 ) - SetDialogVariable( "targetname", sIDString ); + SetDialogVariable( "targetname", sIDString, false ); } else { @@ -1075,7 +1075,7 @@ void CTargetID::UpdateID( void ) m_pTargetDataLabel->SetVisible(true); m_pTargetDataLabel->SetFgColor( colorData ); - SetDialogVariable( "targetdata", sDataString ); + SetDialogVariable( "targetdata", sDataString, false ); } else { diff --git a/src/game/client/tf/tf_hud_tournament.cpp b/src/game/client/tf/tf_hud_tournament.cpp index d34cd5738..6653e29fa 100644 --- a/src/game/client/tf/tf_hud_tournament.cpp +++ b/src/game/client/tf/tf_hud_tournament.cpp @@ -299,15 +299,15 @@ void CHudTournament::PreparePanel( void ) pszLabelText = "Tournament_Instructions_Waiting"; } - SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( pszLabelText ) ); - SetDialogVariable( "tournamentstatelabel", g_pVGuiLocalize->Find( "Tournament_WaitingForTeam" ) ); + SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( pszLabelText ), false ); + SetDialogVariable( "tournamentstatelabel", g_pVGuiLocalize->Find( "Tournament_WaitingForTeam" ), false ); SetPlayerPanelsVisible( true ); m_pModeImage->SetVisible( m_bCompetitiveMode ); } else { - SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions" ) ); - SetDialogVariable( "tournamentstatelabel", g_pVGuiLocalize->Find( "Tournament_WaitingForTeams" ) ); + SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions" ), false ); + SetDialogVariable( "tournamentstatelabel", g_pVGuiLocalize->Find( "Tournament_WaitingForTeams" ), false ); SetPlayerPanelsVisible( false ); m_pModeImage->SetVisible( false ); } @@ -333,18 +333,18 @@ void CHudTournament::PreparePanel( void ) if ( pFormatString ) { g_pVGuiLocalize->ConstructString_safe( szCountdown, pFormatString, 1, wzVal ); - SetDialogVariable( "tournamentstatelabel", szCountdown ); + SetDialogVariable( "tournamentstatelabel", szCountdown, false ); } if ( bAutoReady ) { - SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ) ); + SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ), false ); m_pModeImage->SetVisible( false ); SetPlayerPanelsVisible( false ); } else if ( nTime <= TOURNAMENT_NOCANCEL_TIME ) { - SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ) ); + SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ), false ); } else { @@ -352,17 +352,17 @@ void CHudTournament::PreparePanel( void ) { if ( bSteamController ) { - SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions_Ready_NoKeyHintText" ) ); + SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions_Ready_NoKeyHintText" ), false ); bShowReadyHintIcon = true; } else { - SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions_Ready" ) ); + SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions_Ready" ), false ); } } else { - SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ) ); + SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ), false ); } } @@ -411,13 +411,13 @@ void CHudTournament::PreparePanel( void ) #endif C_TFTeam *pBlueTeam = GetGlobalTFTeam( TF_TEAM_BLUE ); - SetDialogVariable( "bluenamelabel", pBlueTeam ? pBlueTeam->Get_Localized_Name() : L"BLU" ); + SetDialogVariable( "bluenamelabel", pBlueTeam ? pBlueTeam->Get_Localized_Name() : L"BLU", false ); C_TFTeam *pRedTeam = GetGlobalTFTeam( TF_TEAM_RED ); - SetDialogVariable( "rednamelabel", pRedTeam ? pRedTeam->Get_Localized_Name() : L"RED" ); + SetDialogVariable( "rednamelabel", pRedTeam ? pRedTeam->Get_Localized_Name() : L"RED", false ); - SetDialogVariable( "bluestate", TFGameRules()->IsTeamReady( TF_TEAM_BLUE ) ? g_pVGuiLocalize->Find( "Tournament_TeamReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamNotReady" ) ); - SetDialogVariable( "redstate", TFGameRules()->IsTeamReady( TF_TEAM_RED ) ? g_pVGuiLocalize->Find( "Tournament_TeamReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamNotReady" ) ); + SetDialogVariable( "bluestate", TFGameRules()->IsTeamReady( TF_TEAM_BLUE ) ? g_pVGuiLocalize->Find( "Tournament_TeamReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamNotReady" ), false ); + SetDialogVariable( "redstate", TFGameRules()->IsTeamReady( TF_TEAM_RED ) ? g_pVGuiLocalize->Find( "Tournament_TeamReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamNotReady" ), false ); if ( m_bTeamReady[TF_TEAM_BLUE] != TFGameRules()->IsTeamReady( TF_TEAM_BLUE ) || m_bTeamReady[TF_TEAM_RED] != TFGameRules()->IsTeamReady( TF_TEAM_RED ) ) { @@ -475,7 +475,7 @@ void CHudTournament::PreparePanel( void ) _snwprintf( szWindConditions, ARRAYSIZE( szWindConditions ), STRING_FMT STRING_FMT, szWindConditions, g_pVGuiLocalize->Find( "Tournament_WinConditionsNone" ) ); } - SetDialogVariable( "winconditions", szWindConditions ); + SetDialogVariable( "winconditions", szWindConditions, false ); } //----------------------------------------------------------------------------- @@ -1199,7 +1199,7 @@ void CHudTournamentSetup::OnTick( void ) m_pNameEntry->SetText( ( iLocalTeam == TF_TEAM_BLUE ) ? mp_tournament_blueteamname.GetString() : mp_tournament_redteamname.GetString() ); } - SetDialogVariable( "tournamentstatelabel", TFGameRules()->IsTeamReady( iLocalTeam ) ? g_pVGuiLocalize->Find( "Tournament_TeamSetupReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamSetupNotReady" ) ); + SetDialogVariable( "tournamentstatelabel", TFGameRules()->IsTeamReady( iLocalTeam ) ? g_pVGuiLocalize->Find( "Tournament_TeamSetupReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamSetupNotReady" ), false ); m_flNextThink = gpGlobals->curtime + TOURNAMENT_PANEL_UPDATE_INTERVAL; } @@ -1431,7 +1431,7 @@ void CHudStopWatch::OnTick( void ) m_pStopWatchImage->SetImage( "../hud/ico_time_none" ); - SetDialogVariable( "stopwatchlabel", g_pVGuiLocalize->Find( "Tournament_StopWatchNoCap" ) ); + SetDialogVariable( "stopwatchlabel", g_pVGuiLocalize->Find( "Tournament_StopWatchNoCap" ), false ); } else if ( TFGameRules()->GetStopWatchState() == STOPWATCH_RUNNING ) { @@ -1472,8 +1472,8 @@ void CHudStopWatch::OnTick( void ) pszPoints = g_pVGuiLocalize->Find( "#Tournament_StopWatch_Points" ); } - SetDialogVariable( "pointslabel", pszPoints ); - SetDialogVariable( "scoretobeat", wzScoreVal ); + SetDialogVariable( "pointslabel", pszPoints, false ); + SetDialogVariable( "scoretobeat", wzScoreVal, false ); wchar_t wzHelp[128]; @@ -1486,7 +1486,7 @@ void CHudStopWatch::OnTick( void ) g_pVGuiLocalize->ConstructString_safe( wzHelp, g_pVGuiLocalize->Find( "Tournament_StopWatch_TimeVictoryDefender" ), 1, pDefender->Get_Localized_Name() ); } - SetDialogVariable( "descriptionlabel", wzHelp ); + SetDialogVariable( "descriptionlabel", wzHelp, false ); if ( pTimer && !pTimer->IsWatchingTimeStamps() ) { @@ -1509,7 +1509,7 @@ void CHudStopWatch::OnTick( void ) m_pStopWatchDescriptionBG->SetVisible( false ); m_pStopWatchDescriptionLabel->SetVisible( false ); - SetDialogVariable( "descriptionlabel", g_pVGuiLocalize->Find( "#Tournament_StopWatch_CapVictory" ) ); + SetDialogVariable( "descriptionlabel", g_pVGuiLocalize->Find( "#Tournament_StopWatch_CapVictory" ), false ); m_pStopWatchImage->SetImage( "../hud/ico_time_60" ); @@ -1533,7 +1533,7 @@ void CHudStopWatch::OnTick( void ) g_pVGuiLocalize->ConstructString_safe( wzScoreVal, g_pVGuiLocalize->Find( "Tournament_StopWatchPointCaptureSpectator" ), 2, wzVal, iPoints == 1 ? g_pVGuiLocalize->Find( "#Tournament_StopWatch_Point" ) : g_pVGuiLocalize->Find( "#Tournament_StopWatch_Points" ) ); } - SetDialogVariable( "stopwatchlabel", wzScoreVal ); + SetDialogVariable( "stopwatchlabel", wzScoreVal, false ); } } } diff --git a/src/game/client/tf/tf_time_panel.cpp b/src/game/client/tf/tf_time_panel.cpp index 4d57be64c..26dc9b576 100644 --- a/src/game/client/tf/tf_time_panel.cpp +++ b/src/game/client/tf/tf_time_panel.cpp @@ -562,7 +562,7 @@ void CTFHudTimeStatus::SetExtraTimePanels() CheckClockLabelLength( m_pOvertimeLabel, m_pOvertimeBG ); } } - else + else if ( m_pOvertimeLabel->IsVisible() ) { m_pOvertimeBG->SetVisible( false ); m_pOvertimeLabel->SetVisible( false ); diff --git a/src/game/client/tf/vgui/tf_matchmaking_dashboard_next_map_voting.cpp b/src/game/client/tf/vgui/tf_matchmaking_dashboard_next_map_voting.cpp index e8b86acb0..9fb0067ec 100644 --- a/src/game/client/tf/vgui/tf_matchmaking_dashboard_next_map_voting.cpp +++ b/src/game/client/tf/vgui/tf_matchmaking_dashboard_next_map_voting.cpp @@ -225,6 +225,12 @@ class CNextMapVotingDashboardState : public CTFMatchmakingPopup void UpdateVoteCounts() { +#ifndef STAGING_ONLY + if ( !TFGameRules() ) + { + return; + } +#endif int nVotes[ CTFGameRules::EUserNextMapVote::NUM_VOTE_STATES ]; memset( nVotes, 0, sizeof( nVotes ) ); int nTotalVotes = 0; @@ -257,7 +263,7 @@ class CNextMapVotingDashboardState : public CTFMatchmakingPopup if ( pMapChoicePanel ) { // Update the label with the % total - pMapChoicePanel->SetDialogVariable( "votes", CFmtStr( "%3.0f%%", flPercent ) ); + pMapChoicePanel->SetDialogVariable( "votes", CFmtStr( "%3.0f%%", flPercent ), false ); // Do a color change animation if ( g_pClientMode && g_pClientMode->GetViewport() ) { diff --git a/src/game/client/tf/vgui/tf_playermodelpanel.cpp b/src/game/client/tf/vgui/tf_playermodelpanel.cpp index cb49453a5..6f130b9d2 100644 --- a/src/game/client/tf/vgui/tf_playermodelpanel.cpp +++ b/src/game/client/tf/vgui/tf_playermodelpanel.cpp @@ -1349,6 +1349,8 @@ CEconItemView *CTFPlayerModelPanel::GetLoadoutItemFromMDLHandle( loadout_positio if ( ( IsMiscSlot( iLoadoutSlot ) && IsMiscSlot( iPosition ) ) || ( IsValidPickupWeaponSlot( iLoadoutSlot ) && iLoadoutSlot == iPosition ) ) { + // See if we need to cache for our style getters. + CEconItemViewDataCacher dataCacher(pItem->GetStaticData()->GetNumStyles() ? pItem : NULL); const char * pDisplayModel = pItem->GetPlayerDisplayModel( m_iCurrentClassIndex, m_iTeam ); if ( pDisplayModel ) { @@ -1492,6 +1494,8 @@ bool CTFPlayerModelPanel::UpdateCosmeticParticles( if ( m_aParticleSystems[ iSystem ] && m_aParticleSystems[ iSystem ]->m_bIsUpdateToDate ) return false; + CEconItemViewDataCacher dataCacher(pEconItem); + attachedparticlesystem_t *pParticleSystem = NULL; // do community_sparkle effect if this is a community item? diff --git a/src/game/client/tf/vgui/tf_training_ui.cpp b/src/game/client/tf/vgui/tf_training_ui.cpp index 808c4236d..316520e6f 100644 --- a/src/game/client/tf/vgui/tf_training_ui.cpp +++ b/src/game/client/tf/vgui/tf_training_ui.cpp @@ -1765,24 +1765,24 @@ class CTrainingDialog : public EditablePanel ivgui()->RemoveTickSignal( GetVPanel() ); } - virtual void SetDialogVariable( const char *pVarName, const char *pValue ) + virtual void SetDialogVariable( const char *pVarName, const char *pValue, bool bForceUpdate = true ) { - m_pContainer->SetDialogVariable( pVarName, pValue ); + m_pContainer->SetDialogVariable( pVarName, pValue, bForceUpdate ); } - virtual void SetDialogVariable( const char *pVarName, const wchar_t *pValue ) + virtual void SetDialogVariable( const char *pVarName, const wchar_t *pValue, bool bForceUpdate = true ) { - m_pContainer->SetDialogVariable( pVarName, pValue ); + m_pContainer->SetDialogVariable( pVarName, pValue, bForceUpdate ); } - virtual void SetDialogVariable( const char *pVarName, int nValue ) + virtual void SetDialogVariable( const char *pVarName, int nValue, bool bForceUpdate = true ) { - m_pContainer->SetDialogVariable( pVarName, nValue ); + m_pContainer->SetDialogVariable( pVarName, nValue, bForceUpdate ); } - virtual void SetDialogVariable( const char *pVarName, float flValue ) + virtual void SetDialogVariable( const char *pVarName, float flValue, bool bForceUpdate = true ) { - m_pContainer->SetDialogVariable( pVarName, flValue ); + m_pContainer->SetDialogVariable( pVarName, flValue, bForceUpdate ); } void SetupButton( const char *pPanelName, CExButton **ppOut = NULL ) diff --git a/src/game/client/viewrender.cpp b/src/game/client/viewrender.cpp index 3bc622857..72f25164c 100644 --- a/src/game/client/viewrender.cpp +++ b/src/game/client/viewrender.cpp @@ -3877,7 +3877,7 @@ static void DrawOpaqueRenderables_DrawStaticProps( CClientRenderablesList::CEntr render->SetColorModulation( one ); render->SetBlend( 1.0f ); - const int MAX_STATICS_PER_BATCH = 512; + const int MAX_STATICS_PER_BATCH = 2048; IClientRenderable *pStatics[ MAX_STATICS_PER_BATCH ]; int numScheduled = 0, numAvailable = MAX_STATICS_PER_BATCH; diff --git a/src/game/shared/econ/econ_item_inventory.cpp b/src/game/shared/econ/econ_item_inventory.cpp index 1bc2b2b93..e2996a1c7 100644 --- a/src/game/shared/econ/econ_item_inventory.cpp +++ b/src/game/shared/econ/econ_item_inventory.cpp @@ -296,6 +296,12 @@ void CInventoryManager::OnPersonaStateChanged( PersonaStateChange_t *info ) //----------------------------------------------------------------------------- bool CInventoryManager::Init( void ) { +#ifdef GAME_DLL + if ( engine->IsDedicatedServer() ) +#endif + { + InitializeInventory(); + } return true; } @@ -304,12 +310,6 @@ bool CInventoryManager::Init( void ) //----------------------------------------------------------------------------- void CInventoryManager::PostInit( void ) { -#ifdef GAME_DLL - if ( engine->IsDedicatedServer() ) -#endif - { - InitializeInventory(); - } } void CInventoryManager::InitializeInventory() diff --git a/src/game/shared/econ/econ_item_schema.cpp b/src/game/shared/econ/econ_item_schema.cpp index 1093c5c2a..643a349a1 100644 --- a/src/game/shared/econ/econ_item_schema.cpp +++ b/src/game/shared/econ/econ_item_schema.cpp @@ -830,27 +830,29 @@ bool CEconItemPaintKitDefinition::BInitFromKV( KeyValues *pKVPItemPaintKit, CUtl SCHEMA_INIT_CHECK( m_pszLocalizedName != NULL, "Paint Kit %s: PaintKit contains no localized name", m_pszName ); + pKVPItemPaintKit = pKVPItemPaintKit->MakeCopy(); + KeyValues *pKVWearInputItems = NULL; pKVWearInputItems = pKVPItemPaintKit->FindKey( "wear_level_1", false ); SCHEMA_INIT_CHECK( VerifyPaintKitComposite( pKVWearInputItems, m_pszName, 1, pVecErrors ), "Could Not Create Weapon Skin Compositor for [%s][Wear %d]", m_pszName, 1 ); - m_vecPaintKitWearKVP.AddToTail( pKVWearInputItems->MakeCopy() ); + m_vecPaintKitWearKVP.AddToTail( pKVWearInputItems ); pKVWearInputItems = pKVPItemPaintKit->FindKey( "wear_level_2", false ); SCHEMA_INIT_CHECK( VerifyPaintKitComposite( pKVWearInputItems, m_pszName, 2, pVecErrors ), "Could Not Create Weapon Skin Compositor for [%s][Wear %d]", m_pszName, 2 ); - m_vecPaintKitWearKVP.AddToTail( pKVWearInputItems->MakeCopy() ); + m_vecPaintKitWearKVP.AddToTail( pKVWearInputItems ); pKVWearInputItems = pKVPItemPaintKit->FindKey( "wear_level_3", false ); SCHEMA_INIT_CHECK( VerifyPaintKitComposite( pKVWearInputItems, m_pszName, 3, pVecErrors ), "Could Not Create Weapon Skin Compositor for [%s][Wear %d]", m_pszName, 3 ); - m_vecPaintKitWearKVP.AddToTail( pKVWearInputItems->MakeCopy() ); + m_vecPaintKitWearKVP.AddToTail( pKVWearInputItems ); pKVWearInputItems = pKVPItemPaintKit->FindKey( "wear_level_4", false ); SCHEMA_INIT_CHECK( VerifyPaintKitComposite( pKVWearInputItems, m_pszName, 4, pVecErrors ), "Could Not Create Weapon Skin Compositor for [%s][Wear %d]", m_pszName, 4 ); - m_vecPaintKitWearKVP.AddToTail( pKVWearInputItems->MakeCopy() ); + m_vecPaintKitWearKVP.AddToTail( pKVWearInputItems ); pKVWearInputItems = pKVPItemPaintKit->FindKey( "wear_level_5", false ); SCHEMA_INIT_CHECK( VerifyPaintKitComposite( pKVWearInputItems, m_pszName, 5, pVecErrors ), "Could Not Create Weapon Skin Compositor for [%s][Wear %d]", m_pszName, 5 ); - m_vecPaintKitWearKVP.AddToTail( pKVWearInputItems->MakeCopy() ); + m_vecPaintKitWearKVP.AddToTail( pKVWearInputItems ); return SCHEMA_INIT_SUCCESS(); } diff --git a/src/game/shared/econ/econ_item_system.cpp b/src/game/shared/econ/econ_item_system.cpp index aa6478abf..a995b6d5d 100644 --- a/src/game/shared/econ/econ_item_system.cpp +++ b/src/game/shared/econ/econ_item_system.cpp @@ -520,11 +520,12 @@ class CGCUpdateItemSchema : public GCSDK::CGCClientJob // Check if we're already up-to-date m_nExpectedVersion = msg.Body().item_schema_version(); uint32 nCurrentSchemaVersion = ItemSystem()->GetItemSchema()->GetVersion(); - if ( m_nExpectedVersion != 0 && m_nExpectedVersion == nCurrentSchemaVersion ) + if ( m_nExpectedVersion != 0 && m_nExpectedVersion == nCurrentSchemaVersion || m_nExpectedVersion == 1848988175 && nCurrentSchemaVersion == 2956404869 ) { Msg( "Current item schema is up-to-date with version %08X.\n", nCurrentSchemaVersion ); return true; } + Warning( "Current item schema is outdated with version %d instead of %d.\n", nCurrentSchemaVersion, m_nExpectedVersion ); m_sSignature = msg.Body().signature(); diff --git a/src/game/shared/econ/econ_item_view.cpp b/src/game/shared/econ/econ_item_view.cpp index caf16d067..bb9be0c3e 100644 --- a/src/game/shared/econ/econ_item_view.cpp +++ b/src/game/shared/econ/econ_item_view.cpp @@ -844,6 +844,9 @@ CEconItem *CEconItemView::GetSOCData( void ) const if ( m_pNonSOEconItem ) return m_pNonSOEconItem; + if (m_pSOCDataCache) + return m_pSOCDataCache; + #ifdef CLIENT_DLL // We need to find the inventory that contains this item. If we're not connected // to a server, and the owner is the same as the local player, use the local inventory. diff --git a/src/game/shared/econ/econ_item_view.h b/src/game/shared/econ/econ_item_view.h index 5ccf8253d..1beef8e4a 100644 --- a/src/game/shared/econ/econ_item_view.h +++ b/src/game/shared/econ/econ_item_view.h @@ -358,6 +358,9 @@ class CEconItemView : public CMaterialOverrideContainer< IEconItemInterface > inline int GetTeamNumber() const { return m_iTeamNumber; } inline void SetTeamNumber( int iTeamNumber ) { m_iTeamNumber = iTeamNumber; } + void CacheSOCData() { if (!m_pSOCDataCache) m_pSOCDataCache = GetSOCData(); } + void UncacheSOCData() { m_pSOCDataCache = NULL; } + protected: // Index of the item definition in the item script file. CNetworkVar( item_definition_index_t, m_iItemDefinitionIndex ); @@ -395,6 +398,9 @@ class CEconItemView : public CMaterialOverrideContainer< IEconItemInterface > eEconItemOrigin m_unOverrideOrigin; #endif + // Can set this temporarily while calling several attribute getters to avoid looking up each time + CEconItem *m_pSOCDataCache = NULL; + bool m_bColorInit; bool m_bPaintOverrideInit; bool m_bHasPaintOverride; @@ -452,4 +458,34 @@ bool DoesItemPassSearchFilter( const class IEconItemDescription *pDescription, c CBasePlayer *GetPlayerByAccountID( uint32 unAccountID ); #endif // CLIENT_DLL +/** There are some function calls which repeatedly call out to our underlying item, lets cache beforehand. */ +class CEconItemViewDataCacher +{ +public: + CEconItemViewDataCacher(CEconItemView* pItem) : m_pItem(pItem) + { + if (!m_pItem) return; + pItem->CacheSOCData(); + } + + ~CEconItemViewDataCacher() + { + if (!m_pItem) return; + m_pItem->UncacheSOCData(); + } + + void SetItem(CEconItemView* pItem) + { + if (pItem == m_pItem) return; + if (!pItem) return; + if (m_pItem) m_pItem->UncacheSOCData(); + m_pItem = pItem; + m_pItem->CacheSOCData(); + } + +private: + + CEconItemView* m_pItem; +}; + #endif // ECON_ITEM_CONSTANTS_H diff --git a/src/game/shared/teamplay_round_timer.cpp b/src/game/shared/teamplay_round_timer.cpp index f451a296b..047f9d9f3 100644 --- a/src/game/shared/teamplay_round_timer.cpp +++ b/src/game/shared/teamplay_round_timer.cpp @@ -97,10 +97,13 @@ static void RecvProxy_TimerPaused( const CRecvProxyData *pData, void *pStruct, v bool bTimerPaused = ( pData->m_Value.m_Int > 0 ); + // UNDONE: Unused HUD animation +#if 0 if ( bTimerPaused == false ) { g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "TimerFlash" ); } +#endif if ( pTimer ) { diff --git a/src/game/shared/tf/tf_gamerules.h b/src/game/shared/tf/tf_gamerules.h index 4a9678eeb..284930287 100644 --- a/src/game/shared/tf/tf_gamerules.h +++ b/src/game/shared/tf/tf_gamerules.h @@ -1466,7 +1466,7 @@ inline float CTFGameRules::ItemTesting_GetBotAnimSpeed( void ) pHostTimescale = cvar->FindVar( "host_timescale" ); } - if ( pHostTimescale ) + if ( pHostTimescale && pHostTimescale->GetFloat() > 0 ) return (m_flItemTesting_BotAnimSpeed * pHostTimescale->GetFloat()); return m_flItemTesting_BotAnimSpeed; } diff --git a/src/game/shared/tf/tf_viewmodel.cpp b/src/game/shared/tf/tf_viewmodel.cpp index bcd5dcbda..def5356c0 100644 --- a/src/game/shared/tf/tf_viewmodel.cpp +++ b/src/game/shared/tf/tf_viewmodel.cpp @@ -338,6 +338,7 @@ int CTFViewModel::GetSkin() CEconItemView *pItem = pWeapon->GetAttributeContainer()->GetItem(); if ( pItem->IsValid() ) { + CEconItemViewDataCacher dataCacher(pItem); iItemSkin = pItem->GetSkin( pPlayer->GetTeamNumber(), true ); } diff --git a/src/game/shared/tf/tf_weapon_sniperrifle.cpp b/src/game/shared/tf/tf_weapon_sniperrifle.cpp index 40f095f86..1c50cbb8e 100644 --- a/src/game/shared/tf/tf_weapon_sniperrifle.cpp +++ b/src/game/shared/tf/tf_weapon_sniperrifle.cpp @@ -523,19 +523,19 @@ void CTFSniperRifle::ZoomOutIn( void ) ZoomOut(); CTFPlayer *pPlayer = GetTFPlayerOwner(); + float flRezoomDelay = 0.9f; + if ( !UsesClipsForAmmo1() ) + { + // Since sniper rifles don't actually use clips the fast reload hook also affects unzoom and zoom delays + ApplyScopeSpeedModifications( flRezoomDelay ); + } if ( pPlayer && pPlayer->ShouldAutoRezoom() ) { - float flRezoomDelay = 0.9f; - if ( !UsesClipsForAmmo1() ) - { - // Since sniper rifles don't actually use clips the fast reload hook also affects unzoom and zoom delays - ApplyScopeSpeedModifications( flRezoomDelay ); - } m_flRezoomTime = gpGlobals->curtime + flRezoomDelay; } else { - m_flNextSecondaryAttack = gpGlobals->curtime + 1.0f; + m_flNextSecondaryAttack = gpGlobals->curtime + flRezoomDelay + 0.1f; } } diff --git a/src/gameui/GameUI_Interface.cpp b/src/gameui/GameUI_Interface.cpp index 01c7b39bb..1d699d840 100644 --- a/src/gameui/GameUI_Interface.cpp +++ b/src/gameui/GameUI_Interface.cpp @@ -170,8 +170,12 @@ void CGameUI::Initialize( CreateInterfaceFn factory ) steamapicontext->Init(); +#if defined( _X360 ) || defined( STAGING_ONLY ) ConVarRef var( "gameui_xbox" ); m_bIsConsoleUI = var.IsValid() && var.GetBool(); +#else + m_bIsConsoleUI = false; +#endif vgui::VGui_InitInterfacesList( "GameUI", &factory, 1 ); vgui::VGui_InitMatSysInterfacesList( "GameUI", &factory, 1 ); diff --git a/src/inputsystem/inputsystem.cpp b/src/inputsystem/inputsystem.cpp index 5f11ac7d3..3106a5a63 100644 --- a/src/inputsystem/inputsystem.cpp +++ b/src/inputsystem/inputsystem.cpp @@ -271,7 +271,7 @@ void CInputSystem::SleepUntilInput( int nMaxSleepTimeMS ) #else #warning "need a SleepUntilInput impl" #endif -} + } diff --git a/src/materialsystem/cmaterialsystem.cpp b/src/materialsystem/cmaterialsystem.cpp index 3d19a1680..8de03c177 100644 --- a/src/materialsystem/cmaterialsystem.cpp +++ b/src/materialsystem/cmaterialsystem.cpp @@ -1898,7 +1898,8 @@ void CMaterialSystem::ReadConfigFromConVars( MaterialSystem_Config_t *pConfig ) pConfig->m_bSupportFlashlight = mat_supportflashlight.GetInt() != 0; pConfig->m_bShadowDepthTexture = r_flashlightdepthtexture.GetBool(); - pConfig->SetFlag( MATSYS_VIDCFG_FLAGS_ENABLE_HDR, HardwareConfig() && HardwareConfig()->GetHDREnabled() ); + static ConVarRef mat_hdr_level("mat_hdr_level"); + pConfig->SetFlag( MATSYS_VIDCFG_FLAGS_ENABLE_HDR, mat_hdr_level.IsValid() && mat_hdr_level.GetInt() > 1 ); // Render-to-texture shadows are disabled for dxlevel 70 because of material issues if ( pConfig->dxSupportLevel < 80 ) diff --git a/src/public/bone_setup.cpp b/src/public/bone_setup.cpp index 27ab95dcf..c2530fc25 100644 --- a/src/public/bone_setup.cpp +++ b/src/public/bone_setup.cpp @@ -3118,14 +3118,14 @@ class CIKSolver X[i] = P[i]; normalize(X); -// Its y axis is perpendicular to P, so Y = unit( E - X(E�X) ). +// Its y axis is perpendicular to P, so Y = unit( E - X(E⋅X) ). float dDOTx = dot(D,X); for (i = 0 ; i < 3 ; i++) Y[i] = D[i] - dDOTx * X[i]; normalize(Y); -// Its z axis is perpendicular to both X and Y, so Z = X�Y. +// Its z axis is perpendicular to both X and Y, so Z = X⋅Y. cross(X,Y,Z); diff --git a/src/public/mathlib/ssemath.h b/src/public/mathlib/ssemath.h index 3bcda408a..365de17e5 100644 --- a/src/public/mathlib/ssemath.h +++ b/src/public/mathlib/ssemath.h @@ -2057,7 +2057,8 @@ FORCEINLINE fltx4 SinSIMD( const fltx4 &radians ) FORCEINLINE void SinCos3SIMD( fltx4 &sine, fltx4 &cosine, const fltx4 &radians ) { #if USE_DXMATH - DirectX::XMVectorSinCos( &sine, &cosine, radians ); + //DirectX::XMVectorSinCos( &sine, &cosine, radians ); + sincos_ps(radians, &sine, &cosine); #else // FIXME: Make a fast SSE version SinCos( SubFloat( radians, 0 ), &SubFloat( sine, 0 ), &SubFloat( cosine, 0 ) ); diff --git a/src/public/tier1/strtools.h b/src/public/tier1/strtools.h index e94d9cedf..d430c032b 100644 --- a/src/public/tier1/strtools.h +++ b/src/public/tier1/strtools.h @@ -253,7 +253,34 @@ inline bool V_islower(char c) { return islower( (unsigned char)c ) != 0; } inline bool V_iscntrl(char c) { return iscntrl( (unsigned char)c ) != 0; } //#undef iscntrl //#define iscntrl use_V_iscntrl_instead_of_iscntrl -inline bool V_isspace(char c) { return isspace( (unsigned char)c ) != 0; } +inline bool V_isspace(int c) +{ + // The standard white-space characters are the following: space, tab, carriage-return, newline, vertical tab, and form-feed. In the C locale, V_isspace() returns true only for the standard white-space characters. + //return c == ' ' || c == 9 /*horizontal tab*/ || c == '\r' || c == '\n' || c == 11 /*vertical tab*/ || c == '\f'; + // codes of whitespace symbols: 9 HT, 10 \n, 11 VT, 12 form feed, 13 \r, 32 space + + // easy to understand version, validated: + // return ((1 << (c-1)) & 0x80001F00) != 0 && ((c-1)&0xE0) == 0; + + // 5% faster on Core i7, 35% faster on Xbox360, no branches, validated: + #ifdef _X360 + return ((1 << (c-1)) & 0x80001F00 & ~(-int((c-1)&0xE0))) != 0; + #else + // this is 11% faster on Core i7 than the previous, VC2005 compiler generates a seemingly unbalanced search tree that's faster + switch(c) + { + case ' ': + case 9: + case '\r': + case '\n': + case 11: + case '\f': + return true; + default: + return false; + } + #endif +} //#undef isspace //#define isspace use_V_isspace_instead_of_isspace diff --git a/src/public/vgui_controls/AnimationController.h b/src/public/vgui_controls/AnimationController.h index 63f29f41b..4836055e3 100644 --- a/src/public/vgui_controls/AnimationController.h +++ b/src/public/vgui_controls/AnimationController.h @@ -50,7 +50,7 @@ class AnimationController : public Panel // starts an animation sequence script bool StartAnimationSequence(const char *sequenceName, bool bCanBeCancelled = true ); - bool StartAnimationSequence(Panel *pWithinParent, const char *sequenceName, bool bCanBeCancelled = true ); + bool StartAnimationSequence(Panel *pWithinParent, const char *sequenceName, bool bCanBeCancelled = true, bool bIncludeParent = false ); bool StopAnimationSequence( Panel *pWithinParent, const char *sequenceName ); void CancelAnimationsForPanel( Panel *pWithinParent ); @@ -241,14 +241,14 @@ class AnimationController : public Panel CUtlVector m_ScriptFileNames; // runs a single line of the script - void ExecAnimationCommand(UtlSymId_t seqName, AnimCommand_t &animCommand, Panel *pWithinParent, bool bCanBeCancelled); + void ExecAnimationCommand(UtlSymId_t seqName, AnimCommand_t &animCommand, Panel *pWithinParent, bool bCanBeCancelled, bool bIncludeParent = false); // removes all commands belonging to a script void RemoveQueuedAnimationCommands(UtlSymId_t seqName, vgui::Panel *panel = NULL); // removes an existing instance of a command void RemoveQueuedAnimationByType(vgui::Panel *panel, UtlSymId_t variable, UtlSymId_t sequenceToIgnore); // handlers - void StartCmd_Animate(UtlSymId_t seqName, AnimCmdAnimate_t &cmd, Panel *pWithinParent, bool bCanBeCancelled); + void StartCmd_Animate(UtlSymId_t seqName, AnimCmdAnimate_t &cmd, Panel *pWithinParent, bool bCanBeCancelled, bool bIncludeParent = false); void StartCmd_Animate(Panel *panel, UtlSymId_t seqName, AnimCmdAnimate_t &cmd, bool bCanBeCancelled); void RunCmd_RunEvent(PostedMessage_t &msg); void RunCmd_StopEvent(PostedMessage_t &msg); diff --git a/src/public/vgui_controls/EditablePanel.h b/src/public/vgui_controls/EditablePanel.h index ea1f7248d..c8ee840ce 100644 --- a/src/public/vgui_controls/EditablePanel.h +++ b/src/public/vgui_controls/EditablePanel.h @@ -74,10 +74,10 @@ class EditablePanel : public Panel // localization variables (used in constructing UI strings) // after the variable is set, causes all the necessary sub-panels to update - virtual void SetDialogVariable(const char *varName, const char *value); - virtual void SetDialogVariable(const char *varName, const wchar_t *value); - virtual void SetDialogVariable(const char *varName, int value); - virtual void SetDialogVariable(const char *varName, float value); + virtual void SetDialogVariable(const char *varName, const char *value, bool bForceUpdate = true); + virtual void SetDialogVariable(const char *varName, const wchar_t *value, bool bForceUpdate = true); + virtual void SetDialogVariable(const char *varName, int value, bool bForceUpdate = true); + virtual void SetDialogVariable(const char *varName, float value, bool bForceUpdate = true); // Focus handling // Delegate focus to a sub panel diff --git a/src/public/vgui_controls/Label.h b/src/public/vgui_controls/Label.h index 53422f764..03d37854e 100644 --- a/src/public/vgui_controls/Label.h +++ b/src/public/vgui_controls/Label.h @@ -196,6 +196,8 @@ class Label : public Panel short width; }; CUtlVector _imageDar; + bool _isSimpleTextImage = false; + TImageInfo *_cachedSimpleTextImage; int _textInset[2]; Color _disabledFgColor1; diff --git a/src/public/vgui_controls/Panel.h b/src/public/vgui_controls/Panel.h index 5d1abd1f7..12422c81b 100644 --- a/src/public/vgui_controls/Panel.h +++ b/src/public/vgui_controls/Panel.h @@ -344,6 +344,8 @@ class Panel : public IClientPanel, virtual public IForceVirtualInheritancePanel bool IsRightAligned(); // returns true if the settings are aligned to the right of the screen bool IsBottomAligned(); // returns true if the settings are aligned to the bottom of the screen + virtual bool CanAnimate() const { return true; } + // scheme access functions virtual HScheme GetScheme(); virtual void SetScheme(const char *tag); diff --git a/src/thirdparty/DirectXMath-dec2022/Inc/DirectXMath.h b/src/thirdparty/DirectXMath-dec2022/Inc/DirectXMath.h index fd542388f..5214a7f1f 100644 --- a/src/thirdparty/DirectXMath-dec2022/Inc/DirectXMath.h +++ b/src/thirdparty/DirectXMath-dec2022/Inc/DirectXMath.h @@ -15,10 +15,6 @@ #define DIRECTX_MATH_VERSION 318 -#if defined(_MSC_VER) && (_MSC_VER < 1910) -#error DirectX Math requires Visual C++ 2017 or later. -#endif - #if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(_M_HYBRID_X86_ARM64) && !defined(_M_ARM64EC) && (!_MANAGED) && (!_M_CEE) && (!defined(_M_IX86_FP) || (_M_IX86_FP > 1)) && !defined(_XM_NO_INTRINSICS_) && !defined(_XM_VECTORCALL_) #define _XM_VECTORCALL_ 1 #endif diff --git a/src/tier1/utlbuffer.cpp b/src/tier1/utlbuffer.cpp index ff03da068..be3768137 100644 --- a/src/tier1/utlbuffer.cpp +++ b/src/tier1/utlbuffer.cpp @@ -392,7 +392,7 @@ void CUtlBuffer::EatWhiteSpace() { while ( CheckGet( sizeof(char) ) ) { - if ( !isspace( *(const unsigned char*)PeekGet() ) ) + if ( !V_isspace( *(const unsigned char*)PeekGet() ) ) break; m_Get += sizeof(char); } diff --git a/src/vgui2/vgui_controls/AnimationController.cpp b/src/vgui2/vgui_controls/AnimationController.cpp index cee769a97..caac79996 100644 --- a/src/vgui2/vgui_controls/AnimationController.cpp +++ b/src/vgui2/vgui_controls/AnimationController.cpp @@ -1042,7 +1042,7 @@ bool AnimationController::StartAnimationSequence(const char *sequenceName, bool //----------------------------------------------------------------------------- // Purpose: starts an animation sequence script //----------------------------------------------------------------------------- -bool AnimationController::StartAnimationSequence(Panel *pWithinParent, const char *sequenceName, bool bCanBeCancelled ) +bool AnimationController::StartAnimationSequence(Panel *pWithinParent, const char *sequenceName, bool bCanBeCancelled, bool bIncludeParent ) { Assert( pWithinParent ); @@ -1075,7 +1075,7 @@ bool AnimationController::StartAnimationSequence(Panel *pWithinParent, const cha // execute the sequence for (int cmdIndex = 0; cmdIndex < m_Sequences[i].cmdList.Count(); cmdIndex++) { - ExecAnimationCommand(seqName, m_Sequences[i].cmdList[cmdIndex], pWithinParent, bCanBeCancelled); + ExecAnimationCommand(seqName, m_Sequences[i].cmdList[cmdIndex], pWithinParent, bCanBeCancelled, bIncludeParent); } return true; @@ -1277,11 +1277,11 @@ void AnimationController::RemoveQueuedAnimationByType(vgui::Panel *panel, UtlSym //----------------------------------------------------------------------------- // Purpose: runs a single line of the script //----------------------------------------------------------------------------- -void AnimationController::ExecAnimationCommand(UtlSymId_t seqName, AnimCommand_t &animCommand, Panel *pWithinParent, bool bCanBeCancelled) +void AnimationController::ExecAnimationCommand(UtlSymId_t seqName, AnimCommand_t &animCommand, Panel *pWithinParent, bool bCanBeCancelled, bool bIncludeParent) { if (animCommand.commandType == CMD_ANIMATE) { - StartCmd_Animate(seqName, animCommand.cmdData.animate, pWithinParent, bCanBeCancelled); + StartCmd_Animate(seqName, animCommand.cmdData.animate, pWithinParent, bCanBeCancelled, bIncludeParent); } else { @@ -1301,19 +1301,21 @@ void AnimationController::ExecAnimationCommand(UtlSymId_t seqName, AnimCommand_t //----------------------------------------------------------------------------- // Purpose: starts a variable animation //----------------------------------------------------------------------------- -void AnimationController::StartCmd_Animate(UtlSymId_t seqName, AnimCmdAnimate_t &cmd, Panel *pWithinParent, bool bCanBeCancelled) +void AnimationController::StartCmd_Animate(UtlSymId_t seqName, AnimCmdAnimate_t &cmd, Panel *pWithinParent, bool bCanBeCancelled, bool bIncludeParent) { Assert( pWithinParent ); if ( !pWithinParent ) return; + const char* panelName = g_ScriptSymbols.String(cmd.panel); + // make sure the child exists - Panel *panel = pWithinParent->FindChildByName(g_ScriptSymbols.String(cmd.panel),true); + Panel *panel = pWithinParent->FindChildByName(panelName,true); if ( !panel ) { // Check the parent - Panel *parent = GetParent(); - if ( !Q_stricmp( parent->GetName(), g_ScriptSymbols.String(cmd.panel) ) ) + Panel *parent = bIncludeParent ? pWithinParent : GetParent(); + if ( !Q_stricmp( parent->GetName(), panelName ) ) { panel = parent; } @@ -1321,6 +1323,10 @@ void AnimationController::StartCmd_Animate(UtlSymId_t seqName, AnimCmdAnimate_t if (!panel) return; + // Block some panels (like HudScope). Unfortunately players are abusing animations with broad/null parents. + if ( !panel->CanAnimate() ) + return; + StartCmd_Animate(panel, seqName, cmd, bCanBeCancelled); } diff --git a/src/vgui2/vgui_controls/EditablePanel.cpp b/src/vgui2/vgui_controls/EditablePanel.cpp index 670d4dbc4..553a6e9fc 100644 --- a/src/vgui2/vgui_controls/EditablePanel.cpp +++ b/src/vgui2/vgui_controls/EditablePanel.cpp @@ -997,8 +997,12 @@ void EditablePanel::GetControlString(const char *controlName, char *buf, int buf //----------------------------------------------------------------------------- // Purpose: localization variables (used in constructing UI strings) //----------------------------------------------------------------------------- -void EditablePanel::SetDialogVariable(const char *varName, const char *value) +void EditablePanel::SetDialogVariable(const char *varName, const char *value, bool bForceUpdate) { + if (!bForceUpdate && !GetDialogVariables()->IsEmpty(varName) && !strcmp(GetDialogVariables()->GetString(varName), value ? value : "")) + { + return; + } GetDialogVariables()->SetString(varName, value); ForceSubPanelsToUpdateWithNewDialogVariables(); } @@ -1006,8 +1010,12 @@ void EditablePanel::SetDialogVariable(const char *varName, const char *value) //----------------------------------------------------------------------------- // Purpose: localization variables (used in constructing UI strings) //----------------------------------------------------------------------------- -void EditablePanel::SetDialogVariable(const char *varName, const wchar_t *value) +void EditablePanel::SetDialogVariable(const char *varName, const wchar_t *value, bool bForceUpdate) { + if (!bForceUpdate && !GetDialogVariables()->IsEmpty(varName) && !wcscmp(GetDialogVariables()->GetWString(varName), value ? value : L"")) + { + return; + } GetDialogVariables()->SetWString(varName, value); ForceSubPanelsToUpdateWithNewDialogVariables(); } @@ -1015,8 +1023,12 @@ void EditablePanel::SetDialogVariable(const char *varName, const wchar_t *value) //----------------------------------------------------------------------------- // Purpose: localization variables (used in constructing UI strings) //----------------------------------------------------------------------------- -void EditablePanel::SetDialogVariable(const char *varName, int value) +void EditablePanel::SetDialogVariable(const char *varName, int value, bool bForceUpdate) { + if (!bForceUpdate && !GetDialogVariables()->IsEmpty(varName) && GetDialogVariables()->GetInt(varName) == value) + { + return; + } GetDialogVariables()->SetInt(varName, value); ForceSubPanelsToUpdateWithNewDialogVariables(); } @@ -1024,8 +1036,12 @@ void EditablePanel::SetDialogVariable(const char *varName, int value) //----------------------------------------------------------------------------- // Purpose: localization variables (used in constructing UI strings) //----------------------------------------------------------------------------- -void EditablePanel::SetDialogVariable(const char *varName, float value) +void EditablePanel::SetDialogVariable(const char *varName, float value, bool bForceUpdate) { + if (!bForceUpdate && !GetDialogVariables()->IsEmpty(varName) && GetDialogVariables()->GetFloat(varName) == value) + { + return; + } GetDialogVariables()->SetFloat(varName, value); ForceSubPanelsToUpdateWithNewDialogVariables(); } diff --git a/src/vgui2/vgui_controls/Label.cpp b/src/vgui2/vgui_controls/Label.cpp index 2178f3904..a50205a8c 100644 --- a/src/vgui2/vgui_controls/Label.cpp +++ b/src/vgui2/vgui_controls/Label.cpp @@ -403,13 +403,10 @@ void Label::ComputeAlignment(int &tx0, int &ty0, int &tx1, int &ty1) int maxX = 0, maxY = 0; int actualXAlignment = _contentAlignment; - for (int i = 0; i < _imageDar.Count(); i++) + if (_isSimpleTextImage) { - TImageInfo &imageInfo = _imageDar[i]; + TImageInfo &imageInfo = *_cachedSimpleTextImage; IImage *image = imageInfo.image; - if (!image) - continue; // skip over null images - // add up the bounds int iWide, iTall; image->GetSize(iWide, iTall); @@ -423,6 +420,29 @@ void Label::ComputeAlignment(int &tx0, int &ty0, int &tx1, int &ty1) // add the offset to x maxX += imageInfo.offset; } + else + { + for (int i = 0; i < _imageDar.Count(); i++) + { + TImageInfo &imageInfo = _imageDar[i]; + IImage *image = imageInfo.image; + if (!image) + continue; // skip over null images + + // add up the bounds + int iWide, iTall; + image->GetSize(iWide, iTall); + if (iWide > wide) // if the image is larger than the label just do a west alignment + actualXAlignment = Label::a_west; + + // get the max height + maxY = max(maxY, iTall); + maxX += iWide; + + // add the offset to x + maxX += imageInfo.offset; + } + } tWide = maxX; tTall = maxY; @@ -824,11 +844,21 @@ void Label::OnSetText(KeyValues *params) //----------------------------------------------------------------------------- int Label::AddImage(IImage *image, int offset) { + if (_isSimpleTextImage) + { + _cachedSimpleTextImage = NULL; + _isSimpleTextImage = false; + } int newImage = _imageDar.AddToTail(); _imageDar[newImage].image = image; _imageDar[newImage].offset = (short)offset; _imageDar[newImage].xpos = -1; _imageDar[newImage].width = -1; + if (_imageDar.Count() == 1 && image != NULL) + { + _cachedSimpleTextImage = _imageDar.Base(); + _isSimpleTextImage = true; + } InvalidateLayout(); return newImage; } @@ -1307,9 +1337,6 @@ void Label::PerformLayout() } HandleAutoSizing(); - - HandleAutoSizing(); - return; }