CL_ParseStatic: move static entities to the hunk and remove MAX_STATIC_ENTITIES

tutorial from MH: http://forums.insideqc.com/viewtopic.php?t=1928
This commit is contained in:
Eric Wasylishen 2017-03-31 12:52:33 -06:00
parent df624cbbb8
commit ee81dd1741
3 changed files with 4 additions and 10 deletions

View file

@ -52,7 +52,6 @@ client_static_t cls;
client_state_t cl; client_state_t cl;
// FIXME: put these on hunk? // FIXME: put these on hunk?
efrag_t cl_efrags[MAX_EFRAGS]; efrag_t cl_efrags[MAX_EFRAGS];
entity_t cl_static_entities[MAX_STATIC_ENTITIES];
lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES]; lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
dlight_t cl_dlights[MAX_DLIGHTS]; dlight_t cl_dlights[MAX_DLIGHTS];

View file

@ -874,13 +874,10 @@ CL_ParseStatic
void CL_ParseStatic (int version) //johnfitz -- added a parameter void CL_ParseStatic (int version) //johnfitz -- added a parameter
{ {
entity_t *ent; entity_t *ent;
int i;
i = cl.num_statics; // mh - extended static entities begin
if (i >= MAX_STATIC_ENTITIES) ent = (entity_t *) Hunk_Alloc (sizeof (entity_t));
Host_Error ("Too many static entities"); // mh - extended static entities end
ent = &cl_static_entities[i];
cl.num_statics++; cl.num_statics++;
CL_ParseBaseline (ent, version); //johnfitz -- added second parameter CL_ParseBaseline (ent, version); //johnfitz -- added second parameter
@ -1144,7 +1141,7 @@ void CL_ParseServerMessage (void)
if (i == 2) if (i == 2)
{ {
if (cl.num_statics > 128) if (cl.num_statics > 128)
Con_DWarning ("%i static entities exceeds standard limit of 128 (max = %d).\n", cl.num_statics, MAX_STATIC_ENTITIES); Con_DWarning ("%i static entities exceeds standard limit of 128.\n", cl.num_statics);
R_CheckEfrags (); R_CheckEfrags ();
} }
//johnfitz //johnfitz

View file

@ -265,14 +265,12 @@ extern cvar_t m_side;
#define MAX_TEMP_ENTITIES 256 //johnfitz -- was 64 #define MAX_TEMP_ENTITIES 256 //johnfitz -- was 64
#define MAX_STATIC_ENTITIES 4096 //ericw -- was 512 //johnfitz -- was 128
#define MAX_VISEDICTS 4096 // larger, now we support BSP2 #define MAX_VISEDICTS 4096 // larger, now we support BSP2
extern client_state_t cl; extern client_state_t cl;
// FIXME, allocate dynamically // FIXME, allocate dynamically
extern efrag_t cl_efrags[MAX_EFRAGS]; extern efrag_t cl_efrags[MAX_EFRAGS];
extern entity_t cl_static_entities[MAX_STATIC_ENTITIES];
extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES]; extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
extern dlight_t cl_dlights[MAX_DLIGHTS]; extern dlight_t cl_dlights[MAX_DLIGHTS];
extern entity_t cl_temp_entities[MAX_TEMP_ENTITIES]; extern entity_t cl_temp_entities[MAX_TEMP_ENTITIES];