//----------------------------------------------------------------------------- // Purpose: returns true if the weapon selection hud should be hidden because // the CHudMenu is open //----------------------------------------------------------------------------- bool CBaseHudWeaponSelection::IsHudMenuPreventingWeaponSelection() { // Don't allow weapon selection if we're frozen in place C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer(); if ( pPlayer->GetFlags() & FL_FROZEN || pPlayer->IsPlayerDead() ) return true; return IsHudMenuTakingInput(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBaseHudWeaponSelection::OnThink( void ) { // Don't allow weapon selection if we're frozen in place C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer(); if ( pPlayer->GetFlags() & FL_FROZEN || pPlayer->IsPlayerDead() ) { if ( IsInSelectionMode() ) { CancelWeaponSelection(); } } }
void CVoiceStatus::DrawHeadLabels() { if ( m_bHeadLabelsDisabled ) return; if( !m_pHeadLabelMaterial ) return; CMatRenderContextPtr pRenderContext( materials ); for(int i=0; i < VOICE_MAX_PLAYERS; i++) { if ( !m_VoicePlayers[i] ) continue; IClientNetworkable *pClient = cl_entitylist->GetClientEntity( i+1 ); // Don't show an icon if the player is not in our PVS. if ( !pClient || pClient->IsDormant() ) continue; C_BasePlayer *pPlayer = dynamic_cast<C_BasePlayer*>(pClient); if( !pPlayer ) continue; // Don't show an icon for dead or spectating players (ie: invisible entities). if( pPlayer->IsPlayerDead() ) continue; // Place it 20 units above his head. Vector vOrigin = pPlayer->WorldSpaceCenter(); vOrigin.z += g_flHeadOffset; // Align it so it never points up or down. Vector vUp( 0, 0, 1 ); Vector vRight = CurrentViewRight(); if ( fabs( vRight.z ) > 0.95 ) // don't draw it edge-on continue; vRight.z = 0; VectorNormalize( vRight ); float flSize = g_flHeadIconSize; pRenderContext->Bind( pPlayer->GetHeadLabelMaterial() ); IMesh *pMesh = pRenderContext->GetDynamicMesh(); CMeshBuilder meshBuilder; meshBuilder.Begin( pMesh, MATERIAL_QUADS, 1 ); meshBuilder.Color3f( 1.0, 1.0, 1.0 ); meshBuilder.TexCoord2f( 0,0,0 ); meshBuilder.Position3fv( (vOrigin + (vRight * -flSize) + (vUp * flSize)).Base() ); meshBuilder.AdvanceVertex(); meshBuilder.Color3f( 1.0, 1.0, 1.0 ); meshBuilder.TexCoord2f( 0,1,0 ); meshBuilder.Position3fv( (vOrigin + (vRight * flSize) + (vUp * flSize)).Base() ); meshBuilder.AdvanceVertex(); meshBuilder.Color3f( 1.0, 1.0, 1.0 ); meshBuilder.TexCoord2f( 0,1,1 ); meshBuilder.Position3fv( (vOrigin + (vRight * flSize) + (vUp * -flSize)).Base() ); meshBuilder.AdvanceVertex(); meshBuilder.Color3f( 1.0, 1.0, 1.0 ); meshBuilder.TexCoord2f( 0,0,1 ); meshBuilder.Position3fv( (vOrigin + (vRight * -flSize) + (vUp * -flSize)).Base() ); meshBuilder.AdvanceVertex(); meshBuilder.End(); pMesh->Draw(); } }