qbsp: remove remaining enum errors
Remove the enum Error() function and global error strings as well. Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
ea5e46f9df
commit
51bed53570
|
|
@ -77,19 +77,3 @@ const char *rgszWarnings[cWarnings] = {
|
|||
"No target for rotation entity \"%s\"",
|
||||
"line %d: Face with degenerate QuArK-style texture axes",
|
||||
};
|
||||
|
||||
const char *rgszErrors[cErrors] = {
|
||||
"No axis found for winding",
|
||||
"Points on winding exceeded estimate",
|
||||
"Degenerate edge at (%.3f %.3f %.3f)",
|
||||
"Found a non-canonical vector",
|
||||
"Normalization error in FindPlane (vector length %.4f)",
|
||||
"Internal error: pWorldEnt->lumps[BSPPLANE].index >= pWorldEnt->lumps[BSPPLANE].count",
|
||||
"Internal error: numwedges >= cWEdges",
|
||||
"Internal error: numwverts >= cWVerts",
|
||||
"f->original exists in SplitFaceForTjunc",
|
||||
"Internal error: invalid memory %i type in AllocMem",
|
||||
"Too many points on winding (%d)",
|
||||
"Out of memory",
|
||||
"Clipnodes in map exceed " stringify(MAX_BSP_CLIPNODES),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -675,7 +675,6 @@ void ExportDrawNodes(mapentity_t *entity, node_t *headnode, int firstface);
|
|||
#define msgPercent 7
|
||||
|
||||
extern const char *rgszWarnings[cWarnings];
|
||||
extern const char *rgszErrors[cErrors];
|
||||
extern const int rgcMemSize[];
|
||||
|
||||
extern void *AllocMem(int Type, int cSize, bool fZero);
|
||||
|
|
@ -684,7 +683,6 @@ extern void FreeAllMem(void);
|
|||
extern void PrintMem(void);
|
||||
|
||||
extern void Message(int MsgType, ...);
|
||||
extern void Error(int ErrType, ...) __attribute__((noreturn));
|
||||
extern void Error_(const char *error, ...)
|
||||
__attribute__((format(printf,1,2),noreturn));
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,8 @@ CanonicalVector(vec3_t vec)
|
|||
return;
|
||||
} else
|
||||
vec[2] = 0;
|
||||
Error(errDegenerateEdge, vec[0], vec[1], vec[2]);
|
||||
|
||||
Error_("Degenerate edge at (%.3f %.3f %.3f)", vec[0], vec[1], vec[2]);
|
||||
}
|
||||
|
||||
static wedge_t *
|
||||
|
|
@ -158,7 +159,7 @@ FindEdge(vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2)
|
|||
}
|
||||
|
||||
if (numwedges >= cWEdges)
|
||||
Error(errLowWedgeCount);
|
||||
Error_("Internal error: didn't allocate enough edges for tjuncs?");
|
||||
w = pWEdges + numwedges;
|
||||
numwedges++;
|
||||
|
||||
|
|
@ -195,7 +196,7 @@ AddVert(wedge_t *w, vec_t t)
|
|||
|
||||
// insert a new wvert before v
|
||||
if (numwverts >= cWVerts)
|
||||
Error(errLowWvertCount);
|
||||
Error_("Internal error: didn't allocate enough vertices for tjuncs?");
|
||||
|
||||
newv = pWVerts + numwverts;
|
||||
numwverts++;
|
||||
|
|
@ -313,7 +314,7 @@ SplitFaceForTjunc(face_t *f, face_t *original)
|
|||
|
||||
newf = NewFaceFromFace(f);
|
||||
if (f->original)
|
||||
Error(errOriginalExists);
|
||||
Error_("original face still exists (%s)", __func__);
|
||||
|
||||
newf->original = chain;
|
||||
chain = newf;
|
||||
|
|
|
|||
32
qbsp/util.c
32
qbsp/util.c
|
|
@ -43,12 +43,12 @@ AllocMem(int Type, int cElements, bool fZero)
|
|||
int cSize;
|
||||
|
||||
if (Type < 0 || Type > OTHER)
|
||||
Error(errInvalidMemType, Type);
|
||||
Error_("Internal error: invalid memory type %d (%s)", Type, __func__);
|
||||
|
||||
// For windings, cElements == number of points on winding
|
||||
if (Type == WINDING) {
|
||||
if (cElements > MAX_POINTS_ON_WINDING)
|
||||
Error(errTooManyPoints, cElements);
|
||||
Error_("Too many points (%d) on winding (%s)", cElements, __func__);
|
||||
|
||||
cSize = offsetof(winding_t, points[cElements]) + sizeof(int);
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ AllocMem(int Type, int cElements, bool fZero)
|
|||
|
||||
pTemp = malloc(cSize);
|
||||
if (!pTemp)
|
||||
Error(errOutOfMemory);
|
||||
Error_("allocation of %d bytes failed (%s)", cSize, __func__);
|
||||
|
||||
if (fZero)
|
||||
memset(pTemp, 0, cSize);
|
||||
|
|
@ -201,32 +201,6 @@ FreeAllMem(void)
|
|||
/* Keep track of output state */
|
||||
static bool fInPercent = false;
|
||||
|
||||
void
|
||||
Error(int ErrType, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char szBuffer[512];
|
||||
|
||||
va_start(argptr, ErrType);
|
||||
|
||||
if (fInPercent) {
|
||||
printf("\r");
|
||||
fInPercent = false;
|
||||
}
|
||||
if (ErrType >= cErrors) {
|
||||
printf("Program error: unknown ErrType in Message!\n");
|
||||
exit(1);
|
||||
}
|
||||
sprintf(szBuffer, "*** ERROR %02d: ", ErrType);
|
||||
vsprintf(szBuffer + strlen(szBuffer), rgszErrors[ErrType], argptr);
|
||||
puts(szBuffer);
|
||||
if (logfile) {
|
||||
fprintf(logfile, "%s\n", szBuffer);
|
||||
fclose(logfile);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
Error_(const char *error, ...)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,20 +48,3 @@ enum {
|
|||
warnDegenerateQuArKTX,
|
||||
cWarnings
|
||||
};
|
||||
|
||||
enum {
|
||||
errNoWindingAxis,
|
||||
errLowPointCount,
|
||||
errDegenerateEdge,
|
||||
errNonCanonicalVector,
|
||||
errNormalization,
|
||||
errLowPlaneCount,
|
||||
errLowWedgeCount,
|
||||
errLowWvertCount,
|
||||
errOriginalExists,
|
||||
errInvalidMemType, // 50
|
||||
errTooManyPoints,
|
||||
errOutOfMemory,
|
||||
errTooManyClipnodes,
|
||||
cErrors
|
||||
};
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ BaseWindingForPlane(const plane_t *p)
|
|||
vup[0] = 1;
|
||||
break;
|
||||
default:
|
||||
Error(errNoWindingAxis);
|
||||
Error_("Internal error: no axis for winding (%s)", __func__);
|
||||
}
|
||||
|
||||
v = DotProduct(vup, p->normal);
|
||||
|
|
@ -227,7 +227,7 @@ ClipWinding(winding_t *in, const plane_t *split, bool keepon)
|
|||
}
|
||||
|
||||
if (neww->numpoints > maxpts)
|
||||
Error(errLowPointCount);
|
||||
Error_("Internal error: excess clipped points (%s)", __func__);
|
||||
|
||||
// free the original winding
|
||||
FreeMem(in, WINDING, 1);
|
||||
|
|
@ -324,7 +324,7 @@ DivideWinding(winding_t *in, const plane_t *split, winding_t **front,
|
|||
}
|
||||
|
||||
if (f->numpoints > maxpts || b->numpoints > maxpts)
|
||||
Error(errLowPointCount);
|
||||
Error_("Internal error: excess clipped points (%s)", __func__);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ ExportNodePlanes_r(node_t *node, int *planemap)
|
|||
|
||||
if (i == planes->index) {
|
||||
if (planes->index >= planes->count)
|
||||
Error(errLowPlaneCount);
|
||||
Error_("Internal error: plane count mismatch (%s)", __func__);
|
||||
plane = &map.planes[node->planenum];
|
||||
dplane = (dplane_t *)planes->data + planes->index;
|
||||
dplane->normal[0] = plane->normal[0];
|
||||
|
|
@ -188,7 +188,8 @@ ExportClipNodes(mapentity_t *entity, node_t *nodes, const int hullnum)
|
|||
|
||||
CountClipNodes_r(entity, nodes);
|
||||
if (clipnodes->count > MAX_BSP_CLIPNODES)
|
||||
Error(errTooManyClipnodes);
|
||||
Error_("Clipnode count exceeds bsp29 max (%d > %d)",
|
||||
clipnodes->count, MAX_BSP_CLIPNODES);
|
||||
|
||||
olddata = clipnodes->data;
|
||||
clipnodes->data = AllocMem(BSPCLIPNODE, clipnodes->count, true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue