From ef33b9754b538387b3227b5f541b84721f287dad Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 17 Oct 2002 16:03:18 +0000 Subject: [PATCH] support as many packet entities in demos as qwex does (ie, 196). Makes me wonder if I should make the server support sending 196 packet entities to qf clients. --- qw/include/protocol.h | 3 ++- qw/include/sv_demo.h | 2 -- qw/source/cl_ents.c | 12 ++++++------ qw/source/cl_main.c | 2 +- qw/source/sv_ents.c | 7 +++++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/qw/include/protocol.h b/qw/include/protocol.h index 75741245c..fb8273b2f 100644 --- a/qw/include/protocol.h +++ b/qw/include/protocol.h @@ -293,7 +293,8 @@ typedef struct } entity_state_t; -#define MAX_PACKET_ENTITIES 64 // doesn't count nails +#define MAX_PACKET_ENTITIES 64 // doesn't count nails +#define MAX_DEMO_PACKET_ENTITIES 196 // doesn't count nails typedef struct { int num_entities; diff --git a/qw/include/sv_demo.h b/qw/include/sv_demo.h index a88933c1f..0e4ee4a9c 100644 --- a/qw/include/sv_demo.h +++ b/qw/include/sv_demo.h @@ -26,8 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "server.h" -#define MAX_DEMO_PACKET_ENTITIES 64 - typedef struct { byte *data; int start, end, last; diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index db30e6df8..eddb388f0 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -337,9 +337,9 @@ CL_ParsePacketEntities (qboolean delta) if (!word) { // copy rest of ents from old packet while (oldindex < oldp->num_entities) { - if (newindex >= MAX_PACKET_ENTITIES) + if (newindex >= MAX_DEMO_PACKET_ENTITIES) Host_Error ("CL_ParsePacketEntities: newindex == " - "MAX_PACKET_ENTITIES"); + "MAX_DEMO_PACKET_ENTITIES"); newp->entities[newindex] = oldp->entities[oldindex]; newindex++; oldindex++; @@ -357,9 +357,9 @@ CL_ParsePacketEntities (qboolean delta) return; } // copy one of the old entities over to the new packet unchanged - if (newindex >= MAX_PACKET_ENTITIES) + if (newindex >= MAX_DEMO_PACKET_ENTITIES) Host_Error ("CL_ParsePacketEntities: newindex == " - "MAX_PACKET_ENTITIES"); + "MAX_DEMO_PACKET_ENTITIES"); newp->entities[newindex] = oldp->entities[oldindex]; newindex++; oldindex++; @@ -378,9 +378,9 @@ CL_ParsePacketEntities (qboolean delta) continue; } - if (newindex >= MAX_PACKET_ENTITIES) + if (newindex >= MAX_DEMO_PACKET_ENTITIES) Host_Error ("CL_ParsePacketEntities: newindex == " - "MAX_PACKET_ENTITIES"); + "MAX_DEMO_PACKET_ENTITIES"); CL_ParseDelta (&cl_baselines[newnum], &newp->entities[newindex], word); newindex++; diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 0c72a0db0..42a90e5f1 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -184,7 +184,7 @@ static int cl_usleep_cache; client_static_t cls; client_state_t cl; -entity_state_t cl_entities[UPDATE_BACKUP][MAX_PACKET_ENTITIES]; +entity_state_t cl_entities[UPDATE_BACKUP][MAX_DEMO_PACKET_ENTITIES]; entity_state_t cl_baselines[MAX_EDICTS]; efrag_t cl_efrags[MAX_EFRAGS]; diff --git a/qw/source/sv_ents.c b/qw/source/sv_ents.c index df74f73b5..e19f997cc 100644 --- a/qw/source/sv_ents.c +++ b/qw/source/sv_ents.c @@ -615,6 +615,7 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean recorder) { byte *pvs; int e, i, num_edicts, mpe_moaned = 0; + int max_packet_entities = MAX_PACKET_ENTITIES; vec3_t org; client_frame_t *frame; edict_t *clent, *ent; @@ -633,6 +634,8 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean recorder) } else { client_t *cl; + max_packet_entities = MAX_DEMO_PACKET_ENTITIES; + for (i=0, cl = svs.clients; istate != cs_spawned) continue; @@ -686,9 +689,9 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean recorder) continue; // added to the special update list // add to the packetentities - if (pack->num_entities == MAX_PACKET_ENTITIES) { + if (pack->num_entities == max_packet_entities) { if (!mpe_moaned) { - Con_DPrintf ("hit MAX_PACKET_ENTITIES for client %d\n", + Con_DPrintf ("hit max_packet_entities for client %d\n", client->userid); mpe_moaned = 1; }