… | |
… | |
24 | void |
24 | void |
25 | play_sound_player_only (player *pl, short soundnum, sint8 x, sint8 y) |
25 | play_sound_player_only (player *pl, short soundnum, sint8 x, sint8 y) |
26 | { |
26 | { |
27 | char soundtype; |
27 | char soundtype; |
28 | |
28 | |
29 | if (!pl->socket->sound) |
29 | if (!pl->ns->sound) |
30 | return; |
30 | return; |
31 | |
31 | |
32 | /* Do some quick conversion to the sound type we want. */ |
32 | /* Do some quick conversion to the sound type we want. */ |
33 | if (soundnum >= SOUND_CAST_SPELL_0) |
33 | if (soundnum >= SOUND_CAST_SPELL_0) |
34 | { |
34 | { |
… | |
… | |
44 | << uint8 (x) |
44 | << uint8 (x) |
45 | << uint8 (y) |
45 | << uint8 (y) |
46 | << uint16 (soundnum) |
46 | << uint16 (soundnum) |
47 | << uint8 (soundtype); |
47 | << uint8 (soundtype); |
48 | |
48 | |
49 | Send_With_Handling (pl->socket, &sl); |
49 | pl->ns->send_packet (sl); |
50 | } |
50 | } |
51 | |
51 | |
52 | #define POW2(x) ((x) * (x)) |
52 | #define POW2(x) ((x) * (x)) |
53 | |
53 | |
54 | /** Plays some sound on map at x,y. */ |
54 | /** Plays some sound on map at x,y. */ |
55 | void |
55 | void |
56 | play_sound_map (maptile *map, int x, int y, short sound_num) |
56 | play_sound_map (maptile *map, int x, int y, short sound_num) |
57 | { |
57 | { |
58 | player *pl; |
|
|
59 | |
|
|
60 | if (sound_num >= NROF_SOUNDS) |
58 | if (sound_num >= NROF_SOUNDS) |
61 | { |
59 | { |
62 | LOG (llevError, "Tried to play an invalid sound num: %d\n", sound_num); |
60 | LOG (llevError, "Tried to play an invalid sound num: %d\n", sound_num); |
63 | return; |
61 | return; |
64 | } |
62 | } |
65 | |
63 | |
66 | for (pl = first_player; pl; pl = pl->next) |
64 | for_all_players (pl) |
67 | { |
65 | { |
68 | if (pl->ob->map == map) |
66 | if (pl->ob->map == map) |
69 | { |
67 | { |
70 | int distance = isqrt (POW2 (pl->ob->x - x) + POW2 (pl->ob->y - y)); |
68 | int distance = isqrt (POW2 (pl->ob->x - x) + POW2 (pl->ob->y - y)); |
71 | |
69 | |