From 131164748eee708f310e0253a6e3d323e4dcd8a2 Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sun, 25 Aug 2024 19:20:11 +0300 Subject: [PATCH] maps: fix in load n64jam_doomshakalaka https://www.moddb.com/games/quake-2/addons/quake-2-re-release-n64-sp-map-jam --- src/client/cl_effects.c | 8 +++++--- src/client/cl_entities.c | 6 ++++-- src/client/cl_parse.c | 8 +++++--- src/common/cmodels.c | 2 +- src/common/header/shared.h | 2 +- src/common/movemsg.c | 3 ++- src/server/sv_init.c | 5 +++++ 7 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/client/cl_effects.c b/src/client/cl_effects.c index b36516cc..f59471ef 100644 --- a/src/client/cl_effects.c +++ b/src/client/cl_effects.c @@ -54,7 +54,8 @@ CL_AddMuzzleFlash(void) if ((i < 1) || (i >= MAX_EDICTS)) { - Com_Error(ERR_DROP, "CL_AddMuzzleFlash: bad entity"); + Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n", + __func__, i, MAX_EDICTS); } weapon = MSG_ReadByte(&net_message); @@ -334,14 +335,15 @@ CL_AddMuzzleFlash2(void) if ((ent < 1) || (ent >= MAX_EDICTS)) { - Com_Error(ERR_DROP, "CL_AddMuzzleFlash2: bad entity"); + Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n", + __func__, ent, MAX_EDICTS); } flash_number = MSG_ReadByte(&net_message); if (flash_number > 210) { - Com_DPrintf("CL_AddMuzzleFlash2: bad offset"); + Com_DPrintf("%s: bad offset\n", __func__); return; } diff --git a/src/client/cl_entities.c b/src/client/cl_entities.c index e951cea4..9808148c 100644 --- a/src/client/cl_entities.c +++ b/src/client/cl_entities.c @@ -864,7 +864,8 @@ CL_GetEntitySoundOrigin(int ent, vec3_t org) if ((ent < 0) || (ent >= MAX_EDICTS)) { - Com_Error(ERR_DROP, "CL_GetEntitySoundOrigin: bad ent"); + Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n", + __func__, ent, MAX_EDICTS); } old = &cl_entities[ent]; @@ -881,7 +882,8 @@ CL_GetEntitySoundVelocity(int ent, vec3_t vel) if ((ent < 0) || (ent >= MAX_EDICTS)) { - Com_Error(ERR_DROP, "CL_GetEntitySoundVelocity: bad ent"); + Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n", + __func__, ent, MAX_EDICTS); } old = &cl_entities[ent]; diff --git a/src/client/cl_parse.c b/src/client/cl_parse.c index 2f7de6f5..ae6efabe 100644 --- a/src/client/cl_parse.c +++ b/src/client/cl_parse.c @@ -402,12 +402,13 @@ CL_ParsePacketEntities(frame_t *oldframe, frame_t *newframe) if (newnum >= MAX_EDICTS) { - Com_Error(ERR_DROP, "CL_ParsePacketEntities: bad number:%i", newnum); + Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n", + __func__, newnum, MAX_EDICTS); } if (net_message.readcount > net_message.cursize) { - Com_Error(ERR_DROP, "CL_ParsePacketEntities: end of message"); + Com_Error(ERR_DROP, "%s: end of message", __func__); } if (!newnum) @@ -1288,7 +1289,8 @@ CL_ParseStartSoundPacket(void) if (ent > MAX_EDICTS) { - Com_Error(ERR_DROP, "CL_ParseStartSoundPacket: ent = %i", ent); + Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n", + __func__, ent, MAX_EDICTS); } channel &= 7; diff --git a/src/common/cmodels.c b/src/common/cmodels.c index 1576bc44..e235d0bd 100644 --- a/src/common/cmodels.c +++ b/src/common/cmodels.c @@ -69,7 +69,7 @@ Mod_LoadVisibility(const char *name, dvis_t **vis, int *numvisibility, if (!l->filelen) { - Com_Printf("%s: Map %s has too small visibility lump", + Com_Printf("%s: Map %s has too small visibility lump\n", __func__, name); *vis = NULL; return; diff --git a/src/common/header/shared.h b/src/common/header/shared.h index 5aa63764..ba111eff 100644 --- a/src/common/header/shared.h +++ b/src/common/header/shared.h @@ -171,7 +171,7 @@ typedef unsigned char byte; /* per-level limits */ #define MAX_CLIENTS 256 /* absolute limit */ -#define MAX_EDICTS 1024 /* must change protocol to increase more */ +#define MAX_EDICTS 2048 /* must change protocol to increase more */ #define MAX_LIGHTSTYLES 256 #define MAX_MODELS 512 /* these are sent over the net as bytes */ #define MAX_SOUNDS 512 /* so they cannot be blindly increased */ diff --git a/src/common/movemsg.c b/src/common/movemsg.c index fd312c29..d425b793 100644 --- a/src/common/movemsg.c +++ b/src/common/movemsg.c @@ -445,7 +445,8 @@ MSG_WriteDeltaEntity(entity_state_t *from, if (to->number >= MAX_EDICTS) { - Com_Error(ERR_FATAL, "Entity number >= MAX_EDICTS"); + Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n", + __func__, to->number, MAX_EDICTS); } /* send an update */ diff --git a/src/server/sv_init.c b/src/server/sv_init.c index 3a4bedde..5f7780d2 100644 --- a/src/server/sv_init.c +++ b/src/server/sv_init.c @@ -124,6 +124,11 @@ SV_CreateBaseline(void) /* take current state as baseline */ VectorCopy(svent->s.origin, svent->s.old_origin); + if (entnum >= MAX_EDICTS) + { + Com_Error(ERR_DROP, "%s: bad entity %d >= %d\n", + __func__, entnum, MAX_EDICTS); + } sv.baselines[entnum] = svent->s; } }