if (a != 14)
{
Mem_Free(lightsstring);
- Host_Error("invalid lights file, found %d parameters on line %i, should be 13 parameters (origin[0] origin[1] origin[2] falloff light[0] light[1] light[2] subtract spotdir[0] spotdir[1] spotdir[2] spotcone style)\n", a, n + 1);
+ Host_Error("invalid lights file, found %d parameters on line %i, should be 14 parameters (origin[0] origin[1] origin[2] falloff light[0] light[1] light[2] subtract spotdir[0] spotdir[1] spotdir[2] spotcone distancebias style)\n", a, n + 1);
}
s++;
n++;
}
// used only for HalfLife maps
-void Mod_ParseWadsFromEntityLump(char *data)
+void Mod_ParseWadsFromEntityLump(const char *data)
{
char key[128], value[4096];
char wadname[128];
int i, j, k;
if (!data)
return;
- data = COM_Parse(data);
- if (!data)
+ if (!COM_ParseToken(&data))
return; // error
if (com_token[0] != '{')
return; // error
while (1)
{
- data = COM_Parse(data);
- if (!data)
+ if (!COM_ParseToken(&data))
return; // error
if (com_token[0] == '}')
break; // end of worldspawn
strcpy(key, com_token);
while (key[strlen(key)-1] == ' ') // remove trailing spaces
key[strlen(key)-1] = 0;
- data = COM_Parse(data);
- if (!data)
+ if (!COM_ParseToken(&data))
return; // error
strcpy(value, com_token);
if (!strcmp("wad", key)) // for HalfLife maps
loadmodel->surfaces = out;
loadmodel->numsurfaces = count;
+ loadmodel->surfacevisframes = Mem_Alloc(loadmodel->mempool, count * sizeof(int));
+ loadmodel->surfacepvsframes = Mem_Alloc(loadmodel->mempool, count * sizeof(int));
for (surfnum = 0;surfnum < count;surfnum++, in++, out++)
{
+ out->number = surfnum;
// FIXME: validate edges, texinfo, etc?
out->firstedge = LittleLong(in->firstedge);
out->numedges = LittleShort(in->numedges);
// force lightmap upload on first time seeing the surface
out->cached_dlight = true;
- out->cached_ambient = -1000;
- out->cached_lightscalebit = -1000;
CalcSurfaceExtents (out);
*/
static void Mod_LoadMarksurfaces (lump_t *l)
{
- int i, j;
- short *in;
+ int i, j;
+ short *in;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
loadmodel->nummarksurfaces = l->filelen / sizeof(*in);
- loadmodel->marksurfaces = Mem_Alloc(loadmodel->mempool, loadmodel->nummarksurfaces * sizeof(msurface_t *));
+ loadmodel->marksurfaces = Mem_Alloc(loadmodel->mempool, loadmodel->nummarksurfaces * sizeof(int));
for (i = 0;i < loadmodel->nummarksurfaces;i++)
{
j = (unsigned) LittleShort(in[i]);
if (j >= loadmodel->numsurfaces)
Host_Error ("Mod_ParseMarksurfaces: bad surface number");
- loadmodel->marksurfaces[i] = loadmodel->surfaces + j;
+ loadmodel->marksurfaces[i] = j;
}
}
mod->yawmaxs[2] = mod->normalmaxs[2];
mod->rotatedmins[0] = mod->rotatedmins[1] = mod->rotatedmins[2] = -modelradius;
mod->rotatedmaxs[0] = mod->rotatedmaxs[1] = mod->rotatedmaxs[2] = modelradius;
+ mod->radius = modelradius;
+ mod->radius2 = modelradius * modelradius;
// LordHavoc: check for empty submodels (lacrima.bsp has such a glitch)
if (mod->normalmins[0] > mod->normalmaxs[0] || mod->normalmins[1] > mod->normalmaxs[1] || mod->normalmins[2] > mod->normalmaxs[2])
{
VectorClear(mod->yawmaxs);
VectorClear(mod->rotatedmins);
VectorClear(mod->rotatedmaxs);
+ mod->radius = 0;
+ mod->radius2 = 0;
}
mod->numleafs = bm->visleafs;
mod->Draw = R_DrawBrushModelNormal;
- mod->DrawShadow = NULL;
+ mod->DrawFakeShadow = NULL;
// LordHavoc: only register submodels if it is the world
// (prevents bsp models from replacing world submodels)