Enemy territory (and possibly rtcw if we didn't have that already - I dunno.. I don't have a copy!) bsp support.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@408 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-11-13 17:20:25 +00:00
parent 7e7582b734
commit 99c8a53d00

View file

@ -1565,7 +1565,7 @@ void CMod_LoadPlanes (lump_t *l)
if (count < 1) if (count < 1)
Host_Error ("Map with no planes"); Host_Error ("Map with no planes");
// need to save space for box planes // need to save space for box planes
if (count > MAX_Q2MAP_PLANES) if (count >= MAX_Q2MAP_PLANES)
Host_Error ("Map has too many planes"); Host_Error ("Map has too many planes");
out = map_planes; out = map_planes;
@ -2355,7 +2355,7 @@ continue;
out->texinfo->texture->shader = R_RegisterShader(out->texinfo->texture->name); out->texinfo->texture->shader = R_RegisterShader(out->texinfo->texture->name);
} }
if (in->fognum == -1) if (in->fognum == -1 || !map_numfogs)
out->fog = NULL; out->fog = NULL;
else else
out->fog = map_fogs + in->fognum; out->fog = map_fogs + in->fognum;
@ -3088,6 +3088,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
q2dheader_t header; q2dheader_t header;
int length; int length;
static unsigned last_checksum; static unsigned last_checksum;
qboolean nofog;
// free old stuff // free old stuff
numplanes = 0; numplanes = 0;
@ -3125,18 +3126,17 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
header.ident = LittleLong(header.ident); header.ident = LittleLong(header.ident);
header.version = LittleLong(header.version); header.version = LittleLong(header.version);
if (header.version != Q2BSPVERSION && header.version != Q3BSPVERSION)
Host_Error ("CMod_LoadBrushModel: %s has wrong version number (%i should be %i or %i)"
, name, header.version, Q2BSPVERSION, Q3BSPVERSION);
cmod_base = mod_base = (qbyte *)buf; cmod_base = mod_base = (qbyte *)buf;
switch(header.version) switch(header.version)
{ {
default: default:
Sys_Error("Bad internal renderer on q2 map load\n"); if (header.version != Q2BSPVERSION && header.version != Q3BSPVERSION)
Host_Error ("Quake 2 or Quake 3 based BSP with unknown header (%i should be %i or %i)"
, name, header.version, Q2BSPVERSION, Q3BSPVERSION);
break; break;
#if 1 #if 1
case Q3BSPVERSION+1:
case Q3BSPVERSION: case Q3BSPVERSION:
mapisq3 = true; mapisq3 = true;
loadmodel->fromgame = fg_quake3; loadmodel->fromgame = fg_quake3;
@ -3192,7 +3192,10 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
CModQ3_LoadLightgrid (&header.lumps[Q3LUMP_LIGHTGRID]); CModQ3_LoadLightgrid (&header.lumps[Q3LUMP_LIGHTGRID]);
CModQ3_LoadIndexes (&header.lumps[Q3LUMP_DRAWINDEXES]); CModQ3_LoadIndexes (&header.lumps[Q3LUMP_DRAWINDEXES]);
#ifdef Q3SHADERS #ifdef Q3SHADERS
if (header.version != Q3BSPVERSION+1)
CModQ3_LoadFogs (&header.lumps[Q3LUMP_FOGS]); CModQ3_LoadFogs (&header.lumps[Q3LUMP_FOGS]);
else
map_numfogs = 0;
#endif #endif
CModQ3_LoadRFaces (&header.lumps[Q3LUMP_SURFACES]); CModQ3_LoadRFaces (&header.lumps[Q3LUMP_SURFACES]);
CModQ3_LoadMarksurfaces (&header.lumps[Q3LUMP_LEAFSURFACES]); //fixme: duplicated loading. CModQ3_LoadMarksurfaces (&header.lumps[Q3LUMP_LEAFSURFACES]); //fixme: duplicated loading.