diff --git a/engine/client/m_items.c b/engine/client/m_items.c index e0d8d2c42..062f794dd 100644 --- a/engine/client/m_items.c +++ b/engine/client/m_items.c @@ -1526,7 +1526,7 @@ void M_Complex_Key(int key) if (key != K_ESCAPE && key != '`') { - Cbuf_InsertText (va("bind %s \"%s\"\n", Key_KeynumToString (key), currentmenu->selecteditem->bind.command), RESTRICT_LOCAL, false); + Cbuf_InsertText (va("bind \"%s\" \"%s\"\n", Key_KeynumToString (key), currentmenu->selecteditem->bind.command), RESTRICT_LOCAL, false); } bindingactive = false; return; diff --git a/engine/common/net.h b/engine/common/net.h index 41dc62b70..478586931 100644 --- a/engine/common/net.h +++ b/engine/common/net.h @@ -169,7 +169,7 @@ typedef struct extern int net_drop; // packets dropped before this one void Netchan_Init (void); -void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate); +int Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate); void Netchan_OutOfBand (netsrc_t sock, netadr_t adr, int length, qbyte *data); void VARGS Netchan_OutOfBandPrint (netsrc_t sock, netadr_t adr, char *format, ...); void VARGS Netchan_OutOfBandTPrintf (netsrc_t sock, netadr_t adr, int language, translation_t text, ...); diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index b5c632675..06be21e36 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -349,7 +349,7 @@ transmition / retransmition of the reliable messages. A 0 length will still generate a packet and deal with the reliable messages. ================ */ -void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) +int Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) { sizebuf_t send; qbyte send_buf[MAX_OVERALLMSGLEN + PACKET_HEADER]; @@ -361,6 +361,8 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) #ifdef NQPROT if (chan->isnqprotocol) { + int sentsize = 0; + send.data = send_buf; send.maxsize = MAX_NQMSGLEN + PACKET_HEADER; send.cursize = 0; @@ -398,6 +400,7 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) NET_SendPacket (chan->sock, send.cursize, send.data, chan->remote_address); Netchan_Block(chan, send.cursize, rate); + sentsize += send.cursize; send.cursize = 0; } @@ -414,9 +417,10 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) NET_SendPacket (chan->sock, send.cursize, send.data, chan->remote_address); Netchan_Block(chan, send.cursize, rate); + sentsize += send.cursize; send.cursize = 0; } - return; + return sentsize; } #endif @@ -426,7 +430,7 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) chan->fatal_error = true; Con_TPrintf (TL_OUTMESSAGEOVERFLOW , NET_AdrToString (remote_adr, sizeof(remote_adr), chan->remote_address)); - return; + return 0; } // if the remote side dropped the last reliable message, resend it @@ -515,6 +519,8 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) , chan->incoming_reliable_sequence , send.cursize); + return send.cursize; + } /* diff --git a/engine/common/q1bsp.c b/engine/common/q1bsp.c index 62d57c43e..10aa43def 100644 --- a/engine/common/q1bsp.c +++ b/engine/common/q1bsp.c @@ -902,7 +902,7 @@ Calculates a PVS that is the inclusive or of all leafs within 8 pixels of the given point. ============= */ -void Q1BSP_FatPVS (model_t *mod, vec3_t org, qbyte *pvsbuffer, unsigned int buffersize, qboolean add) +unsigned int Q1BSP_FatPVS (model_t *mod, vec3_t org, qbyte *pvsbuffer, unsigned int buffersize, qboolean add) { unsigned int fatbytes = (mod->numleafs+31)>>3; if (fatbytes > buffersize) @@ -910,6 +910,7 @@ void Q1BSP_FatPVS (model_t *mod, vec3_t org, qbyte *pvsbuffer, unsigned int buff if (!add) Q_memset (pvsbuffer, 0, fatbytes); SV_Q1BSP_AddToFatPVS (mod, org, mod->nodes, pvsbuffer, fatbytes); + return fatbytes; } qboolean Q1BSP_EdictInFatPVS(model_t *mod, edict_t *ent, qbyte *pvs) diff --git a/engine/gl/gl_model.h b/engine/gl/gl_model.h index d4f6686cc..b4ccc8a94 100644 --- a/engine/gl/gl_model.h +++ b/engine/gl/gl_model.h @@ -420,7 +420,7 @@ void Q1BSP_Init(void); qboolean Q1BSP_Trace(struct model_s *model, int forcehullnum, int frame, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, struct trace_s *trace); qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, struct trace_s *trace); -void Q1BSP_FatPVS (struct model_s *mod, vec3_t org, qbyte *pvsbuffer, unsigned int buffersize, qboolean add); +unsigned int Q1BSP_FatPVS (struct model_s *mod, vec3_t org, qbyte *pvsbuffer, unsigned int buffersize, qboolean add); qboolean Q1BSP_EdictInFatPVS(struct model_s *mod, struct edict_s *ent, qbyte *pvs); void Q1BSP_FindTouchedLeafs(struct model_s *mod, struct edict_s *ent, float *mins, float *maxs); qbyte *Q1BSP_LeafPVS (struct model_s *model, mleaf_t *leaf, qbyte *buffer); diff --git a/engine/server/server.h b/engine/server/server.h index bf25d76e8..4e94bfaa1 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -298,6 +298,8 @@ typedef struct double senttime; float ping_time; int move_msecs; + int packetsizein; + int packetsizeout; packet_entities_t entities; //must come last (mvd states are bigger) } client_frame_t; diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index ad32481ce..cf84ac12a 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -1619,6 +1619,7 @@ qboolean SV_SendClientDatagram (client_t *client) { qbyte buf[MAX_DATAGRAM]; sizebuf_t msg; + unsigned int sentbytes, fnum; msg.data = buf; msg.maxsize = sizeof(buf); @@ -1677,8 +1678,11 @@ qboolean SV_SendClientDatagram (client_t *client) SV_DarkPlacesDownloadChunk(client, &msg); // send the datagram - Netchan_Transmit (&client->netchan, msg.cursize, buf, SV_RateForClient(client)); + fnum = client->netchan.outgoing_sequence; + sentbytes = Netchan_Transmit (&client->netchan, msg.cursize, buf, SV_RateForClient(client)); + if (client->frameunion.frames) + client->frameunion.frames[fnum & UPDATE_MASK].packetsizeout += sentbytes; return true; } @@ -1995,6 +1999,7 @@ void SV_SendClientMessages (void) { int i, j; client_t *c; + int sentbytes, fnum; float pt = sv.physicstime; #ifdef Q3SERVER @@ -2163,7 +2168,10 @@ void SV_SendClientMessages (void) else { SV_DarkPlacesDownloadChunk(c, &c->datagram); - Netchan_Transmit (&c->netchan, c->datagram.cursize, c->datagram.data, SV_RateForClient(c)); // just update reliable + fnum = c->netchan.outgoing_sequence; + sentbytes = Netchan_Transmit (&c->netchan, c->datagram.cursize, c->datagram.data, SV_RateForClient(c)); // just update reliable + if (c->frameunion.frames) + c->frameunion.frames[fnum & UPDATE_MASK].packetsizeout += sentbytes; c->datagram.cursize = 0; } diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index b70c1b49e..74d1921d4 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -3769,6 +3769,9 @@ void Cmd_FPSList_f(void) double minf = 1000, maxf = 0, this; double ftime; int frames; + int inbytes; + int outbytes; + int msecs; for (c = 0; c < sv.allocated_client_slots; c++) @@ -3776,10 +3779,15 @@ void Cmd_FPSList_f(void) cl = &svs.clients[c]; ftime = 0; frames = 0; + inbytes = 0; + outbytes = 0; if (!cl->state) continue; + if (cl->protocol != SCP_QUAKEWORLD) + continue; + if (cl->frameunion.frames) { for (f = 0; f < UPDATE_BACKUP; f++) @@ -3787,21 +3795,30 @@ void Cmd_FPSList_f(void) if (cl->frameunion.frames[f].move_msecs >= 0) { if (!cl->frameunion.frames[f].move_msecs) + { this = 1001; + msecs+=1; + } else + { this = 1000.0f/cl->frameunion.frames[f].move_msecs; + msecs += cl->frameunion.frames[f].move_msecs; + } ftime += this; if (minf > this) minf = this; if (maxf < this) maxf = this; frames++; + + inbytes += cl->frameunion.frames[f].packetsizein; + outbytes += cl->frameunion.frames[f].packetsizeout; } } } if (frames) - SV_ClientPrintf(host_client, PRINT_HIGH, "%s: %ffps (min%f max %f\n", cl->name, ftime/frames, minf, maxf); + SV_ClientPrintf(host_client, PRINT_HIGH, "%s: %ffps (min%f max %f), in: %fbps, out: %fbps\n", cl->name, ftime/frames, minf, maxf, (1000.0f*inbytes)/msecs, (1000.0f*outbytes)/msecs); else SV_ClientPrintf(host_client, PRINT_HIGH, "%s: no information available\n", cl->name); } @@ -5472,6 +5489,8 @@ void SV_ExecuteClientMessage (client_t *cl) cl->frameunion.frames[cl->netchan.outgoing_sequence & UPDATE_MASK].senttime = realtime; cl->frameunion.frames[cl->netchan.outgoing_sequence & UPDATE_MASK].ping_time = -1; cl->frameunion.frames[cl->netchan.outgoing_sequence & UPDATE_MASK].move_msecs = -1; + cl->frameunion.frames[cl->netchan.outgoing_sequence & UPDATE_MASK].packetsizein = net_message.cursize; + cl->frameunion.frames[cl->netchan.outgoing_sequence & UPDATE_MASK].packetsizeout = 0; } host_client = cl;