//----------------------------------------------------------------------------- // Purpose: Think //----------------------------------------------------------------------------- void CHud::Think(void) { // Determine the visibility of all hud elements for ( int i = 0; i < m_HudList.Size(); i++ ) { // Visible? bool visible = m_HudList[i]->ShouldDraw(); m_HudList[i]->SetActive( visible ); // If it's a vgui panel, hide/show as appropriate vgui::Panel *pPanel = dynamic_cast<vgui::Panel*>(m_HudList[i]); if ( pPanel && pPanel->IsVisible() != visible ) { pPanel->SetVisible( visible ); } else if ( !pPanel ) { // All HUD elements should now derive from vgui!!! Assert( 0 ); } if ( visible ) { m_HudList[i]->ProcessInput(); } } // Let the active weapon at the keybits C_BaseCombatWeapon *pWeapon = GetActiveWeapon(); if ( pWeapon ) { pWeapon->HandleInput(); } }
//----------------------------------------------------------------------------- // Purpose: Think //----------------------------------------------------------------------------- void CHud::Think(void) { #if defined( REPLAY_ENABLED ) // Don't draw this extern IEngineClientReplay *g_EngineClientReplay; const bool bPlayingReplay = g_pEngineClientReplay && g_pEngineClientReplay->IsPlayingReplayDemo(); #endif // Determine the visibility of all hud elements for ( int i = 0; i < m_HudList.Size(); i++ ) { // Visible? bool visible = m_HudList[i]->ShouldDraw(); #if defined( REPLAY_ENABLED ) visible = visible && !bPlayingReplay; #endif m_HudList[i]->SetActive( visible ); // If it's a vgui panel, hide/show as appropriate vgui::Panel *pPanel = dynamic_cast<vgui::Panel*>(m_HudList[i]); if ( pPanel && pPanel->IsVisible() != visible ) { pPanel->SetVisible( visible ); } else if ( !pPanel ) { // All HUD elements should now derive from vgui!!! Assert( 0 ); } if ( visible ) { m_HudList[i]->ProcessInput(); } } // Let the active weapon at the keybits C_BaseCombatWeapon *pWeapon = GetActiveWeapon(); if ( pWeapon ) { pWeapon->HandleInput(); } if ( ( m_flScreenShotTime > 0 ) && ( m_flScreenShotTime < gpGlobals->curtime ) ) { if ( !IsX360() ) { engine->ClientCmd( "screenshot" ); } m_flScreenShotTime = -1; } }