From 4ff4acb8c51acf1db6ffadff5bbaf5c7a8943538 Mon Sep 17 00:00:00 2001 From: Kevin Shanahan Date: Tue, 5 Mar 2013 12:01:15 +1030 Subject: [PATCH] qbsp: create a skip flag for SKIP textures Signed-off-by: Kevin Shanahan --- qbsp/map.c | 35 +++++++++++++++++++---------------- qbsp/qbsp.h | 5 +++-- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/qbsp/map.c b/qbsp/map.c index 6d13f247..3adad7b6 100644 --- a/qbsp/map.c +++ b/qbsp/map.c @@ -62,43 +62,46 @@ Returns a global texinfo number =============== */ static int -FindTexinfo(texinfo_t *t) +FindTexinfo(texinfo_t *texinfo) { - int i, j; - texinfo_t *tex; - const char *name; + int index, j; + texinfo_t *target; + const char *texname; + const int num_texinfo = pWorldEnt->lumps[BSPTEXINFO].index; // set the special flag - name = map.miptex[t->miptex]; - if (name[0] == '*' || !strncasecmp(name, "sky", 3)) + texname = map.miptex[texinfo->miptex]; + if (texname[0] == '*' || !strncasecmp(texname, "sky", 3)) if (!options.fSplitspecial) - t->flags |= TEX_SPECIAL; + texinfo->flags |= TEX_SPECIAL; + if (!strcasecmp(texname, "skip")) + texinfo->flags |= TEX_SKIP; - tex = pWorldEnt->lumps[BSPTEXINFO].data; - for (i = 0; i < pWorldEnt->lumps[BSPTEXINFO].index; i++, tex++) { - if (t->miptex != tex->miptex) + target = pWorldEnt->lumps[BSPTEXINFO].data; + for (index = 0; index < num_texinfo; index++, target++) { + if (texinfo->miptex != target->miptex) continue; - if (t->flags != tex->flags) + if (texinfo->flags != target->flags) continue; for (j = 0; j < 4; j++) { - if (t->vecs[0][j] != tex->vecs[0][j]) + if (texinfo->vecs[0][j] != target->vecs[0][j]) break; - if (t->vecs[1][j] != tex->vecs[1][j]) + if (texinfo->vecs[1][j] != target->vecs[1][j]) break; } if (j != 4) continue; - return i; + return index; } /* Allocate a new texinfo at the end of the array */ - *tex = *t; + *target = *texinfo; pWorldEnt->lumps[BSPTEXINFO].index++; map.cTotal[BSPTEXINFO]++; - return i; + return index; } diff --git a/qbsp/qbsp.h b/qbsp/qbsp.h index ad643d9d..3fa66235 100644 --- a/qbsp/qbsp.h +++ b/qbsp/qbsp.h @@ -97,8 +97,9 @@ // Special contents flags for the compiler only #define CFLAGS_DETAIL (1U << 0) -// flag for textures, sky or slime, no lightmap or 256 subdivision -#define TEX_SPECIAL 1 +// Texture flags +#define TEX_SPECIAL (1U << 0) /* sky or liquid (no lightmap or subdivision */ +#define TEX_SKIP (1U << 1) /* an invisible surface */ #define MAXLIGHTMAPS 4