void C_ASW_TeslaTrap::CustomPaint(int ix, int iy, int alpha, vgui::Panel *pUseIcon) { if ( !m_bAssembled ) return; if (C_ASW_Sentry_Base::s_hAmmoFont == vgui::INVALID_FONT) { vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFile("resource/SwarmSchemeNew.res", "SwarmSchemeNew"); vgui::IScheme *pScheme = vgui::scheme()->GetIScheme(scheme); if (pScheme) C_ASW_Sentry_Base::s_hAmmoFont = vgui::scheme()->GetIScheme(scheme)->GetFont("DefaultSmall", true); } if (C_ASW_Sentry_Base::s_hAmmoFont == vgui::INVALID_FONT || alpha <= 0) return; int nAmmo = MAX( 0, GetAmmo() ); Color textColor( 255, 255, 255, 255 ); if ( nAmmo < 10 ) { textColor = Color( 255, 255, 0, 255 ); } if ( pUseIcon ) { CASW_HUD_Use_Icon *pUseIconPanel = static_cast<CASW_HUD_Use_Icon*>(pUseIcon); float flProgress = (float) nAmmo / (float) GetMaxAmmo(); char szCountText[64]; Q_snprintf( szCountText, sizeof( szCountText ), "%d", MAX( nAmmo, 0 ) ); pUseIconPanel->CustomPaintProgressBar( ix, iy, alpha / 255.0f, flProgress, szCountText, C_ASW_Sentry_Base::s_hAmmoFont, textColor, "#asw_ammo_label" ); } }
void C_ASW_Ammo_Drop::CustomPaint(int ix, int iy, int alpha, vgui::Panel *pUseIcon) { if (s_hAmmoFont == vgui::INVALID_FONT) { vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFile("resource/SwarmSchemeNew.res", "SwarmSchemeNew"); vgui::IScheme *pScheme = vgui::scheme()->GetIScheme(scheme); if (pScheme) s_hAmmoFont = vgui::scheme()->GetIScheme(scheme)->GetFont("DefaultSmall", true); } if (s_hAmmoFont == vgui::INVALID_FONT || alpha <= 0) return; Color textColor( 255, 255, 255, 255 ); if ( pUseIcon ) { CASW_HUD_Use_Icon *pUseIconPanel = static_cast<CASW_HUD_Use_Icon*>(pUseIcon); float flProgress = (float) GetAmmoUnitsRemaining() / 100.0f; char szCountText[64]; Q_snprintf( szCountText, sizeof( szCountText ), "%d%%", MAX( GetAmmoUnitsRemaining(), 0 ) ); pUseIconPanel->CustomPaintProgressBar( ix, iy, alpha / 255.0f, flProgress, szCountText, s_hAmmoFont, textColor, "#asw_ammo_label" ); } }