common: add the bsp2/bsp29 data types
Rename the default bsp29 data types and add the bsp2 data types to the common bspfile.h. Propogate the bsp29 names into the other tools as simple renames for now. Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
0092347789
commit
51419621ec
|
|
@ -27,14 +27,14 @@
|
||||||
/* FIXME - share header with qbsp, etc. */
|
/* FIXME - share header with qbsp, etc. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char identification[4]; // should be WAD2
|
char identification[4]; // should be WAD2
|
||||||
int numlumps;
|
int32_t numlumps;
|
||||||
int infotableofs;
|
int32_t infotableofs;
|
||||||
} wadinfo_t;
|
} wadinfo_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int filepos;
|
int32_t filepos;
|
||||||
int disksize;
|
int32_t disksize;
|
||||||
int size; // uncompressed
|
int32_t size; // uncompressed
|
||||||
char type;
|
char type;
|
||||||
char compression;
|
char compression;
|
||||||
char pad1, pad2;
|
char pad1, pad2;
|
||||||
|
|
@ -118,7 +118,7 @@ CheckBSPFacesPlanar(const bspdata_t *bsp)
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i = 0; i < bsp->numfaces; i++) {
|
for (i = 0; i < bsp->numfaces; i++) {
|
||||||
const dface_t *face = &bsp->dfaces[i];
|
const bsp29_dface_t *face = &bsp->dfaces[i];
|
||||||
dplane_t plane = bsp->dplanes[face->planenum];
|
dplane_t plane = bsp->dplanes[face->planenum];
|
||||||
|
|
||||||
if (face->side) {
|
if (face->side) {
|
||||||
|
|
@ -146,7 +146,7 @@ CheckBSPFile(const bspdata_t *bsp)
|
||||||
|
|
||||||
/* faces */
|
/* faces */
|
||||||
for (i = 0; i < bsp->numfaces; i++) {
|
for (i = 0; i < bsp->numfaces; i++) {
|
||||||
const dface_t *face = &bsp->dfaces[i];
|
const bsp29_dface_t *face = &bsp->dfaces[i];
|
||||||
|
|
||||||
/* texinfo bounds check */
|
/* texinfo bounds check */
|
||||||
if (face->texinfo < 0)
|
if (face->texinfo < 0)
|
||||||
|
|
@ -184,7 +184,7 @@ CheckBSPFile(const bspdata_t *bsp)
|
||||||
|
|
||||||
/* edges */
|
/* edges */
|
||||||
for (i = 0; i < bsp->numedges; i++) {
|
for (i = 0; i < bsp->numedges; i++) {
|
||||||
const dedge_t *edge = &bsp->dedges[i];
|
const bsp29_dedge_t *edge = &bsp->dedges[i];
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
|
|
@ -218,7 +218,7 @@ CheckBSPFile(const bspdata_t *bsp)
|
||||||
|
|
||||||
/* leafs */
|
/* leafs */
|
||||||
for (i = 0; i < bsp->numleafs; i++) {
|
for (i = 0; i < bsp->numleafs; i++) {
|
||||||
const dleaf_t *leaf = &bsp->dleafs[i];
|
const bsp29_dleaf_t *leaf = &bsp->dleafs[i];
|
||||||
const uint16_t endmarksurface =
|
const uint16_t endmarksurface =
|
||||||
leaf->firstmarksurface + leaf->nummarksurfaces;
|
leaf->firstmarksurface + leaf->nummarksurfaces;
|
||||||
if (leaf->firstmarksurface < 0)
|
if (leaf->firstmarksurface < 0)
|
||||||
|
|
@ -238,7 +238,7 @@ CheckBSPFile(const bspdata_t *bsp)
|
||||||
|
|
||||||
/* nodes */
|
/* nodes */
|
||||||
for (i = 0; i < bsp->numnodes; i++) {
|
for (i = 0; i < bsp->numnodes; i++) {
|
||||||
const dnode_t *node = &bsp->dnodes[i];
|
const bsp29_dnode_t *node = &bsp->dnodes[i];
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ int entdatasize;
|
||||||
char *dentdata;
|
char *dentdata;
|
||||||
|
|
||||||
int numleafs;
|
int numleafs;
|
||||||
dleaf_t *dleafs;
|
bsp29_dleaf_t *dleafs;
|
||||||
|
|
||||||
int numplanes;
|
int numplanes;
|
||||||
dplane_t *dplanes;
|
dplane_t *dplanes;
|
||||||
|
|
@ -48,25 +48,25 @@ int numvertexes;
|
||||||
dvertex_t *dvertexes;
|
dvertex_t *dvertexes;
|
||||||
|
|
||||||
int numnodes;
|
int numnodes;
|
||||||
dnode_t *dnodes;
|
bsp29_dnode_t *dnodes;
|
||||||
|
|
||||||
int numtexinfo;
|
int numtexinfo;
|
||||||
texinfo_t *texinfo;
|
texinfo_t *texinfo;
|
||||||
|
|
||||||
int numfaces;
|
int numfaces;
|
||||||
dface_t *dfaces;
|
bsp29_dface_t *dfaces;
|
||||||
|
|
||||||
int numclipnodes;
|
int numclipnodes;
|
||||||
dclipnode_t *dclipnodes;
|
bsp29_dclipnode_t *dclipnodes;
|
||||||
|
|
||||||
int numedges;
|
int numedges;
|
||||||
dedge_t *dedges;
|
bsp29_dedge_t *dedges;
|
||||||
|
|
||||||
int nummarksurfaces;
|
int nummarksurfaces;
|
||||||
unsigned short *dmarksurfaces;
|
uint16_t *dmarksurfaces;
|
||||||
|
|
||||||
int numsurfedges;
|
int numsurfedges;
|
||||||
int *dsurfedges;
|
int32_t *dsurfedges;
|
||||||
|
|
||||||
/* Transitional helper functions */
|
/* Transitional helper functions */
|
||||||
void
|
void
|
||||||
|
|
@ -211,7 +211,7 @@ SwapBSPFile(bspdata_t *bspdata, swaptype_t swap)
|
||||||
|
|
||||||
/* faces */
|
/* faces */
|
||||||
for (i = 0; i < bspdata->numfaces; i++) {
|
for (i = 0; i < bspdata->numfaces; i++) {
|
||||||
dface_t *face = &bspdata->dfaces[i];
|
bsp29_dface_t *face = &bspdata->dfaces[i];
|
||||||
face->texinfo = LittleShort(face->texinfo);
|
face->texinfo = LittleShort(face->texinfo);
|
||||||
face->planenum = LittleShort(face->planenum);
|
face->planenum = LittleShort(face->planenum);
|
||||||
face->side = LittleShort(face->side);
|
face->side = LittleShort(face->side);
|
||||||
|
|
@ -222,7 +222,7 @@ SwapBSPFile(bspdata_t *bspdata, swaptype_t swap)
|
||||||
|
|
||||||
/* nodes */
|
/* nodes */
|
||||||
for (i = 0; i < bspdata->numnodes; i++) {
|
for (i = 0; i < bspdata->numnodes; i++) {
|
||||||
dnode_t *node = &bspdata->dnodes[i];
|
bsp29_dnode_t *node = &bspdata->dnodes[i];
|
||||||
node->planenum = LittleLong(node->planenum);
|
node->planenum = LittleLong(node->planenum);
|
||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
node->mins[j] = LittleShort(node->mins[j]);
|
node->mins[j] = LittleShort(node->mins[j]);
|
||||||
|
|
@ -236,7 +236,7 @@ SwapBSPFile(bspdata_t *bspdata, swaptype_t swap)
|
||||||
|
|
||||||
/* leafs */
|
/* leafs */
|
||||||
for (i = 0; i < bspdata->numleafs; i++) {
|
for (i = 0; i < bspdata->numleafs; i++) {
|
||||||
dleaf_t *leaf = &bspdata->dleafs[i];
|
bsp29_dleaf_t *leaf = &bspdata->dleafs[i];
|
||||||
leaf->contents = LittleLong(leaf->contents);
|
leaf->contents = LittleLong(leaf->contents);
|
||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
leaf->mins[j] = LittleShort(leaf->mins[j]);
|
leaf->mins[j] = LittleShort(leaf->mins[j]);
|
||||||
|
|
@ -249,7 +249,7 @@ SwapBSPFile(bspdata_t *bspdata, swaptype_t swap)
|
||||||
|
|
||||||
/* clipnodes */
|
/* clipnodes */
|
||||||
for (i = 0; i < bspdata->numclipnodes; i++) {
|
for (i = 0; i < bspdata->numclipnodes; i++) {
|
||||||
dclipnode_t *clipnode = &bspdata->dclipnodes[i];
|
bsp29_dclipnode_t *clipnode = &bspdata->dclipnodes[i];
|
||||||
clipnode->planenum = LittleLong(clipnode->planenum);
|
clipnode->planenum = LittleLong(clipnode->planenum);
|
||||||
clipnode->children[0] = LittleShort(clipnode->children[0]);
|
clipnode->children[0] = LittleShort(clipnode->children[0]);
|
||||||
clipnode->children[1] = LittleShort(clipnode->children[1]);
|
clipnode->children[1] = LittleShort(clipnode->children[1]);
|
||||||
|
|
@ -269,19 +269,19 @@ SwapBSPFile(bspdata_t *bspdata, swaptype_t swap)
|
||||||
|
|
||||||
/* marksurfaces */
|
/* marksurfaces */
|
||||||
for (i = 0; i < bspdata->nummarksurfaces; i++) {
|
for (i = 0; i < bspdata->nummarksurfaces; i++) {
|
||||||
unsigned short *marksurface = &bspdata->dmarksurfaces[i];
|
uint16_t *marksurface = &bspdata->dmarksurfaces[i];
|
||||||
*marksurface = LittleShort(*marksurface);
|
*marksurface = LittleShort(*marksurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* surfedges */
|
/* surfedges */
|
||||||
for (i = 0; i < bspdata->numsurfedges; i++) {
|
for (i = 0; i < bspdata->numsurfedges; i++) {
|
||||||
int *surfedge = &bspdata->dsurfedges[i];
|
int32_t *surfedge = &bspdata->dsurfedges[i];
|
||||||
*surfedge = LittleLong(*surfedge);
|
*surfedge = LittleLong(*surfedge);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* edges */
|
/* edges */
|
||||||
for (i = 0; i < bspdata->numedges; i++) {
|
for (i = 0; i < bspdata->numedges; i++) {
|
||||||
dedge_t *edge = &bspdata->dedges[i];
|
bsp29_dedge_t *edge = &bspdata->dedges[i];
|
||||||
edge->v[0] = LittleShort(edge->v[0]);
|
edge->v[0] = LittleShort(edge->v[0]);
|
||||||
edge->v[1] = LittleShort(edge->v[1]);
|
edge->v[1] = LittleShort(edge->v[1]);
|
||||||
}
|
}
|
||||||
|
|
@ -308,15 +308,15 @@ const lumpspec_t lumpspec[] = {
|
||||||
{ "texture", sizeof(byte) },
|
{ "texture", sizeof(byte) },
|
||||||
{ "vertexes", sizeof(dvertex_t) },
|
{ "vertexes", sizeof(dvertex_t) },
|
||||||
{ "visibility", sizeof(byte) },
|
{ "visibility", sizeof(byte) },
|
||||||
{ "nodes", sizeof(dnode_t) },
|
{ "nodes", sizeof(bsp29_dnode_t) },
|
||||||
{ "texinfos", sizeof(texinfo_t) },
|
{ "texinfos", sizeof(texinfo_t) },
|
||||||
{ "faces", sizeof(dface_t) },
|
{ "faces", sizeof(bsp29_dface_t) },
|
||||||
{ "lighting", sizeof(byte) },
|
{ "lighting", sizeof(byte) },
|
||||||
{ "clipnodes", sizeof(dclipnode_t) },
|
{ "clipnodes", sizeof(bsp29_dclipnode_t) },
|
||||||
{ "leafs", sizeof(dleaf_t) },
|
{ "leafs", sizeof(bsp29_dleaf_t) },
|
||||||
{ "marksurfaces", sizeof(unsigned short) },
|
{ "marksurfaces", sizeof(uint16_t) },
|
||||||
{ "edges", sizeof(dedge_t) },
|
{ "edges", sizeof(bsp29_dedge_t) },
|
||||||
{ "surfedges", sizeof(int) },
|
{ "surfedges", sizeof(int32_t) },
|
||||||
{ "models", sizeof(dmodel_t) },
|
{ "models", sizeof(dmodel_t) },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,6 @@ typedef struct {
|
||||||
#define CONTENTS_LAVA -5
|
#define CONTENTS_LAVA -5
|
||||||
#define CONTENTS_SKY -6
|
#define CONTENTS_SKY -6
|
||||||
|
|
||||||
/* !!! if this is changed, it must be changed in asm_i386.h too !!! */
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t planenum;
|
int32_t planenum;
|
||||||
int16_t children[2]; /* negative numbers are -(leafs+1), not nodes */
|
int16_t children[2]; /* negative numbers are -(leafs+1), not nodes */
|
||||||
|
|
@ -144,12 +143,32 @@ typedef struct {
|
||||||
int16_t maxs[3];
|
int16_t maxs[3];
|
||||||
uint16_t firstface;
|
uint16_t firstface;
|
||||||
uint16_t numfaces; /* counting both sides */
|
uint16_t numfaces; /* counting both sides */
|
||||||
} dnode_t;
|
} bsp29_dnode_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t planenum;
|
||||||
|
int32_t children[2]; /* negative numbers are -(leafs+1), not nodes */
|
||||||
|
int16_t mins[3]; /* for sphere culling */
|
||||||
|
int16_t maxs[3];
|
||||||
|
uint32_t firstface;
|
||||||
|
uint32_t numfaces; /* counting both sides */
|
||||||
|
} bsp2_dnode_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note that children are interpreted as unsigned values now, so that we can
|
||||||
|
* handle > 32k clipnodes. Values > 0xFFF0 can be assumed to be CONTENTS
|
||||||
|
* values and can be read as the signed value to be compatible with the above
|
||||||
|
* (i.e. simply subtract 65536).
|
||||||
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t planenum;
|
int32_t planenum;
|
||||||
int16_t children[2]; /* negative numbers are contents */
|
int16_t children[2]; /* negative numbers are contents */
|
||||||
} dclipnode_t;
|
} bsp29_dclipnode_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t planenum;
|
||||||
|
int32_t children[2]; /* negative numbers are contents */
|
||||||
|
} bsp2_dclipnode_t;
|
||||||
|
|
||||||
typedef struct texinfo_s {
|
typedef struct texinfo_s {
|
||||||
float vecs[2][4]; /* [s/t][xyz offset] */
|
float vecs[2][4]; /* [s/t][xyz offset] */
|
||||||
|
|
@ -159,12 +178,17 @@ typedef struct texinfo_s {
|
||||||
|
|
||||||
#define TEX_SPECIAL 1 /* sky or slime, no lightmap or 256 subdivision */
|
#define TEX_SPECIAL 1 /* sky or slime, no lightmap or 256 subdivision */
|
||||||
|
|
||||||
/* note that edge 0 is never used, because negative edge nums are used for
|
/*
|
||||||
|
* Note that edge 0 is never used, because negative edge nums are used for
|
||||||
* counterclockwise use of the edge in a face
|
* counterclockwise use of the edge in a face
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint16_t v[2]; /* vertex numbers */
|
uint16_t v[2]; /* vertex numbers */
|
||||||
} dedge_t;
|
} bsp29_dedge_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t v[2]; /* vertex numbers */
|
||||||
|
} bsp2_dedge_t;
|
||||||
|
|
||||||
#define MAXLIGHTMAPS 4
|
#define MAXLIGHTMAPS 4
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -177,7 +201,19 @@ typedef struct {
|
||||||
/* lighting info */
|
/* lighting info */
|
||||||
uint8_t styles[MAXLIGHTMAPS];
|
uint8_t styles[MAXLIGHTMAPS];
|
||||||
int32_t lightofs; /* start of [numstyles*surfsize] samples */
|
int32_t lightofs; /* start of [numstyles*surfsize] samples */
|
||||||
} dface_t;
|
} bsp29_dface_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t planenum;
|
||||||
|
int32_t side;
|
||||||
|
int32_t firstedge; /* we must support > 64k edges */
|
||||||
|
int32_t numedges;
|
||||||
|
int32_t texinfo;
|
||||||
|
|
||||||
|
/* lighting info */
|
||||||
|
uint8_t styles[MAXLIGHTMAPS];
|
||||||
|
int32_t lightofs; /* start of [numstyles*surfsize] samples */
|
||||||
|
} bsp2_dface_t;
|
||||||
|
|
||||||
/* Ambient Sounds */
|
/* Ambient Sounds */
|
||||||
#define AMBIENT_WATER 0
|
#define AMBIENT_WATER 0
|
||||||
|
|
@ -195,12 +231,20 @@ typedef struct {
|
||||||
int32_t visofs; /* -1 = no visibility info */
|
int32_t visofs; /* -1 = no visibility info */
|
||||||
int16_t mins[3]; /* for frustum culling */
|
int16_t mins[3]; /* for frustum culling */
|
||||||
int16_t maxs[3];
|
int16_t maxs[3];
|
||||||
|
|
||||||
uint16_t firstmarksurface;
|
uint16_t firstmarksurface;
|
||||||
uint16_t nummarksurfaces;
|
uint16_t nummarksurfaces;
|
||||||
|
|
||||||
uint8_t ambient_level[NUM_AMBIENTS];
|
uint8_t ambient_level[NUM_AMBIENTS];
|
||||||
} dleaf_t;
|
} bsp29_dleaf_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t contents;
|
||||||
|
int32_t visofs; /* -1 = no visibility info */
|
||||||
|
int16_t mins[3]; /* for frustum culling */
|
||||||
|
int16_t maxs[3];
|
||||||
|
uint32_t firstmarksurface;
|
||||||
|
uint32_t nummarksurfaces;
|
||||||
|
uint8_t ambient_level[NUM_AMBIENTS];
|
||||||
|
} bsp2_dleaf_t;
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
|
|
||||||
|
|
@ -225,7 +269,7 @@ extern int entdatasize;
|
||||||
extern char *dentdata;
|
extern char *dentdata;
|
||||||
|
|
||||||
extern int numleafs;
|
extern int numleafs;
|
||||||
extern dleaf_t *dleafs;
|
extern bsp29_dleaf_t *dleafs;
|
||||||
|
|
||||||
extern int numplanes;
|
extern int numplanes;
|
||||||
extern dplane_t *dplanes;
|
extern dplane_t *dplanes;
|
||||||
|
|
@ -234,19 +278,19 @@ extern int numvertexes;
|
||||||
extern dvertex_t *dvertexes;
|
extern dvertex_t *dvertexes;
|
||||||
|
|
||||||
extern int numnodes;
|
extern int numnodes;
|
||||||
extern dnode_t *dnodes;
|
extern bsp29_dnode_t *dnodes;
|
||||||
|
|
||||||
extern int numtexinfo;
|
extern int numtexinfo;
|
||||||
extern texinfo_t *texinfo;
|
extern texinfo_t *texinfo;
|
||||||
|
|
||||||
extern int numfaces;
|
extern int numfaces;
|
||||||
extern dface_t *dfaces;
|
extern bsp29_dface_t *dfaces;
|
||||||
|
|
||||||
extern int numclipnodes;
|
extern int numclipnodes;
|
||||||
extern dclipnode_t *dclipnodes;
|
extern bsp29_dclipnode_t *dclipnodes;
|
||||||
|
|
||||||
extern int numedges;
|
extern int numedges;
|
||||||
extern dedge_t *dedges;
|
extern bsp29_dedge_t *dedges;
|
||||||
|
|
||||||
extern int nummarksurfaces;
|
extern int nummarksurfaces;
|
||||||
extern unsigned short *dmarksurfaces;
|
extern unsigned short *dmarksurfaces;
|
||||||
|
|
@ -272,7 +316,7 @@ typedef struct {
|
||||||
char *dentdata;
|
char *dentdata;
|
||||||
|
|
||||||
int numleafs;
|
int numleafs;
|
||||||
dleaf_t *dleafs;
|
bsp29_dleaf_t *dleafs;
|
||||||
|
|
||||||
int numplanes;
|
int numplanes;
|
||||||
dplane_t *dplanes;
|
dplane_t *dplanes;
|
||||||
|
|
@ -281,19 +325,19 @@ typedef struct {
|
||||||
dvertex_t *dvertexes;
|
dvertex_t *dvertexes;
|
||||||
|
|
||||||
int numnodes;
|
int numnodes;
|
||||||
dnode_t *dnodes;
|
bsp29_dnode_t *dnodes;
|
||||||
|
|
||||||
int numtexinfo;
|
int numtexinfo;
|
||||||
texinfo_t *texinfo;
|
texinfo_t *texinfo;
|
||||||
|
|
||||||
int numfaces;
|
int numfaces;
|
||||||
dface_t *dfaces;
|
bsp29_dface_t *dfaces;
|
||||||
|
|
||||||
int numclipnodes;
|
int numclipnodes;
|
||||||
dclipnode_t *dclipnodes;
|
bsp29_dclipnode_t *dclipnodes;
|
||||||
|
|
||||||
int numedges;
|
int numedges;
|
||||||
dedge_t *dedges;
|
bsp29_dedge_t *dedges;
|
||||||
|
|
||||||
int nummarksurfaces;
|
int nummarksurfaces;
|
||||||
uint16_t *dmarksurfaces;
|
uint16_t *dmarksurfaces;
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ typedef struct {
|
||||||
/* tracelist is a null terminated array of BSP models to use for LOS tests */
|
/* tracelist is a null terminated array of BSP models to use for LOS tests */
|
||||||
extern const dmodel_t *const *tracelist;
|
extern const dmodel_t *const *tracelist;
|
||||||
|
|
||||||
void LightFace(dface_t *face, const modelinfo_t *modelinfo);
|
void LightFace(bsp29_dface_t *face, const modelinfo_t *modelinfo);
|
||||||
void MakeTnodes(void);
|
void MakeTnodes(void);
|
||||||
|
|
||||||
extern float scaledist;
|
extern float scaledist;
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ Solve3(const pmatrix3_t *matrix, const vec3_t rhs, vec3_t out)
|
||||||
/*
|
/*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
* SAMPLE POINT DETERMINATION
|
* SAMPLE POINT DETERMINATION
|
||||||
* void SetupBlock (dface_t *f) Returns with surfpt[] set
|
* void SetupBlock (bsp29_dface_t *f) Returns with surfpt[] set
|
||||||
*
|
*
|
||||||
* This is a little tricky because the lightmap covers more area than the face.
|
* This is a little tricky because the lightmap covers more area than the face.
|
||||||
* If done in the straightforward fashion, some of the sample points will be
|
* If done in the straightforward fashion, some of the sample points will be
|
||||||
|
|
@ -194,7 +194,7 @@ TriArea(const dvertex_t *v0, const dvertex_t *v1, const dvertex_t *v2)
|
||||||
}
|
}
|
||||||
|
|
||||||
static vec_t
|
static vec_t
|
||||||
FaceArea(const dface_t *f)
|
FaceArea(const bsp29_dface_t *f)
|
||||||
{
|
{
|
||||||
int i, e;
|
int i, e;
|
||||||
dvertex_t *v0, *v1, *v2;
|
dvertex_t *v0, *v1, *v2;
|
||||||
|
|
@ -222,7 +222,7 @@ FaceArea(const dface_t *f)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
FaceCentroid(const dface_t *f, vec3_t out)
|
FaceCentroid(const bsp29_dface_t *f, vec3_t out)
|
||||||
{
|
{
|
||||||
int i, e;
|
int i, e;
|
||||||
dvertex_t *v0, *v1, *v2;
|
dvertex_t *v0, *v1, *v2;
|
||||||
|
|
@ -265,7 +265,7 @@ FaceCentroid(const dface_t *f, vec3_t out)
|
||||||
* ================
|
* ================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CreateFaceTransform(const dface_t *face, pmatrix3_t *transform)
|
CreateFaceTransform(const bsp29_dface_t *face, pmatrix3_t *transform)
|
||||||
{
|
{
|
||||||
const dplane_t *plane;
|
const dplane_t *plane;
|
||||||
const texinfo_t *tex;
|
const texinfo_t *tex;
|
||||||
|
|
@ -319,7 +319,7 @@ WorldToTexCoord(const vec3_t world, const texinfo_t *tex, vec_t coord[2])
|
||||||
#if 0
|
#if 0
|
||||||
/* Debug helper - move elsewhere? */
|
/* Debug helper - move elsewhere? */
|
||||||
static void
|
static void
|
||||||
PrintFaceInfo(const dface_t *face)
|
PrintFaceInfo(const bsp29_dface_t *face)
|
||||||
{
|
{
|
||||||
const texinfo_t *tex = &texinfo[face->texinfo];
|
const texinfo_t *tex = &texinfo[face->texinfo];
|
||||||
const int offset = dtexdata.header->dataofs[tex->miptex];
|
const int offset = dtexdata.header->dataofs[tex->miptex];
|
||||||
|
|
@ -353,7 +353,7 @@ PrintFaceInfo(const dface_t *face)
|
||||||
*/
|
*/
|
||||||
__attribute__((noinline))
|
__attribute__((noinline))
|
||||||
static void
|
static void
|
||||||
CalcFaceExtents(const dface_t *face, const vec3_t offset, lightsurf_t *surf)
|
CalcFaceExtents(const bsp29_dface_t *face, const vec3_t offset, lightsurf_t *surf)
|
||||||
{
|
{
|
||||||
vec_t mins[2], maxs[2], texcoord[2];
|
vec_t mins[2], maxs[2], texcoord[2];
|
||||||
vec3_t worldpoint;
|
vec3_t worldpoint;
|
||||||
|
|
@ -490,7 +490,7 @@ CalcPoints(const dmodel_t *model, const texorg_t *texorg, lightsurf_t *surf)
|
||||||
|
|
||||||
__attribute__((noinline))
|
__attribute__((noinline))
|
||||||
static void
|
static void
|
||||||
Lightsurf_Init(const modelinfo_t *modelinfo, const dface_t *face,
|
Lightsurf_Init(const modelinfo_t *modelinfo, const bsp29_dface_t *face,
|
||||||
lightsurf_t *lightsurf)
|
lightsurf_t *lightsurf)
|
||||||
{
|
{
|
||||||
plane_t *plane;
|
plane_t *plane;
|
||||||
|
|
@ -875,7 +875,7 @@ LightFace_Min(const lightsample_t *light,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
WriteLightmaps(dface_t *face, const lightsurf_t *lightsurf,
|
WriteLightmaps(bsp29_dface_t *face, const lightsurf_t *lightsurf,
|
||||||
const lightmap_t *lightmaps)
|
const lightmap_t *lightmaps)
|
||||||
{
|
{
|
||||||
int numstyles, size, mapnum, width, s, t, i, j;
|
int numstyles, size, mapnum, width, s, t, i, j;
|
||||||
|
|
@ -953,7 +953,7 @@ WriteLightmaps(dface_t *face, const lightsurf_t *lightsurf,
|
||||||
* ============
|
* ============
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
LightFace(dface_t *face, const modelinfo_t *modelinfo)
|
LightFace(bsp29_dface_t *face, const modelinfo_t *modelinfo)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
const entity_t *entity;
|
const entity_t *entity;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ MakeTnodes_r(int nodenum)
|
||||||
tnode_t *t;
|
tnode_t *t;
|
||||||
dplane_t *plane;
|
dplane_t *plane;
|
||||||
int i;
|
int i;
|
||||||
dnode_t *node;
|
bsp29_dnode_t *node;
|
||||||
|
|
||||||
t = tnode_p++;
|
t = tnode_p++;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,26 +175,20 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t contents;
|
int32_t contents;
|
||||||
int32_t visofs; /* -1 = no visibility info */
|
int32_t visofs; /* -1 = no visibility info */
|
||||||
|
|
||||||
int16_t mins[3]; /* for frustum culling */
|
int16_t mins[3]; /* for frustum culling */
|
||||||
int16_t maxs[3];
|
int16_t maxs[3];
|
||||||
|
|
||||||
uint16_t firstmarksurface;
|
uint16_t firstmarksurface;
|
||||||
uint16_t nummarksurfaces;
|
uint16_t nummarksurfaces;
|
||||||
|
|
||||||
uint8_t ambient_level[NUM_AMBIENTS];
|
uint8_t ambient_level[NUM_AMBIENTS];
|
||||||
} bsp29_dleaf_t;
|
} bsp29_dleaf_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t contents;
|
int32_t contents;
|
||||||
int32_t visofs; /* -1 = no visibility info */
|
int32_t visofs; /* -1 = no visibility info */
|
||||||
|
|
||||||
int16_t mins[3]; /* for frustum culling */
|
int16_t mins[3]; /* for frustum culling */
|
||||||
int16_t maxs[3];
|
int16_t maxs[3];
|
||||||
|
|
||||||
uint32_t firstmarksurface;
|
uint32_t firstmarksurface;
|
||||||
uint32_t nummarksurfaces;
|
uint32_t nummarksurfaces;
|
||||||
|
|
||||||
uint8_t ambient_level[NUM_AMBIENTS];
|
uint8_t ambient_level[NUM_AMBIENTS];
|
||||||
} bsp2_dleaf_t;
|
} bsp2_dleaf_t;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Find an aproximate distance to the nearest emiter of each class for each leaf.
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
SurfaceBBox(const dface_t *s, vec3_t mins, vec3_t maxs)
|
SurfaceBBox(const bsp29_dface_t *s, vec3_t mins, vec3_t maxs)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int e;
|
int e;
|
||||||
|
|
@ -70,11 +70,11 @@ SurfaceBBox(const dface_t *s, vec3_t mins, vec3_t maxs)
|
||||||
void
|
void
|
||||||
CalcAmbientSounds(void)
|
CalcAmbientSounds(void)
|
||||||
{
|
{
|
||||||
const dface_t *surf;
|
const bsp29_dface_t *surf;
|
||||||
const texinfo_t *info;
|
const texinfo_t *info;
|
||||||
const miptex_t *miptex;
|
const miptex_t *miptex;
|
||||||
int i, j, k, l;
|
int i, j, k, l;
|
||||||
dleaf_t *leaf, *hit;
|
bsp29_dleaf_t *leaf, *hit;
|
||||||
byte *vis;
|
byte *vis;
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
float d, maxd;
|
float d, maxd;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue