From 0ab41ee0df806d6d42c2575bd1a1e91aa0802dee Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Tue, 12 Feb 2019 22:41:10 +0200 Subject: [PATCH] Use boolean for r_outof* --- src/client/refresh/soft/header/local.h | 8 ++++---- src/client/refresh/soft/sw_alias.c | 2 +- src/client/refresh/soft/sw_main.c | 14 +++++++++----- src/client/refresh/soft/sw_misc.c | 4 ---- src/client/refresh/soft/sw_polyset.c | 6 +++--- src/client/refresh/soft/sw_rast.c | 8 ++++---- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/client/refresh/soft/header/local.h b/src/client/refresh/soft/header/local.h index a2f25e16..13273cfd 100644 --- a/src/client/refresh/soft/header/local.h +++ b/src/client/refresh/soft/header/local.h @@ -516,10 +516,10 @@ extern int r_aliasblendcolor; extern float aliasxscale, aliasyscale, aliasxcenter, aliasycenter; -extern int r_outofsurfaces; -extern int r_outofedges; -extern int r_outofverts; -extern int r_outoftriangles; +extern qboolean r_outofsurfaces; +extern qboolean r_outofedges; +extern qboolean r_outofverts; +extern qboolean r_outoftriangles; extern mvertex_t *r_pcurrentvertbase; diff --git a/src/client/refresh/soft/sw_alias.c b/src/client/refresh/soft/sw_alias.c index 5658f3fa..b8e77b7e 100644 --- a/src/client/refresh/soft/sw_alias.c +++ b/src/client/refresh/soft/sw_alias.c @@ -232,7 +232,7 @@ R_AliasPreparePoints (const entity_t *currententity, finalvert_t *verts, const f if ((verts + s_pmdl->num_xyz) >= verts_max) { - r_outofverts += s_pmdl->num_xyz - (verts_max - verts); + r_outofverts = true; return; } diff --git a/src/client/refresh/soft/sw_main.c b/src/client/refresh/soft/sw_main.c index 774c6662..f45ec46d 100644 --- a/src/client/refresh/soft/sw_main.c +++ b/src/client/refresh/soft/sw_main.c @@ -68,10 +68,10 @@ int r_numallocatededges; int r_numallocatedverts; int r_numallocatedtriangles; float r_aliasuvscale = 1.0; -int r_outofsurfaces; -int r_outofedges; -int r_outofverts; -int r_outoftriangles; +qboolean r_outofsurfaces; +qboolean r_outofedges; +qboolean r_outofverts; +qboolean r_outoftriangles; qboolean r_dowarp; @@ -379,6 +379,7 @@ R_ReallocateMapBuffers (void) if (r_outofsurfaces) { r_cnumsurfs *= 2; + r_outofsurfaces = false; } if (r_cnumsurfs < NUMSTACKSURFACES) @@ -413,6 +414,7 @@ R_ReallocateMapBuffers (void) if (r_outofedges) { r_numallocatededges *= 2; + r_outofedges = false; } if (r_numallocatededges < NUMSTACKEDGES) @@ -443,6 +445,7 @@ R_ReallocateMapBuffers (void) if (r_outofverts) { r_numallocatedverts *= 2; + r_outofverts = false; } if (r_numallocatedverts < MAXALIASVERTS) @@ -470,6 +473,7 @@ R_ReallocateMapBuffers (void) if (r_outoftriangles) { r_numallocatedtriangles *= 2; + r_outoftriangles = false; } if (r_numallocatedtriangles < vid.height) @@ -1809,7 +1813,7 @@ SWimp_CreateRender(void) edge_basespans = malloc((vid.width*2) * sizeof(espan_t)); // count of "out of items" - r_outofsurfaces = r_outofedges = r_outofverts = r_outoftriangles = 0; + r_outofsurfaces = r_outofedges = r_outofverts = r_outoftriangles = false; // pointers to allocated buffers finalverts = NULL; r_edges = NULL; diff --git a/src/client/refresh/soft/sw_misc.c b/src/client/refresh/soft/sw_misc.c index 224825fd..994e29d1 100644 --- a/src/client/refresh/soft/sw_misc.c +++ b/src/client/refresh/soft/sw_misc.c @@ -385,10 +385,6 @@ R_SetupFrame (void) r_polycount = 0; r_drawnpolycount = 0; r_amodels_drawn = 0; - r_outofsurfaces = 0; - r_outofverts = 0; - r_outofedges = 0; - r_outoftriangles = 0; // d_setup d_minmip = sw_mipcap->value; diff --git a/src/client/refresh/soft/sw_polyset.c b/src/client/refresh/soft/sw_polyset.c index a82fe88e..45352214 100644 --- a/src/client/refresh/soft/sw_polyset.c +++ b/src/client/refresh/soft/sw_polyset.c @@ -220,7 +220,7 @@ R_PushEdgesSpan(int u, int v, int count, if (d_pedgespanpackage >= triangles_max) { // no space any more - r_outoftriangles++; + r_outoftriangles = true; return; } @@ -891,7 +891,7 @@ R_RasterizeAliasPolySmooth(const entity_t *currententity) if ((triangle_spans + initialrightheight) >= triangles_max) { // we dont have enough triangles for save full height - r_outoftriangles++; + r_outoftriangles = true; return; } originalcount = triangle_spans[initialrightheight].count; @@ -920,7 +920,7 @@ R_RasterizeAliasPolySmooth(const entity_t *currententity) if ((triangle_spans + initialrightheight + height) >= triangles_max) { // we dont have enough triangles for save full height - r_outoftriangles++; + r_outoftriangles = true; return; } triangle_spans[initialrightheight + height].count = INT_MIN; // mark end of the spanpackages diff --git a/src/client/refresh/soft/sw_rast.c b/src/client/refresh/soft/sw_rast.c index 9cd8e36e..5c0a123f 100644 --- a/src/client/refresh/soft/sw_rast.c +++ b/src/client/refresh/soft/sw_rast.c @@ -548,14 +548,14 @@ R_RenderFace (entity_t *currententity, const model_t *currentmodel, msurface_t * // skip out if no more surfs if ((surface_p) >= surf_max) { - r_outofsurfaces++; + r_outofsurfaces = true; return; } // ditto if not enough edges left, or switch to auxedges if possible if ((edge_p + fa->numedges + 4) >= edge_max) { - r_outofedges += fa->numedges; + r_outofedges = true; return; } @@ -755,14 +755,14 @@ R_RenderBmodelFace(entity_t *currententity, bedge_t *pedges, msurface_t *psurf) // skip out if no more surfs if (surface_p >= surf_max) { - r_outofsurfaces++; + r_outofsurfaces = true; return; } // ditto if not enough edges left, or switch to auxedges if possible if ((edge_p + psurf->numedges + 4) >= edge_max) { - r_outofedges += psurf->numedges; + r_outofedges = true; return; }