ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/sounds.C
(Generate patch)

Comparing deliantra/server/socket/sounds.C (file contents):
Revision 1.11 by root, Sat Dec 23 13:56:25 2006 UTC vs.
Revision 1.12 by root, Mon Jan 15 01:39:42 2007 UTC

47 << uint8 (soundtype); 47 << uint8 (soundtype);
48 48
49 pl->ns->send_packet (sl); 49 pl->ns->send_packet (sl);
50} 50}
51 51
52#define POW2(x) ((x) * (x))
53
54/** Plays some sound on map at x,y. */ 52/** Plays some sound on map at x,y. */
55void 53void
56play_sound_map (maptile *map, int x, int y, short sound_num) 54play_sound_map (maptile *map, int x, int y, short sound_num)
57{ 55{
58 if (sound_num >= NROF_SOUNDS) 56 if (sound_num >= NROF_SOUNDS)
63 61
64 for_all_players (pl) 62 for_all_players (pl)
65 { 63 {
66 if (pl->ob->map == map) 64 if (pl->ob->map == map)
67 { 65 {
68 int distance = isqrt (POW2 (pl->ob->x - x) + POW2 (pl->ob->y - y)); 66 int distance = idistance (pl->ob->x - x, pl->ob->y - y);
69 67
70 if (distance <= MAX_SOUND_DISTANCE) 68 if (distance <= MAX_SOUND_DISTANCE)
71 {
72 play_sound_player_only (pl, sound_num, (sint8) (x - pl->ob->x), (sint8) (y - pl->ob->y)); 69 play_sound_player_only (pl, sound_num, x - pl->ob->x, y - pl->ob->y);
73 }
74 } 70 }
75 } 71 }
76} 72}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines