Crossfire Server, Branch 1.12  R12190
Defines | Functions
sounds.c File Reference

Sound-related functions. More...

#include <global.h>
#include <sproto.h>
#include <sounds.h>
Include dependency graph for sounds.c:

Go to the source code of this file.

Defines

#define MAX_SOUND_DISTANCE   10
 Maximum distance a player may hear a sound from.
#define POW2(x)   ((x)*(x))

Functions

void play_sound_map (sint8 sound_type, object *emitter, int dir, const char *action)
 Plays a sound on a map.
void play_sound_player_only (player *pl, sint8 sound_type, object *emitter, int dir, const char *action)
 Plays a sound for specified player only.
void send_background_music (player *pl, const char *music)
 Sends background music to client.

Detailed Description

Sound-related functions.

Date:
2003-12-02

Definition in file sounds.c.


Define Documentation

#define MAX_SOUND_DISTANCE   10

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 24 of file sounds.c.

Referenced by play_sound_map().

#define POW2 (   x)    ((x)*(x))

Definition at line 77 of file sounds.c.

Referenced by play_sound_map().


Function Documentation

void play_sound_map ( sint8  sound_type,
object *  emitter,
int  dir,
const char *  action 
)

Plays a sound on a map.

Parameters:
sound_typesound type, see the sound types.
emitterobject emitting the sound. Must be on a map.
dirdirection the sound is moving.
actionsound name to play.

Definition at line 90 of file sounds.c.

References distance(), first_player, isqrt(), MAX_SOUND_DISTANCE, pl::next, pl::ob, play_sound_player_only(), and POW2.

Referenced by attack_message(), cast_spell(), cf_handle_type_apply(), fire_bow(), hole_type_move_on(), kill_object(), move_player_attack(), player_apply(), player_attack_door(), polymorph_melt(), recharge(), save_life(), trapdoor_type_move_on(), and trigger_type_apply().

Here is the call graph for this function:

Here is the caller graph for this function:

void play_sound_player_only ( player pl,
sint8  sound_type,
object *  emitter,
int  dir,
const char *  action 
)

Plays a sound for specified player only.

Parameters:
plplayer to play sound to.
sound_typesound type, see the sound types.
emitterobject emitting a sound.
dirdirection the sound is moving into.
actionsound name to play.

Definition at line 40 of file sounds.c.

References MAX_SOUNDS_TICK, pl::ob, PLAYER, Send_With_Handling(), SND_EFFECTS, SND_MUTE, pl::socket, SockList_AddChar(), SockList_AddLen8Data(), SockList_AddString(), SockList_Init(), SockList_Term(), socket_struct::sound, and socket_struct::sounds_this_tick.

Referenced by attack_message(), cast_spell(), clock_type_apply(), do_learn_spell(), fire_misc_object(), kill_player(), manual_apply(), play_sound_map(), poison_type_apply(), and spellbook_type_apply().

Here is the call graph for this function:

Here is the caller graph for this function:

void send_background_music ( player pl,
const char *  music 
)

Sends background music to client.

Parameters:
plplayer
musicbackground music name. Can be NULL.

Definition at line 121 of file sounds.c.

References Send_With_Handling(), SND_MUSIC, SND_MUTE, pl::socket, SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::sound.

Referenced by enter_map().

Here is the call graph for this function:

Here is the caller graph for this function: