//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFMinigun::WindDown( void ) { // Get the player owning the weapon. CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() ); if ( !pPlayer ) return; SendWeaponAnim( ACT_MP_ATTACK_STAND_POSTFIRE ); // Set the appropriate firing state. m_iWeaponState = AC_STATE_IDLE; pPlayer->m_Shared.RemoveCond( TF_COND_AIMING ); #ifdef CLIENT_DLL WeaponSoundUpdate(); #else pPlayer->ClearWeaponFireScene(); #endif // Time to weapon idle. m_flTimeWeaponIdle = gpGlobals->curtime + 2.0; // Update player's speed pPlayer->TeamFortress_SetSpeed(); #ifdef CLIENT_DLL m_flBarrelTargetVelocity = 0; #endif }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFMinigun::SharedAttack() { CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() ); if ( !pPlayer ) return; if ( !CanAttack() ) { WeaponIdle(); return; } if ( pPlayer->m_nButtons & IN_ATTACK ) { m_iWeaponMode = TF_WEAPON_PRIMARY_MODE; } else if ( pPlayer->m_nButtons & IN_ATTACK2 ) { m_iWeaponMode = TF_WEAPON_SECONDARY_MODE; } switch ( m_iWeaponState ) { default: case AC_STATE_IDLE: { // Removed the need for cells to powerup the AC WindUp(); m_flNextPrimaryAttack = gpGlobals->curtime + 1.0; m_flNextSecondaryAttack = gpGlobals->curtime + 1.0; m_flTimeWeaponIdle = gpGlobals->curtime + 1.0; m_flStartedFiringAt = -1; pPlayer->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRE ); break; } case AC_STATE_STARTFIRING: { // Start playing the looping fire sound if ( m_flNextPrimaryAttack <= gpGlobals->curtime ) { if ( m_iWeaponMode == TF_WEAPON_SECONDARY_MODE ) { m_iWeaponState = AC_STATE_SPINNING; #ifdef GAME_DLL pPlayer->SpeakWeaponFire( MP_CONCEPT_WINDMINIGUN ); #endif } else { m_iWeaponState = AC_STATE_FIRING; #ifdef GAME_DLL pPlayer->SpeakWeaponFire( MP_CONCEPT_FIREMINIGUN ); #endif } m_flNextSecondaryAttack = m_flNextPrimaryAttack = m_flTimeWeaponIdle = gpGlobals->curtime + 0.1; } break; } case AC_STATE_FIRING: { if ( m_iWeaponMode == TF_WEAPON_SECONDARY_MODE ) { #ifdef GAME_DLL pPlayer->ClearWeaponFireScene(); pPlayer->SpeakWeaponFire( MP_CONCEPT_WINDMINIGUN ); #endif m_iWeaponState = AC_STATE_SPINNING; m_flNextSecondaryAttack = m_flNextPrimaryAttack = m_flTimeWeaponIdle = gpGlobals->curtime + 0.1; } else if ( pPlayer->GetAmmoCount(m_iPrimaryAmmoType) <= 0 ) { m_iWeaponState = AC_STATE_DRYFIRE; } else { if ( m_flStartedFiringAt < 0 ) { m_flStartedFiringAt = gpGlobals->curtime; } #ifdef GAME_DLL if ( m_flNextFiringSpeech < gpGlobals->curtime ) { m_flNextFiringSpeech = gpGlobals->curtime + 5.0; pPlayer->SpeakConceptIfAllowed( MP_CONCEPT_MINIGUN_FIREWEAPON ); } #endif // Only fire if we're actually shooting BaseClass::PrimaryAttack(); // fire and do timers CalcIsAttackCritical(); m_bCritShot = IsCurrentAttackACrit(); pPlayer->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY ); m_flTimeWeaponIdle = gpGlobals->curtime + 0.2; } break; } case AC_STATE_DRYFIRE: { m_flStartedFiringAt = -1; if ( pPlayer->GetAmmoCount(m_iPrimaryAmmoType) > 0 ) { m_iWeaponState = AC_STATE_FIRING; } else if ( m_iWeaponMode == TF_WEAPON_SECONDARY_MODE ) { m_iWeaponState = AC_STATE_SPINNING; } SendWeaponAnim( ACT_VM_SECONDARYATTACK ); break; } case AC_STATE_SPINNING: { m_flStartedFiringAt = -1; if ( m_iWeaponMode == TF_WEAPON_PRIMARY_MODE ) { if ( pPlayer->GetAmmoCount(m_iPrimaryAmmoType) > 0 ) { #ifdef GAME_DLL pPlayer->ClearWeaponFireScene(); pPlayer->SpeakWeaponFire( MP_CONCEPT_FIREMINIGUN ); #endif m_iWeaponState = AC_STATE_FIRING; } else { m_iWeaponState = AC_STATE_DRYFIRE; } } SendWeaponAnim( ACT_VM_SECONDARYATTACK ); break; } } }