diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 0767119d..2a4fc5b3 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -918,7 +918,7 @@ void HandleAddingPowerGenFanSound() sGridNo = POWERGENFANSOUND_GRIDNO2; //Create the new ambient fan sound - //gJa25SaveStruct.iPowerGenFanPositionSndID = NewPositionSnd( sGridNo, POSITION_SOUND_STATIONATY_OBJECT, 0, POWER_GEN_FAN_SOUND ); + gJa25SaveStruct.iPowerGenFanPositionSndID = NewPositionSnd( sGridNo, POSITION_SOUND_STATIONATY_OBJECT, 0, POWER_GEN_FAN_SOUND, 30 ); SetPositionSndsInActive( ); SetPositionSndsActive( ); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index b80c9585..f9bdabce 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -2445,7 +2445,7 @@ BOOLEAN SOLDIERTYPE::CreateSoldierCommon( UINT8 ubBodyType, UINT16 usSoldierID, if ( this->ubBodyType == QUEENMONSTER ) { - this->iPositionSndID = NewPositionSnd( NOWHERE, POSITION_SOUND_FROM_SOLDIER, (UINT32)this, QUEEN_AMBIENT_NOISE ); + this->iPositionSndID = NewPositionSnd( NOWHERE, POSITION_SOUND_FROM_SOLDIER, (UINT32)this, QUEEN_AMBIENT_NOISE, 15 ); } diff --git a/Utils/Sound Control.cpp b/Utils/Sound Control.cpp index 2598dc28..af8946bf 100644 --- a/Utils/Sound Control.cpp +++ b/Utils/Sound Control.cpp @@ -774,6 +774,7 @@ typedef struct UINT32 uiData; BOOLEAN fAllocated; BOOLEAN fInActive; + UINT8 volume; } POSITIONSND; @@ -820,7 +821,7 @@ void RecountPositionSnds( void ) } -INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay ) +INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay, UINT8 volume ) { POSITIONSND *pPositionSnd; INT32 iPositionSndIndex; @@ -849,6 +850,7 @@ INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoun pPositionSnd->uiFlags = uiFlags; pPositionSnd->fAllocated = TRUE; pPositionSnd->iSoundToPlay = iSoundToPlay; + pPositionSnd->volume = volume; pPositionSnd->iSoundSampleID = NO_SAMPLE; @@ -892,7 +894,7 @@ void SetPositionSndGridNo( INT32 iPositionSndIndex, INT32 sGridNo ) } } -void SetPositionSndsActive( ) +void SetPositionSndsActive() { UINT32 cnt; POSITIONSND *pPositionSnd; @@ -901,20 +903,27 @@ void SetPositionSndsActive( ) for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) { - pPositionSnd = &gPositionSndData[ cnt ]; + pPositionSnd = &gPositionSndData[cnt]; - if ( pPositionSnd->fAllocated ) - { - if ( pPositionSnd->fInActive ) + if ( pPositionSnd->fAllocated ) { - pPositionSnd->fInActive = FALSE; + if ( pPositionSnd->fInActive ) + { + pPositionSnd->fInActive = FALSE; - // Begin sound effect - // Volume 0 - pPositionSnd->iSoundSampleID = PlayJA2Sample( pPositionSnd->iSoundToPlay, RATE_11025, 0, 0, MIDDLEPAN ); + // Begin sound effect + // Volume 0 + if ( pPositionSnd->iSoundToPlay == POWER_GEN_FAN_SOUND ) + { + pPositionSnd->iSoundSampleID = PlayJA2SampleFromFile( "Sounds\\POWERGENFAN.WAV", RATE_11025, 0, 0, MIDDLEPAN); + } + else + { + pPositionSnd->iSoundSampleID = PlayJA2Sample( pPositionSnd->iSoundToPlay, RATE_11025, 0, 0, MIDDLEPAN ); + } + } } } - } } @@ -1068,7 +1077,7 @@ void SetPositionSndsVolumeAndPanning( ) { if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) { - bVolume = PositionSoundVolume( 15, pPositionSnd->sGridNo ); + bVolume = PositionSoundVolume( pPositionSnd->volume, pPositionSnd->sGridNo ); if ( pPositionSnd->uiFlags & POSITION_SOUND_FROM_SOLDIER ) { diff --git a/Utils/Sound Control.h b/Utils/Sound Control.h index 656be5ce..e351c783 100644 --- a/Utils/Sound Control.h +++ b/Utils/Sound Control.h @@ -379,7 +379,9 @@ enum SoundDefines S_VAL, //BREAK_LIGHT_IGNITING, - NUM_SAMPLES + NUM_SAMPLES, + POWER_GEN_FAN_SOUND = 5001 // This is a workaround to get the generator fan positional sound working in UB campaign. + // Had to special case it because sound effects have been externalized. }; enum AmbientDefines @@ -453,7 +455,7 @@ void PlayDelayedJA2Sample( UINT32 uiDelay, UINT32 usNum, UINT32 usRate, UINT32 u #define POSITION_SOUND_FROM_SOLDIER 0x00000001 #define POSITION_SOUND_STATIONATY_OBJECT 0x00000002 -INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay ); +INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay, UINT8 volume ); void DeletePositionSnd( INT32 iPositionSndIndex ); void SetPositionSndsActive( ); void SetPositionSndsInActive( );