version 1.4 | | version 1.5 |
---|
| | |
/* | | /* |
* static char *rcsid_sound_c = | | * static char *rcsid_sound_c = |
* "$Id: sounds.c,v 1.4 2003/12/02 18:51:44 ryo_saeba Exp $"; | | * "$Id: sounds.c,v 1.5 2003/12/14 16:28:47 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/* Send bug reports to Raphael Quinet (quinet@montefiore.ulg.ac.be) */ | | /* Send bug reports to Raphael Quinet (quinet@montefiore.ulg.ac.be) */ |
| | |
/** | | /** |
* Plays a sound for specified player only | | * Plays a sound for specified player only |
*/ | | */ |
void play_sound_player_only(player *pl, int soundnum, int x, int y) | | void play_sound_player_only(player *pl, short soundnum, sint8 x, sint8 y) |
{ | | { |
int soundtype; | | char soundtype; |
SockList sl; | | SockList sl; |
| | |
if (!pl->socket.sound) return; | | if (!pl->socket.sound) return; |
| | |
#define POW2(x) ((x) * (x)) | | #define POW2(x) ((x) * (x)) |
| | |
/** Plays some sound on map at x,y. */ | | /** Plays some sound on map at x,y. */ |
void play_sound_map(mapstruct *map, int x, int y, int sound_num) | | void play_sound_map(mapstruct *map, int x, int y, short sound_num) |
{ | | { |
player *pl; | | player *pl; |
| | |
| | |
int distance=isqrt(POW2(pl->ob->x - x) + POW2(pl->ob->y - y)); | | int distance=isqrt(POW2(pl->ob->x - x) + POW2(pl->ob->y - y)); |
| | |
if (distance<=MAX_SOUND_DISTANCE) { | | if (distance<=MAX_SOUND_DISTANCE) { |
play_sound_player_only(pl, sound_num, x-pl->ob->x, y-pl->ob->y); | | play_sound_player_only(pl, sound_num, ( sint8 )( x-pl->ob->x ), ( sint8 )( y-pl->ob->y )); |
} | | } |
} | | } |
} | | } |