mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Added new options:
- ENABLE_TA enables fire ambient sound - VOLUME_TA controls fire ambient sound volume Fire ambient sound is played in a loop when there is active fire effect on screen. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8738 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -932,6 +932,8 @@ void LoadGameExternalOptions()
|
|||||||
|
|
||||||
gGameExternalOptions.guiWeaponSoundEffectsVolume = iniReader.ReadInteger("Sound Settings","WEAPON_SOUND_EFFECTS_VOLUME", 0, 0, 1000 /*1000 = 10x?*/);
|
gGameExternalOptions.guiWeaponSoundEffectsVolume = iniReader.ReadInteger("Sound Settings","WEAPON_SOUND_EFFECTS_VOLUME", 0, 0, 1000 /*1000 = 10x?*/);
|
||||||
gGameExternalOptions.gubMaxPercentNoiseSilencedSound = iniReader.ReadInteger("Sound Settings","MAX_PERCENT_NOISE_SILENCED_SOUND", 35, 0, 100 );
|
gGameExternalOptions.gubMaxPercentNoiseSilencedSound = iniReader.ReadInteger("Sound Settings","MAX_PERCENT_NOISE_SILENCED_SOUND", 35, 0, 100 );
|
||||||
|
gGameExternalOptions.fEnableTA = iniReader.ReadBoolean("Sound Settings", "ENABLE_TA", TRUE, false);
|
||||||
|
gGameExternalOptions.ubVolumeTA = iniReader.ReadInteger("Sound Settings", "VOLUME_TA", 50, 1, 127);
|
||||||
|
|
||||||
//################# Tactical Interface Settings #################
|
//################# Tactical Interface Settings #################
|
||||||
|
|
||||||
|
|||||||
@@ -465,6 +465,8 @@ typedef struct
|
|||||||
//Sound settings
|
//Sound settings
|
||||||
UINT32 guiWeaponSoundEffectsVolume;
|
UINT32 guiWeaponSoundEffectsVolume;
|
||||||
UINT8 gubMaxPercentNoiseSilencedSound;
|
UINT8 gubMaxPercentNoiseSilencedSound;
|
||||||
|
BOOLEAN fEnableTA;
|
||||||
|
UINT8 ubVolumeTA;
|
||||||
|
|
||||||
// WDS - Option to turn off stealing
|
// WDS - Option to turn off stealing
|
||||||
BOOLEAN fStealingDisabled;
|
BOOLEAN fStealingDisabled;
|
||||||
|
|||||||
@@ -12,12 +12,17 @@
|
|||||||
#include "Game Events.h"
|
#include "Game Events.h"
|
||||||
#include "Ambient Control.h"
|
#include "Ambient Control.h"
|
||||||
#include "lighting.h"
|
#include "lighting.h"
|
||||||
#include "Random.h"
|
#include "Random.h"
|
||||||
|
#include "SmokeEffects.h" // sevenfm
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AMBIENTDATA_STRUCT gAmbData[ MAX_AMBIENT_SOUNDS ];
|
AMBIENTDATA_STRUCT gAmbData[ MAX_AMBIENT_SOUNDS ];
|
||||||
INT16 gsNumAmbData = 0;
|
INT16 gsNumAmbData = 0;
|
||||||
|
|
||||||
|
// sevenfm
|
||||||
|
UINT32 guiAmbientFire = NO_SAMPLE;
|
||||||
|
UINT8 gubAmbientFutureFireVolume = 0;
|
||||||
|
UINT32 guiFireAmbientLastUpdate = 0;
|
||||||
|
|
||||||
UINT8 gubCurrentSteadyStateAmbience = SSA_NONE;
|
UINT8 gubCurrentSteadyStateAmbience = SSA_NONE;
|
||||||
UINT8 gubCurrentSteadyStateSound = 0;
|
UINT8 gubCurrentSteadyStateSound = 0;
|
||||||
@@ -310,3 +315,107 @@ BOOLEAN SetSteadyStateAmbience( UINT8 ubAmbience )
|
|||||||
|
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateFireAmbient(void)
|
||||||
|
{
|
||||||
|
INT32 iVolume;
|
||||||
|
UINT32 uiClock;
|
||||||
|
|
||||||
|
if (!gGameExternalOptions.fEnableTA)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guiCurrentScreen != GAME_SCREEN)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uiClock = GetJA2Clock();
|
||||||
|
|
||||||
|
if (uiClock - guiFireAmbientLastUpdate < 50)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
guiFireAmbientLastUpdate = uiClock;
|
||||||
|
|
||||||
|
if (FindVisibleSmokeEffect(BURNABLEGAS_SMOKE_EFFECT))
|
||||||
|
{
|
||||||
|
gubAmbientFutureFireVolume = gGameExternalOptions.ubVolumeTA;
|
||||||
|
|
||||||
|
if (guiAmbientFire == NO_SAMPLE)
|
||||||
|
{
|
||||||
|
StartFireAmbient();
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if successfully started
|
||||||
|
if (guiAmbientFire != NO_SAMPLE)
|
||||||
|
{
|
||||||
|
iVolume = SoundGetVolume(guiAmbientFire);
|
||||||
|
|
||||||
|
if (iVolume != gubAmbientFutureFireVolume)
|
||||||
|
{
|
||||||
|
// increase volume until it reaches desired level
|
||||||
|
iVolume = min((INT32)gubAmbientFutureFireVolume, iVolume + 4);
|
||||||
|
SoundSetVolume(guiAmbientFire, iVolume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gubAmbientFutureFireVolume = 0;
|
||||||
|
|
||||||
|
// check if ambient sound is playing
|
||||||
|
if (guiAmbientFire != NO_SAMPLE)
|
||||||
|
{
|
||||||
|
iVolume = SoundGetVolume(guiAmbientFire);
|
||||||
|
|
||||||
|
if (iVolume != gubAmbientFutureFireVolume)
|
||||||
|
{
|
||||||
|
// increase volume until it reaches desired level
|
||||||
|
iVolume = max((INT32)gubAmbientFutureFireVolume, iVolume - 4);
|
||||||
|
SoundSetVolume(guiAmbientFire, iVolume);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iVolume == 0)
|
||||||
|
{
|
||||||
|
StopFireAmbient();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void StopFireAmbient(void)
|
||||||
|
{
|
||||||
|
if (guiAmbientFire != NO_SAMPLE)
|
||||||
|
{
|
||||||
|
SoundStop(guiAmbientFire);
|
||||||
|
guiAmbientFire = NO_SAMPLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartFireAmbient(void)
|
||||||
|
{
|
||||||
|
CHAR8 filename[1024];
|
||||||
|
SOUNDPARMS spParms;
|
||||||
|
|
||||||
|
// Stop ambient
|
||||||
|
if (guiAmbientFire != NO_SAMPLE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(filename, "Sounds\\ambient\\fire.ogg");
|
||||||
|
//gubAmbientFireVolume = LOWVOLUME;
|
||||||
|
|
||||||
|
// start sound
|
||||||
|
memset(&spParms, 0xff, sizeof(SOUNDPARMS));
|
||||||
|
//spParms.uiVolume = CalculateSoundEffectsVolume( LOWVOLUME );
|
||||||
|
spParms.uiVolume = 0;
|
||||||
|
spParms.uiLoop = 0;
|
||||||
|
spParms.uiPriority = GROUP_AMBIENT;
|
||||||
|
|
||||||
|
//guiAmbientFire = SoundPlay( zFileName, &spParms );
|
||||||
|
guiAmbientFire = SoundPlayStreamedFile(filename, &spParms);
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ extern INT16 gsNumAmbData;
|
|||||||
|
|
||||||
BOOLEAN SetSteadyStateAmbience( UINT8 ubAmbience );
|
BOOLEAN SetSteadyStateAmbience( UINT8 ubAmbience );
|
||||||
|
|
||||||
|
void UpdateFireAmbient(void);
|
||||||
|
void StopFireAmbient(void);
|
||||||
|
void StartFireAmbient(void);
|
||||||
|
|
||||||
#define SOUND_NAME_SIZE 256
|
#define SOUND_NAME_SIZE 256
|
||||||
#define NUM_SOUNDS_PER_TIMEFRAME 8
|
#define NUM_SOUNDS_PER_TIMEFRAME 8
|
||||||
|
|||||||
@@ -1063,3 +1063,30 @@ BOOL GetRandomSignalSmokeGridNo(INT32* psGridNo)
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN FindVisibleSmokeEffect(INT8 bType)
|
||||||
|
{
|
||||||
|
UINT32 uiCnt;
|
||||||
|
INT8 bSmokeEffectLevel;
|
||||||
|
|
||||||
|
//loop through all smoke effects
|
||||||
|
for (uiCnt = 0; uiCnt < guiNumSmokeEffects; uiCnt++)
|
||||||
|
{
|
||||||
|
if (gSmokeEffectData[uiCnt].fAllocated &&
|
||||||
|
gSmokeEffectData[uiCnt].bType == bType)
|
||||||
|
{
|
||||||
|
if (gSmokeEffectData[uiCnt].bFlags & SMOKE_EFFECT_ON_ROOF)
|
||||||
|
bSmokeEffectLevel = 1;
|
||||||
|
else
|
||||||
|
bSmokeEffectLevel = 0;
|
||||||
|
|
||||||
|
if (!TileIsOutOfBounds(gSmokeEffectData[uiCnt].sGridNo) &&
|
||||||
|
GridNoOnScreen(gSmokeEffectData[uiCnt].sGridNo))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|||||||
@@ -73,4 +73,7 @@ void UpdateSmokeEffectGraphics( );
|
|||||||
// Flugente: get the gridno and blevel of a random smoke signal, if one exists
|
// Flugente: get the gridno and blevel of a random smoke signal, if one exists
|
||||||
BOOL GetRandomSignalSmokeGridNo(INT32* psGridNo);
|
BOOL GetRandomSignalSmokeGridNo(INT32* psGridNo);
|
||||||
|
|
||||||
|
// find smoke effect on visible screen
|
||||||
|
BOOLEAN FindVisibleSmokeEffect(INT8 bType);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+14
-1
@@ -30,7 +30,8 @@
|
|||||||
#include "Tactical Placement GUI.h"//dnl ch45 071009
|
#include "Tactical Placement GUI.h"//dnl ch45 071009
|
||||||
#include "Map Screen Interface Map Inventory.h"//dnl ch51 081009
|
#include "Map Screen Interface Map Inventory.h"//dnl ch51 081009
|
||||||
#include "World Items.h"//dnl ch77 191113
|
#include "World Items.h"//dnl ch77 191113
|
||||||
#include "Overhead.h" // added by Flugente
|
#include "Overhead.h" // added by Flugente
|
||||||
|
#include "Ambient Control.h" // sevenfm
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "SaveLoadScreen.h"
|
#include "SaveLoadScreen.h"
|
||||||
@@ -409,6 +410,12 @@ void GameLoop(void)
|
|||||||
// rain
|
// rain
|
||||||
RenderRain();
|
RenderRain();
|
||||||
|
|
||||||
|
// sevenfm: update tactical ambients
|
||||||
|
if (guiCurrentScreen == GAME_SCREEN)
|
||||||
|
{
|
||||||
|
UpdateFireAmbient();
|
||||||
|
}
|
||||||
|
|
||||||
// Flugente: dynamic opinions: Dialogue Boxes need to be refreshed
|
// Flugente: dynamic opinions: Dialogue Boxes need to be refreshed
|
||||||
RefreshBoxes( );
|
RefreshBoxes( );
|
||||||
|
|
||||||
@@ -533,6 +540,12 @@ void HandleNewScreenChange( UINT32 uiNewScreen, UINT32 uiOldScreen )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end rain
|
// end rain
|
||||||
|
|
||||||
|
if (uiNewScreen != MSG_BOX_SCREEN)
|
||||||
|
{
|
||||||
|
// stop ambients
|
||||||
|
StopFireAmbient();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleShortCutExitState( void )
|
void HandleShortCutExitState( void )
|
||||||
|
|||||||
Reference in New Issue
Block a user