-#define BUILDNUMBER 710
+#define BUILDNUMBER 716
int buildnumber = BUILDNUMBER;
cl_currentdecal = 0;
// FIXME: r_refdef stuff should be allocated somewhere else?
- r_refdef.decals = cl_renderdecals = Mem_Alloc(cl_decal_mempool, MAX_DECALS * sizeof(renderdecal_t));
+ r_refdef.decals = cl_renderdecals = Mem_Alloc(cl_refdef_mempool, MAX_DECALS * sizeof(renderdecal_t));
}
cvar_t cl_draweffects = {0, "cl_draweffects", "1"};
mempool_t *cl_scores_mempool;
+mempool_t *cl_refdef_mempool;
client_static_t cls;
client_state_t cl;
entity_t cl_static_entities[MAX_STATIC_ENTITIES];
lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
-int cl_numvisedicts;
-entity_t *cl_visedicts[MAX_VISEDICTS];
-
typedef struct effect_s
{
int active;
static void CL_RelinkStaticEntities(void)
{
int i;
- for (i = 0;i < cl.num_statics && cl_numvisedicts < MAX_VISEDICTS;i++)
+ for (i = 0;i < cl.num_statics && r_refdef.numentities < MAX_VISEDICTS;i++)
{
Mod_CheckLoaded(cl_static_entities[i].render.model);
- cl_visedicts[cl_numvisedicts++] = &cl_static_entities[i];
+ r_refdef.entities[r_refdef.numentities++] = &cl_static_entities[i].render;
}
}
continue;
if (effects & EF_NODRAW)
continue;
- if (cl_numvisedicts < MAX_VISEDICTS)
- cl_visedicts[cl_numvisedicts++] = ent;
+ if (r_refdef.numentities < MAX_VISEDICTS)
+ r_refdef.entities[r_refdef.numentities++] = &ent->render;
}
}
void CL_RelinkEntities (void)
{
- cl_numvisedicts = 0;
+ r_refdef.numentities = 0;
CL_LerpPlayerVelocity();
CL_RelinkNetworkEntities();
*/
void CL_Init (void)
{
+ cl_scores_mempool = Mem_AllocPool("client player info");
+
+ cl_refdef_mempool = Mem_AllocPool("refdef");
+ memset(&r_refdef, 0, sizeof(r_refdef));
+ r_refdef.entities = Mem_Alloc(cl_refdef_mempool, sizeof(entity_render_t *) * MAX_VISEDICTS);
+
SZ_Alloc (&cls.message, 1024, "cls.message");
CL_InitInput ();
if (gamemode == GAME_NEHAHRA)
Cmd_AddCommand ("pmodel", CL_PModel_f);
- cl_scores_mempool = Mem_AllocPool("client player info");
-
Cvar_RegisterVariable(&cl_draweffects);
CL_Parse_Init();
cl_numparticles = 0;
// FIXME: r_refdef stuff should be allocated somewhere else?
- r_refdef.particles = cl_renderparticles = Mem_Alloc(cl_part_mempool, cl_maxparticles * sizeof(renderparticle_t));
+ r_refdef.particles = cl_renderparticles = Mem_Alloc(cl_refdef_mempool, cl_maxparticles * sizeof(renderparticle_t));
}
#define particle(ptype, porientation, pcolor, ptex, plight, pscalex, pscaley, palpha, ptime, pbounce, px, py, pz, pvx, pvy, pvz, ptime2, pvx2, pvy2, pvz2, pfriction, ppressure)\
{
entity_t *ent;
- if (cl_numvisedicts >= MAX_VISEDICTS)
+ if (r_refdef.numentities >= MAX_VISEDICTS)
return NULL;
if (num_temp_entities >= MAX_TEMP_ENTITIES)
return NULL;
ent = &cl_temp_entities[num_temp_entities++];
memset (ent, 0, sizeof(*ent));
- cl_visedicts[cl_numvisedicts++] = ent;
+ r_refdef.entities[r_refdef.numentities++] = &ent->render;
ent->render.colormap = -1; // no special coloring
ent->render.scale = 1;
void CL_Disconnect (void);
void CL_Disconnect_f (void);
-// LordHavoc: fixme: move this to r_refdef?
-// LordHavoc: raised this from 256 to the maximum possible number of entities visible
-#define MAX_VISEDICTS (MAX_EDICTS + MAX_STATIC_ENTITIES + MAX_TEMP_ENTITIES)
-extern int cl_numvisedicts;
-extern entity_t *cl_visedicts[MAX_VISEDICTS];
-
//
// cl_input
//
extern int traceline_endcontents; // set by TraceLine
float TraceLine (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal, int contents);
+#define MAX_VISEDICTS (MAX_EDICTS + MAX_STATIC_ENTITIES + MAX_TEMP_ENTITIES)
+
+typedef struct
+{
+ // area to render in
+ int x, y, width, height;
+ float fov_x, fov_y;
+
+ // view point
+ vec3_t vieworg;
+ vec3_t viewangles;
+
+ int numdecals;
+ renderdecal_t *decals;
+
+ int numentities;
+ entity_render_t **entities;
+
+ int numparticles;
+ struct renderparticle_s *particles;
+}
+refdef_t;
+
+refdef_t r_refdef;
+
+extern mempool_t *cl_refdef_mempool;
if (!r_drawentities.integer)
return;
- for (i = 0;i < cl_numvisedicts;i++)
+ for (i = 0;i < r_refdef.numentities;i++)
{
- currentrenderentity = &cl_visedicts[i]->render;
+ currentrenderentity = r_refdef.entities[i];
Mod_CheckLoaded(currentrenderentity->model);
// move view-relative models to where they should be
if (!r_drawentities.integer)
return false;
- for (i = 0;i < cl_numvisedicts;i++)
+ for (i = 0;i < r_refdef.numentities;i++)
{
- currentrenderentity = &cl_visedicts[i]->render;
+ currentrenderentity = r_refdef.entities[i];
if (currentrenderentity->visframe == r_framecount && currentrenderentity->model->DrawSky)
{
currentrenderentity->model->DrawSky();
if (!r_drawentities.integer)
return;
- for (i = 0;i < cl_numvisedicts;i++)
+ for (i = 0;i < r_refdef.numentities;i++)
{
- currentrenderentity = &cl_visedicts[i]->render;
+ currentrenderentity = r_refdef.entities[i];
if (currentrenderentity->visframe == r_framecount && currentrenderentity->model->Draw)
currentrenderentity->model->Draw();
}
//=============================================================================
-typedef struct
-{
- // area to render in
- int x, y, width, height;
- float fov_x, fov_y;
-
- // view point
- vec3_t vieworg;
- vec3_t viewangles;
-
- int numdecals;
- renderdecal_t *decals;
-
- // LordHavoc: this will be enabled at some point, taking the place of cl_visedicts
- int numentities;
- entity_render_t *entities;
-
- int numparticles;
- struct renderparticle_s *particles;
-}
-refdef_t;
-
//extern qboolean r_cache_thrash; // compatability
extern entity_render_t *currentrenderentity;
extern int r_framecount;
extern vec3_t vright;
extern vec3_t r_origin;
-//
-// screen size info
-//
-extern refdef_t r_refdef;
-
-
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
extern unsigned short d_lightstylevalue[256]; // 8.8 fraction of base light value