mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +00:00
- svs_sound too of course
This commit is contained in:
parent
eb9c515c2a
commit
9cef5a1edc
3 changed files with 46 additions and 26 deletions
|
@ -59,6 +59,16 @@ typedef struct net_svc_serverdata_s
|
|||
movevars_t movevars;
|
||||
} net_svc_serverdata_t;
|
||||
|
||||
typedef struct net_svc_sound_s
|
||||
{
|
||||
short channel;
|
||||
float volume;
|
||||
float attenuation;
|
||||
byte sound_num;
|
||||
vec3_t position;
|
||||
int entity;
|
||||
} net_svc_sound_t;
|
||||
|
||||
typedef struct net_svc_updateuserinfo_s
|
||||
{
|
||||
byte slot;
|
||||
|
@ -99,6 +109,7 @@ qboolean NET_SVC_Print_Parse (net_svc_print_t *print, msg_t *message);
|
|||
qboolean NET_SVC_Damage_Parse (net_svc_damage_t *damage, msg_t *message);
|
||||
qboolean NET_SVC_ServerData_Parse (net_svc_serverdata_t *serverdata,
|
||||
msg_t *message);
|
||||
qboolean NET_SVC_Sound_Parse (net_svc_sound_t *sound, msg_t *message);
|
||||
qboolean NET_SVC_UpdateUserInfo_Parse (net_svc_updateuserinfo_t *updateuserinfo,
|
||||
msg_t *message);
|
||||
qboolean NET_SVC_SetInfo_Parse (net_svc_setinfo_t *setinfo, msg_t *message);
|
||||
|
|
|
@ -898,35 +898,16 @@ CL_ParseStaticSound (void)
|
|||
void
|
||||
CL_ParseStartSoundPacket (void)
|
||||
{
|
||||
float attenuation;
|
||||
int channel, ent, sound_num, volume, i;
|
||||
vec3_t pos;
|
||||
net_svc_sound_t sound;
|
||||
|
||||
channel = MSG_ReadShort (net_message);
|
||||
NET_SVC_Sound_Parse (&sound, net_message);
|
||||
|
||||
if (channel & SND_VOLUME)
|
||||
volume = MSG_ReadByte (net_message);
|
||||
else
|
||||
volume = DEFAULT_SOUND_PACKET_VOLUME;
|
||||
if (sound.entity > MAX_EDICTS)
|
||||
Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", sound.entity);
|
||||
|
||||
if (channel & SND_ATTENUATION)
|
||||
attenuation = MSG_ReadByte (net_message) / 64.0;
|
||||
else
|
||||
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
|
||||
|
||||
sound_num = MSG_ReadByte (net_message);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
pos[i] = MSG_ReadCoord (net_message);
|
||||
|
||||
ent = (channel >> 3) & 1023;
|
||||
channel &= 7;
|
||||
|
||||
if (ent > MAX_EDICTS)
|
||||
Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent);
|
||||
|
||||
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos,
|
||||
volume / 255.0, attenuation);
|
||||
S_StartSound (sound.entity, sound.channel,
|
||||
cl.sound_precache[sound.sound_num], sound.position,
|
||||
sound.volume, sound.attenuation);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -45,6 +45,7 @@ static const char rcsid[] =
|
|||
#endif
|
||||
|
||||
#include "QF/msg.h"
|
||||
#include "QF/sound.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "net_svc.h"
|
||||
|
@ -99,6 +100,33 @@ NET_SVC_ServerData_Parse (net_svc_serverdata_t *serverdata, msg_t *message)
|
|||
return message->badread;
|
||||
}
|
||||
|
||||
qboolean
|
||||
NET_SVC_Sound_Parse (net_svc_sound_t *sound, msg_t *message)
|
||||
{
|
||||
int i;
|
||||
|
||||
sound->channel = MSG_ReadShort (message);
|
||||
if (sound->channel & SND_VOLUME)
|
||||
sound->volume = MSG_ReadByte (message) / 255.0;
|
||||
else
|
||||
sound->volume = DEFAULT_SOUND_PACKET_VOLUME / 255.0;
|
||||
|
||||
if (sound->channel & SND_ATTENUATION)
|
||||
sound->attenuation = MSG_ReadByte (message) / 64.0;
|
||||
else
|
||||
sound->attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
|
||||
|
||||
sound->sound_num = MSG_ReadByte (message);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
sound->position[i] = MSG_ReadCoord (message);
|
||||
|
||||
sound->entity = (sound->channel >> 3) & 1023;
|
||||
sound->channel &= 7;
|
||||
|
||||
return message->badread;
|
||||
}
|
||||
|
||||
qboolean
|
||||
NET_SVC_UpdateUserInfo_Parse (net_svc_updateuserinfo_t *updateuserinfo,
|
||||
msg_t *message)
|
||||
|
|
Loading…
Reference in a new issue