dynamically allocate static entities
parent
276eae53c6
commit
796107d4cc
|
@ -48,27 +48,30 @@ cvar_t m_side = {"m_side", "0.8", CVAR_ARCHIVE};
|
|||
cvar_t cl_maxpitch = {"cl_maxpitch", "90", CVAR_ARCHIVE}; //johnfitz -- variable pitch clamping
|
||||
cvar_t cl_minpitch = {"cl_minpitch", "-90", CVAR_ARCHIVE}; //johnfitz -- variable pitch clamping
|
||||
|
||||
cvar_t cl_maxdlights = {"cl_maxdlights", "128", CVAR_ARCHIVE};
|
||||
cvar_t cl_maxtempents = {"cl_maxtempents", "256", CVAR_ARCHIVE};
|
||||
cvar_t cl_maxbeams = {"cl_maxbeams", "32", CVAR_ARCHIVE};
|
||||
cvar_t cl_maxvisedicts = {"cl_maxvisedicts", "4096", CVAR_ARCHIVE};
|
||||
cvar_t cl_maxdlights = {"cl_maxdlights", "128", CVAR_ARCHIVE};
|
||||
cvar_t cl_maxtempents = {"cl_maxtempents", "256", CVAR_ARCHIVE};
|
||||
cvar_t cl_maxbeams = {"cl_maxbeams", "32", CVAR_ARCHIVE};
|
||||
cvar_t cl_maxvisedicts = {"cl_maxvisedicts", "4096", CVAR_ARCHIVE};
|
||||
cvar_t cl_maxstaticents = {"cl_maxstaticents", "4096", CVAR_ARCHIVE};
|
||||
|
||||
client_static_t cls;
|
||||
client_state_t cl;
|
||||
// FIXME: put these on hunk?
|
||||
entity_t cl_static_entities[MAX_STATIC_ENTITIES];
|
||||
|
||||
lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
|
||||
|
||||
entity_t *cl_entities; //johnfitz -- was a static array, now on hunk
|
||||
int32_t cl_max_edicts; //johnfitz -- only changes when new map loads
|
||||
|
||||
dlight_t *cl_dlights;
|
||||
int32_t cl_max_dlights; //johnfitz -- only changes when new map loads
|
||||
int32_t cl_max_dlights;
|
||||
|
||||
entity_t **cl_visedicts;
|
||||
int32_t cl_numvisedicts;
|
||||
int32_t max_visedicts;
|
||||
|
||||
entity_t *cl_static_entities;
|
||||
int32_t max_static_entities;
|
||||
|
||||
extern cvar_t r_lerpmodels, r_lerpmove; //johnfitz
|
||||
|
||||
/*
|
||||
|
@ -106,6 +109,9 @@ void CL_ClearState(void)
|
|||
|
||||
max_visedicts = CLAMP(0, (int32_t)cl_maxvisedicts.value, 32000);
|
||||
cl_visedicts = Hunk_AllocName(max_visedicts * sizeof(*cl_visedicts), "cl_visedicts");
|
||||
|
||||
max_static_entities = CLAMP(0, (int32_t)cl_maxstaticents.value, 16384);
|
||||
cl_static_entities = Hunk_AllocName(max_static_entities * sizeof(*cl_static_entities), "cl_static_entities");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -827,6 +833,7 @@ void CL_Init(void)
|
|||
Cvar_RegisterVariable(&cl_maxtempents);
|
||||
Cvar_RegisterVariable(&cl_maxbeams);
|
||||
Cvar_RegisterVariable(&cl_maxvisedicts);
|
||||
Cvar_RegisterVariable(&cl_maxstaticents);
|
||||
|
||||
Cmd_AddCommand("entities", CL_PrintEntities_f);
|
||||
Cmd_AddCommand("disconnect", CL_Disconnect_f);
|
||||
|
|
|
@ -882,7 +882,7 @@ void CL_ParseStatic(int32_t version) //johnfitz -- added a parameter
|
|||
int32_t i;
|
||||
|
||||
i = cl.num_statics;
|
||||
if(i >= MAX_STATIC_ENTITIES)
|
||||
if(i >= max_static_entities)
|
||||
Host_Error("Too many static entities");
|
||||
|
||||
ent = &cl_static_entities[i];
|
||||
|
@ -1143,7 +1143,7 @@ void CL_ParseServerMessage(void)
|
|||
if(i == 2)
|
||||
{
|
||||
if(cl.num_statics > 128)
|
||||
Con_DWarning("%" PRIi32 " static entities exceeds standard limit of 128 (max = %" PRIi32 ").\n", cl.num_statics, MAX_STATIC_ENTITIES);
|
||||
Con_DWarning("%" PRIi32 " static entities exceeds standard limit of 128 (max = %" PRIi32 ").\n", cl.num_statics, max_static_entities);
|
||||
R_CheckEfrags();
|
||||
}
|
||||
//johnfitz
|
||||
|
|
|
@ -266,12 +266,8 @@ extern cvar_t m_forward;
|
|||
extern cvar_t m_side;
|
||||
|
||||
|
||||
#define MAX_STATIC_ENTITIES 4096 //ericw -- was 512 //johnfitz -- was 128
|
||||
|
||||
extern client_state_t cl;
|
||||
|
||||
// FIXME, allocate dynamically
|
||||
extern entity_t cl_static_entities[MAX_STATIC_ENTITIES];
|
||||
extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
|
||||
|
||||
extern entity_t **cl_visedicts;
|
||||
|
@ -283,7 +279,7 @@ extern int32_t max_beams;
|
|||
|
||||
extern entity_t *cl_temp_entities;
|
||||
extern int32_t num_temp_entities; //johnfitz
|
||||
extern int32_t max_temp_entities; //johnfitz
|
||||
extern int32_t max_temp_entities;
|
||||
|
||||
extern entity_t *cl_entities; //johnfitz -- was a static array, now on hunk
|
||||
extern int32_t cl_max_edicts; //johnfitz -- only changes when new map loads
|
||||
|
@ -291,6 +287,9 @@ extern int32_t cl_max_edicts; //johnfitz -- only changes when new map loads
|
|||
extern dlight_t *cl_dlights;
|
||||
extern int32_t cl_max_dlights;
|
||||
|
||||
extern entity_t *cl_static_entities;
|
||||
extern int32_t max_static_entities;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue