Quake II RTX doxygen
1.0 dev
|
|
Go to the documentation of this file.
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);
73 total = total *
sv.framediv / client->framediv;
76 if (total > client->
rate) {
77 SV_DPrintf(0,
"Frame %d suppressed for %s (total = %"PRIz
")\n",
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);
157 char string[MAX_STRING_CHARS];
161 va_start(argptr, fmt);
162 len =
Q_vsnprintf(
string,
sizeof(
string), fmt, argptr);
165 if (len >=
sizeof(
string)) {
166 Com_WPrintf(
"%s: overflow\n", __func__);
172 MSG_WriteData(
string, len + 1);
177 if (level < client->messagelevel)
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);
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);
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))
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);
401 SV_DPrintf(1,
"Added %sreliable message to %s: %"PRIz
" bytes\n",
431 List_Remove(&
msg->entry);
435 Com_Error(ERR_FATAL,
"%s: bad packet size", __func__);
444 #define FOR_EACH_MSG_SAFE(list) \
445 LIST_FOR_EACH_SAFE(message_packet_t, msg, next, list, entry)
446 #define MSG_FIRST(list) \
447 LIST_FIRST(message_packet_t, list, entry)
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;
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++) {
574 List_Remove(&
msg->entry);
582 MSG_WriteData(
msg->data,
msg->cursize);
609 size_t len, qboolean reliable)
611 if (len > client->
netchan->maxpacketlen) {
615 Com_DPrintf(
"Dumped oversize unreliable for %s\n", client->
name);
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);
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) {
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",
777 size_t len, qboolean reliable)
781 SZ_Write(&client->
netchan->message, data, len);
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--) {
857 #if (defined _DEBUG) && USE_FPS
858 static void check_key_sync(
client_t *client)
860 int div =
sv.framediv / client->framediv;
862 int key2 = !(client->
framenum % div);
866 "[%d] frame %d for %s not synced (%d != %d)\n",
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) {
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;
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);
1054 if (newcl->
netchan->type == NETCHAN_NEW) {
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)
void SV_BroadcastCommand(const char *fmt,...)
static qboolean compress_message(client_t *client, int flags)
void SV_ShutdownClientSend(client_t *client)
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)
void SV_SendClientMessages(void)
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_Multicast(vec3_t origin, multicast_t to)
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,...)
void SV_SendAsyncPackets(void)
void SV_FlushRedirect(int redirected, char *outputbuf, size_t len)
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)
char sv_outputbuf[SV_OUTPUTBUF_LENGTH]
static void repack_unreliables(client_t *client, size_t maxsize)
void SV_ClientCommand(client_t *client, const char *fmt,...)
void SV_CloseDownload(client_t *client)
void Com_LPrintf(print_type_t type, const char *fmt,...)
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_OUTPUTBUF_LENGTH
void SV_BroadcastPrintf(int level, const char *fmt,...)
#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)
void SV_ClientPrintf(client_t *client, int level, const char *fmt,...)
size_t msg_unreliable_bytes
list_t msg_unreliable_list
message_packet_t * msg_pool
static void free_all_messages(client_t *client)
void SV_InitClientSend(client_t *newcl)
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]