mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-03-06 09:31:55 +00:00
renders: remove custom function for non QBSP format
Also remove Little* function usage, QBSP come with correct byte order.
This commit is contained in:
parent
8d21ed6874
commit
9b6bae3454
7 changed files with 64 additions and 391 deletions
|
@ -78,82 +78,6 @@ Mod_NumberLeafs(mleaf_t *leafs, mnode_t *node, int *r_leaftovis, int *r_vistolea
|
||||||
numvisleafs);
|
numvisleafs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
Mod_LoadNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs,
|
|
||||||
int numleafs, mnode_t **nodes, int *numnodes, const byte *mod_base,
|
|
||||||
const lump_t *l)
|
|
||||||
{
|
|
||||||
dnode_t *in;
|
|
||||||
mnode_t *out;
|
|
||||||
int i, count;
|
|
||||||
|
|
||||||
in = (void *)(mod_base + l->fileofs);
|
|
||||||
|
|
||||||
if (l->filelen % sizeof(*in))
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: funny lump size in %s",
|
|
||||||
__func__, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
count = l->filelen / sizeof(*in);
|
|
||||||
out = Hunk_Alloc((count + EXTRA_LUMP_NODES) * sizeof(*out));
|
|
||||||
|
|
||||||
*nodes = out;
|
|
||||||
*numnodes = count;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++)
|
|
||||||
{
|
|
||||||
int j, planenum;
|
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
|
||||||
{
|
|
||||||
out->minmaxs[j] = LittleShort(in->mins[j]);
|
|
||||||
out->minmaxs[3 + j] = LittleShort(in->maxs[j]);
|
|
||||||
}
|
|
||||||
|
|
||||||
planenum = LittleLong(in->planenum);
|
|
||||||
if (planenum < 0 || planenum >= numplanes)
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: Incorrect %d < %d planenum.",
|
|
||||||
__func__, planenum, numplanes);
|
|
||||||
}
|
|
||||||
out->plane = planes + planenum;
|
|
||||||
|
|
||||||
out->firstsurface = LittleShort(in->firstface) & 0xFFFF;
|
|
||||||
out->numsurfaces = LittleShort(in->numfaces) & 0xFFFF;
|
|
||||||
out->contents = CONTENTS_NODE; /* differentiate from leafs */
|
|
||||||
|
|
||||||
for (j = 0; j < 2; j++)
|
|
||||||
{
|
|
||||||
int leafnum;
|
|
||||||
|
|
||||||
leafnum = LittleLong(in->children[j]);
|
|
||||||
|
|
||||||
if (leafnum >= 0)
|
|
||||||
{
|
|
||||||
if (leafnum < 0 || leafnum >= *numnodes)
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: Incorrect %d nodenum as leaf.",
|
|
||||||
__func__, leafnum);
|
|
||||||
}
|
|
||||||
|
|
||||||
out->children[j] = *nodes + leafnum;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
leafnum = -1 - leafnum;
|
|
||||||
if (leafnum < 0 || leafnum >= numleafs)
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: Incorrect %d leafnum.",
|
|
||||||
__func__, leafnum);
|
|
||||||
}
|
|
||||||
|
|
||||||
out->children[j] = (mnode_t *)(leafs + leafnum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Mod_LoadQNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs,
|
Mod_LoadQNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs,
|
||||||
int numleafs, mnode_t **nodes, int *numnodes, const byte *mod_base,
|
int numleafs, mnode_t **nodes, int *numnodes, const byte *mod_base,
|
||||||
|
@ -183,8 +107,8 @@ Mod_LoadQNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
out->minmaxs[j] = LittleFloat(in->mins[j]);
|
out->minmaxs[j] = in->mins[j];
|
||||||
out->minmaxs[3 + j] = LittleFloat(in->maxs[j]);
|
out->minmaxs[3 + j] = in->maxs[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
planenum = LittleLong(in->planenum);
|
planenum = LittleLong(in->planenum);
|
||||||
|
@ -195,15 +119,15 @@ Mod_LoadQNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs
|
||||||
}
|
}
|
||||||
out->plane = planes + planenum;
|
out->plane = planes + planenum;
|
||||||
|
|
||||||
out->firstsurface = LittleLong(in->firstface) & 0xFFFFFFFF;
|
out->firstsurface = in->firstface;
|
||||||
out->numsurfaces = LittleLong(in->numfaces) & 0xFFFFFFFF;
|
out->numsurfaces = in->numfaces;
|
||||||
out->contents = CONTENTS_NODE; /* differentiate from leafs */
|
out->contents = CONTENTS_NODE; /* differentiate from leafs */
|
||||||
|
|
||||||
for (j = 0; j < 2; j++)
|
for (j = 0; j < 2; j++)
|
||||||
{
|
{
|
||||||
int leafnum;
|
int leafnum;
|
||||||
|
|
||||||
leafnum = LittleLong(in->children[j]);
|
leafnum = in->children[j];
|
||||||
|
|
||||||
if (leafnum >= 0)
|
if (leafnum >= 0)
|
||||||
{
|
{
|
||||||
|
@ -238,17 +162,8 @@ Mod_LoadQBSPNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *le
|
||||||
int r_leaftovis[MAX_MAP_LEAFS], r_vistoleaf[MAX_MAP_LEAFS];
|
int r_leaftovis[MAX_MAP_LEAFS], r_vistoleaf[MAX_MAP_LEAFS];
|
||||||
int numvisleafs;
|
int numvisleafs;
|
||||||
|
|
||||||
if ((ident == IDBSPHEADER) ||
|
|
||||||
(ident == RBSPHEADER))
|
|
||||||
{
|
|
||||||
Mod_LoadNodes(name, planes, numplanes, leafs, numleafs, nodes, numnodes,
|
|
||||||
mod_base, l);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Mod_LoadQNodes(name, planes, numplanes, leafs, numleafs, nodes, numnodes,
|
Mod_LoadQNodes(name, planes, numplanes, leafs, numleafs, nodes, numnodes,
|
||||||
mod_base, l);
|
mod_base, l);
|
||||||
}
|
|
||||||
|
|
||||||
Mod_SetParent(*nodes, NULL); /* sets nodes and leafs */
|
Mod_SetParent(*nodes, NULL); /* sets nodes and leafs */
|
||||||
|
|
||||||
|
@ -294,9 +209,9 @@ Mod_LoadVertexes(const char *name, mvertex_t **vertexes, int *numvertexes,
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++)
|
for (i = 0; i < count; i++, in++, out++)
|
||||||
{
|
{
|
||||||
out->position[0] = LittleFloat(in->point[0]);
|
out->position[0] = in->point[0];
|
||||||
out->position[1] = LittleFloat(in->point[1]);
|
out->position[1] = in->point[1];
|
||||||
out->position[2] = LittleFloat(in->point[2]);
|
out->position[2] = in->point[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,14 +247,13 @@ Mod_LoadSetSurfaceLighting(byte *lightdata, int size, msurface_t *out,
|
||||||
out->styles[i] = styles[i];
|
out->styles[i] = styles[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
i = LittleLong(lightofs);
|
if (lightofs == -1 || lightdata == NULL || lightofs >= size)
|
||||||
if (i == -1 || lightdata == NULL || i >= size)
|
|
||||||
{
|
{
|
||||||
out->samples = NULL;
|
out->samples = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out->samples = lightdata + i;
|
out->samples = lightdata + lightofs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +330,7 @@ Mod_CalcSurfaceExtents(const int *surfedges, mvertex_t *vertexes, medge_t *edges
|
||||||
void
|
void
|
||||||
Mod_LoadTexinfoQ2(const char *name, mtexinfo_t **texinfo, int *numtexinfo,
|
Mod_LoadTexinfoQ2(const char *name, mtexinfo_t **texinfo, int *numtexinfo,
|
||||||
const byte *mod_base, const lump_t *l, findimage_t find_image,
|
const byte *mod_base, const lump_t *l, findimage_t find_image,
|
||||||
struct image_s *notexture, maptype_t maptype)
|
struct image_s *notexture)
|
||||||
{
|
{
|
||||||
texinfo_t *in;
|
texinfo_t *in;
|
||||||
mtexinfo_t *out;
|
mtexinfo_t *out;
|
||||||
|
@ -445,12 +359,11 @@ Mod_LoadTexinfoQ2(const char *name, mtexinfo_t **texinfo, int *numtexinfo,
|
||||||
|
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
out->vecs[0][j] = LittleFloat(in->vecs[0][j]);
|
out->vecs[0][j] = in->vecs[0][j];
|
||||||
out->vecs[1][j] = LittleFloat(in->vecs[1][j]);
|
out->vecs[1][j] = in->vecs[1][j];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert flags for game type */
|
out->flags = in->flags;
|
||||||
out->flags = Mod_LoadSurfConvertFlags(LittleLong(in->flags), maptype);
|
|
||||||
|
|
||||||
next = LittleLong(in->nexttexinfo);
|
next = LittleLong(in->nexttexinfo);
|
||||||
if (next > 0)
|
if (next > 0)
|
||||||
|
@ -491,12 +404,12 @@ extra for skybox in soft render
|
||||||
void
|
void
|
||||||
Mod_LoadTexinfo(const char *name, mtexinfo_t **texinfo, int *numtexinfo,
|
Mod_LoadTexinfo(const char *name, mtexinfo_t **texinfo, int *numtexinfo,
|
||||||
const byte *mod_base, const lump_t *l, findimage_t find_image,
|
const byte *mod_base, const lump_t *l, findimage_t find_image,
|
||||||
struct image_s *notexture, maptype_t maptype)
|
struct image_s *notexture)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
Mod_LoadTexinfoQ2(name, texinfo, numtexinfo, mod_base, l, find_image,
|
Mod_LoadTexinfoQ2(name, texinfo, numtexinfo, mod_base, l, find_image,
|
||||||
notexture, maptype);
|
notexture);
|
||||||
|
|
||||||
// count animation frames
|
// count animation frames
|
||||||
for (i = 0; i < *numtexinfo; i++)
|
for (i = 0; i < *numtexinfo; i++)
|
||||||
|
@ -513,41 +426,6 @@ Mod_LoadTexinfo(const char *name, mtexinfo_t **texinfo, int *numtexinfo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
Mod_LoadEdges
|
|
||||||
|
|
||||||
extra is used for skybox, which adds 6 surfaces
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
Mod_LoadEdges(const char *name, medge_t **edges, int *numedges,
|
|
||||||
const byte *mod_base, const lump_t *l)
|
|
||||||
{
|
|
||||||
dedge_t *in;
|
|
||||||
medge_t *out;
|
|
||||||
int i, count;
|
|
||||||
|
|
||||||
in = (void *)(mod_base + l->fileofs);
|
|
||||||
if (l->filelen % sizeof(*in))
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: funny lump size in %s",
|
|
||||||
__func__, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
count = l->filelen / sizeof(*in);
|
|
||||||
out = Hunk_Alloc((count + EXTRA_LUMP_EDGES) * sizeof(*out));
|
|
||||||
|
|
||||||
*edges = out;
|
|
||||||
*numedges = count;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++)
|
|
||||||
{
|
|
||||||
out->v[0] = (unsigned short)LittleShort(in->v[0]);
|
|
||||||
out->v[1] = (unsigned short)LittleShort(in->v[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
Mod_LoadQEdges
|
Mod_LoadQEdges
|
||||||
|
@ -555,8 +433,8 @@ Mod_LoadQEdges
|
||||||
extra is used for skybox, which adds 6 surfaces
|
extra is used for skybox, which adds 6 surfaces
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
Mod_LoadQEdges(const char *name, medge_t **edges, int *numedges,
|
Mod_LoadQBSPEdges(const char *name, medge_t **edges, int *numedges,
|
||||||
const byte *mod_base, const lump_t *l)
|
const byte *mod_base, const lump_t *l)
|
||||||
{
|
{
|
||||||
dqedge_t *in;
|
dqedge_t *in;
|
||||||
|
@ -578,23 +456,8 @@ Mod_LoadQEdges(const char *name, medge_t **edges, int *numedges,
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++)
|
for (i = 0; i < count; i++, in++, out++)
|
||||||
{
|
{
|
||||||
out->v[0] = (unsigned int)LittleLong(in->v[0]);
|
out->v[0] = (unsigned int)in->v[0];
|
||||||
out->v[1] = (unsigned int)LittleLong(in->v[1]);
|
out->v[1] = (unsigned int)in->v[1];
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Mod_LoadQBSPEdges(const char *name, medge_t **edges, int *numedges,
|
|
||||||
const byte *mod_base, const lump_t *l, int ident)
|
|
||||||
{
|
|
||||||
if ((ident == IDBSPHEADER) ||
|
|
||||||
(ident == RBSPHEADER))
|
|
||||||
{
|
|
||||||
Mod_LoadEdges(name, edges, numedges, mod_base, l);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Mod_LoadQEdges(name, edges, numedges, mod_base, l);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,7 +471,7 @@ Mod_LoadSurfedges(const char *name, int **surfedges, int *numsurfedges,
|
||||||
const byte *mod_base, const lump_t *l)
|
const byte *mod_base, const lump_t *l)
|
||||||
{
|
{
|
||||||
const int *in;
|
const int *in;
|
||||||
int i, count;
|
int count;
|
||||||
int *out;
|
int *out;
|
||||||
|
|
||||||
in = (void *)(mod_base + l->fileofs);
|
in = (void *)(mod_base + l->fileofs);
|
||||||
|
@ -625,10 +488,7 @@ Mod_LoadSurfedges(const char *name, int **surfedges, int *numsurfedges,
|
||||||
*surfedges = out;
|
*surfedges = out;
|
||||||
*numsurfedges = count;
|
*numsurfedges = count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
memcpy(out, in, count * sizeof(*in));
|
||||||
{
|
|
||||||
out[i] = LittleLong(in[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -805,12 +665,12 @@ Mod_LoadBSPXDecoupledLM(const dlminfo_t* lminfos, int surfnum, msurface_t *out)
|
||||||
return LittleLong(lminfo->lightofs);
|
return LittleLong(lminfo->lightofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
Mod_LoadMarksurfaces(const char *name, msurface_t ***marksurfaces, unsigned int *nummarksurfaces,
|
Mod_LoadQBSPMarksurfaces(const char *name, msurface_t ***marksurfaces, unsigned int *nummarksurfaces,
|
||||||
msurface_t *surfaces, int numsurfaces, const byte *mod_base, const lump_t *l)
|
msurface_t *surfaces, int numsurfaces, const byte *mod_base, const lump_t *l)
|
||||||
{
|
{
|
||||||
int i, count;
|
int i, count;
|
||||||
const short *in;
|
const unsigned int *in;
|
||||||
msurface_t **out;
|
msurface_t **out;
|
||||||
|
|
||||||
in = (void *)(mod_base + l->fileofs);
|
in = (void *)(mod_base + l->fileofs);
|
||||||
|
@ -830,47 +690,9 @@ Mod_LoadMarksurfaces(const char *name, msurface_t ***marksurfaces, unsigned int
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
j = in[i];
|
||||||
|
|
||||||
j = LittleShort(in[i]) & 0xFFFF;
|
if (j >= numsurfaces)
|
||||||
|
|
||||||
if ((j < 0) || (j >= numsurfaces))
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: bad surface number",
|
|
||||||
__func__);
|
|
||||||
}
|
|
||||||
|
|
||||||
out[i] = surfaces + j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
Mod_LoadQMarksurfaces(const char *name, msurface_t ***marksurfaces, unsigned int *nummarksurfaces,
|
|
||||||
msurface_t *surfaces, int numsurfaces, const byte *mod_base, const lump_t *l)
|
|
||||||
{
|
|
||||||
int i, count;
|
|
||||||
const int *in;
|
|
||||||
msurface_t **out;
|
|
||||||
|
|
||||||
in = (void *)(mod_base + l->fileofs);
|
|
||||||
|
|
||||||
if (l->filelen % sizeof(*in))
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: funny lump size in %s",
|
|
||||||
__func__, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
count = l->filelen / sizeof(*in);
|
|
||||||
out = Hunk_Alloc(count * sizeof(*out));
|
|
||||||
|
|
||||||
*marksurfaces = out;
|
|
||||||
*nummarksurfaces = count;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
j = LittleLong(in[i]) & 0xFFFFFFFF;
|
|
||||||
|
|
||||||
if ((j < 0) || (j >= numsurfaces))
|
|
||||||
{
|
{
|
||||||
Com_Error(ERR_DROP, "%s: bad surface number",
|
Com_Error(ERR_DROP, "%s: bad surface number",
|
||||||
__func__);
|
__func__);
|
||||||
|
@ -881,124 +703,7 @@ Mod_LoadQMarksurfaces(const char *name, msurface_t ***marksurfaces, unsigned int
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Mod_LoadQBSPMarksurfaces(const char *name, msurface_t ***marksurfaces, unsigned int *nummarksurfaces,
|
Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
||||||
msurface_t *surfaces, int numsurfaces, const byte *mod_base, const lump_t *l, int ident)
|
|
||||||
{
|
|
||||||
if ((ident == IDBSPHEADER) ||
|
|
||||||
(ident == RBSPHEADER))
|
|
||||||
{
|
|
||||||
Mod_LoadMarksurfaces(name, marksurfaces, nummarksurfaces,
|
|
||||||
surfaces, numsurfaces, mod_base, l);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Mod_LoadQMarksurfaces(name, marksurfaces, nummarksurfaces,
|
|
||||||
surfaces, numsurfaces, mod_base, l);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
Mod_LoadLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
|
||||||
msurface_t **marksurfaces, unsigned int nummarksurfaces,
|
|
||||||
const byte *mod_base, const lump_t *l)
|
|
||||||
{
|
|
||||||
dleaf_t *in;
|
|
||||||
mleaf_t *out;
|
|
||||||
int i, j, count;
|
|
||||||
|
|
||||||
in = (void *)(mod_base + l->fileofs);
|
|
||||||
|
|
||||||
if (l->filelen % sizeof(*in))
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: funny lump size in %s",
|
|
||||||
__func__, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
count = l->filelen / sizeof(*in);
|
|
||||||
out = Hunk_Alloc((count + EXTRA_LUMP_LEAFS) * sizeof(*out));
|
|
||||||
|
|
||||||
*leafs = out;
|
|
||||||
*numleafs = count;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++)
|
|
||||||
{
|
|
||||||
unsigned int firstleafface;
|
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
|
||||||
{
|
|
||||||
out->minmaxs[j] = LittleShort(in->mins[j]);
|
|
||||||
out->minmaxs[3 + j] = LittleShort(in->maxs[j]);
|
|
||||||
}
|
|
||||||
|
|
||||||
out->contents = LittleLong(in->contents);
|
|
||||||
out->cluster = LittleShort(in->cluster);
|
|
||||||
out->area = LittleShort(in->area);
|
|
||||||
|
|
||||||
// make unsigned long from signed short
|
|
||||||
firstleafface = LittleShort(in->firstleafface) & 0xFFFF;
|
|
||||||
out->nummarksurfaces = LittleShort(in->numleaffaces) & 0xFFFF;
|
|
||||||
|
|
||||||
out->firstmarksurface = marksurfaces + firstleafface;
|
|
||||||
if ((firstleafface + out->nummarksurfaces) > nummarksurfaces)
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: wrong marksurfaces position in %s",
|
|
||||||
__func__, name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
Mod_LoadDKLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
|
||||||
msurface_t **marksurfaces, unsigned int nummarksurfaces,
|
|
||||||
const byte *mod_base, const lump_t *l)
|
|
||||||
{
|
|
||||||
ddkleaf_t *in;
|
|
||||||
mleaf_t *out;
|
|
||||||
int i, j, count;
|
|
||||||
|
|
||||||
in = (void *)(mod_base + l->fileofs);
|
|
||||||
|
|
||||||
if (l->filelen % sizeof(*in))
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: funny lump size in %s",
|
|
||||||
__func__, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
count = l->filelen / sizeof(*in);
|
|
||||||
out = Hunk_Alloc((count + EXTRA_LUMP_LEAFS) * sizeof(*out));
|
|
||||||
|
|
||||||
*leafs = out;
|
|
||||||
*numleafs = count;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++, in++, out++)
|
|
||||||
{
|
|
||||||
unsigned int firstleafface;
|
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
|
||||||
{
|
|
||||||
out->minmaxs[j] = LittleShort(in->mins[j]);
|
|
||||||
out->minmaxs[3 + j] = LittleShort(in->maxs[j]);
|
|
||||||
}
|
|
||||||
|
|
||||||
out->contents = LittleLong(in->contents);
|
|
||||||
out->cluster = LittleShort(in->cluster);
|
|
||||||
out->area = LittleShort(in->area);
|
|
||||||
|
|
||||||
// make unsigned long from signed short
|
|
||||||
firstleafface = LittleShort(in->firstleafface) & 0xFFFF;
|
|
||||||
out->nummarksurfaces = LittleShort(in->numleaffaces) & 0xFFFF;
|
|
||||||
|
|
||||||
out->firstmarksurface = marksurfaces + firstleafface;
|
|
||||||
if ((firstleafface + out->nummarksurfaces) > nummarksurfaces)
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: wrong marksurfaces position in %s",
|
|
||||||
__func__, name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
Mod_LoadQLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
|
||||||
msurface_t **marksurfaces, unsigned int nummarksurfaces,
|
msurface_t **marksurfaces, unsigned int nummarksurfaces,
|
||||||
const byte *mod_base, const lump_t *l)
|
const byte *mod_base, const lump_t *l)
|
||||||
{
|
{
|
||||||
|
@ -1026,17 +731,17 @@ Mod_LoadQLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
out->minmaxs[j] = LittleFloat(in->mins[j]);
|
out->minmaxs[j] = in->mins[j];
|
||||||
out->minmaxs[3 + j] = LittleFloat(in->maxs[j]);
|
out->minmaxs[3 + j] = in->maxs[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
out->contents = LittleLong(in->contents);
|
out->contents = in->contents;
|
||||||
out->cluster = LittleLong(in->cluster);
|
out->cluster = in->cluster;
|
||||||
out->area = LittleLong(in->area);
|
out->area = in->area;
|
||||||
|
|
||||||
// make unsigned long from signed short
|
// make unsigned long from signed short
|
||||||
firstleafface = LittleLong(in->firstleafface) & 0xFFFFFFFF;
|
firstleafface = in->firstleafface;
|
||||||
out->nummarksurfaces = LittleLong(in->numleaffaces) & 0xFFFFFFFF;
|
out->nummarksurfaces = in->numleaffaces;
|
||||||
|
|
||||||
out->firstmarksurface = marksurfaces + firstleafface;
|
out->firstmarksurface = marksurfaces + firstleafface;
|
||||||
if ((firstleafface + out->nummarksurfaces) > nummarksurfaces)
|
if ((firstleafface + out->nummarksurfaces) > nummarksurfaces)
|
||||||
|
@ -1047,33 +752,6 @@ Mod_LoadQLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ident, maptype_t maptype)
|
|
||||||
{
|
|
||||||
if ((ident == IDBSPHEADER) ||
|
|
||||||
(ident == RBSPHEADER))
|
|
||||||
{
|
|
||||||
if ((maptype == map_daikatana) &&
|
|
||||||
(l->filelen % sizeof(ddkleaf_t) == 0))
|
|
||||||
{
|
|
||||||
Mod_LoadDKLeafs(name, leafs, numleafs, marksurfaces, nummarksurfaces,
|
|
||||||
mod_base, l);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Mod_LoadLeafs(name, leafs, numleafs, marksurfaces, nummarksurfaces,
|
|
||||||
mod_base, l);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Mod_LoadQLeafs(name, leafs, numleafs, marksurfaces, nummarksurfaces,
|
|
||||||
mod_base, l);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Need to clean */
|
/* Need to clean */
|
||||||
struct rctx_s {
|
struct rctx_s {
|
||||||
const byte *data;
|
const byte *data;
|
||||||
|
@ -1295,9 +973,9 @@ calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *t
|
||||||
|
|
||||||
for (int surfnum = 0; surfnum < face_count; surfnum++, face_in++)
|
for (int surfnum = 0; surfnum < face_count; surfnum++, face_in++)
|
||||||
{
|
{
|
||||||
int numverts = LittleLong(face_in->numedges);
|
int numverts = face_in->numedges;
|
||||||
int ti = LittleLong(face_in->texinfo);
|
int ti = face_in->texinfo;
|
||||||
int texFlags = LittleLong(texinfo_in[ti].flags);
|
int texFlags = texinfo_in[ti].flags;
|
||||||
if ((ti < 0) || (ti >= texinfo_count))
|
if ((ti < 0) || (ti >= texinfo_count))
|
||||||
{
|
{
|
||||||
return 0; // will error out
|
return 0; // will error out
|
||||||
|
|
|
@ -346,7 +346,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int filelen)
|
||||||
Mod_LoadVertexes(mod->name, &mod->vertexes, &mod->numvertexes, mod_base,
|
Mod_LoadVertexes(mod->name, &mod->vertexes, &mod->numvertexes, mod_base,
|
||||||
&header->lumps[LUMP_VERTEXES]);
|
&header->lumps[LUMP_VERTEXES]);
|
||||||
Mod_LoadQBSPEdges(mod->name, &mod->edges, &mod->numedges,
|
Mod_LoadQBSPEdges(mod->name, &mod->edges, &mod->numedges,
|
||||||
mod_base, &header->lumps[LUMP_EDGES], header->ident);
|
mod_base, &header->lumps[LUMP_EDGES]);
|
||||||
Mod_LoadSurfedges(mod->name, &mod->surfedges, &mod->numsurfedges,
|
Mod_LoadSurfedges(mod->name, &mod->surfedges, &mod->numsurfedges,
|
||||||
mod_base, &header->lumps[LUMP_SURFEDGES]);
|
mod_base, &header->lumps[LUMP_SURFEDGES]);
|
||||||
Mod_LoadLighting(&mod->lightdata, &mod->numlightdata, mod_base,
|
Mod_LoadLighting(&mod->lightdata, &mod->numlightdata, mod_base,
|
||||||
|
@ -355,20 +355,19 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int filelen)
|
||||||
mod_base, &header->lumps[LUMP_PLANES]);
|
mod_base, &header->lumps[LUMP_PLANES]);
|
||||||
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
|
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
|
||||||
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage,
|
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage,
|
||||||
r_notexture, maptype);
|
r_notexture);
|
||||||
|
|
||||||
LM_BeginBuildingLightmaps(mod);
|
LM_BeginBuildingLightmaps(mod);
|
||||||
Mod_LoadQFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
|
Mod_LoadQFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
|
||||||
LM_EndBuildingLightmaps();
|
LM_EndBuildingLightmaps();
|
||||||
|
|
||||||
Mod_LoadQBSPMarksurfaces(mod->name, &mod->marksurfaces, &mod->nummarksurfaces,
|
Mod_LoadQBSPMarksurfaces(mod->name, &mod->marksurfaces, &mod->nummarksurfaces,
|
||||||
mod->surfaces, mod->numsurfaces, mod_base, &header->lumps[LUMP_LEAFFACES],
|
mod->surfaces, mod->numsurfaces, mod_base, &header->lumps[LUMP_LEAFFACES]);
|
||||||
header->ident);
|
|
||||||
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
||||||
&header->lumps[LUMP_VISIBILITY]);
|
&header->lumps[LUMP_VISIBILITY]);
|
||||||
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
||||||
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
||||||
&header->lumps[LUMP_LEAFS], header->ident, maptype);
|
&header->lumps[LUMP_LEAFS]);
|
||||||
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
||||||
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
||||||
&header->lumps[LUMP_NODES], header->ident);
|
&header->lumps[LUMP_NODES], header->ident);
|
||||||
|
|
|
@ -347,7 +347,7 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int filelen)
|
||||||
Mod_LoadVertexes(mod->name, &mod->vertexes, &mod->numvertexes, mod_base,
|
Mod_LoadVertexes(mod->name, &mod->vertexes, &mod->numvertexes, mod_base,
|
||||||
&header->lumps[LUMP_VERTEXES]);
|
&header->lumps[LUMP_VERTEXES]);
|
||||||
Mod_LoadQBSPEdges(mod->name, &mod->edges, &mod->numedges,
|
Mod_LoadQBSPEdges(mod->name, &mod->edges, &mod->numedges,
|
||||||
mod_base, &header->lumps[LUMP_EDGES], header->ident);
|
mod_base, &header->lumps[LUMP_EDGES]);
|
||||||
Mod_LoadSurfedges(mod->name, &mod->surfedges, &mod->numsurfedges,
|
Mod_LoadSurfedges(mod->name, &mod->surfedges, &mod->numsurfedges,
|
||||||
mod_base, &header->lumps[LUMP_SURFEDGES]);
|
mod_base, &header->lumps[LUMP_SURFEDGES]);
|
||||||
Mod_LoadLighting(&mod->lightdata, &mod->numlightdata, mod_base,
|
Mod_LoadLighting(&mod->lightdata, &mod->numlightdata, mod_base,
|
||||||
|
@ -356,20 +356,19 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int filelen)
|
||||||
mod_base, &header->lumps[LUMP_PLANES]);
|
mod_base, &header->lumps[LUMP_PLANES]);
|
||||||
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
|
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
|
||||||
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL3_FindImage,
|
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL3_FindImage,
|
||||||
gl3_notexture, maptype);
|
gl3_notexture);
|
||||||
|
|
||||||
LM_BeginBuildingLightmaps(mod);
|
LM_BeginBuildingLightmaps(mod);
|
||||||
Mod_LoadQFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
|
Mod_LoadQFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
|
||||||
LM_EndBuildingLightmaps();
|
LM_EndBuildingLightmaps();
|
||||||
|
|
||||||
Mod_LoadQBSPMarksurfaces(mod->name, &mod->marksurfaces, &mod->nummarksurfaces,
|
Mod_LoadQBSPMarksurfaces(mod->name, &mod->marksurfaces, &mod->nummarksurfaces,
|
||||||
mod->surfaces, mod->numsurfaces, mod_base, &header->lumps[LUMP_LEAFFACES],
|
mod->surfaces, mod->numsurfaces, mod_base, &header->lumps[LUMP_LEAFFACES]);
|
||||||
header->ident);
|
|
||||||
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
||||||
&header->lumps[LUMP_VISIBILITY]);
|
&header->lumps[LUMP_VISIBILITY]);
|
||||||
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
||||||
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
||||||
&header->lumps[LUMP_LEAFS], header->ident, maptype);
|
&header->lumps[LUMP_LEAFS]);
|
||||||
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
||||||
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
||||||
&header->lumps[LUMP_NODES], header->ident);
|
&header->lumps[LUMP_NODES], header->ident);
|
||||||
|
|
|
@ -347,7 +347,7 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int filelen)
|
||||||
Mod_LoadVertexes(mod->name, &mod->vertexes, &mod->numvertexes, mod_base,
|
Mod_LoadVertexes(mod->name, &mod->vertexes, &mod->numvertexes, mod_base,
|
||||||
&header->lumps[LUMP_VERTEXES]);
|
&header->lumps[LUMP_VERTEXES]);
|
||||||
Mod_LoadQBSPEdges(mod->name, &mod->edges, &mod->numedges,
|
Mod_LoadQBSPEdges(mod->name, &mod->edges, &mod->numedges,
|
||||||
mod_base, &header->lumps[LUMP_EDGES], header->ident);
|
mod_base, &header->lumps[LUMP_EDGES]);
|
||||||
Mod_LoadSurfedges(mod->name, &mod->surfedges, &mod->numsurfedges,
|
Mod_LoadSurfedges(mod->name, &mod->surfedges, &mod->numsurfedges,
|
||||||
mod_base, &header->lumps[LUMP_SURFEDGES]);
|
mod_base, &header->lumps[LUMP_SURFEDGES]);
|
||||||
Mod_LoadLighting(&mod->lightdata, &mod->numlightdata, mod_base,
|
Mod_LoadLighting(&mod->lightdata, &mod->numlightdata, mod_base,
|
||||||
|
@ -356,20 +356,19 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int filelen)
|
||||||
mod_base, &header->lumps[LUMP_PLANES]);
|
mod_base, &header->lumps[LUMP_PLANES]);
|
||||||
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
|
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
|
||||||
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL4_FindImage,
|
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL4_FindImage,
|
||||||
gl4_notexture, maptype);
|
gl4_notexture);
|
||||||
|
|
||||||
LM_BeginBuildingLightmaps(mod);
|
LM_BeginBuildingLightmaps(mod);
|
||||||
Mod_LoadQFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
|
Mod_LoadQFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
|
||||||
LM_EndBuildingLightmaps();
|
LM_EndBuildingLightmaps();
|
||||||
|
|
||||||
Mod_LoadQBSPMarksurfaces(mod->name, &mod->marksurfaces, &mod->nummarksurfaces,
|
Mod_LoadQBSPMarksurfaces(mod->name, &mod->marksurfaces, &mod->nummarksurfaces,
|
||||||
mod->surfaces, mod->numsurfaces, mod_base, &header->lumps[LUMP_LEAFFACES],
|
mod->surfaces, mod->numsurfaces, mod_base, &header->lumps[LUMP_LEAFFACES]);
|
||||||
header->ident);
|
|
||||||
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
||||||
&header->lumps[LUMP_VISIBILITY]);
|
&header->lumps[LUMP_VISIBILITY]);
|
||||||
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
||||||
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
||||||
&header->lumps[LUMP_LEAFS], header->ident, maptype);
|
&header->lumps[LUMP_LEAFS]);
|
||||||
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
||||||
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
||||||
&header->lumps[LUMP_NODES], header->ident);
|
&header->lumps[LUMP_NODES], header->ident);
|
||||||
|
|
|
@ -341,15 +341,15 @@ extern struct image_s *R_LoadImage(const char *name, const char* namewe, const c
|
||||||
imagetype_t type, qboolean r_retexturing, loadimage_t load_image);
|
imagetype_t type, qboolean r_retexturing, loadimage_t load_image);
|
||||||
extern void Mod_LoadQBSPMarksurfaces(const char *name, msurface_t ***marksurfaces,
|
extern void Mod_LoadQBSPMarksurfaces(const char *name, msurface_t ***marksurfaces,
|
||||||
unsigned int *nummarksurfaces, msurface_t *surfaces, int numsurfaces,
|
unsigned int *nummarksurfaces, msurface_t *surfaces, int numsurfaces,
|
||||||
const byte *mod_base, const lump_t *l, int ident);
|
const byte *mod_base, const lump_t *lMod_LoadQBSPMarksurfaces);
|
||||||
extern void Mod_LoadQBSPNodes(const char *name, cplane_t *planes, int numplanes,
|
extern void Mod_LoadQBSPNodes(const char *name, cplane_t *planes, int numplanes,
|
||||||
mleaf_t *leafs, int numleafs, mnode_t **nodes, int *numnodes,
|
mleaf_t *leafs, int numleafs, mnode_t **nodes, int *numnodes,
|
||||||
const byte *mod_base, const lump_t *l, int ident);
|
const byte *mod_base, const lump_t *l, int ident);
|
||||||
extern void Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
extern void Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs,
|
||||||
msurface_t **marksurfaces, unsigned int nummarksurfaces,
|
msurface_t **marksurfaces, unsigned int nummarksurfaces,
|
||||||
const byte *mod_base, const lump_t *l, int ident, maptype_t maptype);
|
const byte *mod_base, const lump_t *l);
|
||||||
extern void Mod_LoadQBSPEdges(const char *name, medge_t **edges, int *numedges,
|
extern void Mod_LoadQBSPEdges(const char *name, medge_t **edges, int *numedges,
|
||||||
const byte *mod_base, const lump_t *l, int ident);
|
const byte *mod_base, const lump_t *l);
|
||||||
extern void Mod_LoadVertexes(const char *name, mvertex_t **vertexes, int *numvertexes,
|
extern void Mod_LoadVertexes(const char *name, mvertex_t **vertexes, int *numvertexes,
|
||||||
const byte *mod_base, const lump_t *l);
|
const byte *mod_base, const lump_t *l);
|
||||||
extern void Mod_LoadLighting(byte **lightdata, int *size, const byte *mod_base, const lump_t *l);
|
extern void Mod_LoadLighting(byte **lightdata, int *size, const byte *mod_base, const lump_t *l);
|
||||||
|
@ -359,7 +359,7 @@ extern void Mod_CalcSurfaceExtents(const int *surfedges, mvertex_t *vertexes,
|
||||||
medge_t *edges, msurface_t *s);
|
medge_t *edges, msurface_t *s);
|
||||||
extern void Mod_LoadTexinfo(const char *name, mtexinfo_t **texinfo, int *numtexinfo,
|
extern void Mod_LoadTexinfo(const char *name, mtexinfo_t **texinfo, int *numtexinfo,
|
||||||
const byte *mod_base, const lump_t *l, findimage_t find_image,
|
const byte *mod_base, const lump_t *l, findimage_t find_image,
|
||||||
struct image_s *notexture, maptype_t maptype);
|
struct image_s *notexture);
|
||||||
extern void Mod_LoadSurfedges(const char *name, int **surfedges, int *numsurfedges,
|
extern void Mod_LoadSurfedges(const char *name, int **surfedges, int *numsurfedges,
|
||||||
const byte *mod_base, const lump_t *l);
|
const byte *mod_base, const lump_t *l);
|
||||||
extern mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node);
|
extern mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node);
|
||||||
|
|
|
@ -354,7 +354,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int filelen)
|
||||||
Mod_LoadVertexes(mod->name, &mod->vertexes, &mod->numvertexes, mod_base,
|
Mod_LoadVertexes(mod->name, &mod->vertexes, &mod->numvertexes, mod_base,
|
||||||
&header->lumps[LUMP_VERTEXES]);
|
&header->lumps[LUMP_VERTEXES]);
|
||||||
Mod_LoadQBSPEdges(mod->name, &mod->edges, &mod->numedges,
|
Mod_LoadQBSPEdges(mod->name, &mod->edges, &mod->numedges,
|
||||||
mod_base, &header->lumps[LUMP_EDGES], header->ident);
|
mod_base, &header->lumps[LUMP_EDGES]);
|
||||||
Mod_LoadSurfedges(mod->name, &mod->surfedges, &mod->numsurfedges,
|
Mod_LoadSurfedges(mod->name, &mod->surfedges, &mod->numsurfedges,
|
||||||
mod_base, &header->lumps[LUMP_SURFEDGES]);
|
mod_base, &header->lumps[LUMP_SURFEDGES]);
|
||||||
Mod_LoadLighting(&mod->lightdata, &mod->numlightdata, mod_base,
|
Mod_LoadLighting(&mod->lightdata, &mod->numlightdata, mod_base,
|
||||||
|
@ -363,18 +363,17 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int filelen)
|
||||||
mod_base, &header->lumps[LUMP_PLANES]);
|
mod_base, &header->lumps[LUMP_PLANES]);
|
||||||
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
|
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
|
||||||
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage,
|
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage,
|
||||||
r_notexture_mip, maptype);
|
r_notexture_mip);
|
||||||
|
|
||||||
Mod_LoadQFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
|
Mod_LoadQFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
|
||||||
|
|
||||||
Mod_LoadQBSPMarksurfaces(mod->name, &mod->marksurfaces, &mod->nummarksurfaces,
|
Mod_LoadQBSPMarksurfaces(mod->name, &mod->marksurfaces, &mod->nummarksurfaces,
|
||||||
mod->surfaces, mod->numsurfaces, mod_base, &header->lumps[LUMP_LEAFFACES],
|
mod->surfaces, mod->numsurfaces, mod_base, &header->lumps[LUMP_LEAFFACES]);
|
||||||
header->ident);
|
|
||||||
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
||||||
&header->lumps[LUMP_VISIBILITY]);
|
&header->lumps[LUMP_VISIBILITY]);
|
||||||
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
||||||
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
||||||
&header->lumps[LUMP_LEAFS], header->ident, maptype);
|
&header->lumps[LUMP_LEAFS]);
|
||||||
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
||||||
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
||||||
&header->lumps[LUMP_NODES], header->ident);
|
&header->lumps[LUMP_NODES], header->ident);
|
||||||
|
|
|
@ -321,7 +321,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int filelen)
|
||||||
Mod_LoadVertexes(mod->name, &mod->vertexes, &mod->numvertexes, mod_base,
|
Mod_LoadVertexes(mod->name, &mod->vertexes, &mod->numvertexes, mod_base,
|
||||||
&header->lumps[LUMP_VERTEXES]);
|
&header->lumps[LUMP_VERTEXES]);
|
||||||
Mod_LoadQBSPEdges(mod->name, &mod->edges, &mod->numedges,
|
Mod_LoadQBSPEdges(mod->name, &mod->edges, &mod->numedges,
|
||||||
mod_base, &header->lumps[LUMP_EDGES], header->ident);
|
mod_base, &header->lumps[LUMP_EDGES]);
|
||||||
Mod_LoadSurfedges(mod->name, &mod->surfedges, &mod->numsurfedges,
|
Mod_LoadSurfedges(mod->name, &mod->surfedges, &mod->numsurfedges,
|
||||||
mod_base, &header->lumps[LUMP_SURFEDGES]);
|
mod_base, &header->lumps[LUMP_SURFEDGES]);
|
||||||
Mod_LoadLighting(&mod->lightdata, &mod->numlightdata, mod_base,
|
Mod_LoadLighting(&mod->lightdata, &mod->numlightdata, mod_base,
|
||||||
|
@ -330,20 +330,19 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int filelen)
|
||||||
mod_base, &header->lumps[LUMP_PLANES]);
|
mod_base, &header->lumps[LUMP_PLANES]);
|
||||||
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
|
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
|
||||||
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)Vk_FindImage,
|
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)Vk_FindImage,
|
||||||
r_notexture, maptype);
|
r_notexture);
|
||||||
|
|
||||||
LM_BeginBuildingLightmaps(mod);
|
LM_BeginBuildingLightmaps(mod);
|
||||||
Mod_LoadQFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
|
Mod_LoadQFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
|
||||||
LM_EndBuildingLightmaps();
|
LM_EndBuildingLightmaps();
|
||||||
|
|
||||||
Mod_LoadQBSPMarksurfaces(mod->name, &mod->marksurfaces, &mod->nummarksurfaces,
|
Mod_LoadQBSPMarksurfaces(mod->name, &mod->marksurfaces, &mod->nummarksurfaces,
|
||||||
mod->surfaces, mod->numsurfaces, mod_base, &header->lumps[LUMP_LEAFFACES],
|
mod->surfaces, mod->numsurfaces, mod_base, &header->lumps[LUMP_LEAFFACES]);
|
||||||
header->ident);
|
|
||||||
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
Mod_LoadVisibility(mod->name, &mod->vis, &mod->numvisibility, mod_base,
|
||||||
&header->lumps[LUMP_VISIBILITY]);
|
&header->lumps[LUMP_VISIBILITY]);
|
||||||
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
|
||||||
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
mod->marksurfaces, mod->nummarksurfaces, mod_base,
|
||||||
&header->lumps[LUMP_LEAFS], header->ident, maptype);
|
&header->lumps[LUMP_LEAFS]);
|
||||||
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
|
||||||
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
|
||||||
&header->lumps[LUMP_NODES], header->ident);
|
&header->lumps[LUMP_NODES], header->ident);
|
||||||
|
|
Loading…
Reference in a new issue