From 5af661ddeb979d185f51d1e88dc0bbf63e914980 Mon Sep 17 00:00:00 2001 From: ac-stef Date: Tue, 1 Nov 2016 00:39:06 +0100 Subject: [PATCH] debug switch to filter out some load_world errors do not flag some map config errors that can be fixed by search&replace (for use in map conversion scripts only) --- source/src/protos.h | 1 + source/src/rendermodel.cpp | 4 ++-- source/src/texture.cpp | 2 +- source/src/worldio.cpp | 4 +++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/src/protos.h b/source/src/protos.h index 15f133c4..e9537b6d 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -828,6 +828,7 @@ extern void render_particles(int time, int typemask = ~0); enum { LWW_ENTATTROVERFLOW = 0x1, LWW_DECODEERR = 0x10, LWW_WORLDERROR = 0x100, LWW_MISSINGMEDIA = 0x1000, LWW_CONFIGERR = 0x10000, LWW_MODELERR = 0x100000, LWW_SCRIPTERR = 0x1000000 }; extern const char *setnames(const char *name); extern void save_world(char *mname, bool skipoptimise = false, bool addcomfort = false); +extern int _ignoreillegalpaths; extern int load_world(char *mname); extern void writemap(char *name, int size, uchar *data); extern void writecfggz(char *name, int size, int sizegz, uchar *data); diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 771b0c1b..4efa258a 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -113,7 +113,7 @@ void mapmodel(int *rad, int *h, int *zoff, char *scale, char *name, char *flags) { if(*scale && *name) // ignore "mapmodel" commands with insufficient parameters { - if(!strchr(name, '/') && !strchr(name, '\\')) flagmapconfigerror(LWW_CONFIGERR * 2); // throw errors for unconverted mapmodels (unspecific, because not all get detected) + if(!_ignoreillegalpaths && !strchr(name, '/') && !strchr(name, '\\')) flagmapconfigerror(LWW_CONFIGERR * 2); // throw errors for unconverted mapmodels (unspecific, because not all get detected) intret(mapmodels.length()); mapmodelinfo &mmi = mapmodels.add(); mmi.rad = *rad; @@ -959,7 +959,7 @@ bool preload_mapmodels(bool trydl) entity &e = ents[i]; if(e.type!=MAPMODEL || !mapmodels.inrange(e.attr2)) continue; mapmodels[ents[i].attr2].flags |= MMF_TEMP_USED; - if(e.attr4 && lookuptexture(e.attr4, notexture, trydl) == notexture) missing++; + if(e.attr4 && lookuptexture(e.attr4, notexture, trydl) == notexture && (!_ignoreillegalpaths || gettextureslot(e.attr4))) missing++; } loopv(mapmodels) if((mapmodels[i].flags & (MMF_REQUIRED | MMF_TEMP_USED)) && !loadmodel(NULL, i, trydl)) missing++; return !missing; diff --git a/source/src/texture.cpp b/source/src/texture.cpp index 64420cda..f5bc7891 100644 --- a/source/src/texture.cpp +++ b/source/src/texture.cpp @@ -502,7 +502,7 @@ void checktexturefilename(const char *name) if(execcontext == IEXC_MAPCFG && strstr(name, "map_editor")) { conoutf("\f3bad texture: %s", name); - flagmapconfigerror(LWW_CONFIGERR * 4); + if(!_ignoreillegalpaths) flagmapconfigerror(LWW_CONFIGERR * 4); } } diff --git a/source/src/worldio.cpp b/source/src/worldio.cpp index b40f56d5..f0de5d50 100644 --- a/source/src/worldio.cpp +++ b/source/src/worldio.cpp @@ -790,6 +790,7 @@ void changemapflag(int val, int mask) VARF(mapoverride_nowaterreflect, 0, 0, 1, changemapflag(mapoverride_nowaterreflect, MHF_DISABLEWATERREFLECT)); VARF(mapoverride_limitwaveheight, 0, 0, 1, changemapflag(mapoverride_limitwaveheight, MHF_LIMITWATERWAVEHEIGHT)); VARF(mapoverride_nostencilshadows, 0, 0, 1, changemapflag(mapoverride_nostencilshadows, MHF_DISABLESTENCILSHADOWS)); +VAR(_ignoreillegalpaths, 0, 0, 1); extern char *mlayout; extern int Mv, Ma, Hhits; @@ -934,6 +935,7 @@ int load_world(char *mname) // still supports all map formats that have e rawcubes.addbuf(q); if(q.len < cubicsize) break; } + delete f; ucharbuf uf(rawcubes.getbuf(), rawcubes.length()); res |= rldecodecubes(uf, world, cubicsize, hdr.version, false) ? 0 : LWW_DECODEERR; // decode file c2skeepalive(); @@ -1026,7 +1028,7 @@ int load_world(char *mname) // still supports all map formats that have e res |= loadskymap(true) ? 0 : LWW_MISSINGMEDIA * 1; watch.start(); - loopi(256) if(texuse[i] && lookupworldtexture(i, false) == notexture) res |= LWW_MISSINGMEDIA * 2; + loopi(256) if(texuse[i] && lookupworldtexture(i, false) == notexture && (!_ignoreillegalpaths || gettextureslot(i))) res |= LWW_MISSINGMEDIA * 2; clientlogf("loaded textures (%d milliseconds)", texloadtime+watch.elapsed()); c2skeepalive(); watch.start();