qbsp: add casts to compile as c++
This commit is contained in:
parent
923118dfc6
commit
ecff3f77a8
10
qbsp/brush.c
10
qbsp/brush.c
|
|
@ -386,7 +386,7 @@ CreateBrushFaces(hullbrush_t *hullbrush, const vec3_t rotate_offset,
|
|||
for (i = 0; i < hullbrush->numfaces; i++, mapface++) {
|
||||
if (!hullnum) {
|
||||
/* Don't generate hintskip faces */
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const char *texname = map.miptex[texinfo[mapface->texinfo].miptex];
|
||||
if (!Q_strcasecmp(texname, "hintskip"))
|
||||
continue;
|
||||
|
|
@ -407,7 +407,7 @@ CreateBrushFaces(hullbrush_t *hullbrush, const vec3_t rotate_offset,
|
|||
continue; // overconstrained plane
|
||||
|
||||
// this face is a keeper
|
||||
f = AllocMem(FACE, 1, true);
|
||||
f = (face_t *)AllocMem(FACE, 1, true);
|
||||
f->w.numpoints = w->numpoints;
|
||||
if (f->w.numpoints > MAXEDGES)
|
||||
Error("face->numpoints > MAXEDGES (%d), source face on line %d",
|
||||
|
|
@ -435,7 +435,7 @@ CreateBrushFaces(hullbrush_t *hullbrush, const vec3_t rotate_offset,
|
|||
|
||||
// account for texture offset, from txqbsp-xt
|
||||
if (options.fixRotateObjTexture) {
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
texinfo_t texInfoNew;
|
||||
vec3_t vecs[2];
|
||||
int k, l;
|
||||
|
|
@ -792,7 +792,7 @@ Brush_GetContents(const mapbrush_t *mapbrush)
|
|||
{
|
||||
const mapface_t *mapface;
|
||||
const char *texname;
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
|
||||
mapface = mapbrush->faces;
|
||||
texname = map.miptex[texinfo[mapface->texinfo].miptex];
|
||||
|
|
@ -909,7 +909,7 @@ LoadBrush(const mapbrush_t *mapbrush, const vec3_t rotate_offset,
|
|||
}
|
||||
|
||||
// create the brush
|
||||
brush = AllocMem(BRUSH, 1, true);
|
||||
brush = (brush_t *)AllocMem(BRUSH, 1, true);
|
||||
|
||||
brush->faces = facelist;
|
||||
VectorCopy(hullbrush.mins, brush->mins);
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ AddLump(FILE *f, int Type)
|
|||
entities = &entity->lumps[Type];
|
||||
if (entities->data) {
|
||||
if (Type == LUMP_MODELS && !options.hexen2) {
|
||||
const dmodel_t *in = entities->data;
|
||||
const dmodel_t *in = (const dmodel_t *)entities->data;
|
||||
dmodelq1_t out;
|
||||
int j, k;
|
||||
for (j = 0; j < entities->count; j++)
|
||||
|
|
@ -201,7 +201,7 @@ GenLump(const char *bspxlump, int Type, size_t sz)
|
|||
}
|
||||
if (!cLen)
|
||||
return;
|
||||
out = malloc(cLen);
|
||||
out = (char *)malloc(cLen);
|
||||
cLen = 0;
|
||||
for (i = 0, entity = map.entities; i < map.numentities; i++, entity++) {
|
||||
entities = &entity->lumps[Type];
|
||||
|
|
@ -221,7 +221,7 @@ void BSPX_AddLump(const char *xname, const void *xdata, size_t xsize)
|
|||
}
|
||||
if (!e)
|
||||
{
|
||||
e = malloc(sizeof(*e));
|
||||
e = (bspxentry_t *)malloc(sizeof(*e));
|
||||
memset(e, 0, sizeof(*e));
|
||||
strncpy(e->lumpname, xname, sizeof(e->lumpname));
|
||||
e->next = bspxentries;
|
||||
|
|
@ -243,7 +243,7 @@ WriteBSPFile(void)
|
|||
FILE *f;
|
||||
size_t ret;
|
||||
|
||||
header = AllocMem(OTHER, sizeof(dheader_t), true);
|
||||
header = (dheader_t *)AllocMem(OTHER, sizeof(dheader_t), true);
|
||||
header->version = options.BSPVersion;
|
||||
|
||||
StripExtension(options.szBSPName);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ copystring(const char *s)
|
|||
{
|
||||
char *b;
|
||||
|
||||
b = AllocMem(OTHER, strlen(s) + 1, true);
|
||||
b = (char *)AllocMem(OTHER, strlen(s) + 1, true);
|
||||
strcpy(b, s);
|
||||
return b;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ NewFaceFromFace(face_t *in)
|
|||
{
|
||||
face_t *newf;
|
||||
|
||||
newf = AllocMem(FACE, 1, true);
|
||||
newf = (face_t *)AllocMem(FACE, 1, true);
|
||||
|
||||
newf->planenum = in->planenum;
|
||||
newf->texinfo = in->texinfo;
|
||||
|
|
@ -389,7 +389,7 @@ BuildSurfaces(face_t **planefaces)
|
|||
continue;
|
||||
|
||||
/* create a new surface to hold the faces on this plane */
|
||||
surf = AllocMem(SURFACE, 1, true);
|
||||
surf = (surface_t *)AllocMem(SURFACE, 1, true);
|
||||
surf->planenum = i;
|
||||
surf->next = surfaces;
|
||||
surfaces = surf;
|
||||
|
|
@ -419,7 +419,7 @@ CopyBrushFaces(const brush_t *brush)
|
|||
facelist = NULL;
|
||||
for (face = brush->faces; face; face = face->next) {
|
||||
brushfaces++;
|
||||
newface = AllocMem(FACE, 1, true);
|
||||
newface = (face_t *)AllocMem(FACE, 1, true);
|
||||
*newface = *face;
|
||||
newface->contents[0] = CONTENTS_EMPTY;
|
||||
newface->contents[1] = brush->contents;
|
||||
|
|
@ -455,7 +455,7 @@ CSGFaces(const mapentity_t *entity)
|
|||
|
||||
Message(msgProgress, "CSGFaces");
|
||||
|
||||
planefaces = AllocMem(OTHER, sizeof(face_t *) * map.maxplanes, true);
|
||||
planefaces = (face_t **)AllocMem(OTHER, sizeof(face_t *) * map.maxplanes, true);
|
||||
csgfaces = brushfaces = csgmergefaces = 0;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ GetUV(const texinfo_t *texinfo, const vec_t *pos, const int width, const int hei
|
|||
static void
|
||||
ExportObjFace(FILE *f, const face_t *face, int *vertcount)
|
||||
{
|
||||
const texinfo_t *texinfos = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfos = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = &texinfos[face->texinfo];
|
||||
const char *texname = map.miptex[texinfo->miptex];
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ LoadFile
|
|||
size_t
|
||||
LoadFile(const char *filename, void *bufptr, bool nofail)
|
||||
{
|
||||
char **buf = bufptr;
|
||||
char **buf = (char **)bufptr;
|
||||
size_t len;
|
||||
FILE *f;
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ LoadFile(const char *filename, void *bufptr, bool nofail)
|
|||
len = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
*buf = AllocMem(OTHER, len + 1, false);
|
||||
*buf = (char *)AllocMem(OTHER, len + 1, false);
|
||||
((char *)*buf)[len] = 0;
|
||||
|
||||
if (fread(*buf, 1, len, f) != len)
|
||||
|
|
|
|||
22
qbsp/map.c
22
qbsp/map.c
|
|
@ -156,7 +156,7 @@ FindTexinfo(texinfo_t *texinfo, unsigned int flags)
|
|||
/* Set the texture flags */
|
||||
texinfo->flags = flags;
|
||||
|
||||
target = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
target = (texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
for (index = 0; index < num_texinfo; index++, target++) {
|
||||
if (texinfo->miptex != target->miptex)
|
||||
continue;
|
||||
|
|
@ -183,9 +183,9 @@ FindTexinfo(texinfo_t *texinfo, unsigned int flags)
|
|||
{
|
||||
/* Enlarge the array */
|
||||
struct lumpdata *lump = &pWorldEnt->lumps[LUMP_TEXINFO];
|
||||
texinfo_t *olddata = lump->data;
|
||||
texinfo_t *olddata = (texinfo_t *)lump->data;
|
||||
int newcount = lump->count * 2;
|
||||
texinfo_t *newdata = AllocMem(BSP_TEXINFO, newcount, true);
|
||||
texinfo_t *newdata = (texinfo_t *)AllocMem(BSP_TEXINFO, newcount, true);
|
||||
|
||||
memcpy(newdata, olddata, lump->index * sizeof(texinfo_t));
|
||||
FreeMem(olddata, BSP_TEXINFO, lump->count);
|
||||
|
|
@ -246,7 +246,7 @@ ParseEpair(parser_t *parser, mapentity_t *entity)
|
|||
{
|
||||
epair_t *epair;
|
||||
|
||||
epair = AllocMem(OTHER, sizeof(epair_t), true);
|
||||
epair = (epair_t *)AllocMem(OTHER, sizeof(epair_t), true);
|
||||
epair->next = entity->epairs;
|
||||
entity->epairs = epair;
|
||||
|
||||
|
|
@ -735,9 +735,9 @@ PreParseFile(const char *buf)
|
|||
Message(msgWarning, warnBadMapFaceCount);
|
||||
map.maxfaces /= 3;
|
||||
|
||||
map.faces = AllocMem(MAPFACE, map.maxfaces, true);
|
||||
map.brushes = AllocMem(MAPBRUSH, map.maxbrushes, true);
|
||||
map.entities = AllocMem(MAPENTITY, map.maxentities, true);
|
||||
map.faces = (mapface_t *)AllocMem(MAPFACE, map.maxfaces, true);
|
||||
map.brushes = (mapbrush_t *)AllocMem(MAPBRUSH, map.maxbrushes, true);
|
||||
map.entities = (mapentity_t *)AllocMem(MAPENTITY, map.maxentities, true);
|
||||
|
||||
// While we're here...
|
||||
pWorldEnt = map.entities;
|
||||
|
|
@ -748,7 +748,7 @@ PreParseFile(const char *buf)
|
|||
* Plus a few extra for animations
|
||||
*/
|
||||
map.maxmiptex = map.maxfaces + 100;
|
||||
map.miptex = AllocMem(MIPTEX, map.maxmiptex, true);
|
||||
map.miptex = (miptex_t *)AllocMem(MIPTEX, map.maxmiptex, true);
|
||||
|
||||
texinfo = &pWorldEnt->lumps[LUMP_TEXINFO];
|
||||
texinfo->data = AllocMem(BSP_TEXINFO, 1024, true);
|
||||
|
|
@ -812,7 +812,7 @@ LoadMapFile(void)
|
|||
texinfo = &pWorldEnt->lumps[LUMP_TEXINFO];
|
||||
|
||||
map.maxplanes = MAX_MAP_PLANES;
|
||||
map.planes = AllocMem(PLANE, map.maxplanes, true);
|
||||
map.planes = (plane_t *)AllocMem(PLANE, map.maxplanes, true);
|
||||
|
||||
Message(msgStat, "%8d faces", map.numfaces);
|
||||
Message(msgStat, "%8d brushes", map.numbrushes);
|
||||
|
|
@ -857,7 +857,7 @@ SetKeyValue(mapentity_t *entity, const char *key, const char *value)
|
|||
ep->value = copystring(value);
|
||||
return;
|
||||
}
|
||||
ep = AllocMem(OTHER, sizeof(epair_t), true);
|
||||
ep = (epair_t *)AllocMem(OTHER, sizeof(epair_t), true);
|
||||
ep->next = entity->epairs;
|
||||
entity->epairs = ep;
|
||||
ep->key = copystring(key);
|
||||
|
|
@ -913,7 +913,7 @@ WriteEntitiesToString(void)
|
|||
|
||||
entities->count = cLen;
|
||||
map.cTotal[LUMP_ENTITIES] += cLen;
|
||||
entities->data = pCur = AllocMem(BSP_ENT, cLen, true);
|
||||
entities->data = pCur = (char *)AllocMem(BSP_ENT, cLen, true);
|
||||
*pCur = 0;
|
||||
|
||||
strcat(pCur, "{\n");
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ FillOutside(node_t *node, const int hullnum, const int numportals)
|
|||
/* Set up state for the recursive fill */
|
||||
memset(&leak, 0, sizeof(leak));
|
||||
if (!map.leakfile) {
|
||||
leak.portals = AllocMem(OTHER, sizeof(portal_t *) * numportals, true);
|
||||
leak.portals = (const portal_t **)AllocMem(OTHER, sizeof(portal_t *) * numportals, true);
|
||||
leak.maxportals = numportals;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ ParserInit(parser_t *p, const char *data)
|
|||
|
||||
|
||||
bool
|
||||
ParseToken(parser_t *p, parseflags_t flags)
|
||||
ParseToken(parser_t *p, int flags)
|
||||
{
|
||||
char *token_p;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ typedef struct parser {
|
|||
char token[MAXTOKEN];
|
||||
} parser_t;
|
||||
|
||||
bool ParseToken(parser_t *p, parseflags_t flags);
|
||||
bool ParseToken(parser_t *p, int flags);
|
||||
void ParserInit(parser_t *p, const char *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ MakeHeadnodePortals(const mapentity_t *entity, node_t *node)
|
|||
for (j = 0; j < 2; j++) {
|
||||
n = j * 3 + i;
|
||||
|
||||
p = AllocMem(PORTAL, 1, true);
|
||||
p = (portal_t *)AllocMem(PORTAL, 1, true);
|
||||
portals[n] = p;
|
||||
|
||||
pl = &bplanes[n];
|
||||
|
|
@ -563,7 +563,7 @@ CutNodePortals_r(node_t *node)
|
|||
* create the new portal by taking the full plane winding for the cutting
|
||||
* plane and clipping it by all of the planes from the other portals
|
||||
*/
|
||||
new_portal = AllocMem(PORTAL, 1, true);
|
||||
new_portal = (portal_t *)AllocMem(PORTAL, 1, true);
|
||||
new_portal->planenum = node->planenum;
|
||||
|
||||
winding = BaseWindingForPlane(plane);
|
||||
|
|
@ -627,7 +627,7 @@ CutNodePortals_r(node_t *node)
|
|||
}
|
||||
|
||||
/* the winding is split */
|
||||
new_portal = AllocMem(PORTAL, 1, true);
|
||||
new_portal = (portal_t *)AllocMem(PORTAL, 1, true);
|
||||
*new_portal = *portal;
|
||||
new_portal->winding = backwinding;
|
||||
FreeMem(portal->winding, WINDING, 1);
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ ChoosePlaneFromList(surface_t *surfaces, vec3_t mins, vec3_t maxs)
|
|||
vec_t distribution, bestdistribution;
|
||||
const plane_t *plane, *plane2;
|
||||
const face_t *face;
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
|
||||
/* pick the plane that splits the least */
|
||||
minsplits = INT_MAX - 1;
|
||||
|
|
@ -547,7 +547,7 @@ DividePlane(surface_t *in, plane_t *split, surface_t **front,
|
|||
in->onnode = true;
|
||||
|
||||
// divide the facets to the front and back sides
|
||||
newsurf = AllocMem(SURFACE, 1, true);
|
||||
newsurf = (surface_t *)AllocMem(SURFACE, 1, true);
|
||||
*newsurf = *in;
|
||||
|
||||
// Prepend each face in facet list to either in or newsurf lists
|
||||
|
|
@ -618,7 +618,7 @@ DividePlane(surface_t *in, plane_t *split, surface_t **front,
|
|||
}
|
||||
|
||||
// stuff got split, so allocate one new plane and reuse in
|
||||
newsurf = AllocMem(SURFACE, 1, true);
|
||||
newsurf = (surface_t *)AllocMem(SURFACE, 1, true);
|
||||
*newsurf = *in;
|
||||
newsurf->faces = backlist;
|
||||
*back = newsurf;
|
||||
|
|
@ -734,7 +734,7 @@ LinkConvexFaces(surface_t *planelist, node_t *leafnode)
|
|||
|
||||
// write the list of faces, and free the originals
|
||||
leaffaces += count;
|
||||
leafnode->markfaces = AllocMem(OTHER, sizeof(face_t *) * (count + 1), true);
|
||||
leafnode->markfaces = (face_t **)AllocMem(OTHER, sizeof(face_t *) * (count + 1), true);
|
||||
|
||||
i = 0;
|
||||
for (surf = planelist; surf; surf = pnext) {
|
||||
|
|
@ -776,7 +776,7 @@ LinkNodeFaces(surface_t *surface)
|
|||
// copy
|
||||
for (f = surface->faces; f; f = f->next) {
|
||||
nodefaces++;
|
||||
newf = AllocMem(FACE, 1, true);
|
||||
newf = (face_t *)AllocMem(FACE, 1, true);
|
||||
*newf = *f;
|
||||
f->original = newf;
|
||||
newf->next = list;
|
||||
|
|
@ -811,8 +811,8 @@ PartitionSurfaces(surface_t *surfaces, node_t *node)
|
|||
Message(msgPercent, splitnodes, csgmergefaces);
|
||||
|
||||
node->faces = LinkNodeFaces(split);
|
||||
node->children[0] = AllocMem(NODE, 1, true);
|
||||
node->children[1] = AllocMem(NODE, 1, true);
|
||||
node->children[0] = (node_t *)AllocMem(NODE, 1, true);
|
||||
node->children[1] = (node_t *)AllocMem(NODE, 1, true);
|
||||
node->planenum = split->planenum;
|
||||
node->detail_separator = split->detail_separator;
|
||||
|
||||
|
|
@ -871,26 +871,26 @@ SolidBSP(const mapentity_t *entity, surface_t *surfhead, bool midsplit)
|
|||
* collision hull for the engine. Probably could be done a little
|
||||
* smarter, but this works.
|
||||
*/
|
||||
headnode = AllocMem(NODE, 1, true);
|
||||
headnode = (node_t *)AllocMem(NODE, 1, true);
|
||||
for (i = 0; i < 3; i++) {
|
||||
headnode->mins[i] = entity->mins[i] - SIDESPACE;
|
||||
headnode->maxs[i] = entity->maxs[i] + SIDESPACE;
|
||||
}
|
||||
headnode->children[0] = AllocMem(NODE, 1, true);
|
||||
headnode->children[0] = (node_t *)AllocMem(NODE, 1, true);
|
||||
headnode->children[0]->planenum = PLANENUM_LEAF;
|
||||
headnode->children[0]->contents = CONTENTS_EMPTY;
|
||||
headnode->children[0]->markfaces = AllocMem(OTHER, sizeof(face_t *), true);
|
||||
headnode->children[1] = AllocMem(NODE, 1, true);
|
||||
headnode->children[0]->markfaces = (face_t **)AllocMem(OTHER, sizeof(face_t *), true);
|
||||
headnode->children[1] = (node_t *)AllocMem(NODE, 1, true);
|
||||
headnode->children[1]->planenum = PLANENUM_LEAF;
|
||||
headnode->children[1]->contents = CONTENTS_EMPTY;
|
||||
headnode->children[1]->markfaces = AllocMem(OTHER, sizeof(face_t *), true);
|
||||
headnode->children[1]->markfaces = (face_t **)AllocMem(OTHER, sizeof(face_t *), true);
|
||||
|
||||
return headnode;
|
||||
}
|
||||
|
||||
Message(msgProgress, "SolidBSP");
|
||||
|
||||
headnode = AllocMem(NODE, 1, true);
|
||||
headnode = (node_t *)AllocMem(NODE, 1, true);
|
||||
usemidsplit = midsplit;
|
||||
|
||||
// calculate a bounding box for the entire model
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ GatherNodeFaces(node_t *headnode)
|
|||
face_t **planefaces;
|
||||
surface_t *surfaces;
|
||||
|
||||
planefaces = AllocMem(OTHER, sizeof(face_t *) * map.maxplanes, true);
|
||||
planefaces = (face_t **)AllocMem(OTHER, sizeof(face_t *) * map.maxplanes, true);
|
||||
GatherNodeFaces_r(headnode, planefaces);
|
||||
surfaces = BuildSurfaces(planefaces);
|
||||
FreeMem(planefaces, OTHER, sizeof(face_t *) * map.maxplanes);
|
||||
|
|
@ -243,7 +243,7 @@ HashEdge(unsigned v1, unsigned v2)
|
|||
static void
|
||||
AddHashEdge(unsigned v1, unsigned v2, unsigned i)
|
||||
{
|
||||
hashedge_t *he = AllocMem(OTHER, sizeof(hashedge_t), true);
|
||||
hashedge_t *he = (hashedge_t *)AllocMem(OTHER, sizeof(hashedge_t), true);
|
||||
unsigned slot = HashEdge(v1, v2);
|
||||
|
||||
he->i = i;
|
||||
|
|
@ -411,7 +411,7 @@ FindFaceEdges(mapentity_t *entity, face_t *face)
|
|||
Error("Internal error: face->numpoints > MAXEDGES (%s)", __func__);
|
||||
|
||||
memsize = face->w.numpoints * sizeof(face->edges[0]);
|
||||
face->edges = AllocMem(OTHER, memsize, true);
|
||||
face->edges = (int *)AllocMem(OTHER, memsize, true);
|
||||
for (i = 0; i < face->w.numpoints; i++) {
|
||||
const vec_t *p1 = face->w.points[i];
|
||||
const vec_t *p2 = face->w.points[(i + 1) % face->w.numpoints];
|
||||
|
|
@ -428,7 +428,7 @@ MakeFaceEdges_r
|
|||
static int
|
||||
MakeFaceEdges_r(mapentity_t *entity, node_t *node, int progress)
|
||||
{
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
face_t *f;
|
||||
|
||||
if (node->planenum == PLANENUM_LEAF)
|
||||
|
|
@ -455,7 +455,7 @@ GrowNodeRegion
|
|||
static void
|
||||
GrowNodeRegion_BSP29(mapentity_t *entity, node_t *node)
|
||||
{
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
struct lumpdata *surfedges = &entity->lumps[LUMP_SURFEDGES];
|
||||
struct lumpdata *faces = &entity->lumps[LUMP_FACES];
|
||||
struct lumpdata *lmshifts = &entity->lumps[BSPX_LMSHIFT];
|
||||
|
|
@ -507,7 +507,7 @@ GrowNodeRegion_BSP29(mapentity_t *entity, node_t *node)
|
|||
static void
|
||||
GrowNodeRegion_BSP2(mapentity_t *entity, node_t *node)
|
||||
{
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
struct lumpdata *surfedges = &entity->lumps[LUMP_SURFEDGES];
|
||||
struct lumpdata *faces = &entity->lumps[LUMP_FACES];
|
||||
struct lumpdata *lmshifts = &entity->lumps[BSPX_LMSHIFT];
|
||||
|
|
@ -564,7 +564,7 @@ CountData_r
|
|||
static void
|
||||
CountData_r(mapentity_t *entity, node_t *node)
|
||||
{
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
face_t *f;
|
||||
|
||||
if (node->planenum == PLANENUM_LEAF)
|
||||
|
|
@ -622,9 +622,9 @@ MakeFaceEdges(mapentity_t *entity, node_t *headnode)
|
|||
edges->data = AllocMem(BSP_EDGE, edges->count, true);
|
||||
|
||||
// Accessory data
|
||||
pHashverts = AllocMem(HASHVERT, vertices->count, true);
|
||||
pEdgeFaces0 = AllocMem(OTHER, sizeof(face_t *) * edges->count, true);
|
||||
pEdgeFaces1 = AllocMem(OTHER, sizeof(face_t *) * edges->count, true);
|
||||
pHashverts = (hashvert_t *)AllocMem(HASHVERT, vertices->count, true);
|
||||
pEdgeFaces0 = (const face_t **)AllocMem(OTHER, sizeof(face_t *) * edges->count, true);
|
||||
pEdgeFaces1 = (const face_t **)AllocMem(OTHER, sizeof(face_t *) * edges->count, true);
|
||||
|
||||
InitHash();
|
||||
|
||||
|
|
@ -637,7 +637,7 @@ MakeFaceEdges(mapentity_t *entity, node_t *headnode)
|
|||
|
||||
/* Free any excess allocated memory */
|
||||
if (vertices->index < vertices->count) {
|
||||
dvertex_t *temp = AllocMem(BSP_VERTEX, vertices->index, true);
|
||||
dvertex_t *temp = (dvertex_t *)AllocMem(BSP_VERTEX, vertices->index, true);
|
||||
memcpy(temp, vertices->data, sizeof(*temp) * vertices->index);
|
||||
FreeMem(vertices->data, BSP_VERTEX, vertices->count);
|
||||
vertices->data = temp;
|
||||
|
|
|
|||
|
|
@ -478,8 +478,8 @@ TJunc(const mapentity_t *entity, node_t *headnode)
|
|||
cWEdges = cWVerts;
|
||||
cWVerts *= 2;
|
||||
|
||||
pWVerts = AllocMem(WVERT, cWVerts, true);
|
||||
pWEdges = AllocMem(WEDGE, cWEdges, true);
|
||||
pWVerts = (wvert_t *)AllocMem(WVERT, cWVerts, true);
|
||||
pWEdges = (wedge_t *)AllocMem(WEDGE, cWEdges, true);
|
||||
|
||||
/*
|
||||
* identify all points on common edges
|
||||
|
|
@ -503,7 +503,7 @@ TJunc(const mapentity_t *entity, node_t *headnode)
|
|||
Message(msgStat, "%8d edge points", numwverts);
|
||||
|
||||
superface_bytes = offsetof(face_t, w.points[MAX_SUPERFACE_POINTS]);
|
||||
superface = AllocMem(OTHER, superface_bytes, true);
|
||||
superface = (face_t*)AllocMem(OTHER, superface_bytes, true);
|
||||
|
||||
/* add extra vertexes on edges where needed */
|
||||
tjuncs = tjuncfaces = 0;
|
||||
|
|
|
|||
10
qbsp/wad.c
10
qbsp/wad.c
|
|
@ -52,7 +52,7 @@ WAD_LoadInfo(wad_t *wad)
|
|||
|
||||
lumpinfosize = sizeof(lumpinfo_t) * hdr->numlumps;
|
||||
fseek(wad->file, hdr->infotableofs, SEEK_SET);
|
||||
wad->lumps = AllocMem(OTHER, lumpinfosize, true);
|
||||
wad->lumps = (lumpinfo_t *)AllocMem(OTHER, lumpinfosize, true);
|
||||
len = fread(wad->lumps, 1, lumpinfosize, wad->file);
|
||||
if (len != lumpinfosize)
|
||||
return false;
|
||||
|
|
@ -63,7 +63,7 @@ WAD_LoadInfo(wad_t *wad)
|
|||
len = fread(&miptex, 1, sizeof(miptex), wad->file);
|
||||
if (len == sizeof(miptex))
|
||||
{
|
||||
tex = AllocMem(OTHER, sizeof(texture_t), true);
|
||||
tex = (texture_t *)AllocMem(OTHER, sizeof(texture_t), true);
|
||||
tex->next = textures;
|
||||
textures = tex;
|
||||
memcpy(tex->name, miptex.name, 16);
|
||||
|
|
@ -118,11 +118,11 @@ WADList_Init(const char *wadstring)
|
|||
pos++;
|
||||
|
||||
if (!options.wadPath[0] || IsAbsolutePath(fname)) {
|
||||
fpath = AllocMem(OTHER, (pos - fname) + 1, false);
|
||||
fpath = (char *)AllocMem(OTHER, (pos - fname) + 1, false);
|
||||
snprintf(fpath, (pos - fname) + 1, "%s", fname);
|
||||
} else {
|
||||
pathlen = strlen(options.wadPath) + 1 + (pos - fname);
|
||||
fpath = AllocMem(OTHER, pathlen + 1, true);
|
||||
fpath = (char *)AllocMem(OTHER, pathlen + 1, true);
|
||||
snprintf(fpath, pathlen + 1, "%s/%s", options.wadPath, fname);
|
||||
}
|
||||
wad.file = fopen(fpath, "rb");
|
||||
|
|
@ -130,7 +130,7 @@ WADList_Init(const char *wadstring)
|
|||
if (options.fVerbose)
|
||||
Message(msgLiteral, "Opened WAD: %s\n", fpath);
|
||||
if (WAD_LoadInfo(&wad)) {
|
||||
newwad = AllocMem(OTHER, sizeof(wad), true);
|
||||
newwad = (wad_t *)AllocMem(OTHER, sizeof(wad), true);
|
||||
memcpy(newwad, &wad, sizeof(wad));
|
||||
newwad->next = wadlist;
|
||||
wadlist = newwad;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ BaseWindingForPlane(const plane_t *p)
|
|||
VectorScale(vright, 8192, vright);
|
||||
|
||||
// project a really big axis aligned box onto the plane
|
||||
w = AllocMem(WINDING, 4, true);
|
||||
w = (winding_t *)AllocMem(WINDING, 4, true);
|
||||
|
||||
VectorSubtract(org, vright, w->points[0]);
|
||||
VectorAdd(w->points[0], vup, w->points[0]);
|
||||
|
|
@ -105,7 +105,7 @@ CopyWinding(const winding_t *w)
|
|||
int size;
|
||||
winding_t *c;
|
||||
|
||||
c = AllocMem(WINDING, w->numpoints, false);
|
||||
c = (winding_t *)AllocMem(WINDING, w->numpoints, false);
|
||||
size = offsetof(winding_t, points[w->numpoints]);
|
||||
memcpy(c, w, size);
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ ClipWinding(winding_t *in, const plane_t *split, bool keepon)
|
|||
|
||||
/* can't use maxpoints = counts[0] + 2 because of fp grouping errors */
|
||||
maxpts = in->numpoints + 4;
|
||||
neww = AllocMem(WINDING, maxpts, true);
|
||||
neww = (winding_t *)AllocMem(WINDING, maxpts, true);
|
||||
|
||||
for (i = 0; i < in->numpoints; i++) {
|
||||
p1 = in->points[i];
|
||||
|
|
@ -287,8 +287,8 @@ DivideWinding(winding_t *in, const plane_t *split, winding_t **front,
|
|||
|
||||
/* can't use maxpoints = counts[0] + 2 because of fp grouping errors */
|
||||
maxpts = in->numpoints + 4;
|
||||
*front = f = AllocMem(WINDING, maxpts, true);
|
||||
*back = b = AllocMem(WINDING, maxpts, true);
|
||||
*front = f = (winding_t *)AllocMem(WINDING, maxpts, true);
|
||||
*back = b = (winding_t *)AllocMem(WINDING, maxpts, true);
|
||||
|
||||
for (i = 0; i < in->numpoints; i++) {
|
||||
p1 = in->points[i];
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ ExportNodePlanes(node_t *nodes)
|
|||
planes->data = AllocMem(BSP_PLANE, planes->count, true);
|
||||
}
|
||||
// TODO: make one-time allocation?
|
||||
planemap = AllocMem(OTHER, sizeof(int) * planes->count, true);
|
||||
planemap = (int *)AllocMem(OTHER, sizeof(int) * planes->count, true);
|
||||
memset(planemap, -1, sizeof(int) * planes->count);
|
||||
ExportNodePlanes_r(nodes, planemap);
|
||||
FreeMem(planemap, OTHER, sizeof(int) * planes->count);
|
||||
|
|
@ -238,7 +238,7 @@ ExportClipNodes(mapentity_t *entity, node_t *nodes, const int hullnum)
|
|||
for (i = 1; i < hullnum; i++)
|
||||
model->headnode[i] += diff;
|
||||
if (options.BSPVersion == BSPVERSION) {
|
||||
bsp29_dclipnode_t *clipnode = clipnodes->data;
|
||||
bsp29_dclipnode_t *clipnode = (bsp29_dclipnode_t *)clipnodes->data;
|
||||
for (i = 0; i < oldcount; i++, clipnode++) {
|
||||
if (clipnode->children[0] < MAX_BSP_CLIPNODES)
|
||||
clipnode->children[0] += diff;
|
||||
|
|
@ -246,7 +246,7 @@ ExportClipNodes(mapentity_t *entity, node_t *nodes, const int hullnum)
|
|||
clipnode->children[1] += diff;
|
||||
}
|
||||
} else {
|
||||
bsp2_dclipnode_t *clipnode = clipnodes->data;
|
||||
bsp2_dclipnode_t *clipnode = (bsp2_dclipnode_t *)clipnodes->data;
|
||||
for (i = 0; i < oldcount; i++, clipnode++) {
|
||||
if (clipnode->children[0] >= 0)
|
||||
clipnode->children[0] += diff;
|
||||
|
|
@ -276,7 +276,7 @@ static void
|
|||
CountLeaves(mapentity_t *entity, node_t *node)
|
||||
{
|
||||
face_t **markfaces, *face;
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
|
||||
entity->lumps[LUMP_LEAFS].count++;
|
||||
for (markfaces = node->markfaces; *markfaces; markfaces++) {
|
||||
|
|
@ -330,10 +330,10 @@ ExportLeaf
|
|||
static void
|
||||
ExportLeaf_BSP29(mapentity_t *entity, node_t *node)
|
||||
{
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
struct lumpdata *leaves = &entity->lumps[LUMP_LEAFS];
|
||||
struct lumpdata *marksurfs = &entity->lumps[LUMP_MARKSURFACES];
|
||||
uint16_t *marksurfnums = marksurfs->data;
|
||||
uint16_t *marksurfnums = (uint16_t *)marksurfs->data;
|
||||
face_t **markfaces, *face;
|
||||
bsp29_dleaf_t *dleaf;
|
||||
|
||||
|
|
@ -380,10 +380,10 @@ ExportLeaf_BSP29(mapentity_t *entity, node_t *node)
|
|||
static void
|
||||
ExportLeaf_BSP2(mapentity_t *entity, node_t *node)
|
||||
{
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
struct lumpdata *leaves = &entity->lumps[LUMP_LEAFS];
|
||||
struct lumpdata *marksurfs = &entity->lumps[LUMP_MARKSURFACES];
|
||||
uint32_t *marksurfnums = marksurfs->data;
|
||||
uint32_t *marksurfnums = (uint32_t *)marksurfs->data;
|
||||
face_t **markfaces, *face;
|
||||
bsp2_dleaf_t *dleaf;
|
||||
|
||||
|
|
@ -430,10 +430,10 @@ ExportLeaf_BSP2(mapentity_t *entity, node_t *node)
|
|||
static void
|
||||
ExportLeaf_BSP2rmq(mapentity_t *entity, node_t *node)
|
||||
{
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
struct lumpdata *leaves = &entity->lumps[LUMP_LEAFS];
|
||||
struct lumpdata *marksurfs = &entity->lumps[LUMP_MARKSURFACES];
|
||||
uint32_t *marksurfnums = marksurfs->data;
|
||||
uint32_t *marksurfnums = (uint32_t *)marksurfs->data;
|
||||
face_t **markfaces, *face;
|
||||
bsp2rmq_dleaf_t *dleaf;
|
||||
|
||||
|
|
@ -630,13 +630,13 @@ ExportDrawNodes(mapentity_t *entity, node_t *headnode, int firstface)
|
|||
* BeginBSPFile.
|
||||
*/
|
||||
if (options.BSPVersion == BSP2VERSION) {
|
||||
bsp2_dleaf_t *leaf = pWorldEnt->lumps[LUMP_LEAFS].data;
|
||||
bsp2_dleaf_t *leaf = (bsp2_dleaf_t *)pWorldEnt->lumps[LUMP_LEAFS].data;
|
||||
leaf->contents = CONTENTS_SOLID;
|
||||
} else if (options.BSPVersion == BSP2RMQVERSION) {
|
||||
bsp2rmq_dleaf_t *leaf = pWorldEnt->lumps[LUMP_LEAFS].data;
|
||||
bsp2rmq_dleaf_t *leaf = (bsp2rmq_dleaf_t *)pWorldEnt->lumps[LUMP_LEAFS].data;
|
||||
leaf->contents = CONTENTS_SOLID;
|
||||
} else {
|
||||
bsp29_dleaf_t *leaf = pWorldEnt->lumps[LUMP_LEAFS].data;
|
||||
bsp29_dleaf_t *leaf = (bsp29_dleaf_t *)pWorldEnt->lumps[LUMP_LEAFS].data;
|
||||
leaf->contents = CONTENTS_SOLID;
|
||||
}
|
||||
|
||||
|
|
@ -703,7 +703,7 @@ static void
|
|||
WriteExtendedTexinfoFlags(void)
|
||||
{
|
||||
bool needwrite = false;
|
||||
const texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const texinfo_t *texinfo = (const texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const int num_texinfo = pWorldEnt->lumps[LUMP_TEXINFO].index;
|
||||
int i;
|
||||
|
||||
|
|
@ -738,7 +738,7 @@ WriteExtendedTexinfoFlags(void)
|
|||
static void
|
||||
CleanBSPTexinfoFlags(void)
|
||||
{
|
||||
texinfo_t *texinfo = pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
texinfo_t *texinfo = (texinfo_t *)pWorldEnt->lumps[LUMP_TEXINFO].data;
|
||||
const int num_texinfo = pWorldEnt->lumps[LUMP_TEXINFO].index;
|
||||
int i;
|
||||
|
||||
|
|
@ -761,7 +761,7 @@ FinishBSPFile(void)
|
|||
Message(msgProgress, "WriteBSPFile");
|
||||
|
||||
// TODO: Fix this somewhere else?
|
||||
newdata = AllocMem(BSP_PLANE, map.cTotal[LUMP_PLANES], true);
|
||||
newdata = (dplane_t *)AllocMem(BSP_PLANE, map.cTotal[LUMP_PLANES], true);
|
||||
memcpy(newdata, planes->data, map.cTotal[LUMP_PLANES] * MemSize[BSP_PLANE]);
|
||||
FreeMem(planes->data, BSP_PLANE, planes->count);
|
||||
planes->data = newdata;
|
||||
|
|
|
|||
Loading…
Reference in New Issue