Atrinik Server  4.0
Macros | Functions
sounds.c File Reference
#include <global.h>
#include <toolkit/packet.h>
#include <player.h>
#include <object.h>

Go to the source code of this file.

Macros

#define MAX_SOUND_DISTANCE   12
 
#define MAX_SOUND_DISTANCE_SQUARED   POW2(MAX_SOUND_DISTANCE)
 
#define MAP_LEVEL_VOLUME_ADJUST   10
 

Functions

void play_sound_player_only (player *pl, int type, const char *filename, int x, int y, int loop, int volume)
 
static int play_sound_map_internal (mapstruct *tiled, mapstruct *map, mapstruct *orig, int type, const char *filename, int x, int y, int loop, int volume)
 
void play_sound_map (mapstruct *map, int type, const char *filename, int x, int y, int loop, int volume)
 

Detailed Description

Sound related functions.

Definition in file sounds.c.

Macro Definition Documentation

#define MAP_LEVEL_VOLUME_ADJUST   10

Volume adjustment for each map level.

Definition at line 47 of file sounds.c.

#define MAX_SOUND_DISTANCE   12

Maximum distance a player may hear a sound from.

This is only used for new client/server sound. If the sound source on the map is farther away than this, we don't sent it to the client.

Definition at line 41 of file sounds.c.

#define MAX_SOUND_DISTANCE_SQUARED   POW2(MAX_SOUND_DISTANCE)

Squared maximum sound distance, using POW2.

Definition at line 43 of file sounds.c.

Function Documentation

void play_sound_map ( mapstruct map,
int  type,
const char *  filename,
int  x,
int  y,
int  loop,
int  volume 
)

Plays a sound on a map.

Considers tiled maps.

Parameters
mapMap to play the sound on.
typeType of the sound being played, one of CMD_SOUND_xxx.
filenameName of the sound to play.
xX position where the sound is playing from.
yY position where the sound is playing from.
loopHow many times to loop the sound, -1 for infinite number.
volumeVolume adjustment.

Definition at line 159 of file sounds.c.

static int play_sound_map_internal ( mapstruct tiled,
mapstruct map,
mapstruct orig,
int  type,
const char *  filename,
int  x,
int  y,
int  loop,
int  volume 
)
static

Internal function used by play_sound_map().

Parameters
tiledTiled map that is being checked.
mapMap to play the sound on.
typeType of the sound being played, one of CMD_SOUND_xxx.
filenameName of the sound to play.
xX position where the sound is playing from.
yY position where the sound is playing from.
loopHow many times to loop the sound, -1 for infinite number.
volumeVolume adjustment.
Returns
0.

Definition at line 117 of file sounds.c.

void play_sound_player_only ( player pl,
int  type,
const char *  filename,
int  x,
int  y,
int  loop,
int  volume 
)

Plays a sound for specified player only.

Parameters
plPlayer to play sound to.
typeType of the sound being played, one of CMD_SOUND_xxx.
filenameName of the sound to play.
xX position where the sound is playing from.
yY position where the sound is playing from.
loopHow many times to loop the sound, -1 for infinite number.
volumeVolume adjustment.

Definition at line 66 of file sounds.c.