Quote:
Originally Posted by Arkshine
Yes, you're right, the index is passed. ^^
|
Unfortunately the info we just found gets us nowhere. I have tested all the possible and impossible methods to send a sound to client and what I have found:
CS does not accept SVC_SOUND SVC_SOUNDFADE SVC_STOPSOUND SVC_SPAWNSTATICSOUND if they are sent through
message_begin(), when I run one of these 4 it disconnects and gives the error.
However if I type in console the command
cl_messages
I get something like this:
Quote:
-------- Message Load ---------
1:svc_nop: 688 msgs:0.67K
5:svc_setview: 8 msgs:0.02K
6:svc_sound: 234 msgs:2.78K
7:svc_time: 44467 msgs:217.12K
8:svc_print: 5 msgs:0.18K
9:svc_stufftext: 16 msgs:0.44K
10:svc_setangle: 11 msgs:0.08K
11:svc_serverinfo: 2 msgs:0.49K
12:svc_lightstyle: 128 msgs:1.02K
13:svc_updateuserinfo: 101 msgs:17.12K
14:svc_deltadescription: 14 msgs:11.77K
15:svc_clientdata: 44467 msgs:527.07K
17:svc_pings: 1983 msgs:50.26K
21:svc_event_reliable: 8 msgs:0.02K
22:svc_spawnbaseline: 2 msgs:4.47K
23:svc_temp_entity: 2290 msgs:146.69K
25:svc_signonnum: 2 msgs:0.00K
29:svc_spawnstaticsound: 6384 msgs:93.52K
32:svc_cdtrack: 2 msgs:0.01K
35:svc_weaponanim: 9 msgs:0.03K
37:svc_roomtype: 2 msgs:0.01K
39:svc_newusermsg: 164 msgs.04K
40:svc_packetentities: 5 msgs:0.39K
41:svc_deltapacketentities: 44460 msgs:2602.64K
42:svc_choke: 79 msgs:0.08K
43:svc_resourcelist: 2 msgs9.83K
44:svc_newmovevars: 5 msgs:0.50K
45:svc_resourcerequest: 2 msgs:0.02K
46:svc_customization: 2 msgs:0.08K
52:svc_voiceinit: 2 msgs:0.03K
54:svc_sendextrainfo: 2 msgs:0.01K
User messages: 2666:19K
|
That means that there is another way that these sounds are transmited and we do not have access to it. swds.dll is the way to make this work, and I think that SV_Multicast is the function responsible for selecting the clients who receive the messages.
Edit: Also about the cvars that are changed we also have this messages in console:
Quote:
25296 0027 svc_clientdata
25296 0055 svc_deltapacketentities
25296 0198 svc_sound
25296 0211 svc_sound
25296 0224 svc_sound
25296 0237 svc_sound
25296 0250 svc_temp_entity
25296 0263 svc_sound
25296 0275 svc_temp_entity
25302 0008 AmmoPickup
25302 0011 AmmoPickup
25302 0014 AmmoPickup
25302 0017 AmmoPickup
25302 0020 Health
25302 0022 Damage
25302 0035 Damage
25302 0048 svc_customization
25302 0088 svc_updateuserinfo
25302 0261 svc_time
25302 0266 svc_choke
25302 0267 svc_clientdata
25302 0312svc_deltapacketentities
25302 0445 svc_sound
25302 0457 svc_sound
25302 0470 svc_temp_entity
25302 0542 svc_sound
25302 0554 svc_sound
25311 0008 TeamInfo
25311 0016 SelAmmo
25311 0021 GameTitle
25311 0023 svc_sendcvarvalue
|
It means that we have another way that these are transmited...
Edit2: Also SVC_DELTAPACKETENTITIES is sent through a different channel.
Edit3:
I have got some code from quake engine so you can see some info regarding sound transmition.
PHP Code:
/*
=================
SV_Multicast
Sends the contents of sv.multicast to a subset of the clients,
then clears sv.multicast.
MULTICAST_ALL same as broadcast
MULTICAST_PVS send to clients potentially visible from org
MULTICAST_PHS send to clients potentially hearable from org
=================
*/
void SV_Multicast (vec3_t origin, int to)
{
client_t *client;
byte *mask;
mleaf_t *leaf;
int leafnum;
int j;
qboolean reliable;
leaf = Mod_PointInLeaf (origin, sv.worldmodel);
if (!leaf)
leafnum = 0;
else
leafnum = leaf - sv.worldmodel->leafs;
reliable = qfalse;
switch (to)
{
case MULTICAST_ALL_R:
reliable = qtrue; // intentional fallthrough
case MULTICAST_ALL:
mask = sv.pvs; // leaf 0 is everything;
break;
case MULTICAST_PHS_R:
reliable = qtrue; // intentional fallthrough
case MULTICAST_PHS:
mask = sv.phs + leafnum * 4*((sv.worldmodel->numleafs+31)>>5);
break;
case MULTICAST_PVS_R:
reliable = qtrue; // intentional fallthrough
case MULTICAST_PVS:
mask = sv.pvs + leafnum * 4*((sv.worldmodel->numleafs+31)>>5);
break;
default:
mask = NULL;
SV_Error ("SV_Multicast: bad to:%i", to);
}
// send the data to all relevent clients
for (j = 0, client = svs.clients; j < MAX_CLIENTS; j++, client++)
{
if (client->state != cs_spawned)
continue;
if (to == MULTICAST_PHS_R || to == MULTICAST_PHS) {
vec3_t delta;
VectorSubtract(origin, client->edict->v.origin, delta);
if (Length(delta) <= 1024)
goto inrange;
}
leaf = Mod_PointInLeaf (client->edict->v.origin, sv.worldmodel);
if (leaf)
{
// -1 is because pvs rows are 1 based, not 0 based like leafs
leafnum = leaf - sv.worldmodel->leafs - 1;
if ( !(mask[leafnum>>3] & (1<<(leafnum&7)) ) )
{
// Con_Printf ("supressed multicast\n");
continue;
}
}
inrange:
if (reliable) {
ClientReliableCheckBlock(client, sv.multicast.cursize);
ClientReliableWrite_SZ(client, sv.multicast.data, sv.multicast.cursize);
} else
SZ_Write (&client->datagram, sv.multicast.data, sv.multicast.cursize);
}
SZ_Clear (&sv.multicast);
}
/*
==================
SV_StartSound
Each entity can have eight independant sound sources, like voice,
weapon, feet, etc.
Channel 0 is an auto-allocate channel, the others override anything
allready running on that entity/channel pair.
An attenuation of 0 will play full volume everywhere in the level.
Larger attenuations will drop off. (max 4 attenuation)
==================
*/
void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
float attenuation)
{
int sound_num;
int field_mask;
int i;
int ent;
vec3_t origin;
qboolean use_phs;
qboolean reliable = qfalse;
if (volume < 0 || volume > 255)
SV_Error ("SV_StartSound: volume = %i", volume);
if (attenuation < 0 || attenuation > 4)
SV_Error ("SV_StartSound: attenuation = %f", attenuation);
if (channel < 0 || channel > 15)
SV_Error ("SV_StartSound: channel = %i", channel);
// find precache number for sound
for (sound_num=1 ; sound_num<MAX_SOUNDS
&& sv.sound_precache[sound_num] ; sound_num++)
if (!strcmp(sample, sv.sound_precache[sound_num]))
break;
if ( sound_num == MAX_SOUNDS || !sv.sound_precache[sound_num] )
{
Con_Printf ("SV_StartSound: %s not precacheed\n", sample);
return;
}
ent = NUM_FOR_EDICT(entity);
if ((channel & 8) || !sv_phs.value) // no PHS flag
{
if (channel & 8)
reliable = qtrue; // sounds that break the phs are reliable
use_phs = qfalse;
channel &= 7;
}
else
use_phs = qtrue;
// if (channel == CHAN_BODY || channel == CHAN_VOICE)
// reliable = qtrue;
channel = (ent<<3) | channel;
field_mask = 0;
if (volume != DEFAULT_SOUND_PACKET_VOLUME)
channel |= SND_VOLUME;
if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
channel |= SND_ATTENUATION;
// use the entity origin unless it is a bmodel
if (entity->v.solid == SOLID_BSP)
{
for (i=0 ; i<3 ; i++)
origin[i] = entity->v.origin[i]+0.5*(entity->v.mins[i]+entity->v.maxs[i]);
}
else
{
VectorCopy (entity->v.origin, origin);
}
MSG_WriteByte (&sv.multicast, svc_sound);
MSG_WriteShort (&sv.multicast, channel);
if (channel & SND_VOLUME)
MSG_WriteByte (&sv.multicast, volume);
if (channel & SND_ATTENUATION)
MSG_WriteByte (&sv.multicast, attenuation*64);
MSG_WriteByte (&sv.multicast, sound_num);
for (i=0 ; i<3 ; i++)
MSG_WriteCoord (&sv.multicast, origin[i]);
if (use_phs)
SV_Multicast (origin, reliable ? MULTICAST_PHS_R : MULTICAST_PHS);
else
SV_Multicast (origin, reliable ? MULTICAST_ALL_R : MULTICAST_ALL);
}
__________________