[PATCH 8/9] qbsp: Remove stricmp/strcasecmp workaround
Patch the source files and remove the preprocessor workaround for stricmp/strcasecmp substitution. Signed-off-by: Tyrann <tyrann@disenchant.net>
This commit is contained in:
parent
099e22f733
commit
1c082ace11
2
Makefile
2
Makefile
|
|
@ -144,8 +144,6 @@ QBSP_OBJECTS = \
|
|||
mathlib.o merge.o outside.o parser.o portals.o qbsp.o solidbsp.o \
|
||||
surfaces.o tjunc.o util.o wad.o winding.o writebsp.o
|
||||
|
||||
qbsp/%.o: CPPFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp
|
||||
|
||||
qbsp/%.o: qbsp/%.c
|
||||
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
|
||||
|
||||
|
|
|
|||
13
qbsp/brush.c
13
qbsp/brush.c
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
See file, 'COPYING', for details.
|
||||
*/
|
||||
// brush.c
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "qbsp.h"
|
||||
|
||||
|
|
@ -263,7 +264,7 @@ FindTargetEntity(char *szTarget)
|
|||
|
||||
for (iEntity = 0; iEntity < map.cEntities; iEntity++) {
|
||||
szName = ValueForKey(iEntity, "targetname");
|
||||
if (szName && !stricmp(szTarget, szName))
|
||||
if (szName && !strcasecmp(szTarget, szName))
|
||||
return iEntity;
|
||||
}
|
||||
|
||||
|
|
@ -728,20 +729,20 @@ LoadBrush(int iBrush)
|
|||
pTexinfo[map.rgFaces[map.rgBrushes[iBrush].iFaceStart].
|
||||
texinfo].miptex];
|
||||
|
||||
if (!stricmp(szName, "clip") && hullnum == 0)
|
||||
if (!strcasecmp(szName, "clip") && hullnum == 0)
|
||||
return NULL; // "clip" brushes don't show up in the draw hull
|
||||
|
||||
// entities never use water merging
|
||||
if (map.iEntities != 0)
|
||||
contents = CONTENTS_SOLID;
|
||||
else if (szName[0] == '*') {
|
||||
if (!strnicmp(szName + 1, "lava", 4))
|
||||
if (!strncasecmp(szName + 1, "lava", 4))
|
||||
contents = CONTENTS_LAVA;
|
||||
else if (!strnicmp(szName + 1, "slime", 5))
|
||||
else if (!strncasecmp(szName + 1, "slime", 5))
|
||||
contents = CONTENTS_SLIME;
|
||||
else
|
||||
contents = CONTENTS_WATER;
|
||||
} else if (!strnicmp(szName, "sky", 3) && hullnum == 0)
|
||||
} else if (!strncasecmp(szName, "sky", 3) && hullnum == 0)
|
||||
contents = CONTENTS_SKY;
|
||||
else
|
||||
contents = CONTENTS_SOLID;
|
||||
|
|
|
|||
15
qbsp/map.c
15
qbsp/map.c
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
See file, 'COPYING', for details.
|
||||
*/
|
||||
// map.c
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "qbsp.h"
|
||||
#include "parser.h"
|
||||
|
|
@ -65,7 +66,7 @@ FindTexinfo(texinfo_t *t)
|
|||
|
||||
// set the special flag
|
||||
if ((rgszMiptex[t->miptex][0] == '*'
|
||||
|| !strnicmp(rgszMiptex[t->miptex], "sky", 3))
|
||||
|| !strncasecmp(rgszMiptex[t->miptex], "sky", 3))
|
||||
&& !options.fSplitspecial)
|
||||
t->flags |= TEX_SPECIAL;
|
||||
|
||||
|
|
@ -111,19 +112,19 @@ ParseEpair(void)
|
|||
Message(msgError, errEpairTooLong, linenum);
|
||||
e->value = copystring(token);
|
||||
|
||||
if (!stricmp(e->key, "origin"))
|
||||
if (!strcasecmp(e->key, "origin"))
|
||||
sscanf(e->value, "%f %f %f",
|
||||
&(map.rgEntities[map.iEntities].origin[0]),
|
||||
&(map.rgEntities[map.iEntities].origin[1]),
|
||||
&(map.rgEntities[map.iEntities].origin[2]));
|
||||
else if (!stricmp(e->key, "classname")) {
|
||||
if (!stricmp(e->value, "info_player_start")) {
|
||||
else if (!strcasecmp(e->key, "classname")) {
|
||||
if (!strcasecmp(e->value, "info_player_start")) {
|
||||
if (rgfStartSpots & info_player_start)
|
||||
Message(msgWarning, warnMultipleStarts);
|
||||
rgfStartSpots |= info_player_start;
|
||||
} else if (!stricmp(e->value, "info_player_deathmatch"))
|
||||
} else if (!strcasecmp(e->value, "info_player_deathmatch"))
|
||||
rgfStartSpots |= info_player_deathmatch;
|
||||
else if (!stricmp(e->value, "info_player_coop"))
|
||||
else if (!strcasecmp(e->value, "info_player_coop"))
|
||||
rgfStartSpots |= info_player_coop;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
35
qbsp/qbsp.c
35
qbsp/qbsp.c
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
See file, 'COPYING', for details.
|
||||
*/
|
||||
// qbsp.c
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "qbsp.h"
|
||||
#include "wad.h"
|
||||
|
|
@ -386,45 +387,45 @@ ParseOptions(char *szOptions)
|
|||
NameCount++;
|
||||
} else {
|
||||
szTok++;
|
||||
if (!stricmp(szTok, "tjunc"))
|
||||
if (!strcasecmp(szTok, "tjunc"))
|
||||
options.fTjunc = true;
|
||||
else if (!stricmp(szTok, "nofill"))
|
||||
else if (!strcasecmp(szTok, "nofill"))
|
||||
options.fNofill = true;
|
||||
else if (!stricmp(szTok, "noclip"))
|
||||
else if (!strcasecmp(szTok, "noclip"))
|
||||
options.fNoclip = true;
|
||||
else if (!stricmp(szTok, "onlyents"))
|
||||
else if (!strcasecmp(szTok, "onlyents"))
|
||||
options.fOnlyents = true;
|
||||
else if (!stricmp(szTok, "verbose"))
|
||||
else if (!strcasecmp(szTok, "verbose"))
|
||||
options.fAllverbose = true;
|
||||
else if (!stricmp(szTok, "splitspecial"))
|
||||
else if (!strcasecmp(szTok, "splitspecial"))
|
||||
options.fSplitspecial = true;
|
||||
else if (!stricmp(szTok, "transwater"))
|
||||
else if (!strcasecmp(szTok, "transwater"))
|
||||
options.fTranswater = true;
|
||||
else if (!stricmp(szTok, "transsky"))
|
||||
else if (!strcasecmp(szTok, "transsky"))
|
||||
options.fTranssky = true;
|
||||
else if (!stricmp(szTok, "oldaxis"))
|
||||
else if (!strcasecmp(szTok, "oldaxis"))
|
||||
options.fOldaxis = true;
|
||||
else if (!stricmp(szTok, "bspleak"))
|
||||
else if (!strcasecmp(szTok, "bspleak"))
|
||||
options.fBspleak = true;
|
||||
else if (!stricmp(szTok, "noverbose"))
|
||||
else if (!strcasecmp(szTok, "noverbose"))
|
||||
options.fNoverbose = true;
|
||||
else if (!stricmp(szTok, "oldleak"))
|
||||
else if (!strcasecmp(szTok, "oldleak"))
|
||||
options.fOldleak = true;
|
||||
else if (!stricmp(szTok, "nopercent"))
|
||||
else if (!strcasecmp(szTok, "nopercent"))
|
||||
options.fNopercent = true;
|
||||
else if (!stricmp(szTok, "leakdist")) {
|
||||
else if (!strcasecmp(szTok, "leakdist")) {
|
||||
szTok2 = GetTok(szTok + strlen(szTok) + 1, szEnd);
|
||||
if (!szTok2)
|
||||
Message(msgError, errInvalidOption, szTok);
|
||||
options.dxLeakDist = atoi(szTok2);
|
||||
szTok = szTok2;
|
||||
} else if (!stricmp(szTok, "subdivide")) {
|
||||
} else if (!strcasecmp(szTok, "subdivide")) {
|
||||
szTok2 = GetTok(szTok + strlen(szTok), szEnd);
|
||||
if (!szTok2)
|
||||
Message(msgError, errInvalidOption, szTok);
|
||||
options.dxSubdivide = atoi(szTok2);
|
||||
szTok = szTok2;
|
||||
} else if (!stricmp(szTok, "?") || !stricmp(szTok, "help"))
|
||||
} else if (!strcasecmp(szTok, "?") || !strcasecmp(szTok, "help"))
|
||||
PrintOptions();
|
||||
else
|
||||
Message(msgError, errUnknownOption, szTok);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
See file, 'COPYING', for details.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "qbsp.h"
|
||||
#include "wad.h"
|
||||
|
||||
|
|
@ -139,7 +141,7 @@ WAD_ProcessWad(wad_t *w)
|
|||
for (i = 0; i < cMiptex; i++)
|
||||
for (j = 0; j < w->numwads; j++) {
|
||||
for (k = 0; k < w->wadlist[j].header.numlumps; k++)
|
||||
if (!stricmp(rgszMiptex[i], w->wadlist[j].lumps[k].name)) {
|
||||
if (!strcasecmp(rgszMiptex[i], w->wadlist[j].lumps[k].name)) {
|
||||
// Found it. Add in the size and skip to outer loop.
|
||||
pWorldEnt->cTexdata += w->wadlist[j].lumps[k].disksize;
|
||||
j = w->numwads;
|
||||
|
|
@ -202,7 +204,7 @@ WAD_LoadLump(wadlist_t *w, char *name, byte *dest)
|
|||
int len;
|
||||
|
||||
for (i = 0; i < w->header.numlumps; i++) {
|
||||
if (!stricmp(name, w->lumps[i].name)) {
|
||||
if (!strcasecmp(name, w->lumps[i].name)) {
|
||||
fseek(w->Wad, w->lumps[i].filepos, SEEK_SET);
|
||||
len = fread(dest, 1, w->lumps[i].disksize, w->Wad);
|
||||
if (len != w->lumps[i].disksize)
|
||||
|
|
@ -239,7 +241,7 @@ WAD_AddAnimatingTextures(wad_t *w)
|
|||
// see if this name exists in the wadfiles
|
||||
for (l = 0; l < w->numwads; l++)
|
||||
for (k = 0; k < w->wadlist[l].header.numlumps; k++)
|
||||
if (!stricmp(name, w->wadlist[l].lumps[k].name)) {
|
||||
if (!strcasecmp(name, w->wadlist[l].lumps[k].name)) {
|
||||
FindMiptex(name); // add to the miptex list
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue