//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CWeaponShieldGrenade::PrimaryAttack( void ) { CBasePlayer *pPlayer = dynamic_cast<CBasePlayer*>( GetOwner() ); if ( !pPlayer ) return; if ( !ComputeEMPFireState() ) return; if ( !GetPrimaryAmmo() ) return; // player "shoot" animation PlayAttackAnimation( ACT_VM_THROW ); ThrowGrenade(); // Setup for refire m_flNextPrimaryAttack = gpGlobals->curtime + 1.0; CheckRemoveDisguise(); // If I'm now out of ammo, switch away if ( !HasPrimaryAmmo() ) { g_pGameRules->GetNextBestWeapon( pPlayer, NULL ); } }
//----------------------------------------------------------------------------- // Purpose: Draw the ammo counts //----------------------------------------------------------------------------- void CWeaponCombatShield::DrawAmmo( void ) { // ROBIN: Removed this now that the shield colors itself to show health level return; int r, g, b, a; int x, y; // Get the shield power level float flPowerLevel = GetShieldHealth(); float flInverseFactor = 1.0 - flPowerLevel; // Set our color gHUD.m_clrNormal.GetColor( r, g, b, a ); int iWidth = XRES(12); int iHeight = YRES(64); x = XRES(548); y = ( ScreenHeight() - YRES(2) - iHeight ); // Flashing the power level? float flFlash = 0; if ( gpGlobals->curtime < m_flFlashTimeEnd && !GetPrimaryAmmo() ) { flFlash = fmod( gpGlobals->curtime, 0.25 ); flFlash *= 2 * M_PI; flFlash = cos( flFlash ); } // draw the exhausted portion of the bar. vgui::surface()->DrawSetColor( Color( r, g * flPowerLevel, b * flPowerLevel, 100 + (flFlash * 100) ) ); vgui::surface()->DrawFilledRect( x, y, x + iWidth, y + iHeight * flInverseFactor ); // draw the powerered portion of the bar vgui::surface()->DrawSetColor( Color( r, g * flPowerLevel, b * flPowerLevel, 190 ) ); vgui::surface()->DrawFilledRect( x, y + iHeight * flInverseFactor, x + iWidth, y + iHeight * flInverseFactor + iHeight * flPowerLevel); }