|
78 | 78 | #include "client_virtualreality.h" |
79 | 79 |
|
80 | 80 | #include "econ_gcmessages.h" |
| 81 | +#include "gamestate/gamestate.h" |
81 | 82 |
|
82 | 83 | #if defined( _X360 ) |
83 | 84 | #include "tf_clientscoreboard.h" |
@@ -395,6 +396,7 @@ ClientModeTFNormal::ClientModeTFNormal() |
395 | 396 | m_bInitializedHudAspect = false; |
396 | 397 |
|
397 | 398 | m_flLastSlaughterTime = -1.0f; |
| 399 | + m_flCurMaxFPS = -1.0f; |
398 | 400 |
|
399 | 401 | #if defined( _X360 ) |
400 | 402 | m_pScoreboard = NULL; |
@@ -1544,8 +1546,13 @@ void ClientModeTFNormal::FireGameEvent( IGameEvent *event ) |
1544 | 1546 | { |
1545 | 1547 | m_eConnectState = k_eConnectState_Connecting; |
1546 | 1548 | m_bPendingRichPresenceUpdate = true; |
| 1549 | + // TODO(mcoms): test out always restricting info panel |
| 1550 | +#if 0 |
1547 | 1551 | const char *pchSource = event->GetString( "source" ); |
1548 | 1552 | m_bRestrictInfoPanel = pchSource && ( FStrEq( "matchmaking", pchSource ) || !Q_strncmp( pchSource, "quickplay_", 10 ) ); |
| 1553 | +#else |
| 1554 | + m_bRestrictInfoPanel = true; |
| 1555 | +#endif |
1549 | 1556 |
|
1550 | 1557 | m_bInfoPanelShown = false; |
1551 | 1558 | } |
@@ -1977,6 +1984,12 @@ void ClientModeTFNormal::Update() |
1977 | 1984 | UpdateSteamRichPresence(); |
1978 | 1985 | } |
1979 | 1986 |
|
| 1987 | + if ( m_eLastConnectState != m_eConnectState ) |
| 1988 | + { |
| 1989 | + OnConnectStateChanged(); |
| 1990 | + m_eLastConnectState = m_eConnectState; |
| 1991 | + } |
| 1992 | + |
1980 | 1993 | TFModalStack()->Update(); |
1981 | 1994 |
|
1982 | 1995 | NotificationQueue_Update(); |
@@ -2209,6 +2222,47 @@ bool ClientModeTFNormal::IsTauntSelectPanelVisible() const |
2209 | 2222 | return m_pMenuTauntSelection && m_pMenuTauntSelection->IsVisible(); |
2210 | 2223 | } |
2211 | 2224 |
|
| 2225 | +//---------------------------------------------------------------------------- |
| 2226 | +void ClientModeTFNormal::OnConnectStateChanged() |
| 2227 | +{ |
| 2228 | + static ConVarRef fps_max( "fps_max" ); |
| 2229 | + static ConVarRef ui_fps_max( "ui_fps_max" ); |
| 2230 | + |
| 2231 | + switch ( m_eConnectState ) |
| 2232 | + { |
| 2233 | + case k_eConnectState_Connecting: |
| 2234 | + { |
| 2235 | + if ( m_flCurMaxFPS < 0.0f ) |
| 2236 | + { |
| 2237 | + m_flCurMaxFPS = fps_max.GetFloat(); |
| 2238 | + } |
| 2239 | + // while loading, keep it at our lowest |
| 2240 | + fps_max.SetValue( 30.0f ); |
| 2241 | + break; |
| 2242 | + } |
| 2243 | + case k_eConnectState_Connected: |
| 2244 | + { |
| 2245 | + // after loading, restore it. |
| 2246 | + Assert( m_flCurMaxFPS >= 0.0f ); |
| 2247 | + fps_max.SetValue( m_flCurMaxFPS >= 0.0f ? m_flCurMaxFPS : 1000.0f ); |
| 2248 | + m_flCurMaxFPS = -1.0f; |
| 2249 | + break; |
| 2250 | + } |
| 2251 | + default: |
| 2252 | + { |
| 2253 | + if ( m_flCurMaxFPS < 0.0f ) |
| 2254 | + { |
| 2255 | + m_flCurMaxFPS = fps_max.GetFloat(); |
| 2256 | + } |
| 2257 | + // if not in game, set fps_max to UI mode. |
| 2258 | + fps_max.SetValue( ui_fps_max.GetFloat() ); |
| 2259 | + break; |
| 2260 | + } |
| 2261 | + } |
| 2262 | + |
| 2263 | + GetGameStateManager()->QueueEvent( "ingame", m_eConnectState == k_eConnectState_Connected ? "1" : "0" ); |
| 2264 | +} |
| 2265 | + |
2212 | 2266 | //---------------------------------------------------------------------------- |
2213 | 2267 | void ClientModeTFNormal::UpdateSteamRichPresence() const |
2214 | 2268 | { |
|
0 commit comments