void CASWHud3DMarineNames::PaintBoxesAroundUseEntities() { C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer(); if ( !pPlayer || !pPlayer->GetMarine() || pPlayer->GetMarine()->GetHealth() <= 0 ) return; C_BaseEntity *pEnt = NULL; if ( pPlayer->GetNumUseEntities() > 0 ) { pEnt = pPlayer->GetUseEntity(); if ( !pEnt ) { pEnt = pPlayer->GetUseEntity( 0 ); } IASW_Client_Usable_Entity* pUsable = dynamic_cast< IASW_Client_Usable_Entity* >( pEnt ); if ( !pUsable || !pUsable->ShouldPaintBoxAround() ) { pEnt = NULL; } } if ( pEnt ) { C_ASW_Use_Area *pArea = dynamic_cast< C_ASW_Use_Area* >( pEnt ); if ( pArea ) { if ( pArea->GetGlowEntity() ) { ASWInput()->SetUseGlowEntity( pArea->GetGlowEntity() ); } else { PaintBoxAround( pEnt, 6 ); } } else { ASWInput()->SetUseGlowEntity( pEnt ); } } else { ASWInput()->SetUseGlowEntity( NULL ); } }
void CASWHudUseArea::Paint() { VPROF_BUDGET( "CASWHudUseArea::Paint", VPROF_BUDGETGROUP_ASW_CLIENT ); GetSize(m_iFrameWidth,m_iFrameHeight); m_iFrameWidth = ScreenWidth(); BaseClass::Paint(); C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer(); if (!pPlayer) return; C_ASW_Marine *pMarine = pPlayer->GetMarine(); if (!pMarine) return; int r, g, b; r = g = b = 255; if (asw_debug_hud.GetBool()) { char cbuffer[20]; Q_snprintf(cbuffer, sizeof(cbuffer), "Usable = %d", pPlayer->m_iUseEntities); g_pMatSystemSurface->DrawColoredText(m_hUseAreaFont, 0, 0, r, g, b, 200, &cbuffer[0]); } for (int k=0; k<3; k++) { pPlayer->UseIconTarget[k] = NULL; } m_iNumUseIcons = 0; pPlayer->FindUseEntities(); // don't add any icons if our marine is dead if (!pPlayer->GetMarine() || !pPlayer->GetMarine()->IsAlive()) { pPlayer->UseIconTarget[0] = NULL; if (m_pUseIcon) m_pUseIcon->ClearUseAction(); return; } int iNumToDraw = MIN(1, pPlayer->m_iUseEntities); int iDrew = 0; for (int i=0; i<iNumToDraw; i++) { if (AddUseIconsFor(pPlayer->GetUseEntity(i))) iDrew++; if (asw_debug_hud.GetBool()) { char buffer[20]; C_BaseEntity *pEnt = pPlayer->GetUseEntity(i); Q_snprintf(buffer, sizeof(buffer), "Use:%d", pEnt->entindex()); //int wide = g_pMatSystemSurface->DrawTextLen(m_hUseAreaFont, &buffer[0]); int tall = vgui::surface()->GetFontTall( m_hUseAreaFont ); float xPos = 0; float yPos = (i+1) * tall; // actual text g_pMatSystemSurface->DrawColoredText(m_hUseAreaFont, xPos, yPos, r, g, b, 200, &buffer[0]); } } if (iDrew < 1) { if (m_pUseIcon) m_pUseIcon->ClearUseAction(); } }