limit surfaces amount to unsigned short

This commit is contained in:
Denis Pauk 2019-05-15 22:34:53 +03:00
parent a4c958ac96
commit 5f2293bf0d
5 changed files with 24 additions and 23 deletions

View file

@ -151,14 +151,8 @@ extern oldrefdef_t r_refdef;
#define TRANSPARENT_COLOR 0xFF
#define TURB_TEX_SIZE 64 // base turbulent texture size
#define CYCLE 128 // turbulent cycle size
#define SCANBUFFERPAD 0x1000
#define DS_SPAN_LIST_END -128
// flags in finalvert_t.flags
#define ALIAS_LEFT_CLIP 0x0001
#define ALIAS_TOP_CLIP 0x0002
@ -175,8 +169,6 @@ extern oldrefdef_t r_refdef;
#define XCENTERING (1.0 / 2.0)
#define YCENTERING (1.0 / 2.0)
#define CLIP_EPSILON 0.001
#define BACKFACE_EPSILON 0.01
#define NEAR_CLIP 0.01
@ -184,9 +176,9 @@ extern oldrefdef_t r_refdef;
#define ALIAS_Z_CLIP_PLANE 4
// turbulence stuff
#define AMP 8*0x10000
#define AMP2 3
#define SPEED 20
#define AMP 8*0x10000
#define AMP2 3
#define SPEED 20
/*
@ -310,19 +302,24 @@ typedef struct surf_s
// -1 = in inverted span (end before
// start)
int flags; // currentface flags
msurface_t *msurf;
msurface_t *msurf;
entity_t *entity;
float nearzi; // nearest 1/z on surface, for mipmapping
qboolean insubmodel;
float d_ziorigin, d_zistepu, d_zistepv;
} surf_t;
typedef unsigned short surfindex_t;
// surface index size
#define SURFINDEX_MAX (1 << (sizeof(surfindex_t) * 8))
typedef struct edge_s
{
shift20_t u;
shift20_t u_step;
struct edge_s *prev, *next;
unsigned short surfs[2];
surfindex_t surfs[2];
struct edge_s *nextremove;
float nearzi;
medge_t *owner;

View file

@ -46,11 +46,6 @@ typedef struct
vec3_t position;
} mvertex_t;
#define SIDE_FRONT 0
#define SIDE_BACK 1
#define SIDE_ON 2
// plane_t structure
typedef struct mplane_s
{
@ -231,9 +226,6 @@ typedef struct model_s
//============================================================================
void Mod_Init(void);
void Mod_ClearAll(void);
void *Mod_Extradata(model_t *mod); // handles caching
void Mod_TouchModel(char *name);
mleaf_t *Mod_PointInLeaf(float *p, model_t *model);
byte *Mod_ClusterPVS(int cluster, model_t *model);

View file

@ -382,6 +382,14 @@ R_ReallocateMapBuffers (void)
if (r_cnumsurfs < NUMSTACKSURFACES)
r_cnumsurfs = NUMSTACKSURFACES;
// edge_t->surf limited size to short
if (r_cnumsurfs > SURFINDEX_MAX)
{
r_cnumsurfs = SURFINDEX_MAX;
R_Printf(PRINT_ALL, "%s: Code has limitation to surfaces count.\n",
__func__);
}
lsurfs = malloc (r_cnumsurfs * sizeof(surf_t));
if (!lsurfs)
{

View file

@ -1226,6 +1226,8 @@ SPRITE MODELS
/*
=================
Mod_LoadSpriteModel
support for .sp2 sprites
=================
*/
static void

View file

@ -749,7 +749,7 @@ R_PolygonDrawSpans(espan_t *pspan, int iswater )
pspan++;
} while (pspan->count != DS_SPAN_LIST_END);
} while (pspan->count != INT_MIN);
}
/*
@ -818,6 +818,8 @@ R_PolygonScanLeftEdge (espan_t *s_polygon_spans)
i = r_polydesc.nump;
} while (i != lmaxindex);
pspan->count = INT_MIN; // mark the end of the span list
}
/*
@ -903,7 +905,7 @@ R_PolygonScanRightEdge(espan_t *s_polygon_spans)
} while (i != s_maxindex);
pspan->count = DS_SPAN_LIST_END; // mark the end of the span list
pspan->count = INT_MIN; // mark the end of the span list
}
/*