Implement Com_Error in renders

This commit is contained in:
Denis Pauk 2023-10-07 18:52:23 +03:00
parent edfd93802b
commit 4c4d244788
44 changed files with 281 additions and 216 deletions

View file

@ -1418,7 +1418,7 @@ Mod_LoadNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -1441,7 +1441,7 @@ Mod_LoadNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs,
planenum = LittleLong(in->planenum);
if (planenum < 0 || planenum >= numplanes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d < %d planenum.",
Com_Error(ERR_DROP, "%s: Incorrect %d < %d planenum.",
__func__, planenum, numplanes);
}
out->plane = planes + planenum;
@ -1460,7 +1460,7 @@ Mod_LoadNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs,
{
if (leafnum < 0 || leafnum >= *numnodes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d nodenum as leaf.",
Com_Error(ERR_DROP, "%s: Incorrect %d nodenum as leaf.",
__func__, leafnum);
}
@ -1471,7 +1471,7 @@ Mod_LoadNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs,
leafnum = -1 - leafnum;
if (leafnum < 0 || leafnum >= numleafs)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d leafnum.",
Com_Error(ERR_DROP, "%s: Incorrect %d leafnum.",
__func__, leafnum);
}
@ -1500,7 +1500,7 @@ Mod_LoadQNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -1523,7 +1523,7 @@ Mod_LoadQNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs
planenum = LittleLong(in->planenum);
if (planenum < 0 || planenum >= numplanes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d < %d planenum.",
Com_Error(ERR_DROP, "%s: Incorrect %d < %d planenum.",
__func__, planenum, numplanes);
}
out->plane = planes + planenum;
@ -1542,7 +1542,7 @@ Mod_LoadQNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs
{
if (leafnum < 0 || leafnum >= *numnodes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d nodenum as leaf.",
Com_Error(ERR_DROP, "%s: Incorrect %d nodenum as leaf.",
__func__, leafnum);
}
@ -1553,7 +1553,7 @@ Mod_LoadQNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs
leafnum = -1 - leafnum;
if (leafnum < 0 || leafnum >= numleafs)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d leafnum.",
Com_Error(ERR_DROP, "%s: Incorrect %d leafnum.",
__func__, leafnum);
}
@ -1634,7 +1634,7 @@ Mod_LoadVertexes(const char *name, mvertex_t **vertexes, int *numvertexes,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -1768,7 +1768,7 @@ Mod_CalcSurfaceExtents(int *surfedges, mvertex_t *vertexes, medge_t *edges,
if (!(tex->flags & (SURF_WARP | SURF_SKY)) && s->extents[i] > 256)
{
ri.Sys_Error(ERR_DROP, "%s: Bad surface extents", __func__);
Com_Error(ERR_DROP, "%s: Bad surface extents", __func__);
}
}
}
@ -1793,7 +1793,7 @@ Mod_LoadTexinfo(const char *name, mtexinfo_t **texinfo, int *numtexinfo,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -1871,7 +1871,7 @@ Mod_LoadEdges(const char *name, medge_t **edges, int *numedges,
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -1906,7 +1906,7 @@ Mod_LoadQEdges(const char *name, medge_t **edges, int *numedges,
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -1957,7 +1957,7 @@ Mod_LoadPlanes(const char *name, cplane_t **planes, int *numplanes,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -2002,7 +2002,7 @@ Mod_LoadSurfedges(const char *name, int **surfedges, int *numsurfedges,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -2054,7 +2054,7 @@ Mod_PointInLeaf(const vec3_t p, mnode_t *node)
{
if (!node)
{
ri.Sys_Error(ERR_DROP, "%s: bad node.", __func__);
Com_Error(ERR_DROP, "%s: bad node.", __func__);
return NULL;
}
@ -2222,7 +2222,7 @@ Mod_LoadMarksurfaces(const char *name, msurface_t ***marksurfaces, int *nummarks
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -2240,7 +2240,7 @@ Mod_LoadMarksurfaces(const char *name, msurface_t ***marksurfaces, int *nummarks
if ((j < 0) || (j >= numsurfaces))
{
ri.Sys_Error(ERR_DROP, "%s: bad surface number",
Com_Error(ERR_DROP, "%s: bad surface number",
__func__);
}
@ -2260,7 +2260,7 @@ Mod_LoadQMarksurfaces(const char *name, msurface_t ***marksurfaces, int *nummark
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -2277,7 +2277,7 @@ Mod_LoadQMarksurfaces(const char *name, msurface_t ***marksurfaces, int *nummark
if ((j < 0) || (j >= numsurfaces))
{
ri.Sys_Error(ERR_DROP, "%s: bad surface number",
Com_Error(ERR_DROP, "%s: bad surface number",
__func__);
}
@ -2314,7 +2314,7 @@ Mod_LoadLeafs(const char *name, mleaf_t **leafs, int *numleafs,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -2345,7 +2345,7 @@ Mod_LoadLeafs(const char *name, mleaf_t **leafs, int *numleafs,
out->firstmarksurface = marksurfaces + firstleafface;
if ((firstleafface + out->nummarksurfaces) > nummarksurfaces)
{
ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s",
Com_Error(ERR_DROP, "%s: wrong marksurfaces position in %s",
__func__, name);
}
}
@ -2364,7 +2364,7 @@ Mod_LoadQLeafs(const char *name, mleaf_t **leafs, int *numleafs,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, name);
}
@ -2395,7 +2395,7 @@ Mod_LoadQLeafs(const char *name, mleaf_t **leafs, int *numleafs,
out->firstmarksurface = marksurfaces + firstleafface;
if ((firstleafface + out->nummarksurfaces) > nummarksurfaces)
{
ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s",
Com_Error(ERR_DROP, "%s: wrong marksurfaces position in %s",
__func__, name);
}
}

View file

@ -399,7 +399,7 @@ GetPCXPalette24to8(byte *d_8to24table, byte** d_16to8table)
*d_16to8table = malloc(0x10000);
if (!(*d_16to8table))
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't allocate memory for d_16to8table", __func__);
Com_Error(ERR_FATAL, "%s: Couldn't allocate memory for d_16to8table", __func__);
// code never returns after ERR_FATAL
return;
}
@ -474,7 +474,7 @@ GetPCXPalette(byte **colormap, unsigned *d_8to24table)
*colormap = malloc(256 * 320);
if (!(*colormap))
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't allocate memory for colormap", __func__);
Com_Error(ERR_FATAL, "%s: Couldn't allocate memory for colormap", __func__);
// code never returns after ERR_FATAL
return;
}
@ -522,7 +522,7 @@ GetPCXPalette(byte **colormap, unsigned *d_8to24table)
*colormap = malloc(256 * 320);
if (!(*colormap))
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't allocate memory for colormap", __func__);
Com_Error(ERR_FATAL, "%s: Couldn't allocate memory for colormap", __func__);
// code never returns after ERR_FATAL
return;
}

View file

@ -46,7 +46,7 @@ Draw_InitLocal(void)
if (!draw_chars)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars",
Com_Error(ERR_FATAL, "%s: Couldn't load pics/conchars",
__func__);
}
}
@ -282,7 +282,7 @@ RDraw_Fill(int x, int y, int w, int h, int c)
if ((unsigned)c > 255)
{
ri.Sys_Error(ERR_FATAL, "Draw_Fill: bad color");
Com_Error(ERR_FATAL, "Draw_Fill: bad color");
}
glDisable(GL_TEXTURE_2D);

View file

@ -633,7 +633,7 @@ R_Upload32Soft(unsigned *data, int width, int height, qboolean mipmap)
if (scaled_width * scaled_height > sizeof(scaled) / 4)
{
// this can't really happen (because they're clamped to 256 above), but whatever
ri.Sys_Error(ERR_DROP, "R_Upload32: too big");
Com_Error(ERR_DROP, "R_Upload32: too big");
}
/* scan the texture for any non-255 alpha */
@ -885,7 +885,7 @@ R_LoadPic(const char *name, byte *pic, int width, int realwidth,
{
if (numgltextures == MAX_GLTEXTURES)
{
ri.Sys_Error(ERR_DROP, "MAX_GLTEXTURES");
Com_Error(ERR_DROP, "MAX_GLTEXTURES");
}
numgltextures++;
@ -895,7 +895,7 @@ R_LoadPic(const char *name, byte *pic, int width, int realwidth,
if (strlen(name) >= sizeof(image->name))
{
ri.Sys_Error(ERR_DROP, "%s: \"%s\" is too long", __func__, name);
Com_Error(ERR_DROP, "%s: \"%s\" is too long", __func__, name);
}
strcpy(image->name, name);

View file

@ -307,7 +307,7 @@ R_BuildLightMap(msurface_t *surf, byte *dest, int stride)
if (surf->texinfo->flags &
(SURF_SKY | SURF_TRANS33 | SURF_TRANS66 | SURF_WARP))
{
ri.Sys_Error(ERR_DROP, "R_BuildLightMap called for non-lit surface");
Com_Error(ERR_DROP, "R_BuildLightMap called for non-lit surface");
}
smax = (surf->extents[0] >> surf->lmshift) + 1;
@ -333,7 +333,7 @@ R_BuildLightMap(msurface_t *surf, byte *dest, int stride)
if (!s_blocklights)
{
ri.Sys_Error(ERR_DROP, "Can't alloc s_blocklights");
Com_Error(ERR_DROP, "Can't alloc s_blocklights");
}
}

View file

@ -81,7 +81,7 @@ LM_UploadBlock(qboolean dynamic)
if (++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS)
{
ri.Sys_Error(ERR_DROP,
Com_Error(ERR_DROP,
"%s() - MAX_LIGHTMAPS exceeded\n", __func__);
}
}
@ -244,7 +244,7 @@ LM_CreateSurfaceLightmap(msurface_t *surf)
if (!LM_AllocBlock(smax, tmax, &surf->light_s, &surf->light_t))
{
ri.Sys_Error(ERR_FATAL,
Com_Error(ERR_FATAL,
"%s: Consecutive calls to LM_AllocBlock(%d,%d) failed\n",
__func__, smax, tmax);
}

View file

@ -350,7 +350,7 @@ R_DrawEntitiesOnList(void)
R_DrawSpriteModel(currententity, currentmodel);
break;
default:
ri.Sys_Error(ERR_DROP, "Bad modeltype");
Com_Error(ERR_DROP, "Bad modeltype");
break;
}
}
@ -639,7 +639,7 @@ R_SetupFrame(void)
{
if (!r_worldmodel)
{
ri.Sys_Error(ERR_DROP, "%s: bad world model", __func__);
Com_Error(ERR_DROP, "%s: bad world model", __func__);
return;
}
@ -1036,7 +1036,7 @@ R_RenderView(refdef_t *fd)
if (!r_worldmodel && !(r_newrefdef.rdflags & RDF_NOWORLDMODEL))
{
ri.Sys_Error(ERR_DROP, "%s: NULL worldmodel", __func__);
Com_Error(ERR_DROP, "%s: NULL worldmodel", __func__);
}
if (r_speeds->value)
@ -2001,3 +2001,16 @@ Com_Printf(const char *msg, ...)
ri.Com_VPrintf(PRINT_ALL, msg, argptr);
va_end(argptr);
}
void
Com_Error(int code, const char *fmt, ...)
{
va_list argptr;
char text[4096]; // MAXPRINTMSG == 4096
va_start(argptr, fmt);
vsnprintf(text, sizeof(text), fmt, argptr);
va_end(argptr);
ri.Sys_Error(code, "%s", text);
}

View file

@ -137,7 +137,7 @@ Mod_LoadSubmodels(model_t *loadmodel, const byte *mod_base, const lump_t *l)
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -179,7 +179,7 @@ Mod_LoadSubmodels(model_t *loadmodel, const byte *mod_base, const lump_t *l)
// check limits
if (out->firstnode >= loadmodel->numnodes)
{
ri.Sys_Error(ERR_DROP, "%s: Inline model %i has bad firstnode",
Com_Error(ERR_DROP, "%s: Inline model %i has bad firstnode",
__func__, i);
}
}
@ -350,7 +350,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -378,7 +378,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (out->numedges < 3)
{
ri.Sys_Error(ERR_DROP, "%s: Surface with %d edges",
Com_Error(ERR_DROP, "%s: Surface with %d edges",
__func__, out->numedges);
}
out->flags = 0;
@ -394,7 +394,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (planenum < 0 || planenum >= loadmodel->numplanes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d planenum.",
Com_Error(ERR_DROP, "%s: Incorrect %d planenum.",
__func__, planenum);
}
out->plane = loadmodel->planes + planenum;
@ -403,7 +403,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if ((ti < 0) || (ti >= loadmodel->numtexinfo))
{
ri.Sys_Error(ERR_DROP, "%s: bad texinfo number",
Com_Error(ERR_DROP, "%s: bad texinfo number",
__func__);
}
@ -475,7 +475,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -503,7 +503,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (out->numedges < 3)
{
ri.Sys_Error(ERR_DROP, "%s: Surface with %d edges",
Com_Error(ERR_DROP, "%s: Surface with %d edges",
__func__, out->numedges);
}
out->flags = 0;
@ -519,7 +519,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (planenum < 0 || planenum >= loadmodel->numplanes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d planenum.",
Com_Error(ERR_DROP, "%s: Incorrect %d planenum.",
__func__, planenum);
}
out->plane = loadmodel->planes + planenum;
@ -528,7 +528,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if ((ti < 0) || (ti >= loadmodel->numtexinfo))
{
ri.Sys_Error(ERR_DROP, "%s: bad texinfo number",
Com_Error(ERR_DROP, "%s: bad texinfo number",
__func__);
}
@ -597,7 +597,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
if (mod != mod_known)
{
ri.Sys_Error(ERR_DROP, "%s: Loaded a brush model after the world", __func__);
Com_Error(ERR_DROP, "%s: Loaded a brush model after the world", __func__);
}
header = (dheader_t *)buffer;
@ -606,7 +606,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
if (i != IDBSPHEADER && i != QBSPHEADER)
{
ri.Sys_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER);
}
@ -614,7 +614,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
if (i != BSPVERSION && i != BSPDKMVERSION)
{
ri.Sys_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION);
}
@ -735,7 +735,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
if (!name[0])
{
ri.Sys_Error(ERR_DROP, "%s: NULL name", __func__);
Com_Error(ERR_DROP, "%s: NULL name", __func__);
}
/* inline models are grabbed only from worldmodel */
@ -745,7 +745,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
if (i < 1 || i >= parent_model->numsubmodels)
{
ri.Sys_Error(ERR_DROP, "%s: bad inline model number",
Com_Error(ERR_DROP, "%s: bad inline model number",
__func__);
}
@ -779,7 +779,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
{
if (mod_numknown == MAX_MOD_KNOWN)
{
ri.Sys_Error(ERR_DROP, "%s: mod_numknown == MAX_MOD_KNOWN", __func__);
Com_Error(ERR_DROP, "%s: mod_numknown == MAX_MOD_KNOWN", __func__);
}
mod_numknown++;
@ -794,7 +794,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
{
if (crash)
{
ri.Sys_Error(ERR_DROP, "%s: %s not found",
Com_Error(ERR_DROP, "%s: %s not found",
__func__, mod->name);
}
@ -819,7 +819,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
&(mod->type));
if (!mod->extradata)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",
Com_Error(ERR_DROP, "%s: Failed to load %s",
__func__, mod->name);
}
};
@ -832,7 +832,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
&(mod->type));
if (!mod->extradata)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",
Com_Error(ERR_DROP, "%s: Failed to load %s",
__func__, mod->name);
}
}
@ -845,7 +845,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
break;
default:
ri.Sys_Error(ERR_DROP, "%s: unknown fileid for %s",
Com_Error(ERR_DROP, "%s: unknown fileid for %s",
__func__, mod->name);
break;
}

View file

@ -184,7 +184,7 @@ int RI_InitContext(void* win)
// Coders are stupid.
if (win == NULL)
{
ri.Sys_Error(ERR_FATAL, "R_InitContext() must not be called with NULL argument!");
Com_Error(ERR_FATAL, "R_InitContext() must not be called with NULL argument!");
return false;
}

View file

@ -366,7 +366,7 @@ R_BlendLightmaps(const model_t *currentmodel)
/* try uploading the block now */
if (!LM_AllocBlock(smax, tmax, &surf->dlight_s, &surf->dlight_t))
{
ri.Sys_Error(ERR_FATAL,
Com_Error(ERR_FATAL,
"%s: Consecutive calls to LM_AllocBlock(%d,%d) failed\n",
__func__, smax, tmax);
}

View file

@ -100,7 +100,7 @@ R_SubdividePolygon(int numverts, float *verts, msurface_t *warpface)
if (numverts > 60)
{
ri.Sys_Error(ERR_DROP, "%s: numverts = %i", __func__, numverts);
Com_Error(ERR_DROP, "%s: numverts = %i", __func__, numverts);
}
R_BoundPoly(numverts, verts, mins, maxs);
@ -454,7 +454,7 @@ R_ClipSkyPolygon(int nump, vec3_t vecs, int stage)
if (nump > MAX_CLIP_VERTS - 2)
{
ri.Sys_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS");
Com_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS");
}
if (stage == 6)

View file

@ -46,7 +46,7 @@ GL3_Draw_InitLocal(void)
if (!draw_chars)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars",
Com_Error(ERR_FATAL, "%s: Couldn't load pics/conchars",
__func__);
}
@ -279,7 +279,7 @@ GL3_Draw_Fill(int x, int y, int w, int h, int c)
if ((unsigned)c > 255)
{
ri.Sys_Error(ERR_FATAL, "Draw_Fill: bad color");
Com_Error(ERR_FATAL, "Draw_Fill: bad color");
}
color.c = d_8to24table[c];

View file

@ -407,7 +407,7 @@ GL3_LoadPic(char *name, byte *pic, int width, int realwidth,
{
if (numgl3textures == MAX_GL3TEXTURES)
{
ri.Sys_Error(ERR_DROP, "MAX_GLTEXTURES");
Com_Error(ERR_DROP, "MAX_GLTEXTURES");
}
numgl3textures++;
@ -417,7 +417,7 @@ GL3_LoadPic(char *name, byte *pic, int width, int realwidth,
if (strlen(name) >= sizeof(image->name))
{
ri.Sys_Error(ERR_DROP, "%s: \"%s\" is too long", __func__, name);
Com_Error(ERR_DROP, "%s: \"%s\" is too long", __func__, name);
}
strcpy(image->name, name);

View file

@ -119,7 +119,7 @@ GL3_BuildLightMap(msurface_t *surf, int offsetInLMbuf, int stride)
if (surf->texinfo->flags &
(SURF_SKY | SURF_TRANS33 | SURF_TRANS66 | SURF_WARP))
{
ri.Sys_Error(ERR_DROP, "GL3_BuildLightMap called for non-lit surface");
Com_Error(ERR_DROP, "GL3_BuildLightMap called for non-lit surface");
}
smax = (surf->extents[0] >> surf->lmshift) + 1;
@ -130,7 +130,7 @@ GL3_BuildLightMap(msurface_t *surf, int offsetInLMbuf, int stride)
if (size > 34*34*3)
{
ri.Sys_Error(ERR_DROP, "Bad s_blocklights size");
Com_Error(ERR_DROP, "Bad s_blocklights size");
}
// count number of lightmaps surf actually has

View file

@ -64,7 +64,7 @@ GL3_LM_UploadBlock(void)
if (++gl3_lms.current_lightmap_texture == MAX_LIGHTMAPS)
{
ri.Sys_Error(ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n");
Com_Error(ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n");
}
}
@ -220,7 +220,7 @@ GL3_LM_CreateSurfaceLightmap(msurface_t *surf)
if (!GL3_LM_AllocBlock(smax, tmax, &surf->light_s, &surf->light_t))
{
ri.Sys_Error(ERR_FATAL,
Com_Error(ERR_FATAL,
"%s: Consecutive calls to LM_AllocBlock(%d,%d) failed\n",
__func__, smax, tmax);
}

View file

@ -1113,7 +1113,7 @@ GL3_DrawEntitiesOnList(void)
GL3_DrawSpriteModel(currententity, currentmodel);
break;
default:
ri.Sys_Error(ERR_DROP, "Bad modeltype");
Com_Error(ERR_DROP, "Bad modeltype");
break;
}
}
@ -1159,7 +1159,7 @@ GL3_DrawEntitiesOnList(void)
GL3_DrawSpriteModel(currententity, currentmodel);
break;
default:
ri.Sys_Error(ERR_DROP, "Bad modeltype");
Com_Error(ERR_DROP, "Bad modeltype");
break;
}
}
@ -1189,7 +1189,7 @@ SetupFrame(void)
{
if (!gl3_worldmodel)
{
ri.Sys_Error(ERR_DROP, "%s: bad world model", __func__);
Com_Error(ERR_DROP, "%s: bad world model", __func__);
return;
}
@ -1628,7 +1628,7 @@ GL3_RenderView(refdef_t *fd)
if (!gl3_worldmodel && !(gl3_newrefdef.rdflags & RDF_NOWORLDMODEL))
{
ri.Sys_Error(ERR_DROP, "R_RenderView: NULL worldmodel");
Com_Error(ERR_DROP, "R_RenderView: NULL worldmodel");
}
if (r_speeds->value)
@ -2066,3 +2066,16 @@ Com_Printf(const char *msg, ...)
ri.Com_VPrintf(PRINT_ALL, msg, argptr);
va_end(argptr);
}
void
Com_Error(int code, const char *fmt, ...)
{
va_list argptr;
char text[4096]; // MAXPRINTMSG == 4096
va_start(argptr, fmt);
vsnprintf(text, sizeof(text), fmt, argptr);
va_end(argptr);
ri.Sys_Error(code, "%s", text);
}

View file

@ -134,7 +134,7 @@ Mod_LoadSubmodels(gl3model_t *loadmodel, byte *mod_base, lump_t *l)
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -176,7 +176,7 @@ Mod_LoadSubmodels(gl3model_t *loadmodel, byte *mod_base, lump_t *l)
// check limits
if (out->firstnode >= loadmodel->numnodes)
{
ri.Sys_Error(ERR_DROP, "%s: Inline model %i has bad firstnode",
Com_Error(ERR_DROP, "%s: Inline model %i has bad firstnode",
__func__, i);
}
}
@ -349,7 +349,7 @@ Mod_LoadFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -370,7 +370,7 @@ Mod_LoadFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (out->numedges < 3)
{
ri.Sys_Error(ERR_DROP, "%s: Surface with %d edges",
Com_Error(ERR_DROP, "%s: Surface with %d edges",
__func__, out->numedges);
}
out->flags = 0;
@ -386,7 +386,7 @@ Mod_LoadFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (planenum < 0 || planenum >= loadmodel->numplanes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d planenum.",
Com_Error(ERR_DROP, "%s: Incorrect %d planenum.",
__func__, planenum);
}
out->plane = loadmodel->planes + planenum;
@ -395,7 +395,7 @@ Mod_LoadFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
if ((ti < 0) || (ti >= loadmodel->numtexinfo))
{
ri.Sys_Error(ERR_DROP, "%s: bad texinfo number",
Com_Error(ERR_DROP, "%s: bad texinfo number",
__func__);
}
@ -457,7 +457,7 @@ Mod_LoadQFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -478,7 +478,7 @@ Mod_LoadQFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (out->numedges < 3)
{
ri.Sys_Error(ERR_DROP, "%s: Surface with %d edges",
Com_Error(ERR_DROP, "%s: Surface with %d edges",
__func__, out->numedges);
}
out->flags = 0;
@ -494,7 +494,7 @@ Mod_LoadQFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (planenum < 0 || planenum >= loadmodel->numplanes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d planenum.",
Com_Error(ERR_DROP, "%s: Incorrect %d planenum.",
__func__, planenum);
}
out->plane = loadmodel->planes + planenum;
@ -503,7 +503,7 @@ Mod_LoadQFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
if ((ti < 0) || (ti >= loadmodel->numtexinfo))
{
ri.Sys_Error(ERR_DROP, "%s: bad texinfo number",
Com_Error(ERR_DROP, "%s: bad texinfo number",
__func__);
}
@ -563,7 +563,7 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
if (mod != mod_known)
{
ri.Sys_Error(ERR_DROP, "%s: Loaded a brush model after the world", __func__);
Com_Error(ERR_DROP, "%s: Loaded a brush model after the world", __func__);
}
header = (dheader_t *)buffer;
@ -572,7 +572,7 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
if (i != IDBSPHEADER && i != QBSPHEADER)
{
ri.Sys_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER);
}
@ -580,7 +580,7 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
if (i != BSPVERSION && i != BSPDKMVERSION)
{
ri.Sys_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION);
}
@ -701,7 +701,7 @@ Mod_ForName (const char *name, gl3model_t *parent_model, qboolean crash)
if (!name[0])
{
ri.Sys_Error(ERR_DROP, "%s: NULL name", __func__);
Com_Error(ERR_DROP, "%s: NULL name", __func__);
}
/* inline models are grabbed only from worldmodel */
@ -711,7 +711,7 @@ Mod_ForName (const char *name, gl3model_t *parent_model, qboolean crash)
if (i < 1 || i >= parent_model->numsubmodels)
{
ri.Sys_Error(ERR_DROP, "%s: bad inline model number",
Com_Error(ERR_DROP, "%s: bad inline model number",
__func__);
}
@ -745,7 +745,7 @@ Mod_ForName (const char *name, gl3model_t *parent_model, qboolean crash)
{
if (mod_numknown == MAX_MOD_KNOWN)
{
ri.Sys_Error(ERR_DROP, "%s: mod_numknown == MAX_MOD_KNOWN", __func__);
Com_Error(ERR_DROP, "%s: mod_numknown == MAX_MOD_KNOWN", __func__);
}
mod_numknown++;
@ -760,7 +760,7 @@ Mod_ForName (const char *name, gl3model_t *parent_model, qboolean crash)
{
if (crash)
{
ri.Sys_Error(ERR_DROP, "%s: %s not found",
Com_Error(ERR_DROP, "%s: %s not found",
__func__, mod->name);
}
@ -785,7 +785,7 @@ Mod_ForName (const char *name, gl3model_t *parent_model, qboolean crash)
&(mod->type));
if (!mod->extradata)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",
Com_Error(ERR_DROP, "%s: Failed to load %s",
__func__, mod->name);
}
};
@ -798,7 +798,7 @@ Mod_ForName (const char *name, gl3model_t *parent_model, qboolean crash)
&(mod->type));
if (!mod->extradata)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",
Com_Error(ERR_DROP, "%s: Failed to load %s",
__func__, mod->name);
}
}
@ -811,7 +811,7 @@ Mod_ForName (const char *name, gl3model_t *parent_model, qboolean crash)
break;
default:
ri.Sys_Error(ERR_DROP, "%s: unknown fileid for %s",
Com_Error(ERR_DROP, "%s: unknown fileid for %s",
__func__, mod->name);
break;
}

View file

@ -191,7 +191,7 @@ int GL3_PrepareForWindow(void)
{
if (libgl == NULL)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load libGL: %s!",
Com_Error(ERR_FATAL, "%s: Couldn't load libGL: %s!",
__func__, SDL_GetError());
return -1;
@ -299,7 +299,7 @@ int GL3_InitContext(void* win)
// Coders are stupid.
if (win == NULL)
{
ri.Sys_Error(ERR_FATAL, "R_InitContext() must not be called with NULL argument!");
Com_Error(ERR_FATAL, "R_InitContext() must not be called with NULL argument!");
return false;
}

View file

@ -50,7 +50,7 @@ R_SubdividePolygon(int numverts, float *verts, msurface_t *warpface)
if (numverts > 60)
{
ri.Sys_Error(ERR_DROP, "numverts = %i", numverts);
Com_Error(ERR_DROP, "numverts = %i", numverts);
}
R_BoundPoly(numverts, verts, mins, maxs);
@ -467,7 +467,7 @@ ClipSkyPolygon(int nump, vec3_t vecs, int stage)
if (nump > MAX_CLIP_VERTS - 2)
{
ri.Sys_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS");
Com_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS");
}
if (stage == 6)

View file

@ -40,7 +40,7 @@ GL4_Draw_InitLocal(void)
draw_chars = R_FindPic("conchars", (findimage_t)GL4_FindImage);
if (!draw_chars)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars.pcx",
Com_Error(ERR_FATAL, "%s: Couldn't load pics/conchars.pcx",
__func__);
}
@ -273,7 +273,7 @@ GL4_Draw_Fill(int x, int y, int w, int h, int c)
if ((unsigned)c > 255)
{
ri.Sys_Error(ERR_FATAL, "Draw_Fill: bad color");
Com_Error(ERR_FATAL, "Draw_Fill: bad color");
}
color.c = d_8to24table[c];

View file

@ -407,7 +407,7 @@ GL4_LoadPic(char *name, byte *pic, int width, int realwidth,
{
if (numgl4textures == MAX_GL4TEXTURES)
{
ri.Sys_Error(ERR_DROP, "MAX_GLTEXTURES");
Com_Error(ERR_DROP, "MAX_GLTEXTURES");
}
numgl4textures++;
@ -417,7 +417,7 @@ GL4_LoadPic(char *name, byte *pic, int width, int realwidth,
if (strlen(name) >= sizeof(image->name))
{
ri.Sys_Error(ERR_DROP, "%s: \"%s\" is too long", __func__, name);
Com_Error(ERR_DROP, "%s: \"%s\" is too long", __func__, name);
}
strcpy(image->name, name);

View file

@ -119,7 +119,7 @@ GL4_BuildLightMap(msurface_t *surf, int offsetInLMbuf, int stride)
if (surf->texinfo->flags &
(SURF_SKY | SURF_TRANS33 | SURF_TRANS66 | SURF_WARP))
{
ri.Sys_Error(ERR_DROP, "GL4_BuildLightMap called for non-lit surface");
Com_Error(ERR_DROP, "GL4_BuildLightMap called for non-lit surface");
}
smax = (surf->extents[0] >> surf->lmshift) + 1;
@ -130,7 +130,7 @@ GL4_BuildLightMap(msurface_t *surf, int offsetInLMbuf, int stride)
if (size > 34*34*3)
{
ri.Sys_Error(ERR_DROP, "Bad s_blocklights size");
Com_Error(ERR_DROP, "Bad s_blocklights size");
}
// count number of lightmaps surf actually has

View file

@ -64,7 +64,7 @@ GL4_LM_UploadBlock(void)
if (++gl4_lms.current_lightmap_texture == MAX_LIGHTMAPS)
{
ri.Sys_Error(ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n");
Com_Error(ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n");
}
}
@ -220,7 +220,7 @@ GL4_LM_CreateSurfaceLightmap(msurface_t *surf)
if (!GL4_LM_AllocBlock(smax, tmax, &surf->light_s, &surf->light_t))
{
ri.Sys_Error(ERR_FATAL,
Com_Error(ERR_FATAL,
"%s: Consecutive calls to LM_AllocBlock(%d,%d) failed\n",
__func__, smax, tmax);
}

View file

@ -1100,7 +1100,7 @@ GL4_DrawEntitiesOnList(void)
GL4_DrawSpriteModel(currententity, currentmodel);
break;
default:
ri.Sys_Error(ERR_DROP, "Bad modeltype");
Com_Error(ERR_DROP, "Bad modeltype");
break;
}
}
@ -1146,7 +1146,7 @@ GL4_DrawEntitiesOnList(void)
GL4_DrawSpriteModel(currententity, currentmodel);
break;
default:
ri.Sys_Error(ERR_DROP, "Bad modeltype");
Com_Error(ERR_DROP, "Bad modeltype");
break;
}
}
@ -1176,7 +1176,7 @@ SetupFrame(void)
{
if (!gl4_worldmodel)
{
ri.Sys_Error(ERR_DROP, "%s: bad world model", __func__);
Com_Error(ERR_DROP, "%s: bad world model", __func__);
return;
}
@ -1615,7 +1615,7 @@ GL4_RenderView(refdef_t *fd)
if (!gl4_worldmodel && !(gl4_newrefdef.rdflags & RDF_NOWORLDMODEL))
{
ri.Sys_Error(ERR_DROP, "R_RenderView: NULL worldmodel");
Com_Error(ERR_DROP, "R_RenderView: NULL worldmodel");
}
if (r_speeds->value)
@ -2050,3 +2050,16 @@ Com_Printf(const char *msg, ...)
ri.Com_VPrintf(PRINT_ALL, msg, argptr);
va_end(argptr);
}
void
Com_Error(int code, const char *fmt, ...)
{
va_list argptr;
char text[4096]; // MAXPRINTMSG == 4096
va_start(argptr, fmt);
vsnprintf(text, sizeof(text), fmt, argptr);
va_end(argptr);
ri.Sys_Error(code, "%s", text);
}

View file

@ -132,7 +132,7 @@ Mod_LoadSubmodels(gl4model_t *loadmodel, byte *mod_base, lump_t *l)
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -174,7 +174,7 @@ Mod_LoadSubmodels(gl4model_t *loadmodel, byte *mod_base, lump_t *l)
// check limits
if (out->firstnode >= loadmodel->numnodes)
{
ri.Sys_Error(ERR_DROP, "%s: Inline model %i has bad firstnode",
Com_Error(ERR_DROP, "%s: Inline model %i has bad firstnode",
__func__, i);
}
}
@ -271,7 +271,7 @@ Mod_LoadFaces(gl4model_t *loadmodel, byte *mod_base, lump_t *l)
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -300,7 +300,7 @@ Mod_LoadFaces(gl4model_t *loadmodel, byte *mod_base, lump_t *l)
if (planenum < 0 || planenum >= loadmodel->numplanes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d planenum.",
Com_Error(ERR_DROP, "%s: Incorrect %d planenum.",
__func__, planenum);
}
out->plane = loadmodel->planes + planenum;
@ -309,7 +309,7 @@ Mod_LoadFaces(gl4model_t *loadmodel, byte *mod_base, lump_t *l)
if ((ti < 0) || (ti >= loadmodel->numtexinfo))
{
ri.Sys_Error(ERR_DROP, "%s: bad texinfo number",
Com_Error(ERR_DROP, "%s: bad texinfo number",
__func__);
}
@ -370,7 +370,7 @@ Mod_LoadLeafs(gl4model_t *loadmodel, byte *mod_base, lump_t *l)
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -403,7 +403,7 @@ Mod_LoadLeafs(gl4model_t *loadmodel, byte *mod_base, lump_t *l)
out->firstmarksurface = loadmodel->marksurfaces + firstleafface;
if ((firstleafface + out->nummarksurfaces) > loadmodel->nummarksurfaces)
{
ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s",
Com_Error(ERR_DROP, "%s: wrong marksurfaces position in %s",
__func__, loadmodel->name);
}
}
@ -419,7 +419,7 @@ Mod_LoadBrushModel(gl4model_t *mod, void *buffer, int modfilelen)
if (mod != mod_known)
{
ri.Sys_Error(ERR_DROP, "Loaded a brush model after the world");
Com_Error(ERR_DROP, "Loaded a brush model after the world");
}
header = (dheader_t *)buffer;
@ -428,7 +428,7 @@ Mod_LoadBrushModel(gl4model_t *mod, void *buffer, int modfilelen)
if (i != BSPVERSION)
{
ri.Sys_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION);
}
@ -538,7 +538,7 @@ Mod_ForName (const char *name, gl4model_t *parent_model, qboolean crash)
if (!name[0])
{
ri.Sys_Error(ERR_DROP, "%s: NULL name", __func__);
Com_Error(ERR_DROP, "%s: NULL name", __func__);
}
/* inline models are grabbed only from worldmodel */
@ -548,7 +548,7 @@ Mod_ForName (const char *name, gl4model_t *parent_model, qboolean crash)
if (i < 1 || i >= parent_model->numsubmodels)
{
ri.Sys_Error(ERR_DROP, "%s: bad inline model number",
Com_Error(ERR_DROP, "%s: bad inline model number",
__func__);
}
@ -582,7 +582,7 @@ Mod_ForName (const char *name, gl4model_t *parent_model, qboolean crash)
{
if (mod_numknown == MAX_MOD_KNOWN)
{
ri.Sys_Error(ERR_DROP, "mod_numknown == MAX_MOD_KNOWN");
Com_Error(ERR_DROP, "mod_numknown == MAX_MOD_KNOWN");
}
mod_numknown++;
@ -597,7 +597,7 @@ Mod_ForName (const char *name, gl4model_t *parent_model, qboolean crash)
{
if (crash)
{
ri.Sys_Error(ERR_DROP, "%s: %s not found",
Com_Error(ERR_DROP, "%s: %s not found",
__func__, mod->name);
}
@ -622,7 +622,7 @@ Mod_ForName (const char *name, gl4model_t *parent_model, qboolean crash)
&(mod->type));
if (!mod->extradata)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",
Com_Error(ERR_DROP, "%s: Failed to load %s",
__func__, mod->name);
}
};
@ -635,7 +635,7 @@ Mod_ForName (const char *name, gl4model_t *parent_model, qboolean crash)
&(mod->type));
if (!mod->extradata)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",
Com_Error(ERR_DROP, "%s: Failed to load %s",
__func__, mod->name);
}
}
@ -648,7 +648,7 @@ Mod_ForName (const char *name, gl4model_t *parent_model, qboolean crash)
break;
default:
ri.Sys_Error(ERR_DROP, "%s: unknown fileid for %s",
Com_Error(ERR_DROP, "%s: unknown fileid for %s",
__func__, mod->name);
break;
}

View file

@ -191,7 +191,7 @@ int GL4_PrepareForWindow(void)
{
if (libgl == NULL)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load libGL: %s!",
Com_Error(ERR_FATAL, "%s: Couldn't load libGL: %s!",
__func__, SDL_GetError());
return -1;
@ -299,7 +299,7 @@ int GL4_InitContext(void* win)
// Coders are stupid.
if (win == NULL)
{
ri.Sys_Error(ERR_FATAL, "R_InitContext() must not be called with NULL argument!");
Com_Error(ERR_FATAL, "R_InitContext() must not be called with NULL argument!");
return false;
}

View file

@ -50,7 +50,7 @@ R_SubdividePolygon(int numverts, float *verts, msurface_t *warpface)
if (numverts > 60)
{
ri.Sys_Error(ERR_DROP, "numverts = %i", numverts);
Com_Error(ERR_DROP, "numverts = %i", numverts);
}
R_BoundPoly(numverts, verts, mins, maxs);
@ -467,7 +467,7 @@ ClipSkyPolygon(int nump, vec3_t vecs, int stage)
if (nump > MAX_CLIP_VERTS - 2)
{
ri.Sys_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS");
Com_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS");
}
if (stage == 6)

View file

@ -56,7 +56,7 @@ Draw_InitLocal (void)
if (!draw_chars)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars", __func__);
Com_Error(ERR_FATAL, "%s: Couldn't load pics/conchars", __func__);
}
}

View file

@ -102,7 +102,7 @@ R_FindFreeImage (void)
if (i == numr_images)
{
if (numr_images == MAX_RIMAGES)
ri.Sys_Error(ERR_DROP, "%s: Max images", __func__);
Com_Error(ERR_DROP, "%s: Max images", __func__);
numr_images++;
}
image = &r_images[i];
@ -260,7 +260,7 @@ R_LoadPic8 (char *name, byte *pic, int width, int realwidth, int height, int rea
image = R_FindFreeImage();
if (strlen(name) >= sizeof(image->name))
ri.Sys_Error(ERR_DROP, "%s: '%s' is too long", __func__, name);
Com_Error(ERR_DROP, "%s: '%s' is too long", __func__, name);
strcpy (image->name, name);
image->registration_sequence = registration_sequence;
@ -274,7 +274,7 @@ R_LoadPic8 (char *name, byte *pic, int width, int realwidth, int height, int rea
image->pixels[0] = malloc(full_size);
if (!image->pixels[0])
{
ri.Sys_Error(ERR_FATAL, "%s: Can't allocate image.", __func__);
Com_Error(ERR_FATAL, "%s: Can't allocate image.", __func__);
// code never returns after ERR_FATAL
return NULL;
}
@ -338,7 +338,7 @@ R_LoadPic (char *name, byte *pic, int width, int realwidth, int height, int real
pic8 = malloc(data_size);
if (!pic8)
{
ri.Sys_Error(ERR_FATAL, "%s: Can't allocate image.", __func__);
Com_Error(ERR_FATAL, "%s: Can't allocate image.", __func__);
// code never returns after ERR_FATAL
return NULL;
}

View file

@ -1331,7 +1331,7 @@ RE_RenderFrame (refdef_t *fd)
if (!r_worldmodel && !( r_newrefdef.rdflags & RDF_NOWORLDMODEL ) )
{
ri.Sys_Error(ERR_FATAL, "%s: NULL worldmodel", __func__);
Com_Error(ERR_FATAL, "%s: NULL worldmodel", __func__);
}
// Need to rerender whole frame
@ -1903,7 +1903,7 @@ RE_InitContext(void *win)
if(win == NULL)
{
ri.Sys_Error(ERR_FATAL, "%s() must not be called with NULL argument!", __func__);
Com_Error(ERR_FATAL, "%s() must not be called with NULL argument!", __func__);
return false;
}
@ -2406,7 +2406,7 @@ SWimp_CreateRender(int width, int height)
swap_buffers = malloc(height * width * sizeof(pixel_t) * 2);
if (!swap_buffers)
{
ri.Sys_Error(ERR_FATAL, "%s: Can't allocate swapbuffer.", __func__);
Com_Error(ERR_FATAL, "%s: Can't allocate swapbuffer.", __func__);
// code never returns after ERR_FATAL
return;
}
@ -2482,7 +2482,7 @@ Sys_Error (const char *error, ...)
vsnprintf(text, sizeof(text), error, argptr);
va_end(argptr);
ri.Sys_Error (ERR_FATAL, "%s", text);
Com_Error(ERR_FATAL, "%s", text);
}
void
@ -2494,6 +2494,19 @@ Com_Printf(const char *msg, ...)
va_end(argptr);
}
void
Com_Error(int code, const char *fmt, ...)
{
va_list argptr;
char text[4096]; // MAXPRINTMSG == 4096
va_start(argptr, fmt);
vsnprintf(text, sizeof(text), fmt, argptr);
va_end(argptr);
ri.Sys_Error(code, "%s", text);
}
/*
==============================================================================

View file

@ -340,7 +340,7 @@ R_SetupFrame (void)
if (!r_worldmodel)
{
ri.Sys_Error(ERR_DROP, "%s: bad world model", __func__);
Com_Error(ERR_DROP, "%s: bad world model", __func__);
return;
}

View file

@ -136,7 +136,7 @@ Mod_LoadSubmodels(model_t *loadmodel, const byte *mod_base, const lump_t *l)
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -178,7 +178,7 @@ Mod_LoadSubmodels(model_t *loadmodel, const byte *mod_base, const lump_t *l)
// check limits
if (out->firstnode >= loadmodel->numnodes)
{
ri.Sys_Error(ERR_DROP, "%s: Inline model %i has bad firstnode",
Com_Error(ERR_DROP, "%s: Inline model %i has bad firstnode",
__func__, i);
}
}
@ -196,7 +196,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -215,7 +215,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (out->numedges < 3)
{
ri.Sys_Error(ERR_DROP, "%s: Surface with %d edges",
Com_Error(ERR_DROP, "%s: Surface with %d edges",
__func__, out->numedges);
}
out->flags = 0;
@ -230,7 +230,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (planenum < 0 || planenum >= loadmodel->numplanes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d planenum.",
Com_Error(ERR_DROP, "%s: Incorrect %d planenum.",
__func__, planenum);
}
out->plane = loadmodel->planes + planenum;
@ -239,7 +239,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if ((ti < 0) || (ti >= loadmodel->numtexinfo))
{
ri.Sys_Error(ERR_DROP, "%s: bad texinfo number",
Com_Error(ERR_DROP, "%s: bad texinfo number",
__func__);
}
@ -305,7 +305,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -324,7 +324,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (out->numedges < 3)
{
ri.Sys_Error(ERR_DROP, "%s: Surface with %d edges",
Com_Error(ERR_DROP, "%s: Surface with %d edges",
__func__, out->numedges);
}
out->flags = 0;
@ -339,7 +339,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (planenum < 0 || planenum >= loadmodel->numplanes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d planenum.",
Com_Error(ERR_DROP, "%s: Incorrect %d planenum.",
__func__, planenum);
}
out->plane = loadmodel->planes + planenum;
@ -348,7 +348,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if ((ti < 0) || (ti >= loadmodel->numtexinfo))
{
ri.Sys_Error(ERR_DROP, "%s: bad texinfo number",
Com_Error(ERR_DROP, "%s: bad texinfo number",
__func__);
}
@ -412,7 +412,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
if (mod != mod_known)
{
ri.Sys_Error(ERR_DROP, "%s: Loaded a brush model after the world", __func__);
Com_Error(ERR_DROP, "%s: Loaded a brush model after the world", __func__);
}
header = (dheader_t *)buffer;
@ -421,7 +421,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
if (i != IDBSPHEADER && i != QBSPHEADER)
{
ri.Sys_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER);
}
@ -429,7 +429,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
if (i != BSPVERSION && i != BSPDKMVERSION)
{
ri.Sys_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION);
}
@ -555,7 +555,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
if (!name[0])
{
ri.Sys_Error(ERR_DROP, "%s: NULL name", __func__);
Com_Error(ERR_DROP, "%s: NULL name", __func__);
}
/* inline models are grabbed only from worldmodel */
@ -565,7 +565,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
if (i < 1 || i >= parent_model->numsubmodels)
{
ri.Sys_Error(ERR_DROP, "%s: bad inline model number",
Com_Error(ERR_DROP, "%s: bad inline model number",
__func__);
}
@ -599,7 +599,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
{
if (mod_numknown == MAX_MOD_KNOWN)
{
ri.Sys_Error(ERR_DROP, "%s: mod_numknown == MAX_MOD_KNOWN", __func__);
Com_Error(ERR_DROP, "%s: mod_numknown == MAX_MOD_KNOWN", __func__);
}
mod_numknown++;
@ -614,7 +614,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
{
if (crash)
{
ri.Sys_Error(ERR_DROP, "%s: %s not found",
Com_Error(ERR_DROP, "%s: %s not found",
__func__, mod->name);
}
@ -639,7 +639,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
&(mod->type));
if (!mod->extradata)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",
Com_Error(ERR_DROP, "%s: Failed to load %s",
__func__, mod->name);
}
};
@ -652,7 +652,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
&(mod->type));
if (!mod->extradata)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",
Com_Error(ERR_DROP, "%s: Failed to load %s",
__func__, mod->name);
}
}
@ -665,7 +665,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
break;
default:
ri.Sys_Error(ERR_DROP, "%s: unknown fileid for %s",
Com_Error(ERR_DROP, "%s: unknown fileid for %s",
__func__, mod->name);
break;
}

View file

@ -991,7 +991,7 @@ R_ClipAndDrawPoly ( float alpha, int isturbulent, qboolean textured )
return;
if (nump > MAXWORKINGVERTS)
{
ri.Sys_Error(ERR_DROP, "%s: too many points: %d", __func__, nump);
Com_Error(ERR_DROP, "%s: too many points: %d", __func__, nump);
}
}

View file

@ -288,7 +288,7 @@ R_InitCaches (void)
sc_base = (surfcache_t *)malloc(size);
if (!sc_base)
{
ri.Sys_Error(ERR_FATAL, "%s: Can't allocate cache.", __func__);
Com_Error(ERR_FATAL, "%s: Can't allocate cache.", __func__);
// code never returns after ERR_FATAL
return;
}
@ -337,12 +337,12 @@ D_SCAlloc (int width, int size)
if ((width < 0) || (width > 256))
{
ri.Sys_Error(ERR_FATAL, "%s: bad cache width %d\n", __func__, width);
Com_Error(ERR_FATAL, "%s: bad cache width %d\n", __func__, width);
}
if ((size <= 0) || (size > 0x10000))
{
ri.Sys_Error(ERR_FATAL, "%s: bad cache size %d\n", __func__, size);
Com_Error(ERR_FATAL, "%s: bad cache size %d\n", __func__, size);
}
// Add header size
@ -350,7 +350,7 @@ D_SCAlloc (int width, int size)
size = (size + 3) & ~3;
if (size > sc_size)
{
ri.Sys_Error(ERR_FATAL, "%s: %i > cache size of %i", __func__, size, sc_size);
Com_Error(ERR_FATAL, "%s: %i > cache size of %i", __func__, size, sc_size);
}
// if there is not size bytes after the rover, reset to the start
@ -370,7 +370,7 @@ D_SCAlloc (int width, int size)
sc_rover = sc_rover->next;
if (!sc_rover)
{
ri.Sys_Error(ERR_FATAL, "%s: hit the end of memory", __func__);
Com_Error(ERR_FATAL, "%s: hit the end of memory", __func__);
}
if (sc_rover->owner)
*sc_rover->owner = NULL;

View file

@ -1695,7 +1695,7 @@ void QVk_Restart(void)
{
QVk_WaitAndShutdownAll();
if (!QVk_Init())
ri.Sys_Error(ERR_FATAL, "Unable to restart Vulkan renderer");
Com_Error(ERR_FATAL, "Unable to restart Vulkan renderer");
QVk_PostInit();
ri.Vid_RequestRestart(RESTART_PARTIAL);
}

View file

@ -40,7 +40,7 @@ void Draw_InitLocal (void)
if (!draw_chars)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars",
Com_Error(ERR_FATAL, "%s: Couldn't load pics/conchars",
__func__);
}
}
@ -226,7 +226,7 @@ void RE_Draw_Fill (int x, int y, int w, int h, int c)
return;
if ((unsigned)c > 255)
ri.Sys_Error(ERR_FATAL, "%s: bad color", __func__);
Com_Error(ERR_FATAL, "%s: bad color", __func__);
color.c = d_8to24table[c];

View file

@ -911,7 +911,7 @@ static uint32_t Vk_Upload32Native (byte *data, int width, int height, imagetype_
{
*texBuffer = malloc(scaled_width * scaled_height * 4);
if (!*texBuffer)
ri.Sys_Error(ERR_DROP, "%s: too big", __func__);
Com_Error(ERR_DROP, "%s: too big", __func__);
ResizeSTB(data, width, height,
*texBuffer, scaled_width, scaled_height);
@ -974,7 +974,7 @@ static uint32_t Vk_Upload32 (byte *data, int width, int height, imagetype_t type
*texBuffer = malloc(scaled_width * scaled_height * 4);
if (!*texBuffer)
ri.Sys_Error(ERR_DROP, "%s: too big", __func__);
Com_Error(ERR_DROP, "%s: too big", __func__);
*upload_width = scaled_width;
*upload_height = scaled_height;
@ -1029,7 +1029,7 @@ static uint32_t Vk_Upload8 (const byte *data, int width, int height, imagetype_t
trans = malloc(s * sizeof(*trans));
if (!trans)
ri.Sys_Error(ERR_DROP, "%s: too large", __func__);
Com_Error(ERR_DROP, "%s: too large", __func__);
for (i = 0; i < s; i++)
{
@ -1126,14 +1126,14 @@ Vk_LoadPic(const char *name, byte *pic, int width, int realwidth,
if (i == numvktextures)
{
if (numvktextures == MAX_VKTEXTURES)
ri.Sys_Error(ERR_DROP, "%s: MAX_VKTEXTURES", __func__);
Com_Error(ERR_DROP, "%s: MAX_VKTEXTURES", __func__);
numvktextures++;
}
image = &vktextures[i];
}
if (strlen(name) >= sizeof(image->name))
ri.Sys_Error(ERR_DROP, "%s: \"%s\" is too long", __func__, name);
Com_Error(ERR_DROP, "%s: \"%s\" is too long", __func__, name);
strcpy(image->name, name);
image->registration_sequence = registration_sequence;
// zero-clear Vulkan texture handle

View file

@ -297,7 +297,7 @@ R_BuildLightMap(msurface_t *surf, byte *dest, int stride)
if (surf->texinfo->flags &
(SURF_SKY | SURF_TRANS33 | SURF_TRANS66 | SURF_WARP))
{
ri.Sys_Error(ERR_DROP, "R_BuildLightMap called for non-lit surface");
Com_Error(ERR_DROP, "R_BuildLightMap called for non-lit surface");
}
smax = (surf->extents[0] >> surf->lmshift) + 1;
@ -323,7 +323,7 @@ R_BuildLightMap(msurface_t *surf, byte *dest, int stride)
if (!s_blocklights)
{
ri.Sys_Error(ERR_DROP, "Can't alloc s_blocklights");
Com_Error(ERR_DROP, "Can't alloc s_blocklights");
}
}

View file

@ -87,7 +87,7 @@ LM_UploadBlock(qboolean dynamic)
if (++vk_lms.current_lightmap_texture == MAX_LIGHTMAPS)
{
ri.Sys_Error(ERR_DROP,
Com_Error(ERR_DROP,
"%s() - MAX_LIGHTMAPS exceeded\n", __func__);
}
}
@ -250,7 +250,7 @@ Vk_CreateSurfaceLightmap(msurface_t *surf)
if (!LM_AllocBlock(smax, tmax, &surf->light_s, &surf->light_t))
{
ri.Sys_Error(ERR_FATAL,
Com_Error(ERR_FATAL,
"%s: Consecutive calls to LM_AllocBlock(%d,%d) failed\n",
__func__, smax, tmax);
}

View file

@ -628,7 +628,7 @@ R_SetupFrame(void)
{
if (!r_worldmodel)
{
ri.Sys_Error(ERR_DROP, "%s: bad world model", __func__);
Com_Error(ERR_DROP, "%s: bad world model", __func__);
return;
}
@ -910,7 +910,7 @@ RE_RenderView(refdef_t *fd)
if (!r_worldmodel && !(r_newrefdef.rdflags & RDF_NOWORLDMODEL))
{
ri.Sys_Error(ERR_DROP, "%s: NULL worldmodel", __func__);
Com_Error(ERR_DROP, "%s: NULL worldmodel", __func__);
}
if (r_speeds->value)
@ -1776,3 +1776,16 @@ Com_Printf(const char *msg, ...)
ri.Com_VPrintf(PRINT_ALL, msg, argptr);
va_end(argptr);
}
void
Com_Error(int code, const char *fmt, ...)
{
va_list argptr;
char text[4096]; // MAXPRINTMSG == 4096
va_start(argptr, fmt);
vsnprintf(text, sizeof(text), fmt, argptr);
va_end(argptr);
ri.Sys_Error(code, "%s", text);
}

View file

@ -168,7 +168,7 @@ void Mesh_Init (void)
if (Mesh_VertsRealloc(MAX_VERTS))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
}
@ -280,7 +280,7 @@ Vk_DrawAliasFrameLerpCommands (entity_t *currententity, int *order, int *order_e
if (Mesh_VertsRealloc(1))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
drawInfo[0][0].firstVertex = 0;
@ -315,7 +315,7 @@ Vk_DrawAliasFrameLerpCommands (entity_t *currententity, int *order, int *order_e
if (Mesh_VertsRealloc(pipeCounters[pipelineIdx]))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
drawInfo[pipelineIdx][pipeCounters[pipelineIdx]].vertexCount = count;
@ -332,7 +332,7 @@ Vk_DrawAliasFrameLerpCommands (entity_t *currententity, int *order, int *order_e
if (Mesh_VertsRealloc(vertIdx))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
// unused in this case, since texturing is disabled
@ -369,7 +369,7 @@ Vk_DrawAliasFrameLerpCommands (entity_t *currententity, int *order, int *order_e
if (Mesh_VertsRealloc(vertIdx))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
// texture coordinates come from the draw list
@ -400,7 +400,7 @@ Vk_DrawAliasFrameLerpCommands (entity_t *currententity, int *order, int *order_e
if (Mesh_VertsRealloc(pipeCounters[pipelineIdx] + 1))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
pipeCounters[pipelineIdx]++;
@ -525,7 +525,7 @@ Vk_DrawAliasFrameLerp(entity_t *currententity, dmdl_t *paliashdr, float backlerp
if (Mesh_VertsRealloc(paliashdr->num_xyz))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
lerp = s_lerped[0];
@ -597,14 +597,14 @@ Vk_DrawAliasShadow(int *order, int *order_end, int posenum,
if (Mesh_VertsRealloc(count))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
do
{
if (Mesh_VertsRealloc(order[2]))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
/* normals and vertexes come from the frame list */

View file

@ -107,7 +107,7 @@ Mod_LoadSubmodels(model_t *loadmodel, const byte *mod_base, const lump_t *l)
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -149,7 +149,7 @@ Mod_LoadSubmodels(model_t *loadmodel, const byte *mod_base, const lump_t *l)
// check limits
if (out->firstnode >= loadmodel->numnodes)
{
ri.Sys_Error(ERR_DROP, "%s: Inline model %i has bad firstnode",
Com_Error(ERR_DROP, "%s: Inline model %i has bad firstnode",
__func__, i);
}
}
@ -320,7 +320,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -348,7 +348,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (out->numedges < 3)
{
ri.Sys_Error(ERR_DROP, "%s: Surface with %d edges",
Com_Error(ERR_DROP, "%s: Surface with %d edges",
__func__, out->numedges);
}
out->flags = 0;
@ -364,7 +364,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (planenum < 0 || planenum >= loadmodel->numplanes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d planenum.",
Com_Error(ERR_DROP, "%s: Incorrect %d planenum.",
__func__, planenum);
}
out->plane = loadmodel->planes + planenum;
@ -373,7 +373,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if ((ti < 0) || (ti >= loadmodel->numtexinfo))
{
ri.Sys_Error(ERR_DROP, "%s: bad texinfo number",
Com_Error(ERR_DROP, "%s: bad texinfo number",
__func__);
}
@ -445,7 +445,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (l->filelen % sizeof(*in))
{
ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s",
Com_Error(ERR_DROP, "%s: funny lump size in %s",
__func__, loadmodel->name);
}
@ -473,7 +473,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (out->numedges < 3)
{
ri.Sys_Error(ERR_DROP, "%s: Surface with %d edges",
Com_Error(ERR_DROP, "%s: Surface with %d edges",
__func__, out->numedges);
}
out->flags = 0;
@ -489,7 +489,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if (planenum < 0 || planenum >= loadmodel->numplanes)
{
ri.Sys_Error(ERR_DROP, "%s: Incorrect %d planenum.",
Com_Error(ERR_DROP, "%s: Incorrect %d planenum.",
__func__, planenum);
}
out->plane = loadmodel->planes + planenum;
@ -498,7 +498,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
if ((ti < 0) || (ti >= loadmodel->numtexinfo))
{
ri.Sys_Error(ERR_DROP, "%s: bad texinfo number",
Com_Error(ERR_DROP, "%s: bad texinfo number",
__func__);
}
@ -567,7 +567,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
if (mod != models_known)
{
ri.Sys_Error(ERR_DROP, "%s: Loaded a brush model after the world", __func__);
Com_Error(ERR_DROP, "%s: Loaded a brush model after the world", __func__);
}
header = (dheader_t *)buffer;
@ -576,7 +576,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
if (i != IDBSPHEADER && i != QBSPHEADER)
{
ri.Sys_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER);
}
@ -584,7 +584,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
if (i != BSPVERSION && i != BSPDKMVERSION)
{
ri.Sys_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION);
}
@ -705,7 +705,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
if (!name[0])
{
ri.Sys_Error(ERR_DROP, "%s: NULL name", __func__);
Com_Error(ERR_DROP, "%s: NULL name", __func__);
}
/* inline models are grabbed only from worldmodel */
@ -715,7 +715,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
if (i < 1 || i >= parent_model->numsubmodels)
{
ri.Sys_Error(ERR_DROP, "%s: bad inline model number",
Com_Error(ERR_DROP, "%s: bad inline model number",
__func__);
}
@ -749,7 +749,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
{
if (mod_numknown == models_known_max)
{
ri.Sys_Error(ERR_DROP, "%s: mod_numknown == models_known_max", __func__);
Com_Error(ERR_DROP, "%s: mod_numknown == models_known_max", __func__);
}
mod_numknown++;
@ -764,7 +764,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
{
if (crash)
{
ri.Sys_Error(ERR_DROP, "%s: %s not found",
Com_Error(ERR_DROP, "%s: %s not found",
__func__, mod->name);
}
@ -805,7 +805,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
&(mod->type));
if (!mod->extradata)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",
Com_Error(ERR_DROP, "%s: Failed to load %s",
__func__, mod->name);
}
};
@ -818,7 +818,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
&(mod->type));
if (!mod->extradata)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",
Com_Error(ERR_DROP, "%s: Failed to load %s",
__func__, mod->name);
}
}
@ -831,7 +831,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
break;
default:
ri.Sys_Error(ERR_DROP, "%s: unknown fileid for %s",
Com_Error(ERR_DROP, "%s: unknown fileid for %s",
__func__, mod->name);
break;
}

View file

@ -44,7 +44,7 @@ DrawVkPoly(mpoly_t *p, image_t *texture, float *color)
if (Mesh_VertsRealloc(p->numverts))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
v = p->verts;
@ -103,7 +103,7 @@ static void DrawVkFlowingPoly (msurface_t *fa, image_t *texture, float *color)
if (Mesh_VertsRealloc(p->numverts))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
v = p->verts;
@ -449,7 +449,7 @@ Vk_RenderLightmappedPoly(msurface_t *surf, float *modelMatrix, float alpha, enti
if (Mesh_VertsRealloc(nv))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
if (is_dynamic)

View file

@ -87,7 +87,7 @@ R_SubdividePolygon(int numverts, float *verts, msurface_t *warpface)
if (numverts > 60)
{
ri.Sys_Error(ERR_DROP, "%s: numverts = %i", __func__, numverts);
Com_Error(ERR_DROP, "%s: numverts = %i", __func__, numverts);
}
R_BoundPoly(numverts, verts, mins, maxs);
@ -325,7 +325,7 @@ EmitWaterPolys(msurface_t *fa, image_t *texture, float *modelMatrix,
if (Mesh_VertsRealloc(p->numverts))
{
ri.Sys_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
Com_Error(ERR_FATAL, "%s: can't allocate memory", __func__);
}
for (i = 0, v = p->verts; i < p->numverts; i++, v++)
@ -435,7 +435,7 @@ ClipSkyPolygon(int nump, vec3_t vecs, int stage)
int i, j;
if (nump > MAX_CLIP_VERTS - 2)
ri.Sys_Error(ERR_DROP, "%s: MAX_CLIP_VERTS", __func__);
Com_Error(ERR_DROP, "%s: MAX_CLIP_VERTS", __func__);
if (stage == 6)
{
/* fully clipped, so draw it */