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.20 by root, Tue Jul 31 01:18:16 2007 UTC vs.
Revision 1.21 by root, Wed Aug 1 00:26:05 2007 UTC

39/** 39/**
40 * Maximum distance a player may hear a sound from. 40 * Maximum distance a player may hear a sound from.
41 * This is only used for new client/server sound. If the sound source 41 * This is only used for new client/server sound. If the sound source
42 * on the map is farther away than this, we don't sent it to the client. 42 * on the map is farther away than this, we don't sent it to the client.
43 */ 43 */
44#define MAX_SOUND_DISTANCE 10 44#define MAX_SOUND_DISTANCE 16
45 45
46// the hashtable 46// the hashtable
47typedef std::tr1::unordered_map 47typedef std::tr1::unordered_map
48 < 48 <
49 const char *, 49 const char *,
87client::play_sound (faceidx sound, int dx, int dy) 87client::play_sound (faceidx sound, int dx, int dy)
88{ 88{
89 if (!sound) 89 if (!sound)
90 return; 90 return;
91 91
92 if (dx < -10 || dx > 10) return; 92 if (dx < -MAX_SOUND_DISTANCE || dx > MAX_SOUND_DISTANCE) return;
93 if (dy < -10 || dy > 10) return; 93 if (dy < -MAX_SOUND_DISTANCE || dy > MAX_SOUND_DISTANCE) return;
94 94
95 if (fx_want [FT_SOUND]) 95 if (fx_want [FT_SOUND])
96 { 96 {
97 // cfplus 97 // cfplus
98 send_face (sound); 98 send_face (sound);
99 flush_fx (); 99 flush_fx ();
100 100
101 uint8 vol = clamp (255 - idistance (dx, dy) * 255 / 10, 0, 255); 101 uint8 vol = clamp (255 - idistance (dx, dy) * 361 / MAX_SOUND_DISTANCE, 0, 255);
102 102
103 // cut off volume here 103 // cut off volume here
104 if (vol < 16) 104 if (vol < 8)
105 return; 105 return;
106 106
107 packet sl ("sc"); 107 packet sl ("sc");
108 108
109 uint8 *len = sl.cur; 109 uint8 *len = sl.cur;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines