From c97fa338792f434e0f61c3fb84f638ce31b3112d Mon Sep 17 00:00:00 2001 From: Spoike Date: Thu, 9 Aug 2018 15:50:07 +0000 Subject: [PATCH] Fix bug with previous commit. Fix loading legacy saved games. Hide the misaligned lumps warning under the developer cvar. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5289 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_parse.c | 6 ++++++ engine/gl/gl_model.c | 2 +- engine/qclib/pr_edict.c | 8 ++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index d782351a8..affaae1ad 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -5224,13 +5224,19 @@ static void CL_ParseSetInfo (void) if (cls.fteprotocolextensions2 & PEXT2_INFOBLOBS) key = InfoBuf_DecodeString(temp, temp+strlen(temp), &keysize); else + { + keysize = strlen(temp); key = Z_StrDup(temp); + } temp = MSG_ReadString(); if (cls.fteprotocolextensions2 & PEXT2_INFOBLOBS) val = InfoBuf_DecodeString(temp, temp+strlen(temp), &valsize); else + { + valsize = strlen(temp); val = Z_StrDup(temp); + } if (slot == 255) InfoBuf_SyncReceive(&cl.serverinfo, key, keysize, val, valsize, offset, final); diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 430326e39..a64ad8c24 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -5184,7 +5184,7 @@ static qboolean QDECL Mod_LoadBrushModel (model_t *mod, void *buffer, size_t fsi { //pre-phong versions of tyrutils wrote misaligned lumps. These crash on arm/etc. char *tmp; int ofs = 0; - Con_Printf(CON_WARNING"%s: Misaligned lumps detected\n", mod->name); + Con_DPrintf(CON_WARNING"%s: Misaligned lumps detected\n", mod->name); tmp = BZ_Malloc(fsize); memcpy(tmp, mod_base, fsize); for (i = 0; i < HEADER_LUMPS; i++) diff --git a/engine/qclib/pr_edict.c b/engine/qclib/pr_edict.c index 1fe630bbf..725756858 100644 --- a/engine/qclib/pr_edict.c +++ b/engine/qclib/pr_edict.c @@ -1801,9 +1801,11 @@ char *PDECL PR_SaveEnts(pubprogfuncs_t *ppf, char *buf, size_t *bufofs, size_t b //write the ents for (a = 0; a < sv_num_edicts; a++) { + char head[64]; edictrun_t *ed = (edictrun_t *)EDICT_NUM(progfuncs, a); - AddS ("{\n"); + QC_snprintfz(head, sizeof(head), "{//%i\n", a); + AddS (head); if (ed->ereftype == ER_ENTITY) //free entities write a {} with no data. the loader detects this specifically. ED_WriteEdict(progfuncs, ed, buf, bufofs, bufmax, true); @@ -2207,9 +2209,7 @@ int PDECL PR_LoadEnts(pubprogfuncs_t *ppf, const char *file, void *ctx, void (PD } else { - ed = (edictrun_t *)EDICT_NUM(progfuncs, numents); - if (!ed) - ed = ED_AllocIntoTable(progfuncs, numents, false, prinst.fields_size); + ed = ED_AllocIntoTable(progfuncs, numents, false, prinst.fields_size); if (externs->entspawn) externs->entspawn((struct edict_s *) ed, true);