Amulets & Armor  v1.02
Open Source Game
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Data Structures | Macros | Functions
AREASND

Sound effects over areas of the map. More...

Data Structures

struct  T_areaSoundStructTag
 

Macros

#define AREA_SOUND_ID
 
#define AREA_SOUND_ID_DONE
 
#define T_areaSoundStruct   struct T_areaSoundStructTag
 

Functions

T_void AreaSoundCheck (T_void)
 
T_areaSound AreaSoundCreate (T_sword16 x, T_sword16 y, T_word16 radius, T_word16 volume, E_areaSoundType type, T_word16 length, T_areaSound p_groupLeader, T_areaSoundFinishCallback p_callback, T_word32 data, T_word16 soundNum)
 
T_void AreaSoundDestroy (T_areaSound areaSound)
 
T_areaSound AreaSoundFindGroupLeader (T_word16 groupID)
 
T_void AreaSoundFinish (T_void)
 
T_void AreaSoundInitialize (T_void)
 
T_void AreaSoundLoad (T_word32 mapNumber)
 
T_void AreaSoundMove (T_areaSound areaSound, T_sword16 newX, T_sword16 newY)
 
T_void AreaSoundSetGroupId (T_areaSound areaSound, T_word16 groupID)
 
T_void AreaSoundUpdate (T_sword16 listenX, T_sword16 listenY)
 
T_void ICalculateAllVolumes (T_sword16 listenX, T_sword16 listenY)
 
T_word16 ICalculateVolume (T_areaSoundStruct *p_sound, T_sword16 listenX, T_sword16 listenY)
 
T_areaSound IFindGroupLeader (T_word16 groupId)
 
T_areaSoundStructIFindLoudestNotChannelSound (T_void)
 
T_areaSoundStructIFindPrevSound (T_areaSoundStruct *p_sound)
 
T_void ISetGroupLeaderAndId (T_areaSound areaSound, T_areaSound groupLeader, T_word16 groupId)
 
T_void IUpdateActiveSounds (T_sword16 listenX, T_sword16 listenY)
 
T_void IUpdateInactiveSounds (T_sword16 listenX, T_sword16 listenY)
 

Detailed Description

Sound effects over areas of the map.

Area sounds are sound effects on a map. They are used for environmental effects such as lava and water or just windy corridors.

See Also
http://www.amuletsandarmor.com/AALicense.txt

Macro Definition Documentation

#define AREA_SOUND_ID
Value:
((((T_word32)'A')<<0) | \
(((T_word32)'S')<<8) | \
(((T_word32)'n')<<16) | \
(((T_word32)'d')<<24))
#define AREA_SOUND_ID_DONE
Value:
((((T_word32)'F')<<0) | \
(((T_word32)'A')<<8) | \
(((T_word32)'S')<<16) | \
(((T_word32)'_')<<24))
#define T_areaSoundStruct   struct T_areaSoundStructTag

Function Documentation

T_void AreaSoundCheck ( T_void  )

AreaSoundCheck is a routine only used in debugging to check to see that the sounds have not been corrupted. If there is a problem, it will crash the program.

T_areaSound AreaSoundCreate ( T_sword16  x,
T_sword16  y,
T_word16  radius,
T_word16  volume,
E_areaSoundType  type,
T_word16  length,
T_areaSound  p_groupLeader,
T_areaSoundFinishCallback  p_callback,
T_word32  data,
T_word16  soundNum 
)

AreaSoundCreate creates and sets up a new area sound. As well, it sets up the new location and placement of the area sound in reference to its group.

Parameters
x– X Location of area sound
y– Y Location of area sound
radius– Radius at point zero sound
volume– Maximum volume at center
type– One shot, or loop
length– How long is sound to play (not used if looping)
p_groupLeader– Connect to which group?
p_callback– who to call when ONCE done
data– Extra data field
soundNum– Number of sound to play
Returns
area sound handle that was created
T_void AreaSoundDestroy ( T_areaSound  areaSound)

AreaSoundDestroy turns off a given sound AND removes it from the list of sounds.

Parameters
areaSound– Area sound to destroy
T_areaSound AreaSoundFindGroupLeader ( T_word16  groupID)

AreaSoundFindGroupLeader finds the group leader for a given group id. returns AREA_SOUND_BAD if no group is found, or groupID is zero.

Parameters
groupID– ID of group
Returns
identifier for area sound
T_void AreaSoundFinish ( T_void  )

AreaSoundFinish frees up all memory used by the area sound module after turning off all the sounds.

T_void AreaSoundInitialize ( T_void  )

AreaSoundInitialize starts up the area sound module. Really not too much is done here. Should things change in the future, more will be done.

T_void AreaSoundLoad ( T_word32  mapNumber)

AreaSoundLoad loads a whole level of area sounds for the given level number.

Parameters
mapNumber– Map/level sounds to load
T_void AreaSoundMove ( T_areaSound  areaSound,
T_sword16  newX,
T_sword16  newY 
)

AreaSoundMove changes the placement of the given area sound to the new location.

Parameters
areaSound– area sound to move
newX– New X location of sound
newY– New Y location of sound
T_void AreaSoundSetGroupId ( T_areaSound  areaSound,
T_word16  groupID 
)

AreaSoundSetGroupId changes the group id on an area sound.

Parameters
areaSound– Area sound to affect
groupID– ID of the group to attach sound
T_void AreaSoundUpdate ( T_sword16  listenX,
T_sword16  listenY 
)

AreaSoundUpdate updates the volumes and activity of all sounds based on the sound areas and the given listening location.

Parameters
listenX– X Position where sounds are heard.
listenY– Y Position where sounds are heard.
T_void ICalculateAllVolumes ( T_sword16  listenX,
T_sword16  listenY 
)

ICalculateAllVolumes is a routine that determines volume levels for all the area sounds.

Parameters
listenX– X Position where sounds are heard.
listenY– Y Position where sounds are heard.
T_word16 ICalculateVolume ( T_areaSoundStruct p_sound,
T_sword16  listenX,
T_sword16  listenY 
)

ICalculateVolume determines the volume level of a sound given the listening location.

Parameters
p_sound– Pointer to sound to calc. volume.
listenX– X Position where sounds are heard.
listenY– Y Position where sounds are heard.
T_areaSound IFindGroupLeader ( T_word16  groupId)

IFindGroupLeader searches through the list of area sounds and finds the first instance of a given areaSound.

Parameters
groupId– Group id to find leader of.
Returns
Found group leader, or AREA_SOUND_BAD
T_areaSoundStruct * IFindLoudestNotChannelSound ( T_void  )

IFindLoudestNotChannelSound searches throught the area sounds to find the loudest audible sound that is not being played.

Returns
loudest non-playing sound, or NULL
T_areaSoundStruct * IFindPrevSound ( T_areaSoundStruct p_sound)

IFindPrevSound searches in the linked list for the previous sound to the given sound.

Parameters
p_sound– Sound to find previous of
Returns
Previous sound, or NULL
T_void ISetGroupLeaderAndId ( T_areaSound  areaSound,
T_areaSound  groupLeader,
T_word16  groupId 
)

ISetGroupLeaderAndId changes the group leader and id for the given instance.

Parameters
areaSound– area sound to change group leader
groupLeader– Group leader to change to
groupId– Group Id to change to
T_void IUpdateActiveSounds ( T_sword16  listenX,
T_sword16  listenY 
)

IUpdateActiveSounds go through the listof area sounds and identifies those sounds that are active and determines their new volume level and if they should be turned off.

Parameters
listenX– X Position where sounds are heard.
listenY– Y Position where sounds are heard.
T_void IUpdateInactiveSounds ( T_sword16  listenX,
T_sword16  listenY 
)

IUpdateInactiveSounds does the work of determining if there are new sounds that can be played or "take over" other sounds.

Parameters
listenX– X Position where sounds are heard.
listenY– Y Position where sounds are heard.