qbsp: c++ compat changes
This commit is contained in:
parent
a4c24ac0fa
commit
6e94f6a1c2
|
|
@ -23,6 +23,10 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* FIXME - put this typedef elsewhere */
|
/* FIXME - put this typedef elsewhere */
|
||||||
typedef uint8_t byte;
|
typedef uint8_t byte;
|
||||||
|
|
||||||
|
|
@ -243,4 +247,8 @@ void WriteBSPFile(void);
|
||||||
void PrintBSPFileSizes(void);
|
void PrintBSPFileSizes(void);
|
||||||
void BSPX_AddLump(const char *xname, const void *xdata, size_t xsize);
|
void BSPX_AddLump(const char *xname, const void *xdata, size_t xsize);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __BSPFILE_H__ */
|
#endif /* __BSPFILE_H__ */
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,14 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t LoadFile(const char *filename, void *bufptr, bool nofail);
|
size_t LoadFile(const char *filename, void *bufptr, bool nofail);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAXTOKEN 1024
|
#define MAXTOKEN 1024
|
||||||
|
|
||||||
typedef enum parseflags {
|
typedef enum parseflags {
|
||||||
|
|
@ -43,4 +47,8 @@ typedef struct parser {
|
||||||
bool ParseToken(parser_t *p, parseflags_t flags);
|
bool ParseToken(parser_t *p, parseflags_t flags);
|
||||||
void ParserInit(parser_t *p, const char *data);
|
void ParserInit(parser_t *p, const char *data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* PARSER_H */
|
#endif /* PARSER_H */
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ void BSPX_Brushes_AddModel(struct bspxbrushes_s *ctx, int modelnum, brush_t *bru
|
||||||
if (ctx->lumpmaxsize < ctx->lumpsize + sizeof(permodel) + permodel.numbrushes*sizeof(perbrush) + permodel.numfaces*sizeof(perface))
|
if (ctx->lumpmaxsize < ctx->lumpsize + sizeof(permodel) + permodel.numbrushes*sizeof(perbrush) + permodel.numfaces*sizeof(perface))
|
||||||
{
|
{
|
||||||
ctx->lumpmaxsize = (ctx->lumpsize + sizeof(permodel) + permodel.numbrushes*sizeof(perbrush) + permodel.numfaces*sizeof(perface))*2;
|
ctx->lumpmaxsize = (ctx->lumpsize + sizeof(permodel) + permodel.numbrushes*sizeof(perbrush) + permodel.numfaces*sizeof(perface))*2;
|
||||||
ctx->lumpinfo = realloc(ctx->lumpinfo, ctx->lumpmaxsize);
|
ctx->lumpinfo = (byte *) realloc(ctx->lumpinfo, ctx->lumpmaxsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
permodel.ver = LittleLong(1);
|
permodel.ver = LittleLong(1);
|
||||||
|
|
@ -547,7 +547,7 @@ ProcessFile(void)
|
||||||
if (wadstring[0])
|
if (wadstring[0])
|
||||||
Message(msgWarning, warnNoValidWads);
|
Message(msgWarning, warnNoValidWads);
|
||||||
/* Try the default wad name */
|
/* Try the default wad name */
|
||||||
defaultwad = AllocMem(OTHER, strlen(options.szMapName) + 5, false);
|
defaultwad = (char *) AllocMem(OTHER, strlen(options.szMapName) + 5, false);
|
||||||
strcpy(defaultwad, options.szMapName);
|
strcpy(defaultwad, options.szMapName);
|
||||||
StripExtension(defaultwad);
|
StripExtension(defaultwad);
|
||||||
DefaultExtension(defaultwad, ".wad");
|
DefaultExtension(defaultwad, ".wad");
|
||||||
|
|
@ -829,7 +829,7 @@ InitQBSP(int argc, char **argv)
|
||||||
if (argv[i][0] != '-')
|
if (argv[i][0] != '-')
|
||||||
length += 2; /* quotes */
|
length += 2; /* quotes */
|
||||||
}
|
}
|
||||||
szBuf = AllocMem(OTHER, length, true);
|
szBuf = (char *) AllocMem(OTHER, length, true);
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
/* Quote filenames for the parsing function */
|
/* Quote filenames for the parsing function */
|
||||||
if (argv[i][0] != '-')
|
if (argv[i][0] != '-')
|
||||||
|
|
|
||||||
|
|
@ -38,13 +38,16 @@
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "warnerr.h"
|
#include "warnerr.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef offsetof
|
#ifndef offsetof
|
||||||
#define offsetof(type, member) __builtin_offsetof(type, member)
|
#define offsetof(type, member) __builtin_offsetof(type, member)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define __func__ __FUNCTION__
|
#define __func__ __FUNCTION__
|
||||||
#define inline __inline
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
|
|
@ -626,4 +629,8 @@ void Message(int MsgType, ...);
|
||||||
void Error(const char *error, ...)
|
void Error(const char *error, ...)
|
||||||
__attribute__((format(printf,1,2),noreturn));
|
__attribute__((format(printf,1,2),noreturn));
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char identification[4]; // should be WAD2
|
char identification[4]; // should be WAD2
|
||||||
int numlumps;
|
int numlumps;
|
||||||
|
|
@ -67,4 +71,8 @@ void WADList_Free(wad_t *wadlist);
|
||||||
const texture_t *WADList_GetTexture(const char *name);
|
const texture_t *WADList_GetTexture(const char *name);
|
||||||
// for getting a texture width/height
|
// for getting a texture width/height
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* WAD_H */
|
#endif /* WAD_H */
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@
|
||||||
*/
|
*/
|
||||||
// warnerr.h
|
// warnerr.h
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
warnNoWadKey, // 0
|
warnNoWadKey, // 0
|
||||||
warnNoValidWads,
|
warnNoValidWads,
|
||||||
|
|
@ -49,3 +53,7 @@ enum {
|
||||||
warnMixedFaceContents,
|
warnMixedFaceContents,
|
||||||
cWarnings
|
cWarnings
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue