parent
5465ab4ff6
commit
e9052f3002
|
|
@ -541,7 +541,7 @@ main(int argc, char **argv)
|
|||
|
||||
LoadBSPFile(source, &bspdata);
|
||||
|
||||
ConvertBSPFormat(&bspdata, &bspver_generic);
|
||||
ConvertBSPFormat(GENERIC_BSP, &bspdata);
|
||||
|
||||
for (i = 0; i < argc - 1; i++) {
|
||||
if (!strcmp(argv[i], "--compare")) {
|
||||
|
|
@ -556,7 +556,7 @@ main(int argc, char **argv)
|
|||
strcpy(refbspname, argv[i]);
|
||||
DefaultExtension(refbspname, ".bsp");
|
||||
LoadBSPFile(refbspname, &refbspdata);
|
||||
ConvertBSPFormat(&refbspdata, &bspver_generic);
|
||||
ConvertBSPFormat(GENERIC_BSP, &refbspdata);
|
||||
|
||||
printf("comparing reference bsp %s with test bsp %s\n", refbspname, source);
|
||||
|
||||
|
|
@ -569,21 +569,21 @@ main(int argc, char **argv)
|
|||
if (!(i < argc - 1)) {
|
||||
Error("--convert requires an argument");
|
||||
}
|
||||
|
||||
const bspversion_t *fmt = nullptr;
|
||||
|
||||
for (const bspversion_t *bspver : bspversions) {
|
||||
if (!strcmp(argv[i], bspver->short_name)) {
|
||||
fmt = bspver;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fmt) {
|
||||
|
||||
int fmt;
|
||||
if (!strcmp(argv[i], "bsp29")) {
|
||||
fmt = BSPVERSION;
|
||||
} else if (!strcmp(argv[i], "bsp2")) {
|
||||
fmt = BSP2VERSION;
|
||||
} else if (!strcmp(argv[i], "bsp2rmq")) {
|
||||
fmt = BSP2RMQVERSION;
|
||||
} else if (!strcmp(argv[i], "q2bsp")) {
|
||||
fmt = Q2_BSPVERSION;
|
||||
} else {
|
||||
Error("Unsupported format %s", argv[i]);
|
||||
}
|
||||
|
||||
ConvertBSPFormat(&bspdata, fmt);
|
||||
|
||||
ConvertBSPFormat(fmt, &bspdata);
|
||||
|
||||
StripExtension(source);
|
||||
strcat(source, "-");
|
||||
|
|
@ -672,7 +672,7 @@ main(int argc, char **argv)
|
|||
bsp2_dface_t* face = BSP_GetFace(bsp, fnum);
|
||||
face->texinfo = texinfonum;
|
||||
|
||||
ConvertBSPFormat(&bspdata, bspdata.loadversion);
|
||||
ConvertBSPFormat(bspdata.loadversion, &bspdata);
|
||||
|
||||
// Overwrite source bsp!
|
||||
WriteBSPFile(source, &bspdata);
|
||||
|
|
|
|||
1863
common/bspfile.cc
1863
common/bspfile.cc
File diff suppressed because it is too large
Load Diff
|
|
@ -188,7 +188,7 @@ bool Face_IsLightmapped(const mbsp_t *bsp, const bsp2_dface_t *face)
|
|||
if (texinfo == nullptr)
|
||||
return false;
|
||||
|
||||
if (bsp->loadversion == &bspver_q2 || bsp->loadversion == &bspver_qbism) {
|
||||
if (bsp->loadversion == Q2_BSPVERSION) {
|
||||
if (texinfo->flags & (Q2_SURF_WARP|Q2_SURF_SKY|Q2_SURF_NODRAW)) { //mxd. +Q2_SURF_NODRAW
|
||||
return false;
|
||||
}
|
||||
|
|
@ -223,7 +223,7 @@ TextureName_Contents(const char *texname)
|
|||
bool //mxd
|
||||
Contents_IsTranslucent(const mbsp_t *bsp, const int contents)
|
||||
{
|
||||
if (bsp->loadversion == &bspver_q2 || bsp->loadversion == &bspver_qbism)
|
||||
if (bsp->loadversion == Q2_BSPVERSION)
|
||||
return (contents & Q2_SURF_TRANSLUCENT) && ((contents & Q2_SURF_TRANSLUCENT) != Q2_SURF_TRANSLUCENT); // Don't count KMQ2 fence flags combo as translucent
|
||||
else
|
||||
return contents == CONTENTS_WATER || contents == CONTENTS_LAVA || contents == CONTENTS_SLIME;
|
||||
|
|
@ -238,7 +238,7 @@ Face_IsTranslucent(const mbsp_t *bsp, const bsp2_dface_t *face)
|
|||
int //mxd. Returns CONTENTS_ value for Q1, Q2_SURF_ bitflags for Q2...
|
||||
Face_Contents(const mbsp_t *bsp, const bsp2_dface_t *face)
|
||||
{
|
||||
if (bsp->loadversion == &bspver_q2 || bsp->loadversion == &bspver_qbism) {
|
||||
if (bsp->loadversion == Q2_BSPVERSION) {
|
||||
const gtexinfo_t *info = Face_Texinfo(bsp, face);
|
||||
return info->flags;
|
||||
} else {
|
||||
|
|
@ -281,13 +281,8 @@ static bool Light_PointInSolid_r(const mbsp_t *bsp, const int nodenum, const vec
|
|||
{
|
||||
if (nodenum < 0) {
|
||||
const mleaf_t *leaf = BSP_GetLeafFromNodeNum(bsp, nodenum);
|
||||
|
||||
//mxd
|
||||
if (bsp->loadversion == &bspver_q2 || bsp->loadversion == &bspver_qbism) {
|
||||
return leaf->contents & Q2_CONTENTS_SOLID;
|
||||
}
|
||||
|
||||
return (leaf->contents == CONTENTS_SOLID || leaf->contents == CONTENTS_SKY);
|
||||
return (bsp->loadversion == Q2_BSPVERSION ? leaf->contents & Q2_CONTENTS_SOLID : (leaf->contents == CONTENTS_SOLID || leaf->contents == CONTENTS_SKY)); //mxd
|
||||
}
|
||||
|
||||
const bsp2_dnode_t *node = &bsp->dnodes[nodenum];
|
||||
|
|
|
|||
|
|
@ -52,41 +52,17 @@
|
|||
#define MAX_ENT_KEY 32
|
||||
#define MAX_ENT_VALUE 1024
|
||||
|
||||
struct bspversion_t
|
||||
{
|
||||
/* identifier value, the first int32_t in the header */
|
||||
int32_t ident;
|
||||
/* version value, if supported; use NO_VERSION if a version is not required */
|
||||
int32_t version;
|
||||
/* short name used for command line args, etc */
|
||||
const char *short_name;
|
||||
/* full display name for printing */
|
||||
const char *name;
|
||||
};
|
||||
|
||||
#define NO_VERSION -1
|
||||
|
||||
#define BSPVERSION 29
|
||||
#define BSP2RMQVERSION (('B' << 24) | ('S' << 16) | ('P' << 8) | '2')
|
||||
#define BSP2VERSION ('B' | ('S' << 8) | ('P' << 16) | ('2' << 24))
|
||||
#define BSPHLVERSION 30 //24bit lighting, and private palettes in the textures lump.
|
||||
#define Q2_BSPIDENT (('P'<<24)+('S'<<16)+('B'<<8)+'I')
|
||||
#define Q2_BSPVERSION 38
|
||||
#define Q2_QBISMIDENT (('P'<<24)+('S'<<16)+('B'<<8)+'Q')
|
||||
|
||||
extern const bspversion_t bspver_generic, bspver_q1, bspver_h2, bspver_bsp2, bspver_bsp2rmq, bspver_hl, bspver_q2, bspver_qbism;
|
||||
|
||||
/* table of supported versions */
|
||||
constexpr const bspversion_t *const bspversions[] = {
|
||||
&bspver_generic,
|
||||
&bspver_q1,
|
||||
&bspver_h2,
|
||||
&bspver_bsp2,
|
||||
&bspver_bsp2rmq,
|
||||
&bspver_hl,
|
||||
&bspver_q2,
|
||||
&bspver_qbism
|
||||
};
|
||||
/* Not an actual file format, but the mbsp_t struct */
|
||||
/* TODO: Should probably separate the type tag for bspdata_t from the file
|
||||
version numbers */
|
||||
#define GENERIC_BSP 99
|
||||
|
||||
typedef struct {
|
||||
int32_t fileofs;
|
||||
|
|
@ -314,8 +290,6 @@ struct q2_dnode_t {
|
|||
uint16_t numfaces; // counting both sides
|
||||
};
|
||||
|
||||
using q2_dnode_qbism_t = 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
|
||||
|
|
@ -413,8 +387,6 @@ typedef struct {
|
|||
uint32_t v[2]; /* vertex numbers */
|
||||
} bsp2_dedge_t;
|
||||
|
||||
using q2_dedge_qbism_t = bsp2_dedge_t;
|
||||
|
||||
#define MAXLIGHTMAPS 4
|
||||
typedef struct {
|
||||
int16_t planenum;
|
||||
|
|
@ -452,18 +424,6 @@ typedef struct {
|
|||
int32_t lightofs; // start of [numstyles*surfsize] samples
|
||||
} q2_dface_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t planenum; // NOTE: only difference from bsp2_dface_t
|
||||
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
|
||||
} q2_dface_qbism_t;
|
||||
|
||||
/* Ambient Sounds */
|
||||
#define AMBIENT_WATER 0
|
||||
#define AMBIENT_SKY 1
|
||||
|
|
@ -521,22 +481,6 @@ typedef struct {
|
|||
uint16_t numleafbrushes;
|
||||
} q2_dleaf_t;
|
||||
|
||||
typedef struct {
|
||||
int32_t contents; // OR of all brushes (not needed?)
|
||||
|
||||
int32_t cluster;
|
||||
int32_t area;
|
||||
|
||||
float mins[3]; // for frustum culling
|
||||
float maxs[3];
|
||||
|
||||
uint32_t firstleafface;
|
||||
uint32_t numleaffaces;
|
||||
|
||||
uint32_t firstleafbrush;
|
||||
uint32_t numleafbrushes;
|
||||
} q2_dleaf_qbism_t;
|
||||
|
||||
typedef struct {
|
||||
// bsp2_dleaf_t
|
||||
int32_t contents;
|
||||
|
|
@ -548,10 +492,10 @@ typedef struct {
|
|||
uint8_t ambient_level[NUM_AMBIENTS];
|
||||
|
||||
// q2 extras
|
||||
int32_t cluster;
|
||||
int32_t area;
|
||||
uint32_t firstleafbrush;
|
||||
uint32_t numleafbrushes;
|
||||
int16_t cluster;
|
||||
int16_t area;
|
||||
uint16_t firstleafbrush;
|
||||
uint16_t numleafbrushes;
|
||||
} mleaf_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -559,11 +503,6 @@ typedef struct {
|
|||
int16_t texinfo;
|
||||
} dbrushside_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t planenum; // facing out of the leaf
|
||||
int32_t texinfo;
|
||||
} q2_dbrushside_qbism_t;
|
||||
|
||||
typedef struct {
|
||||
int32_t firstside;
|
||||
int32_t numsides;
|
||||
|
|
@ -803,66 +742,8 @@ typedef struct {
|
|||
uint8_t dpop[256];
|
||||
} q2bsp_t;
|
||||
|
||||
typedef struct {
|
||||
int nummodels;
|
||||
q2_dmodel_t *dmodels;
|
||||
|
||||
int visdatasize;
|
||||
dvis_t *dvis;
|
||||
|
||||
int lightdatasize;
|
||||
uint8_t *dlightdata;
|
||||
|
||||
int entdatasize;
|
||||
char *dentdata;
|
||||
|
||||
int numleafs;
|
||||
q2_dleaf_qbism_t *dleafs;
|
||||
|
||||
int numplanes;
|
||||
dplane_t *dplanes;
|
||||
|
||||
int numvertexes;
|
||||
dvertex_t *dvertexes;
|
||||
|
||||
int numnodes;
|
||||
q2_dnode_qbism_t *dnodes;
|
||||
|
||||
int numtexinfo;
|
||||
q2_texinfo_t *texinfo;
|
||||
|
||||
int numfaces;
|
||||
q2_dface_qbism_t *dfaces;
|
||||
|
||||
int numedges;
|
||||
q2_dedge_qbism_t *dedges;
|
||||
|
||||
int numleaffaces;
|
||||
uint32_t *dleaffaces;
|
||||
|
||||
int numleafbrushes;
|
||||
uint32_t *dleafbrushes;
|
||||
|
||||
int numsurfedges;
|
||||
int32_t *dsurfedges;
|
||||
|
||||
int numareas;
|
||||
darea_t *dareas;
|
||||
|
||||
int numareaportals;
|
||||
dareaportal_t *dareaportals;
|
||||
|
||||
int numbrushes;
|
||||
dbrush_t *dbrushes;
|
||||
|
||||
int numbrushsides;
|
||||
q2_dbrushside_qbism_t *dbrushsides;
|
||||
|
||||
uint8_t dpop[256];
|
||||
} q2bsp_qbism_t;
|
||||
|
||||
struct mbsp_t {
|
||||
const bspversion_t *loadversion;
|
||||
int32_t loadversion;
|
||||
|
||||
int nummodels;
|
||||
dmodelh2_t *dmodels;
|
||||
|
|
@ -911,7 +792,7 @@ struct mbsp_t {
|
|||
uint32_t *dleaffaces;
|
||||
|
||||
int numleafbrushes;
|
||||
uint32_t *dleafbrushes;
|
||||
uint16_t *dleafbrushes;
|
||||
|
||||
int numsurfedges;
|
||||
int32_t *dsurfedges;
|
||||
|
|
@ -926,7 +807,7 @@ struct mbsp_t {
|
|||
dbrush_t *dbrushes;
|
||||
|
||||
int numbrushsides;
|
||||
q2_dbrushside_qbism_t *dbrushsides;
|
||||
dbrushside_t *dbrushsides;
|
||||
|
||||
uint8_t dpop[256];
|
||||
}; // "generic" bsp - superset of all other supported types
|
||||
|
|
@ -943,7 +824,8 @@ typedef struct {
|
|||
} q2_dheader_t;
|
||||
|
||||
typedef struct {
|
||||
const bspversion_t *version, *loadversion;
|
||||
int32_t loadversion;
|
||||
int32_t version;
|
||||
int hullcount;
|
||||
|
||||
struct {
|
||||
|
|
@ -952,7 +834,6 @@ typedef struct {
|
|||
bsp2_t bsp2;
|
||||
q2bsp_t q2bsp;
|
||||
mbsp_t mbsp;
|
||||
q2bsp_qbism_t q2bsp_qbism;
|
||||
} data;
|
||||
|
||||
bspxentry_t *bspxentries;
|
||||
|
|
@ -961,7 +842,7 @@ typedef struct {
|
|||
void LoadBSPFile(char *filename, bspdata_t *bspdata); //returns the filename as contained inside a bsp
|
||||
void WriteBSPFile(const char *filename, bspdata_t *bspdata);
|
||||
void PrintBSPFileSizes(const bspdata_t *bspdata);
|
||||
void ConvertBSPFormat(bspdata_t *bspdata, const bspversion_t *to_version);
|
||||
void ConvertBSPFormat(int32_t version, bspdata_t *bspdata);
|
||||
void BSPX_AddLump(bspdata_t *bspdata, const char *xname, const void *xdata, size_t xsize);
|
||||
const void *BSPX_GetLump(bspdata_t *bspdata, const char *xname, size_t *xsize);
|
||||
|
||||
|
|
|
|||
|
|
@ -1579,7 +1579,7 @@ static void MakeSurfaceLights(const mbsp_t *bsp)
|
|||
|
||||
for (int i = 0; i < bsp->numleafs; i++) {
|
||||
const mleaf_t *leaf = bsp->dleafs + i;
|
||||
const qboolean underwater = ((bsp->loadversion == &bspver_q2 || bsp->loadversion == &bspver_qbism) ? leaf->contents & Q2_CONTENTS_LIQUID : leaf->contents != CONTENTS_EMPTY); //mxd
|
||||
const qboolean underwater = (bsp->loadversion == Q2_BSPVERSION ? leaf->contents & Q2_CONTENTS_LIQUID : leaf->contents != CONTENTS_EMPTY); //mxd
|
||||
|
||||
for (int k = 0; k < leaf->nummarksurfaces; k++) {
|
||||
const int facenum = bsp->dleaffaces[leaf->firstmarksurface + k];
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void // WHO TOUCHED MY PALET?
|
|||
LoadPalette(bspdata_t *bspdata)
|
||||
{
|
||||
// Load Quake 2 palette
|
||||
if (bspdata->loadversion == &bspver_q2 || bspdata->loadversion == &bspver_qbism) {
|
||||
if (bspdata->loadversion == Q2_BSPVERSION) {
|
||||
uint8_t *palette;
|
||||
char path[1024];
|
||||
char colormap[] = "pics/colormap.pcx";
|
||||
|
|
@ -66,7 +66,7 @@ LoadPalette(bspdata_t *bspdata)
|
|||
for (int i = 0; i < 768; i++)
|
||||
thepalette[i] = palette[i];
|
||||
|
||||
} else if (bspdata->loadversion == &bspver_h2) {
|
||||
} else if (bspdata->hullcount == MAX_MAP_HULLS_H2) { // Gross hacks
|
||||
// Copy Hexen 2 palette
|
||||
for (int i = 0; i < 768; i++)
|
||||
thepalette[i] = hexen2palette[i];
|
||||
|
|
@ -721,7 +721,7 @@ void // Expects correct palette and game/mod paths to be set
|
|||
LoadOrConvertTextures(mbsp_t *bsp)
|
||||
{
|
||||
// Load or convert textures...
|
||||
if (bsp->loadversion == &bspver_q2 || bsp->loadversion == &bspver_qbism)
|
||||
if (bsp->loadversion == Q2_BSPVERSION)
|
||||
LoadTextures(bsp);
|
||||
else if (bsp->texdatasize > 0)
|
||||
ConvertTextures(bsp);
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ LightWorld(bspdata_t *bspdata, qboolean forcedscale)
|
|||
CalcualateVertexNormals(bsp);
|
||||
|
||||
const qboolean bouncerequired = cfg_static.bounce.boolValue() && (debugmode == debugmode_none || debugmode == debugmode_bounce || debugmode == debugmode_bouncelights); //mxd
|
||||
const qboolean isQuake2map = (bsp->loadversion == &bspver_q2 || bsp->loadversion == &bspver_qbism); //mxd
|
||||
const qboolean isQuake2map = (bsp->loadversion == Q2_BSPVERSION); //mxd
|
||||
|
||||
if (bouncerequired || isQuake2map) {
|
||||
MakeTextureColors(bsp);
|
||||
|
|
@ -470,7 +470,7 @@ LightWorld(bspdata_t *bspdata, qboolean forcedscale)
|
|||
// Transfer greyscale lightmap (or color lightmap for Q2/HL) to the bsp and update lightdatasize
|
||||
if (!litonly) {
|
||||
free(bsp->dlightdata);
|
||||
if (isQuake2map || bsp->loadversion == &bspver_hl) {
|
||||
if (bsp->loadversion == Q2_BSPVERSION || bsp->loadversion == BSPHLVERSION) {
|
||||
bsp->lightdatasize = lit_file_p;
|
||||
bsp->dlightdata = (uint8_t *)malloc(bsp->lightdatasize);
|
||||
memcpy(bsp->dlightdata, lit_filebase, bsp->lightdatasize);
|
||||
|
|
@ -545,9 +545,9 @@ LoadExtendedTexinfoFlags(const char *sourcefilename, const mbsp_t *bsp)
|
|||
static const char* //mxd
|
||||
GetBaseDirName(bspdata_t *bspdata)
|
||||
{
|
||||
if (bspdata->loadversion == &bspver_q2 || bspdata->loadversion == &bspver_qbism)
|
||||
if (bspdata->loadversion == Q2_BSPVERSION)
|
||||
return "BASEQ2";
|
||||
if (bspdata->loadversion == &bspver_h2)
|
||||
if (bspdata->hullcount == MAX_MAP_HULLS_H2)
|
||||
return "DATA1";
|
||||
return "ID1";
|
||||
}
|
||||
|
|
@ -951,7 +951,7 @@ light_main(int argc, const char **argv)
|
|||
{
|
||||
bspdata_t bspdata;
|
||||
mbsp_t *const bsp = &bspdata.data.mbsp;
|
||||
const bspversion_t *loadversion;
|
||||
int32_t loadversion;
|
||||
int i;
|
||||
double start;
|
||||
double end;
|
||||
|
|
@ -1199,10 +1199,10 @@ light_main(int argc, const char **argv)
|
|||
LoadBSPFile(source, &bspdata);
|
||||
|
||||
loadversion = bspdata.version;
|
||||
ConvertBSPFormat(&bspdata, &bspver_generic);
|
||||
ConvertBSPFormat(GENERIC_BSP, &bspdata);
|
||||
|
||||
//mxd. Use 1.0 rangescale as a default to better match with qrad3/arghrad
|
||||
if ((loadversion == &bspver_q2 || loadversion == &bspver_qbism) && !cfg.rangescale.isChanged())
|
||||
if (loadversion == Q2_BSPVERSION && !cfg.rangescale.isChanged())
|
||||
{
|
||||
const auto rs = new lockable_vec_t(cfg.rangescale.primaryName(), 1.0f, 0.0f, 100.0f);
|
||||
cfg.rangescale = *rs; // Gross hacks to avoid displaying this in OptionsSummary...
|
||||
|
|
@ -1242,7 +1242,7 @@ light_main(int argc, const char **argv)
|
|||
|
||||
if (!onlyents)
|
||||
{
|
||||
if (loadversion != &bspver_q2 && loadversion != &bspver_qbism && bsp->loadversion != &bspver_hl) //mxd. No lit for Quake 2
|
||||
if (loadversion != Q2_BSPVERSION && bsp->loadversion != BSPHLVERSION) //mxd. No lit for Quake 2
|
||||
CheckLitNeeded(cfg);
|
||||
SetupDirt(cfg);
|
||||
|
||||
|
|
@ -1281,7 +1281,7 @@ light_main(int argc, const char **argv)
|
|||
|
||||
WriteEntitiesToString(cfg, bsp);
|
||||
/* Convert data format back if necessary */
|
||||
ConvertBSPFormat(&bspdata, loadversion);
|
||||
ConvertBSPFormat(loadversion, &bspdata);
|
||||
|
||||
if (!litonly) {
|
||||
WriteBSPFile(source, &bspdata);
|
||||
|
|
|
|||
|
|
@ -1034,7 +1034,7 @@ GetLightContrib(const globalconfig_t &cfg, const light_t *entity, const vec3_t s
|
|||
if (dist < 0.1) {
|
||||
// Catch 0 distance between sample point and light (produces infinite brightness / nan's) and causes
|
||||
// problems later
|
||||
dist = 0.1f;
|
||||
dist = 0.1;
|
||||
VectorSet(surfpointToLightDir_out, 0, 0, 1);
|
||||
}
|
||||
const float add = GetLightValueWithAngle(cfg, entity, surfnorm, surfpointToLightDir_out, dist, twosided);
|
||||
|
|
@ -3081,7 +3081,7 @@ WriteLightmaps(const mbsp_t *bsp, bsp2_dface_t *face, facesup_t *facesup, const
|
|||
continue;
|
||||
|
||||
// skip lightmaps where all samples have brightness below 1
|
||||
if (bsp->loadversion != &bspver_q2 && bsp->loadversion != &bspver_qbism) { // HACK: don't do this on Q2. seems if all styles are 0xff, the face is drawn fullbright instead of black (Q1)
|
||||
if (bsp->loadversion != Q2_BSPVERSION) { // HACK: don't do this on Q2. seems if all styles are 0xff, the face is drawn fullbright instead of black (Q1)
|
||||
const float maxb = Lightmap_MaxBrightness(&lightmap, lightsurf);
|
||||
if (maxb < 1)
|
||||
continue;
|
||||
|
|
@ -3146,7 +3146,7 @@ WriteLightmaps(const mbsp_t *bsp, bsp2_dface_t *face, facesup_t *facesup, const
|
|||
|
||||
// q2 support
|
||||
int lightofs;
|
||||
if (bsp->loadversion == &bspver_q2 || bsp->loadversion == &bspver_qbism || bsp->loadversion == &bspver_hl) {
|
||||
if (bsp->loadversion == Q2_BSPVERSION || bsp->loadversion == BSPHLVERSION) {
|
||||
lightofs = lit - lit_filebase;
|
||||
} else {
|
||||
lightofs = out - filebase;
|
||||
|
|
|
|||
|
|
@ -716,7 +716,7 @@ TraceFaces (traceinfo_t *ti, int node, const vec3_t start, const vec3_t end)
|
|||
|
||||
// only solid and sky faces stop the trace.
|
||||
bool issolid, issky; //mxd
|
||||
if(bsp_static->loadversion == &bspver_q2 || bsp_static->loadversion == &bspver_qbism) {
|
||||
if(bsp_static->loadversion == Q2_BSPVERSION) {
|
||||
issolid = !(fi->content & Q2_SURF_TRANSLUCENT);
|
||||
issky = (fi->content & Q2_SURF_SKY);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ Embree_FilterFuncN(const struct RTCFilterFunctionNArguments* args)
|
|||
|
||||
//mxd
|
||||
bool isFence, isGlass;
|
||||
if(bsp_static->loadversion == &bspver_q2 || bsp_static->loadversion == &bspver_qbism) {
|
||||
if(bsp_static->loadversion == Q2_BSPVERSION) {
|
||||
const int contents = Face_Contents(bsp_static, face);
|
||||
isFence = ((contents & Q2_SURF_TRANSLUCENT) == Q2_SURF_TRANSLUCENT); // KMQuake 2-specific. Use texture alpha chanel when both flags are set.
|
||||
isGlass = !isFence && (contents & Q2_SURF_TRANSLUCENT);
|
||||
|
|
@ -559,7 +559,7 @@ MakeFaces_r(const mbsp_t *bsp, const int nodenum, std::vector<plane_t> *planes,
|
|||
const int leafnum = -nodenum - 1;
|
||||
const mleaf_t *leaf = &bsp->dleafs[leafnum];
|
||||
|
||||
if ((bsp->loadversion == &bspver_q2 || bsp->loadversion == &bspver_qbism) ? leaf->contents & Q2_CONTENTS_SOLID : leaf->contents == CONTENTS_SOLID) {
|
||||
if (bsp->loadversion == Q2_BSPVERSION ? leaf->contents & Q2_CONTENTS_SOLID : leaf->contents == CONTENTS_SOLID) {
|
||||
std::vector<winding_t *> leaf_windings = Leaf_MakeFaces(bsp, leaf, *planes);
|
||||
for (winding_t *w : leaf_windings) {
|
||||
result->push_back(w);
|
||||
|
|
@ -631,16 +631,15 @@ Embree_TraceInit(const mbsp_t *bsp)
|
|||
|
||||
const int contents = Face_Contents(bsp, face); //mxd
|
||||
const gtexinfo_t *texinfo = Face_Texinfo(bsp, face);
|
||||
const bool is_q2 = bsp->loadversion == &bspver_q2 || bsp->loadversion == &bspver_qbism;
|
||||
|
||||
//mxd. Skip NODRAW faces, but not SKY ones (Q2's sky01.wal has both flags set)
|
||||
if(is_q2 && (contents & Q2_SURF_NODRAW) && !(contents & Q2_SURF_SKY))
|
||||
if(bsp->loadversion == Q2_BSPVERSION && (contents & Q2_SURF_NODRAW) && !(contents & Q2_SURF_SKY))
|
||||
continue;
|
||||
|
||||
// handle glass / water
|
||||
const float alpha = Face_Alpha(model, face);
|
||||
if (alpha < 1.0f
|
||||
|| (is_q2 && (contents & Q2_SURF_TRANSLUCENT))) { //mxd. Both fence and transparent textures are done using SURF_TRANS flags in Q2
|
||||
|| (bsp->loadversion == Q2_BSPVERSION && (contents & Q2_SURF_TRANSLUCENT))) { //mxd. Both fence and transparent textures are done using SURF_TRANS flags in Q2
|
||||
filterfaces.push_back(face);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -653,7 +652,7 @@ Embree_TraceInit(const mbsp_t *bsp)
|
|||
}
|
||||
|
||||
// handle sky
|
||||
if (is_q2) {
|
||||
if (bsp->loadversion == Q2_BSPVERSION) {
|
||||
// Q2: arghrad compat: sky faces only emit sunlight if:
|
||||
// sky flag set, light flag set, value nonzero
|
||||
if ((contents & Q2_SURF_SKY) != 0
|
||||
|
|
|
|||
|
|
@ -1234,7 +1234,7 @@ main(int argc, char **argv)
|
|||
{
|
||||
bspdata_t bspdata;
|
||||
mbsp_t *const bsp = &bspdata.data.mbsp;
|
||||
const bspversion_t *loadversion;
|
||||
int32_t loadversion;
|
||||
int i;
|
||||
|
||||
init_log("vis.log");
|
||||
|
|
@ -1309,7 +1309,7 @@ main(int argc, char **argv)
|
|||
LoadBSPFile(sourcefile, &bspdata);
|
||||
|
||||
loadversion = bspdata.version;
|
||||
ConvertBSPFormat(&bspdata, &bspver_generic);
|
||||
ConvertBSPFormat(GENERIC_BSP, &bspdata);
|
||||
|
||||
strcpy(portalfile, argv[i]);
|
||||
StripExtension(portalfile);
|
||||
|
|
@ -1341,7 +1341,7 @@ main(int argc, char **argv)
|
|||
CalcAmbientSounds(bsp);
|
||||
|
||||
/* Convert data format back if necessary */
|
||||
ConvertBSPFormat(&bspdata, loadversion);
|
||||
ConvertBSPFormat(loadversion, &bspdata);
|
||||
|
||||
WriteBSPFile(sourcefile, &bspdata);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue