void CLocalNetworkBackdoor::EntityDormant( int iEnt, int iSerialNum ) { CCachedEntState *pCached = &m_CachedEntState[iEnt]; IClientNetworkable *pNet = pCached->m_pNetworkable; Assert( pNet == entitylist->GetClientNetworkable( iEnt ) ); if ( pNet ) { Assert( pCached->m_iSerialNumber == pNet->GetIClientUnknown()->GetRefEHandle().GetSerialNumber() ); if ( pCached->m_iSerialNumber == iSerialNum ) { m_EntsAlive.Set( iEnt ); // Tell the game code that this guy is now dormant. Assert( pCached->m_bDormant == pNet->IsDormant() ); if ( !pCached->m_bDormant ) { pNet->NotifyShouldTransmit( SHOULDTRANSMIT_END ); pCached->m_bDormant = true; } } else { pNet->Release(); pCached->m_pNetworkable = NULL; m_PrevEntsAlive.Clear( iEnt ); } } }
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(); } }