|
I didnt have time to look too much at the source code yet, but here is a
small one on increasing the maximum number of precached sounds, as well
as a small related bugfix. All changes are contained between //KSand
//END KS
////////////////////
In CL_Parse.c
///////////////////
void CL_ParseStartSoundPacket(void)
{
vec3_t pos;
int channel, ent;
int sound_num;
int volume;
int field_mask;
float attenuation;
int i;
field_mask = MSG_ReadByte();
if (field_mask & SND_VOLUME)
volume = MSG_ReadByte ();
else
volume = DEFAULT_SOUND_PACKET_VOLUME;
if (field_mask & SND_ATTENUATION)
attenuation = MSG_ReadByte () / 64.0;
else
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
channel = MSG_ReadShort ();
sound_num = MSG_ReadByte ();
//KS Increase max sounds
if (field_mask & SND_OVERFLOW)
sound_num += 256;//was 255
if (field_mask & SND_OVERFLOW2)
sound_num += 512;
//KS This gets replace by the above code
/*if (field_mask & SND_OVERFLOW)
sound_num += 255;*/
//END KS
ent = channel >> 3;
channel &= 7;
if (ent > MAX_EDICTS)
Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent);
for (i=0 ; i<3 ; i++)
pos[i] = MSG_ReadCoord ();
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
}
////////////////////
In SV_Main.c
////////////////////
void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
float attenuation)
{
int sound_num;
int field_mask;
int i;
int ent;
#if RJNET
sizebuf_t cm;
byte datagram_buf[MAX_DATAGRAM];
client_t *client;
vec_t distance;
vec3_t diff;
cm.data = datagram_buf;
cm.maxsize = sizeof(datagram_buf);
cm.cursize = 0;
#endif
if (strcmpi(sample,"misc/null.wav") == 0)
{
SV_StopSound(entity,channel);
return;
}
if (volume < 0 || volume > 255)
Sys_Error ("SV_StartSound: volume = %i", volume);
if (attenuation < 0 || attenuation > 4)
Sys_Error ("SV_StartSound: attenuation = %f", attenuation);
if (channel < 0 || channel > 7)
Sys_Error ("SV_StartSound: channel = %i", channel);
if (sv.datagram.cursize > MAX_DATAGRAM-16)
return;
// find precache number for sound
for (sound_num=1 ; sound_num |