Versioned map entity patches

This commit is contained in:
Andrei Drexler 2021-08-29 14:55:10 +03:00 committed by Ozkan Sezer
parent 7d01a1cc11
commit 5ae076ea2d
9 changed files with 24 additions and 10 deletions

View file

@ -1,10 +1,10 @@
INPUT := gfx/conback.lmp \ INPUT := gfx/conback.lmp \
maps/e1m1.ent \ maps/e1m1@c49d.ent \
maps/e1m2.ent \ maps/e1m2@0caa.ent \
maps/e1m4.ent \ maps/e1m4@958e.ent \
maps/e2m2.ent \ maps/e2m2@fbfe.ent \
maps/e2m3.ent \ maps/e2m3@237a.ent \
maps/e2m7.ent \ maps/e2m7@10a8.ent \
default.cfg default.cfg
OUTPUT := quakespasm.pak OUTPUT := quakespasm.pak

View file

@ -796,20 +796,34 @@ Mod_LoadEntities
*/ */
void Mod_LoadEntities (lump_t *l) void Mod_LoadEntities (lump_t *l)
{ {
char basemapname[MAX_QPATH];
char entfilename[MAX_QPATH]; char entfilename[MAX_QPATH];
char *ents; char *ents;
int mark; int mark;
unsigned int path_id; unsigned int path_id;
unsigned int crc = 0;
if (! external_ents.value) if (! external_ents.value)
goto _load_embedded; goto _load_embedded;
q_strlcpy(entfilename, loadmodel->name, sizeof(entfilename)); if (l->filelen > 0)
COM_StripExtension(entfilename, entfilename, sizeof(entfilename)); crc = CRC_Block(mod_base + l->fileofs, l->filelen);
q_strlcat(entfilename, ".ent", sizeof(entfilename));
Con_DPrintf2("trying to load %s\n", entfilename);
mark = Hunk_LowMark(); mark = Hunk_LowMark();
q_strlcpy(basemapname, loadmodel->name, sizeof(basemapname));
COM_StripExtension(basemapname, basemapname, sizeof(basemapname));
q_snprintf(entfilename, sizeof(entfilename), "%s@%04x.ent", basemapname, crc);
Con_DPrintf2("trying to load %s\n", entfilename);
ents = (char *) COM_LoadHunkFile (entfilename, &path_id); ents = (char *) COM_LoadHunkFile (entfilename, &path_id);
if (!ents)
{
q_snprintf(entfilename, sizeof(entfilename), "%s.ent", basemapname);
Con_DPrintf2("trying to load %s\n", entfilename);
ents = (char *) COM_LoadHunkFile (entfilename, &path_id);
}
if (ents) if (ents)
{ {
// use ent file only from the same gamedir as the map // use ent file only from the same gamedir as the map

Binary file not shown.