mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-03-14 23:12:41 +00:00
renders: validate count of clusters in visibility lump
This commit is contained in:
parent
14a832c710
commit
a21e1f27ed
12 changed files with 52 additions and 12 deletions
|
@ -705,7 +705,7 @@ Mod_LoadQBSPMarksurfaces(const char *name, msurface_t ***marksurfaces, unsigned
|
|||
void
|
||||
Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
||||
msurface_t **marksurfaces, unsigned int nummarksurfaces,
|
||||
const byte *mod_base, const lump_t *l)
|
||||
int *numclusters, const byte *mod_base, const lump_t *l)
|
||||
{
|
||||
dqleaf_t *in;
|
||||
mleaf_t *out;
|
||||
|
@ -724,6 +724,7 @@ Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
|||
|
||||
*leafs = out;
|
||||
*numleafs = count;
|
||||
*numclusters = 0;
|
||||
|
||||
for (i = 0; i < count; i++, in++, out++)
|
||||
{
|
||||
|
@ -748,6 +749,11 @@ Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
|||
Com_Error(ERR_DROP, "%s: wrong marksurfaces position in %s",
|
||||
__func__, name);
|
||||
}
|
||||
|
||||
if (out->cluster >= *numclusters)
|
||||
{
|
||||
*numclusters = out->cluster + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -374,13 +374,19 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
|
|||
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
||||
&header->lumps[LUMP_VISIBILITY]);
|
||||
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
||||
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
||||
&header->lumps[LUMP_LEAFS]);
|
||||
mod->marksurfaces, mod->nummarksurfaces, &mod->numclusters,
|
||||
mod_base, &header->lumps[LUMP_LEAFS]);
|
||||
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
||||
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
||||
&header->lumps[LUMP_NODES], header->ident);
|
||||
Mod_LoadSubmodels(mod, mod_base, &header->lumps[LUMP_MODELS]);
|
||||
mod->numframes = 2; /* regular and alternate animation */
|
||||
|
||||
if (mod->vis && mod->numclusters != mod->vis->numclusters)
|
||||
{
|
||||
Com_Error(ERR_DROP, "%s: Map %s has incorrect number of clusters %d != %d",
|
||||
__func__, mod->name, mod->numclusters, mod->vis->numclusters);
|
||||
}
|
||||
}
|
||||
|
||||
/* Temporary solution, need to use load file dirrectly */
|
||||
|
|
|
@ -84,6 +84,7 @@ typedef struct model_s
|
|||
msurface_t **marksurfaces;
|
||||
|
||||
int numvisibility;
|
||||
int numclusters;
|
||||
dvis_t *vis;
|
||||
|
||||
byte *lightdata;
|
||||
|
|
|
@ -375,13 +375,19 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
|
|||
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
||||
&header->lumps[LUMP_VISIBILITY]);
|
||||
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
||||
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
||||
&header->lumps[LUMP_LEAFS]);
|
||||
mod->marksurfaces, mod->nummarksurfaces, &mod->numclusters,
|
||||
mod_base, &header->lumps[LUMP_LEAFS]);
|
||||
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
||||
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
||||
&header->lumps[LUMP_NODES], header->ident);
|
||||
Mod_LoadSubmodels(mod, mod_base, &header->lumps[LUMP_MODELS]);
|
||||
mod->numframes = 2; /* regular and alternate animation */
|
||||
|
||||
if (mod->vis && mod->numclusters != mod->vis->numclusters)
|
||||
{
|
||||
Com_Error(ERR_DROP, "%s: Map %s has incorrect number of clusters %d != %d",
|
||||
__func__, mod->name, mod->numclusters, mod->vis->numclusters);
|
||||
}
|
||||
}
|
||||
|
||||
/* Temporary solution, need to use load file dirrectly */
|
||||
|
|
|
@ -95,6 +95,7 @@ typedef struct model_s
|
|||
msurface_t **marksurfaces;
|
||||
|
||||
int numvisibility;
|
||||
int numclusters;
|
||||
dvis_t *vis;
|
||||
|
||||
byte *lightdata;
|
||||
|
|
|
@ -375,13 +375,19 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
|
|||
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
||||
&header->lumps[LUMP_VISIBILITY]);
|
||||
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
||||
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
||||
&header->lumps[LUMP_LEAFS]);
|
||||
mod->marksurfaces, mod->nummarksurfaces, &mod->numclusters,
|
||||
mod_base, &header->lumps[LUMP_LEAFS]);
|
||||
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
||||
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
||||
&header->lumps[LUMP_NODES], header->ident);
|
||||
Mod_LoadSubmodels(mod, mod_base, &header->lumps[LUMP_MODELS]);
|
||||
mod->numframes = 2; /* regular and alternate animation */
|
||||
|
||||
if (mod->vis && mod->numclusters != mod->vis->numclusters)
|
||||
{
|
||||
Com_Error(ERR_DROP, "%s: Map %s has incorrect number of clusters %d != %d",
|
||||
__func__, mod->name, mod->numclusters, mod->vis->numclusters);
|
||||
}
|
||||
}
|
||||
|
||||
/* Temporary solution, need to use load file dirrectly */
|
||||
|
|
|
@ -95,6 +95,7 @@ typedef struct model_s
|
|||
msurface_t **marksurfaces;
|
||||
|
||||
int numvisibility;
|
||||
int numclusters;
|
||||
dvis_t *vis;
|
||||
|
||||
byte *lightdata;
|
||||
|
|
|
@ -340,7 +340,7 @@ extern void Mod_LoadQBSPNodes(const char *name, cplane_t *planes, int numplanes,
|
|||
const byte *mod_base, const lump_t *l, int ident);
|
||||
extern void Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
||||
msurface_t **marksurfaces, unsigned int nummarksurfaces,
|
||||
const byte *mod_base, const lump_t *l);
|
||||
int *numclusters, const byte *mod_base, const lump_t *l);
|
||||
extern void Mod_LoadQBSPEdges(const char *name, medge_t **edges, int *numedges,
|
||||
const byte *mod_base, const lump_t *l);
|
||||
extern void Mod_LoadVertexes(const char *name, mvertex_t **vertexes, int *numvertexes,
|
||||
|
|
|
@ -108,6 +108,7 @@ typedef struct model_s
|
|||
msurface_t **marksurfaces;
|
||||
|
||||
int numvisibility;
|
||||
int numclusters;
|
||||
dvis_t *vis;
|
||||
|
||||
byte *lightdata;
|
||||
|
|
|
@ -380,14 +380,19 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
|
|||
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
||||
&header->lumps[LUMP_VISIBILITY]);
|
||||
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
||||
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
||||
&header->lumps[LUMP_LEAFS]);
|
||||
mod->marksurfaces, mod->nummarksurfaces, &mod->numclusters,
|
||||
mod_base, &header->lumps[LUMP_LEAFS]);
|
||||
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
||||
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
||||
&header->lumps[LUMP_NODES], header->ident);
|
||||
Mod_LoadSubmodels(mod, mod_base, &header->lumps[LUMP_MODELS]);
|
||||
mod->numframes = 2; /* regular and alternate animation */
|
||||
|
||||
if (mod->vis && mod->numclusters != mod->vis->numclusters)
|
||||
{
|
||||
Com_Error(ERR_DROP, "%s: Map %s has incorrect number of clusters %d != %d",
|
||||
__func__, mod->name, mod->numclusters, mod->vis->numclusters);
|
||||
}
|
||||
R_InitSkyBox(mod);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ typedef struct model_s
|
|||
msurface_t **marksurfaces;
|
||||
|
||||
int numvisibility;
|
||||
int numclusters;
|
||||
dvis_t *vis;
|
||||
|
||||
byte *lightdata;
|
||||
|
|
|
@ -348,13 +348,19 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
|
|||
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
||||
&header->lumps[LUMP_VISIBILITY]);
|
||||
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
||||
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
||||
&header->lumps[LUMP_LEAFS]);
|
||||
mod->marksurfaces, mod->nummarksurfaces, &mod->numclusters,
|
||||
mod_base, &header->lumps[LUMP_LEAFS]);
|
||||
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
||||
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
||||
&header->lumps[LUMP_NODES], header->ident);
|
||||
Mod_LoadSubmodels(mod, mod_base, &header->lumps[LUMP_MODELS]);
|
||||
mod->numframes = 2; /* regular and alternate animation */
|
||||
|
||||
if (mod->vis && mod->numclusters != mod->vis->numclusters)
|
||||
{
|
||||
Com_Error(ERR_DROP, "%s: Map %s has incorrect number of clusters %d != %d",
|
||||
__func__, mod->name, mod->numclusters, mod->vis->numclusters);
|
||||
}
|
||||
}
|
||||
|
||||
/* Temporary solution, need to use load file dirrectly */
|
||||
|
|
Loading…
Reference in a new issue