2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 09:57:21 +01:00

Stop gauss pulse sound on overcharge

This commit is contained in:
Roman Chistokhodov 2019-07-30 20:08:50 +03:00
parent fa50aeeb0c
commit 3e1e8961bf
2 changed files with 12 additions and 2 deletions

View File

@ -815,6 +815,7 @@ void EV_FirePython( event_args_t *args )
//======================
// GAUSS START
//======================
#define SND_STOP (1 << 5)
#define SND_CHANGE_PITCH (1 << 7) // duplicated in protocol.h change sound pitch
void EV_SpinGauss( event_args_t *args )
@ -835,6 +836,7 @@ void EV_SpinGauss( event_args_t *args )
pitch = args->iparam1;
iSoundState = args->bparam1 ? SND_CHANGE_PITCH : 0;
iSoundState = args->bparam2 ? SND_STOP : iSoundState;
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "ambience/pulsemachine.wav", 1.0, ATTN_NORM, iSoundState, pitch );
}

View File

@ -278,19 +278,27 @@ void CGauss::SecondaryAttack()
// ALERT( at_console, "%d %d %d\n", m_fInAttack, m_iSoundState, pitch );
const bool overcharge = m_pPlayer->m_flStartCharge < gpGlobals->time - 10.0f;
if( m_iSoundState == 0 )
ALERT( at_console, "sound state %d\n", m_iSoundState );
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, pitch, 0, ( m_iSoundState == SND_CHANGE_PITCH ) ? 1 : 0, 0 );
#ifdef GAUSS_OVERCHARGE_FIX
if (!overcharge)
#endif
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, pitch, 0, ( m_iSoundState == SND_CHANGE_PITCH ) ? 1 : 0, 0 );
m_iSoundState = SND_CHANGE_PITCH; // hack for going through level transitions
m_pPlayer->m_iWeaponVolume = GAUSS_PRIMARY_CHARGE_VOLUME;
// m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.1f;
if( m_pPlayer->m_flStartCharge < gpGlobals->time - 10.0f )
if( overcharge )
{
// Player charged up too long. Zap him.
#ifdef GAUSS_OVERCHARGE_FIX
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, pitch, 0, 0, 1 );
#endif
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro4.wav", 1.0f, ATTN_NORM, 0, 80 + RANDOM_LONG( 0, 0x3f ) );
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/electro6.wav", 1.0f, ATTN_NORM, 0, 75 + RANDOM_LONG( 0, 0x3f ) );