Skip to content

Commit

Permalink
Fixed #28
Browse files Browse the repository at this point in the history
This reverts asssault cannon changes from commit 55c8827 which causes #28 .
  • Loading branch information
YoYo178 committed May 25, 2024
1 parent 48ab739 commit fc39603
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
80 changes: 40 additions & 40 deletions mp/src/game/shared/ff/weapons/ff_weapon_assaultcannon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ CFFWeaponAssaultCannon::CFFWeaponAssaultCannon()
m_flBarrelRotationStopTimer = 0.0f;
#ifdef CLIENT_DLL
m_sndBarrelRotation = NULL;
//m_sndLoopShot = NULL;
m_sndLoopShot = NULL;
#endif
}

Expand All @@ -186,7 +186,7 @@ CFFWeaponAssaultCannon::~CFFWeaponAssaultCannon()
#ifdef CLIENT_DLL

StopBarrelRotationSound();
//StopLoopShotSound();
StopLoopShotSound();

#endif
}
Expand Down Expand Up @@ -234,7 +234,7 @@ bool CFFWeaponAssaultCannon::Holster(CBaseCombatWeapon *pSwitchingTo)

#ifdef CLIENT_DLL
StopBarrelRotationSound();
//StopLoopShotSound();
StopLoopShotSound();
#endif

//m_fFireState = 0;
Expand Down Expand Up @@ -268,7 +268,7 @@ void CFFWeaponAssaultCannon::Drop( const Vector& vecVelocity )

#ifdef CLIENT_DLL
StopBarrelRotationSound();
//StopLoopShotSound();
StopLoopShotSound();
#endif

return BaseClass::Drop( vecVelocity );
Expand Down Expand Up @@ -506,7 +506,7 @@ void CFFWeaponAssaultCannon::ItemPostFrame()

#ifdef CLIENT_DLL
StopBarrelRotationSound();
//StopLoopShotSound();
StopLoopShotSound();
#endif

HandleFireOnEmpty();
Expand Down Expand Up @@ -554,7 +554,7 @@ void CFFWeaponAssaultCannon::ItemPostFrame()

#ifdef CLIENT_DLL
StopBarrelRotationSound();
//StopLoopShotSound();
StopLoopShotSound();
#endif

#ifdef GAME_DLL
Expand Down Expand Up @@ -589,7 +589,7 @@ void CFFWeaponAssaultCannon::ItemPostFrame()
void CFFWeaponAssaultCannon::Precache()
{
PrecacheScriptSound("Assaultcannon.single_shot");
//PrecacheScriptSound("Assaultcannon.loop_shot");
PrecacheScriptSound("Assaultcannon.loop_shot");
PrecacheScriptSound("Assaultcannon.Windup");
PrecacheScriptSound("Assaultcannon.Winddown");
PrecacheScriptSound("assaultcannon.rotate");
Expand Down Expand Up @@ -741,16 +741,16 @@ void CFFWeaponAssaultCannon::StopBarrelRotationSound()
}

// stop the spinning sound
//void CFFWeaponAssaultCannon::StopLoopShotSound()
//{
// if (m_sndLoopShot)
// {
// // fade and die
// //CSoundEnvelopeController::GetController().SoundFadeOut( m_sndLoopShot, 0.05f, true );
// CSoundEnvelopeController::GetController().SoundDestroy(m_sndLoopShot);
// m_sndLoopShot = NULL;
// }
//}
void CFFWeaponAssaultCannon::StopLoopShotSound()
{
if (m_sndLoopShot)
{
// fade and die
//CSoundEnvelopeController::GetController().SoundFadeOut( m_sndLoopShot, 0.05f, true );
CSoundEnvelopeController::GetController().SoundDestroy(m_sndLoopShot);
m_sndLoopShot = NULL;
}
}
#endif
//-----------------------------------------------------------------------------
// Purpose: Keep the barrels spinning
Expand Down Expand Up @@ -824,29 +824,29 @@ void CFFWeaponAssaultCannon::UpdateBarrelRotation()
CSoundEnvelopeController::GetController().SoundChangePitch( m_sndBarrelRotation, flPitch, 0.05f );
}

//if (m_bFiring)
//{
// float flVolume = FLerp( FF_AC_LOOPSHOTSOUND_VOLUME_LOW, FF_AC_LOOPSHOTSOUND_VOLUME_HIGH, flPercent );
// float flPitch = FLerp( FF_AC_LOOPSHOTSOUND_PITCH_LOW, FF_AC_LOOPSHOTSOUND_PITCH_HIGH, flPercent );
//
// // also setup and play the loop shot sound if it's not setup yet
// if (!m_sndLoopShot)
// {
// CPASAttenuationFilter filter( this );
// m_sndLoopShot = (CSoundEnvelopeController::GetController()).SoundCreate( filter, entindex(), "assaultcannon.loop_shot" );
// CSoundEnvelopeController::GetController().Play( m_sndLoopShot, flVolume, flPitch );
// }
// // modify the spinning sound if it exists
// else
// {
// CSoundEnvelopeController::GetController().SoundChangeVolume( m_sndLoopShot, flVolume, 0.05f );
// CSoundEnvelopeController::GetController().SoundChangePitch( m_sndLoopShot, flPitch, 0.05f );
// }
//}
//else
//{
// StopLoopShotSound();
//}
if (m_bFiring)
{
float flVolume = FLerp( FF_AC_LOOPSHOTSOUND_VOLUME_LOW, FF_AC_LOOPSHOTSOUND_VOLUME_HIGH, flPercent );
float flPitch = FLerp( FF_AC_LOOPSHOTSOUND_PITCH_LOW, FF_AC_LOOPSHOTSOUND_PITCH_HIGH, flPercent );

// also setup and play the loop shot sound if it's not setup yet
if (!m_sndLoopShot)
{
CPASAttenuationFilter filter( this );
m_sndLoopShot = (CSoundEnvelopeController::GetController()).SoundCreate( filter, entindex(), "assaultcannon.loop_shot" );
CSoundEnvelopeController::GetController().Play( m_sndLoopShot, flVolume, flPitch );
}
// modify the spinning sound if it exists
else
{
CSoundEnvelopeController::GetController().SoundChangeVolume( m_sndLoopShot, flVolume, 0.05f );
CSoundEnvelopeController::GetController().SoundChangePitch( m_sndLoopShot, flPitch, 0.05f );
}
}
else
{
StopLoopShotSound();
}
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions mp/src/game/shared/ff/weapons/ff_weapon_assaultcannon.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class CFFWeaponAssaultCannon : public CFFWeaponBase
void StopBarrelRotationSound();
CSoundPatch *m_sndBarrelRotation;

//void StopLoopShotSound();
//CSoundPatch *m_sndLoopShot;
void StopLoopShotSound();
CSoundPatch *m_sndLoopShot;

#endif

Expand Down

0 comments on commit fc39603

Please sign in to comment.