mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 22:40:50 +00:00
use only allocated surfaces
This commit is contained in:
parent
a57b1f9be0
commit
d36f19fda5
3 changed files with 8 additions and 32 deletions
|
@ -160,7 +160,6 @@ extern oldrefdef_t r_refdef;
|
||||||
|
|
||||||
#define NUMSTACKEDGES 2000
|
#define NUMSTACKEDGES 2000
|
||||||
#define NUMSTACKSURFACES 1000
|
#define NUMSTACKSURFACES 1000
|
||||||
#define MINSURFACES NUMSTACKSURFACES
|
|
||||||
#define MAXSPANS 3000
|
#define MAXSPANS 3000
|
||||||
|
|
||||||
// flags in finalvert_t.flags
|
// flags in finalvert_t.flags
|
||||||
|
|
|
@ -68,7 +68,6 @@ mvertex_t *r_pcurrentvertbase;
|
||||||
|
|
||||||
int c_surf;
|
int c_surf;
|
||||||
static int r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs;
|
static int r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs;
|
||||||
static qboolean r_surfsonstack;
|
|
||||||
int r_clipflags;
|
int r_clipflags;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -403,10 +402,9 @@ void R_NewMap (void)
|
||||||
|
|
||||||
r_cnumsurfs = sw_maxsurfs->value;
|
r_cnumsurfs = sw_maxsurfs->value;
|
||||||
|
|
||||||
if (r_cnumsurfs <= MINSURFACES)
|
if (r_cnumsurfs <= NUMSTACKSURFACES)
|
||||||
r_cnumsurfs = MINSURFACES;
|
r_cnumsurfs = NUMSTACKSURFACES;
|
||||||
|
|
||||||
if (r_cnumsurfs > NUMSTACKSURFACES)
|
|
||||||
{
|
{
|
||||||
surfaces = malloc (r_cnumsurfs * sizeof(surf_t));
|
surfaces = malloc (r_cnumsurfs * sizeof(surf_t));
|
||||||
if (!surfaces)
|
if (!surfaces)
|
||||||
|
@ -418,15 +416,10 @@ void R_NewMap (void)
|
||||||
|
|
||||||
surface_p = surfaces;
|
surface_p = surfaces;
|
||||||
surf_max = &surfaces[r_cnumsurfs];
|
surf_max = &surfaces[r_cnumsurfs];
|
||||||
r_surfsonstack = false;
|
|
||||||
// surface 0 doesn't really exist; it's just a dummy because index 0
|
// surface 0 doesn't really exist; it's just a dummy because index 0
|
||||||
// is used to indicate no edge attached to surface
|
// is used to indicate no edge attached to surface
|
||||||
surfaces--;
|
surfaces--;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
r_surfsonstack = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
r_maxedgesseen = 0;
|
r_maxedgesseen = 0;
|
||||||
r_maxsurfsseen = 0;
|
r_maxsurfsseen = 0;
|
||||||
|
@ -858,8 +851,6 @@ R_DrawBEntitiesOnList (void)
|
||||||
insubmodel = false;
|
insubmodel = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static surf_t *lsurfs;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
R_EdgeDrawing
|
R_EdgeDrawing
|
||||||
|
@ -873,15 +864,6 @@ R_EdgeDrawing (void)
|
||||||
if ( r_newrefdef.rdflags & RDF_NOWORLDMODEL )
|
if ( r_newrefdef.rdflags & RDF_NOWORLDMODEL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (r_surfsonstack)
|
|
||||||
{
|
|
||||||
surfaces = lsurfs;
|
|
||||||
surf_max = &surfaces[r_cnumsurfs];
|
|
||||||
// surface 0 doesn't really exist; it's just a dummy because index 0
|
|
||||||
// is used to indicate no edge attached to surface
|
|
||||||
surfaces--;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set function pointer pdrawfunc used later in this function
|
// Set function pointer pdrawfunc used later in this function
|
||||||
R_BeginEdgeFrame ();
|
R_BeginEdgeFrame ();
|
||||||
|
|
||||||
|
@ -1075,9 +1057,15 @@ RE_RenderFrame (refdef_t *fd)
|
||||||
|
|
||||||
if (sw_reportsurfout->value && r_outofsurfaces)
|
if (sw_reportsurfout->value && r_outofsurfaces)
|
||||||
R_Printf(PRINT_ALL,"Short %d surfaces\n", r_outofsurfaces);
|
R_Printf(PRINT_ALL,"Short %d surfaces\n", r_outofsurfaces);
|
||||||
|
else if (r_outofsurfaces)
|
||||||
|
R_Printf(PRINT_ALL, "%s: not enough %d surfaces\n",
|
||||||
|
__func__, r_cnumsurfs);
|
||||||
|
|
||||||
if (sw_reportedgeout->value && r_outofedges)
|
if (sw_reportedgeout->value && r_outofedges)
|
||||||
R_Printf(PRINT_ALL,"Short roughly %d edges\n", r_outofedges * 2 / 3);
|
R_Printf(PRINT_ALL,"Short roughly %d edges\n", r_outofedges * 2 / 3);
|
||||||
|
else if (r_outofedges)
|
||||||
|
R_Printf(PRINT_ALL, "%s: not enough %d edges\n",
|
||||||
|
__func__, r_numallocatededges);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1746,12 +1734,6 @@ static void SWimp_DestroyRender(void)
|
||||||
}
|
}
|
||||||
finalverts = NULL;
|
finalverts = NULL;
|
||||||
|
|
||||||
if(lsurfs)
|
|
||||||
{
|
|
||||||
free(lsurfs);
|
|
||||||
}
|
|
||||||
lsurfs = NULL;
|
|
||||||
|
|
||||||
if(r_warpbuffer)
|
if(r_warpbuffer)
|
||||||
{
|
{
|
||||||
free(r_warpbuffer);
|
free(r_warpbuffer);
|
||||||
|
@ -1907,7 +1889,6 @@ SWimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
|
||||||
|
|
||||||
edge_basespans = malloc((vid.width*2) * sizeof(espan_t));
|
edge_basespans = malloc((vid.width*2) * sizeof(espan_t));
|
||||||
finalverts = malloc((MAXALIASVERTS + 3) * sizeof(finalvert_t));
|
finalverts = malloc((MAXALIASVERTS + 3) * sizeof(finalvert_t));
|
||||||
lsurfs = malloc((NUMSTACKSURFACES + 1) * sizeof(surf_t));
|
|
||||||
r_warpbuffer = malloc(vid.height * vid.width * sizeof(pixel_t));
|
r_warpbuffer = malloc(vid.height * vid.width * sizeof(pixel_t));
|
||||||
|
|
||||||
if ((vid.width >= 2048) && (sizeof(shift20_t) == 4)) // 2k+ resolution and 32 == shift20_t
|
if ((vid.width >= 2048) && (sizeof(shift20_t) == 4)) // 2k+ resolution and 32 == shift20_t
|
||||||
|
|
|
@ -546,8 +546,6 @@ void R_RenderFace (msurface_t *fa, int clipflags)
|
||||||
// ditto if not enough edges left, or switch to auxedges if possible
|
// ditto if not enough edges left, or switch to auxedges if possible
|
||||||
if ((edge_p + fa->numedges + 4) >= edge_max)
|
if ((edge_p + fa->numedges + 4) >= edge_max)
|
||||||
{
|
{
|
||||||
R_Printf(PRINT_ALL, "%s: not enough %d edges\n",
|
|
||||||
__func__, r_numallocatededges);
|
|
||||||
r_outofedges += fa->numedges;
|
r_outofedges += fa->numedges;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -754,8 +752,6 @@ void R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf)
|
||||||
// ditto if not enough edges left, or switch to auxedges if possible
|
// ditto if not enough edges left, or switch to auxedges if possible
|
||||||
if ((edge_p + psurf->numedges + 4) >= edge_max)
|
if ((edge_p + psurf->numedges + 4) >= edge_max)
|
||||||
{
|
{
|
||||||
R_Printf(PRINT_ALL, "%s: not enough %d edges\n",
|
|
||||||
__func__, r_numallocatededges);
|
|
||||||
r_outofedges += psurf->numedges;
|
r_outofedges += psurf->numedges;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue