Quake II RTX doxygen
1.0 dev
|
|
Go to the source code of this file.
|
void | SV_FlushRedirect (int redirected, char *outputbuf, size_t len) |
|
static qboolean | SV_RateDrop (client_t *client) |
|
static void | SV_CalcSendTime (client_t *client, size_t size) |
|
void | SV_ClientPrintf (client_t *client, int level, const char *fmt,...) |
|
void | SV_BroadcastPrintf (int level, const char *fmt,...) |
|
void | SV_ClientCommand (client_t *client, const char *fmt,...) |
|
void | SV_BroadcastCommand (const char *fmt,...) |
|
void | SV_Multicast (vec3_t origin, multicast_t to) |
|
static qboolean | compress_message (client_t *client, int flags) |
|
void | SV_ClientAddMessage (client_t *client, int flags) |
|
static void | free_msg_packet (client_t *client, message_packet_t *msg) |
|
static void | free_all_messages (client_t *client) |
|
static void | add_msg_packet (client_t *client, byte *data, size_t len, qboolean reliable) |
|
static qboolean | check_entity (client_t *client, int entnum) |
|
static void | emit_snd (client_t *client, message_packet_t *msg) |
|
static void | write_snd (client_t *client, message_packet_t *msg, size_t maxsize) |
|
static void | write_msg (client_t *client, message_packet_t *msg, size_t maxsize) |
|
static void | write_unreliables (client_t *client, size_t maxsize) |
|
static void | add_message_old (client_t *client, byte *data, size_t len, qboolean reliable) |
|
static void | write_reliables_old (client_t *client, size_t maxsize) |
|
static void | repack_unreliables (client_t *client, size_t maxsize) |
|
static void | write_datagram_old (client_t *client) |
|
static void | add_message_new (client_t *client, byte *data, size_t len, qboolean reliable) |
|
static void | write_datagram_new (client_t *client) |
|
static void | finish_frame (client_t *client) |
|
void | SV_SendClientMessages (void) |
|
static void | write_pending_download (client_t *client) |
|
void | SV_SendAsyncPackets (void) |
|
void | SV_InitClientSend (client_t *newcl) |
|
void | SV_ShutdownClientSend (client_t *client) |
|
◆ FOR_EACH_MSG_SAFE
◆ MSG_FIRST
◆ add_message_new()
static void add_message_new |
( |
client_t * |
client, |
|
|
byte * |
data, |
|
|
size_t |
len, |
|
|
qboolean |
reliable |
|
) |
| |
|
static |
◆ add_message_old()
static void add_message_old |
( |
client_t * |
client, |
|
|
byte * |
data, |
|
|
size_t |
len, |
|
|
qboolean |
reliable |
|
) |
| |
|
static |
◆ add_msg_packet()
static void add_msg_packet |
( |
client_t * |
client, |
|
|
byte * |
data, |
|
|
size_t |
len, |
|
|
qboolean |
reliable |
|
) |
| |
|
static |
Definition at line 463 of file send.c.
475 if (len > MAX_MSGLEN) {
476 Com_Error(ERR_FATAL,
"%s: oversize packet", __func__);
479 Com_WPrintf(
"%s: %s: out of dynamic memory\n",
480 __func__, client->
name);
487 Com_WPrintf(
"%s: %s: out of message slots\n",
488 __func__, client->
name);
492 List_Remove(&
msg->entry);
495 memcpy(
msg->data, data, len);
496 msg->cursize = (uint16_t)len;
Referenced by add_message_new(), and add_message_old().
◆ check_entity()
static qboolean check_entity |
( |
client_t * |
client, |
|
|
int |
entnum |
|
) |
| |
|
static |
◆ compress_message()
static qboolean compress_message |
( |
client_t * |
client, |
|
|
int |
flags |
|
) |
| |
|
static |
Definition at line 338 of file send.c.
341 byte buffer[MAX_MSGLEN];
350 if (client->
settings[CLS_RECORDING]) {
351 if (client->
protocol != PROTOCOL_VERSION_Q2PRO)
353 if (client->
version < PROTOCOL_VERSION_Q2PRO_EXTENDED_LAYOUT)
361 deflateReset(&
svs.z);
364 svs.z.next_out = buffer + 5;
365 svs.z.avail_out = (uInt)(MAX_MSGLEN - 5);
367 if (deflate(&
svs.z, Z_FINISH) != Z_STREAM_END)
370 buffer[0] = svc_zpacket;
371 buffer[1] =
svs.z.total_out & 255;
372 buffer[2] = (
svs.z.total_out >> 8) & 255;
374 buffer[4] = (
msg_write.cursize >> 8) & 255;
377 client->
name,
svs.z.total_in,
svs.z.total_out + 5);
Referenced by SV_ClientAddMessage().
◆ emit_snd()
Definition at line 533 of file send.c.
538 entnum =
msg->sendchan >> 3;
542 if (!(flags & SND_POS) && !
check_entity(client, entnum)) {
543 SV_DPrintf(0,
"Forcing position on entity %d for %s\n",
544 entnum, client->
name);
552 if (flags & SND_VOLUME)
554 if (flags & SND_ATTENUATION)
556 if (flags & SND_OFFSET)
561 if (flags & SND_POS) {
562 for (i = 0; i < 3; i++) {
Referenced by write_snd().
◆ finish_frame()
◆ free_all_messages()
◆ free_msg_packet()
◆ repack_unreliables()
static void repack_unreliables |
( |
client_t * |
client, |
|
|
size_t |
maxsize |
|
) |
| |
|
static |
Definition at line 657 of file send.c.
671 if (
msg->data[1] == TE_BLOOD ||
msg->data[1] == TE_SPLASH ||
672 msg->data[1] == TE_GUNSHOT ||
msg->data[1] == TE_BULLET_SPARKS ||
673 msg->data[1] == TE_SHOTGUN) {
696 if (
msg->cursize &&
msg->data[0] == svc_sound) {
Referenced by write_datagram_old().
◆ SV_BroadcastCommand()
void SV_BroadcastCommand |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Definition at line 214 of file send.c.
217 char string[MAX_STRING_CHARS];
221 va_start(argptr, fmt);
222 len =
Q_vsnprintf(
string,
sizeof(
string), fmt, argptr);
225 if (len >=
sizeof(
string)) {
226 Com_WPrintf(
"%s: overflow\n", __func__);
231 MSG_WriteData(
string, len + 1);
Referenced by SV_SpawnServer().
◆ SV_BroadcastPrintf()
void SV_BroadcastPrintf |
( |
int |
level, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
◆ SV_CalcSendTime()
static void SV_CalcSendTime |
( |
client_t * |
client, |
|
|
size_t |
size |
|
) |
| |
|
static |
◆ SV_ClientAddMessage()
Definition at line 399 of file send.c.
401 SV_DPrintf(1,
"Added %sreliable message to %s: %"PRIz
" bytes\n",
Referenced by AC_Announce(), handle_filtercmd(), MVD_BroadcastPrintf(), MVD_ChangeLevel(), MVD_LayoutChannels(), MVD_LayoutClients(), MVD_LayoutFollow(), MVD_LayoutMenu(), MVD_LayoutScores(), MVD_ParseSound(), MVD_SwitchChannel(), MVD_UpdateConfigstring(), PF_bprintf(), PF_configstring(), PF_cprintf(), PF_StartSound(), PF_Unicast(), stuff_cmds(), SV_BeginDownload_f(), SV_BroadcastCommand(), SV_BroadcastPrintf(), SV_ClientCommand(), SV_ClientPrintf(), SV_DropClient(), SV_FlushRedirect(), SV_Multicast(), SV_New_f(), SV_StopDownload_f(), SV_Stuff_f(), SV_StuffAll_f(), write_cs_list(), write_plain_baselines(), and write_plain_configstrings().
◆ SV_ClientCommand()
void SV_ClientCommand |
( |
client_t * |
client, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Definition at line 185 of file send.c.
188 char string[MAX_STRING_CHARS];
191 va_start(argptr, fmt);
192 len =
Q_vsnprintf(
string,
sizeof(
string), fmt, argptr);
195 if (len >=
sizeof(
string)) {
196 Com_WPrintf(
"%s: overflow\n", __func__);
201 MSG_WriteData(
string, len + 1);
Referenced by MVD_Invuse_f(), stuff_junk(), SV_New_f(), SV_StuffCvar_f(), and SV_UpdateUserinfo().
◆ SV_ClientPrintf()
void SV_ClientPrintf |
( |
client_t * |
client, |
|
|
int |
level, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Definition at line 121 of file send.c.
124 char string[MAX_STRING_CHARS];
127 if (level < client->messagelevel)
130 va_start(argptr, fmt);
131 len =
Q_vsnprintf(
string,
sizeof(
string), fmt, argptr);
134 if (len >=
sizeof(
string)) {
135 Com_WPrintf(
"%s: overflow\n", __func__);
141 MSG_WriteData(
string, len + 1);
Referenced by AC_ClientBegin(), AC_ParseFileViolation(), AC_ParseViolation(), gtv_forward_cmd(), MVD_Admin_f(), MVD_AutoFollow_f(), mvd_channel_list_f(), MVD_Commands_f(), MVD_Follow_f(), MVD_FollowStart(), MVD_Forward_f(), MVD_Join_f(), MVD_NotifyClient(), MVD_Observe_f(), MVD_Say_f(), MVD_SetPlayer(), MVD_TrySwitchChannel(), print_channel(), print_drop_reason(), SV_BeginDownload_f(), SV_ConSay_f(), SV_Lag_f(), and SV_UpdateUserinfo().
◆ SV_FlushRedirect()
void SV_FlushRedirect |
( |
int |
redirected, |
|
|
char * |
outputbuf, |
|
|
size_t |
len |
|
) |
| |
Definition at line 32 of file send.c.
34 byte buffer[MAX_PACKETLEN_DEFAULT];
37 memcpy(buffer,
"\xff\xff\xff\xffprint\n", 10);
38 memcpy(buffer + 10, outputbuf, len);
43 MSG_WriteData(outputbuf, len);
◆ SV_InitClientSend()
◆ SV_Multicast()
void SV_Multicast |
( |
vec3_t |
origin, |
|
|
multicast_t |
to |
|
) |
| |
Definition at line 255 of file send.c.
258 byte mask[VIS_MAX_BYTES];
259 mleaf_t *leaf1, *leaf2;
260 int leafnum q_unused;
265 Com_Error(ERR_DROP,
"%s: no map loaded", __func__);
271 case MULTICAST_ALL_R:
278 case MULTICAST_PHS_R:
283 leafnum = leaf1 -
sv.
cm.cache->leafs;
286 case MULTICAST_PVS_R:
291 leafnum = leaf1 -
sv.
cm.cache->leafs;
295 Com_Error(ERR_DROP,
"SV_Multicast: bad to: %i", to);
312 player_state_t *ps = &client->
edict->client->ps;
313 VectorMA(ps->viewoffset, 0.125f, ps->pmove.origin, org);
317 VectorCopy(client->
edict->s.origin, org);
322 if (leaf2->cluster == -1)
324 if (!Q_IsBitSet(mask, leaf2->cluster))
Referenced by PF_PositionedSound(), and SV_InitGameProgs().
◆ SV_RateDrop()
static qboolean SV_RateDrop |
( |
client_t * |
client | ) |
|
|
static |
◆ SV_SendAsyncPackets()
Definition at line 987 of file send.c.
1003 if (netchan->fragment_pending) {
1004 cursize = netchan->TransmitNextFragment(netchan);
1018 if (netchan->reliable_length && !retransmit && client->
state !=
cs_zombie) {
1023 if (netchan->type == NETCHAN_OLD) {
1030 if (netchan->message.cursize || netchan->reliable_ack_pending ||
1031 netchan->reliable_length || retransmit) {
1032 cursize = netchan->Transmit(netchan, 0, NULL, 1);
Referenced by MVD_ChangeLevel(), SV_Frame(), and SV_SpawnServer().
◆ SV_SendClientMessages()
Definition at line 880 of file send.c.
893 #if (defined _DEBUG) && USE_FPS
894 if (developer->integer)
895 check_key_sync(client);
900 if (client->
netchan->message.overflowed) {
911 if (client->
netchan->fragment_pending) {
Referenced by SV_Frame(), and SV_SpawnServer().
◆ SV_ShutdownClientSend()
◆ write_datagram_new()
Definition at line 788 of file send.c.
798 Com_WPrintf(
"Frame overflowed for %s\n", client->
name);
807 Com_WPrintf(
"Dumping datagram for %s\n", client->
name);
813 if (sv_pad_packets->integer) {
814 size_t pad =
msg_write.cursize + sv_pad_packets->integer;
819 for (; pad > 0; pad--) {
Referenced by SV_InitClientSend().
◆ write_datagram_old()
Definition at line 713 of file send.c.
716 size_t maxsize, cursize;
719 maxsize = client->
netchan->maxpacketlen;
720 if (client->
netchan->reliable_length) {
722 maxsize -= client->
netchan->reliable_length;
728 maxsize -=
msg->cursize;
736 SV_DPrintf(0,
"Frame %d overflowed for %s: %"PRIz
" > %"PRIz
"\n",
Referenced by SV_InitClientSend().
◆ write_msg()
◆ write_pending_download()
Definition at line 932 of file send.c.
944 if (client->
netchan->reliable_length)
947 buf = &client->
netchan->message;
948 if (buf->cursize > client->
netchan->maxpacketlen)
951 remaining = client->
netchan->maxpacketlen - buf->cursize;
956 if (chunk > remaining - 4)
957 chunk = remaining - 4;
Referenced by SV_SendAsyncPackets().
◆ write_reliables_old()
static void write_reliables_old |
( |
client_t * |
client, |
|
|
size_t |
maxsize |
|
) |
| |
|
static |
Definition at line 624 of file send.c.
629 if (client->
netchan->reliable_length) {
638 if (client->
netchan->message.cursize +
msg->cursize > maxsize) {
641 Com_WPrintf(
"%s to %s: overflow on the first message\n",
642 __func__, client->
name);
647 SV_DPrintf(1,
"%s to %s: writing msg %d: %d bytes\n",
648 __func__, client->
name, count,
msg->cursize);
650 SZ_Write(&client->
netchan->message,
msg->data,
msg->cursize);
Referenced by SV_SendAsyncPackets(), and write_datagram_old().
◆ write_snd()
◆ write_unreliables()
static void write_unreliables |
( |
client_t * |
client, |
|
|
size_t |
maxsize |
|
) |
| |
|
inlinestatic |
◆ sv_outputbuf
void SV_BuildClientFrame(client_t *client)
static void free_msg_packet(client_t *client, message_packet_t *msg)
static void write_snd(client_t *client, message_packet_t *msg, size_t maxsize)
static qboolean compress_message(client_t *client, int flags)
static void write_reliables_old(client_t *client, size_t maxsize)
entity_packed_t * entities
byte * BSP_ClusterVis(bsp_t *bsp, byte *mask, int cluster, int vis)
static void add_message_new(client_t *client, byte *data, size_t len, qboolean reliable)
static void SV_CalcSendTime(client_t *client, size_t size)
void(* WriteDatagram)(struct client_s *)
void SZ_WriteByte(sizebuf_t *sb, int c)
void SZ_WriteShort(sizebuf_t *sb, int c)
size_t Q_vsnprintf(char *dest, size_t size, const char *fmt, va_list argptr)
static void finish_frame(client_t *client)
void MSG_WriteByte(int c)
void SV_ClientAddMessage(client_t *client, int flags)
#define SV_AlignKeyFrames(client)
#define FOR_EACH_CLIENT(client)
qboolean CM_AreasConnected(cm_t *cm, int area1, int area2)
static void write_unreliables(client_t *client, size_t maxsize)
void Com_Error(error_type_t type, const char *fmt,...)
client_frame_t frames[UPDATE_BACKUP]
static void emit_snd(client_t *client, message_packet_t *msg)
void SV_MvdMulticast(int leafnum, multicast_t to)
static void add_msg_packet(client_t *client, byte *data, size_t len, qboolean reliable)
static void repack_unreliables(client_t *client, size_t maxsize)
void SV_CloseDownload(client_t *client)
static void write_pending_download(client_t *client)
void MSG_WriteShort(int c)
static void write_msg(client_t *client, message_packet_t *msg, size_t maxsize)
size_t message_size[RATE_MESSAGES]
void SV_DropClient(client_t *client, const char *reason)
#define SV_CLIENTSYNC(cl)
qboolean NET_SendPacket(netsrc_t sock, const void *data, size_t len, const netadr_t *to)
mleaf_t * CM_PointLeaf(cm_t *cm, vec3_t p)
static void write_datagram_new(client_t *client)
void(* AddMessage)(struct client_s *, byte *, size_t, qboolean)
void(* WriteFrame)(struct client_s *)
static void add_message_old(client_t *client, byte *data, size_t len, qboolean reliable)
size_t msg_unreliable_bytes
list_t msg_unreliable_list
message_packet_t * msg_pool
static void free_all_messages(client_t *client)
static qboolean SV_RateDrop(client_t *client)
static void write_datagram_old(client_t *client)
void SZ_Clear(sizebuf_t *buf)
static qboolean check_entity(client_t *client, int entnum)
#define FOR_EACH_MSG_SAFE(list)
char name[MAX_CLIENT_NAME]