Commit eb3aacca authored by Libretro-Admin's avatar Libretro-Admin
Browse files
parent c344c7e1
...@@ -281,11 +281,7 @@ R_NewMap(void) ...@@ -281,11 +281,7 @@ R_NewMap(void)
r_viewleaf = NULL; r_viewleaf = NULL;
R_ClearParticles(); R_ClearParticles();
r_cnumsurfs = r_maxsurfs.value; r_cnumsurfs = qclamp((int)r_maxsurfs.value, MINSURFACES, MAXSURFACES);
if (r_cnumsurfs <= MINSURFACES)
r_cnumsurfs = MINSURFACES;
if (r_cnumsurfs > NUMSTACKSURFACES) { if (r_cnumsurfs > NUMSTACKSURFACES) {
surfaces = (surf_t*)Hunk_AllocName(r_cnumsurfs * sizeof(surf_t), "surfaces"); surfaces = (surf_t*)Hunk_AllocName(r_cnumsurfs * sizeof(surf_t), "surfaces");
surface_p = surfaces; surface_p = surfaces;
...@@ -301,11 +297,7 @@ R_NewMap(void) ...@@ -301,11 +297,7 @@ R_NewMap(void)
r_maxedgesseen = 0; r_maxedgesseen = 0;
r_maxsurfsseen = 0; r_maxsurfsseen = 0;
r_numallocatededges = r_maxedges.value; r_numallocatededges = qclamp((int)r_maxedges.value, MINEDGES, MAXEDGES);
if (r_numallocatededges < MINEDGES)
r_numallocatededges = MINEDGES;
if (r_numallocatededges <= NUMSTACKEDGES) { if (r_numallocatededges <= NUMSTACKEDGES) {
auxedges = NULL; auxedges = NULL;
} else { } else {
......
...@@ -62,11 +62,19 @@ extern vec3_t vup, base_vup; ...@@ -62,11 +62,19 @@ extern vec3_t vup, base_vup;
extern vec3_t vpn, base_vpn; extern vec3_t vpn, base_vpn;
extern vec3_t vright, base_vright; extern vec3_t vright, base_vright;
// FIXME - reasoning behind number choice? /*
#define NUMSTACKEDGES 3000 * Min edges/surfaces are just a reasonable number to play the
#define MINEDGES NUMSTACKEDGES * original id/hipnotic/rouge maps. Surfaces we want to reference
#define NUMSTACKSURFACES 1500 * using shorts to pack the edge_t struct into cache lines, so the
* upper limit on those is 16 bits. Edges is just 32 bit limited, but
* no need for quite that many if we don't have the surfs...
*/
#define NUMSTACKEDGES 2400
#define NUMSTACKSURFACES 800
#define MINSURFACES NUMSTACKSURFACES #define MINSURFACES NUMSTACKSURFACES
#define MINEDGES NUMSTACKEDGES
#define MAXSURFACES 0xffff
#define MAXEDGES (MAXSURFACES << 2)
#define MAXSPANS 3000 #define MAXSPANS 3000
// !!! if this is changed, it must be changed in asm_draw.h too !!! // !!! if this is changed, it must be changed in asm_draw.h too !!!
...@@ -141,7 +149,7 @@ typedef struct edge_s { ...@@ -141,7 +149,7 @@ typedef struct edge_s {
fixed16_t u; fixed16_t u;
fixed16_t u_step; fixed16_t u_step;
struct edge_s *prev, *next; struct edge_s *prev, *next;
unsigned int surfs[2]; uint16_t surfs[2];
struct edge_s *nextremove; struct edge_s *nextremove;
float nearzi; float nearzi;
medge_t *owner; medge_t *owner;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment