keep track of map load errors

Collect warnings during load_world() and issue a warning at the end. Most,
but not all warnings already printed a message - which usually scrolls out
of the console quite fast.

The collected value is also given back by the loadmap command, which
allows batch editing scripts for maps stop at problematic maps.

Mapsound errors are not detected, if soundvol is zero. Missing textures are
not flagged, if notexture is set.

The error code is ored together from those elements:

0x0000001  entity attribute overflow
  One or more map entities had attribute values, that are no longer
  supported with map format 10. Rework manually.

0x0000010  map decoder error
  Indicates a damaged map file.

0x0000100  world error -1
  Map is completely solid. Very funny.

0x0000200  world error -2
  Map border is not solid. Fix manually.

0x0001000  missing skymap texture files
0x0002000  missing world texture files (only if no notexture is set)
0x0004000  missing mapmodel files
0x0008000  missing mapsound files

0x0010000  bad mapsound command in map config
0x0020000  bad mapmodel command in map config
0x0040000  bad texture command in map config
0x0080000  bad loadnotexture command in map config

0x0100000  error during loading of mapmodels (see earlier console output)

0x1000000  out of range integer value in map config (for example, "fog 0")
0x2000000  out of range float value in map config
0x4000000  generic cubescript error in map config

The command loadmap is now also available for non-debug builds.

DOCREF loadmap
This commit is contained in:
ac-stef
2016-08-30 20:56:58 +02:00
parent 9c964d95b4
commit 1310516c14
10 changed files with 109 additions and 65 deletions
+16 -6
View File
@@ -11,7 +11,7 @@ mapmodelattributes loadingattributes;
#include "md2.h"
#include "md3.h"
#define checkmdl if(!loadingmodel) { conoutf("not loading a model"); return; }
#define checkmdl if(!loadingmodel) { conoutf("not loading a model"); flagmapconfigerror(LWW_MODELERR); return; }
void mdlcullface(int *cullface)
{
@@ -119,7 +119,11 @@ void mapmodel(int *rad, int *h, int *zoff, char *scale, char *name)
mmi.h = *h;
mmi.zoff = *zoff;
mmi.scale = atof(scale);
if(mmi.scale < 0.25f || mmi.scale > 4.0f) mmi.scale = 1.0f;
if(mmi.scale < 0.25f || mmi.scale > 4.0f)
{
mmi.scale = 1.0f;
if(strcmp(scale, "0")) flagmapconfigerror(LWW_CONFIGERR * 2);
}
mmi.m = NULL;
filtertext(name, name, FTXT__MEDIAFILEPATH);
@@ -382,7 +386,11 @@ model *loadmodel(const char *name, int i, bool trydl) // load model by name
{
mdllookup.access(m->name(), m);
setmodelattributes(m->name(), loadingattributes);
if(m->shadowdist && !m->cullface) conoutf("\f3mapmodel config error: disabling face culling in combination with shadows will cause visual errors (%s)", m->name());
if(m->shadowdist && !m->cullface)
{
conoutf("\f3mapmodel config error: disabling face culling in combination with shadows will cause visual errors (%s)", m->name());
flagmapconfigerror(LWW_MODELERR);
}
}
loadingmodel = NULL;
}
@@ -896,15 +904,17 @@ void preload_entmodels()
}
}
void preload_mapmodels(bool trydl)
bool preload_mapmodels(bool trydl)
{
int missing = 0;
loopv(ents)
{
entity &e = ents[i];
if(e.type!=MAPMODEL || !mapmodels.inrange(e.attr2)) continue;
loadmodel(NULL, e.attr2, trydl);
if(e.attr4) lookuptexture(e.attr4, notexture, trydl);
if(!loadmodel(NULL, e.attr2, trydl)) missing++;
if(e.attr4 && lookuptexture(e.attr4, notexture, trydl) == notexture) missing++;
}
return !missing;
}
inline void renderhboxpart(playerent *d, vec top, vec bottom, vec up)