Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Vanilla Modding » Does anyone know how the Steady State Ambience works?
Does anyone know how the Steady State Ambience works?[message #279345]
|
Thu, 05 May 2011 16:55
|
|
|
Can this be utilized or is it an inactive feature from the get go?
I tried plugging in some sounds, but have failed initially.
Report message to a moderator
|
|
|
|
Re: Does anyone know how the Steady State Ambience works?[message #280563]
|
Mon, 23 May 2011 20:08
|
|
|
So I take it that nobody knows anything about this?
Can someone who is familiar with the source confirm this please? I originally found it in the Night Ops Source, but I can almost guarantee that it exists in the Regular source.
Report message to a moderator
|
|
|
|
Re: Does anyone know how the Steady State Ambience works?[message #282138]
|
Fri, 03 June 2011 21:49
|
|
|
Anyone?
I feel like this could up the immersion level if we figure out how to get it working.
Report message to a moderator
|
|
|
|
Re: Does anyone know how the Steady State Ambience works?[message #282886]
|
Fri, 10 June 2011 00:41
|
|
|
God damn I wish someone would at least check this out to see if there is something of value.
The way I saw it was that, whenever close to a particular tile, the game would play ambience.
This is unlike the current set up where the owl, cricket, and bird ambience sounds play every once in a while.
For example:
When close to the water at the ocean, we could put in a waves crashing sound.
Please can someone check this out? I know there are a shit load of people who look at the code.
Thanks,
Report message to a moderator
|
|
|
|
|
Re: Does anyone know how the Steady State Ambience works?[message #282964]
|
Fri, 10 June 2011 14:13
|
|
|
I know how "Ambience" works. I want to know if it is possible to integrate an unused feature that is present in the source. It is called "Steady State Ambience".
Report message to a moderator
|
|
|
|
|
Re: Does anyone know how the Steady State Ambience works?[message #283007]
|
Fri, 10 June 2011 19:34
|
|
|
No. You took the words that I typed on the screen the wrong way. My tone was not of that nature at all.
Have you seen it? Has anyone else seen it?
Report message to a moderator
|
|
|
|
Re: Does anyone know how the Steady State Ambience works?[message #288146]
|
Tue, 02 August 2011 14:59
|
|
|
Someone look in the source for me.
Look up steady state ambience.
What do you make out of it?
Report message to a moderator
|
|
|
|
Re: Does anyone know how the Steady State Ambience works?[message #290649]
|
Tue, 13 September 2011 22:33
|
|
|
[font:Fixedsys][color:#006600]Code for Steady State Ambience[/color][/font]
Ambient Types
Toggle Spoiler#ifndef _AMBIENT_TYPES_H
#define _AMBIENT_TYPES_H
#define MAX_AMBIENT_SOUNDS 100
#define AMB_TOD_DAWN 0
#define AMB_TOD_DAY 1
#define AMB_TOD_DUSK 2
#define AMB_TOD_NIGHT 3
typedef struct
{
UINT32 uiMinTime;
UINT32 uiMaxTime;
UINT8 ubTimeCatagory;
SGPFILENAME zFilename;
UINT32 uiVol;
} AMBIENTDATA_STRUCT;
#endif
Ambienct Control .H
Toggle Spoiler#ifndef __AMBIENT_CONTROL
#define __AMBIENT_CONTROL
#include "sgp.h"
#include "Ambient types.h"
BOOLEAN LoadAmbientControlFile( UINT8 ubAmbientID );
void HandleNewSectorAmbience( UINT8 ubAmbientID );
UINT32 SetupNewAmbientSound( UINT32 uiAmbientID );
void StopAmbients( );
void DeleteAllAmbients();
extern AMBIENTDATA_STRUCT gAmbData[ MAX_AMBIENT_SOUNDS ];
extern INT16 gsNumAmbData;
BOOLEAN SetSteadyStateAmbience( UINT8 ubAmbience );
#define SOUND_NAME_SIZE 256
#define NUM_SOUNDS_PER_TIMEFRAME 8
enum
{
SSA_NONE,
SSA_COUNTRYSIZE,
SSA_NEAR_WATER,
SSA_IN_WATER,
SSA_HEAVY_FOREST,
SSA_PINE_FOREST,
SSA_ABANDONED,
SSA_AIRPORT,
SSA_WASTELAND,
SSA_UNDERGROUND,
SSA_OCEAN,
NUM_STEADY_STATE_AMBIENCES
};
typedef struct
{
CHAR8 zSoundNames[ NUM_SOUNDS_PER_TIMEFRAME ][ SOUND_NAME_SIZE ];
} STEADY_STATE_AMBIENCE;
#endif
Ambient Control .C
Toggle Spoiler#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
#include "stdio.h"
#include "sgp.h"
#include "Ambient types.h"
#include "fileman.h"
#include "environment.h"
#include "Sound Control.h"
#include "Game Events.h"
#endif
AMBIENTDATA_STRUCT gAmbData[ MAX_AMBIENT_SOUNDS ];
INT16 gsNumAmbData = 0;
UINT8 gubCurrentSteadyStateAmbience = SSA_NONE;
UINT8 gubCurrentSteadyStateSound = 0;
UINT32 guiCurrentSteadyStateSoundHandle = NO_SAMPLE;
STEADY_STATE_AMBIENCE gSteadyStateAmbientTable[ NUM_STEADY_STATE_AMBIENCES ] =
{
// NONE
"",
"",
"",
"",
// NIGHT
"",
"",
"",
"",
// COUNTRYSIZE
// DAY
"SOUNDS\\SSA\\insects Day 01.wav",
"",
"",
"",
// NIGHT
"SOUNDS\\SSA\
ight_crickets_01D.wav",
"SOUNDS\\SSA\
ight_crickets_01B.wav",
"SOUNDS\\SSA\
ight_crickets_01C.wav",
"SOUNDS\\SSA\
ight_crickets_01A.wav",
// NEAR WATER
// DAY
"SOUNDS\\SSA\\swamp_day_01a.wav",
"SOUNDS\\SSA\\swamp_day_01b.wav",
"SOUNDS\\SSA\\swamp_day_01c.wav",
"SOUNDS\\SSA\\swamp_day_01d.wav",
//NIGHT
"SOUNDS\\SSA\\marsh_at_night_01a.wav",
"SOUNDS\\SSA\\marsh_at_night_01b.wav",
"SOUNDS\\SSA\\marsh_at_night_01c.wav",
"SOUNDS\\SSA\\marsh_at_night_01d.wav",
//INWATER
//DAY
"SOUNDS\\SSA\\middle_of_water_01d.wav",
"SOUNDS\\SSA\\middle_of_water_01c.wav",
"SOUNDS\\SSA\\middle_of_water_01b.wav",
"SOUNDS\\SSA\\middle_of_water_01a.wav",
// night
"SOUNDS\\SSA\\middle_of_water_01d.wav",
"SOUNDS\\SSA\\middle_of_water_01c.wav",
"SOUNDS\\SSA\\middle_of_water_01b.wav",
"SOUNDS\\SSA\\middle_of_water_01a.wav",
// HEAVY FOREST
// day
"SOUNDS\\SSA\\JUNGLE_DAY_01a.wav",
"SOUNDS\\SSA\\JUNGLE_DAY_01b.wav",
"SOUNDS\\SSA\\JUNGLE_DAY_01c.wav",
"SOUNDS\\SSA\\JUNGLE_DAY_01d.wav",
// night
"SOUNDS\\SSA\
ight_crickets_03a.wav",
"SOUNDS\\SSA\
ight_crickets_03b.wav",
"SOUNDS\\SSA\
ight_crickets_03c.wav",
"SOUNDS\\SSA\
ight_crickets_03d.wav",
// PINE FOREST
// DAY
"SOUNDS\\SSA\\pine_forest_01a.wav",
"SOUNDS\\SSA\\pine_forest_01b.wav",
"SOUNDS\\SSA\\pine_forest_01c.wav",
"SOUNDS\\SSA\\pine_forest_01d.wav",
// NIGHT
"SOUNDS\\SSA\
ight_crickets_02a.wav",
"SOUNDS\\SSA\
ight_crickets_02b.wav",
"SOUNDS\\SSA\
ight_crickets_02c.wav",
"SOUNDS\\SSA\
ight_crickets_02d.wav",
// ABANDANDED
// DAY
"SOUNDS\\SSA\\metal_wind_01a.wav",
"SOUNDS\\SSA\\metal_wind_01b.wav",
"SOUNDS\\SSA\\metal_wind_01c.wav",
"SOUNDS\\SSA\\metal_wind_01d.wav",
// NIGHT
"SOUNDS\\SSA\
ight_insects_01a.wav",
"SOUNDS\\SSA\
ight_insects_01b.wav",
"SOUNDS\\SSA\
ight_insects_01c.wav",
"SOUNDS\\SSA\
ight_insects_01d.wav",
// AIRPORT
// DAY
"SOUNDS\\SSA\\rotating radar dish.wav",
"",
"",
"",
// NIGHT
"SOUNDS\\SSA\\rotating radar dish.wav",
"",
"",
"",
// WASTE LAND
// DAY
"SOUNDS\\SSA\\gentle_wind.wav",
"",
"",
"",
// NIGHT
"SOUNDS\\SSA\\insects_at_night_04.wav",
"",
"",
"",
// UNDERGROUND
// DAY
"SOUNDS\\SSA\\low ominous ambience.wav",
"",
"",
"",
// NIGHT
"SOUNDS\\SSA\\low ominous ambience.wav",
"",
"",
"",
// OCEAN
// DAY
"SOUNDS\\SSA\\sea_01a.wav",
"SOUNDS\\SSA\\sea_01b.wav",
"SOUNDS\\SSA\\sea_01c.wav",
"SOUNDS\\SSA\\sea_01d.wav",
// NIGHT
"SOUNDS\\SSA\\ocean_waves_01a.wav",
"SOUNDS\\SSA\\ocean_waves_01b.wav",
"SOUNDS\\SSA\\ocean_waves_01c.wav",
"SOUNDS\\SSA\\ocean_waves_01d.wav",
};
BOOLEAN LoadAmbientControlFile( UINT8 ubAmbientID )
{
SGPFILENAME zFilename;
HWFILE hFile;
INT32 cnt;
// BUILD FILENAME
sprintf( zFilename, "AMBIENT\\%d.bad", ubAmbientID );
// OPEN, LOAD
hFile = FileOpen( zFilename, FILE_ACCESS_READ, FALSE);
if ( !hFile )
{
return( FALSE );
}
// READ #
if( !FileRead( hFile, &gsNumAmbData, sizeof( INT16 ), NULL ) )
{
return( FALSE );
}
// LOOP FOR OTHERS
for ( cnt = 0; cnt < gsNumAmbData; cnt++ )
{
if( !FileRead( hFile, &(gAmbData[ cnt ]), sizeof( AMBIENTDATA_STRUCT ), NULL ) )
{
return( FALSE );
}
sprintf( zFilename, "AMBIENT\\%s", gAmbData[ cnt ].zFilename );
strcpy( gAmbData[ cnt ].zFilename, zFilename );
}
FileClose( hFile );
return( TRUE );
}
void GetAmbientDataPtr( AMBIENTDATA_STRUCT **ppAmbData, UINT16 *pusNumData )
{
*ppAmbData = gAmbData;
*pusNumData = gsNumAmbData;
}
void StopAmbients( )
{
SoundStopAllRandom( );
}
void HandleNewSectorAmbience( UINT8 ubAmbientID )
{
// OK, we could have just loaded a sector, erase all ambient sounds from queue, shutdown all ambient groupings
SoundStopAllRandom( );
DeleteAllStrategicEventsOfType( EVENT_AMBIENT );
if( !gfBasement && !gfCaves )
{
if( LoadAmbientControlFile( ubAmbientID ) )
{
// OK, load them up!
BuildDayAmbientSounds( );
}
else
{
DebugMsg(TOPIC_JA2, DBG_LEVEL_0, String("Cannot load Ambient data for tileset" ) );
}
}
}
void DeleteAllAmbients()
{
// JA2Gold: it seems that ambient sounds don't get unloaded when we exit a sector!?
SoundStopAllRandom();
DeleteAllStrategicEventsOfType( EVENT_AMBIENT );
}
UINT32 SetupNewAmbientSound( UINT32 uiAmbientID )
{
RANDOMPARMS rpParms;
memset(&rpParms, 0xff, sizeof(RANDOMPARMS));
rpParms.uiTimeMin = gAmbData[ uiAmbientID ].uiMinTime;
rpParms.uiTimeMax = gAmbData[ uiAmbientID ].uiMaxTime;
rpParms.uiVolMin = CalculateSoundEffectsVolume( gAmbData[ uiAmbientID ].uiVol );
rpParms.uiVolMax = CalculateSoundEffectsVolume( gAmbData[ uiAmbientID ].uiVol );
rpParms.uiPriority = GROUP_AMBIENT;
return SoundPlayRandom( gAmbData[ uiAmbientID ].zFilename, &rpParms );
}
UINT32 StartSteadyStateAmbient( UINT32 ubVolume, UINT32 ubLoops)
{
SOUNDPARMS spParms;
memset(&spParms, 0xff, sizeof(SOUNDPARMS));
spParms.uiVolume = CalculateSoundEffectsVolume( ubVolume );
spParms.uiLoop = ubLoops;
spParms.uiPriority=GROUP_AMBIENT;
return(SoundPlay( gSteadyStateAmbientTable[ gubCurrentSteadyStateAmbience ].zSoundNames[ gubCurrentSteadyStateSound ], &spParms ) );
}
BOOLEAN SetSteadyStateAmbience( UINT8 ubAmbience )
{
BOOLEAN fInNight = FALSE;
INT32 cnt;
UINT8 ubNumSounds = 0;
UINT8 ubChosenSound;
// Stop all ambients...
if ( guiCurrentSteadyStateSoundHandle != NO_SAMPLE )
{
SoundStop( guiCurrentSteadyStateSoundHandle );
guiCurrentSteadyStateSoundHandle = NO_SAMPLE;
}
// Determine what time of day we are in ( day/night)
if( gubEnvLightValue >= LIGHT_DUSK_CUTOFF)
{
fInNight = TRUE;
}
// loop through listing to get num sounds...
for ( cnt = ( fInNight * 4 ); cnt < ( NUM_SOUNDS_PER_TIMEFRAME / 2 ); cnt++ )
{
if ( gSteadyStateAmbientTable[ ubAmbience ].zSoundNames[ cnt ][ 0 ] == 0 )
{
break;
}
ubNumSounds++;
}
if ( ubNumSounds == 0 )
{
return( FALSE );
}
// Pick one
ubChosenSound = (UINT8) Random( ubNumSounds );
// Set!
gubCurrentSteadyStateAmbience = ubAmbience;
gubCurrentSteadyStateSound = ubChosenSound;
guiCurrentSteadyStateSoundHandle = StartSteadyStateAmbient( LOWVOLUME, 0 );
return( TRUE );
}
Report message to a moderator
|
|
|
|
|
Re: Does anyone know how the Steady State Ambience works?[message #290712]
|
Wed, 14 September 2011 21:28
|
|
|
PasHancockwhat is Steady State Ambience for?
Steady State Ambience is Dynamic Ambience in game.
Report message to a moderator
|
|
|
|
|
|
|
Goto Forum:
Current Time: Thu Apr 18 05:31:56 GMT+3 2024
Total time taken to generate the page: 0.01242 seconds
|