- cl_max_entities = MAX_EDICTS;
- cl_max_static_entities = 256;
- cl_max_temp_entities = 512;
- cl_max_effects = 256;
- cl_max_beams = 256;
- cl_max_dlights = MAX_DLIGHTS;
- cl_max_lightstyle = MAX_LIGHTSTYLES;
- cl_max_brushmodel_entities = MAX_EDICTS;
-
- cl_entities = Mem_Alloc(cl_entities_mempool, cl_max_entities * sizeof(entity_t));
- cl_entities_active = Mem_Alloc(cl_entities_mempool, cl_max_entities * sizeof(qbyte));
- cl_static_entities = Mem_Alloc(cl_entities_mempool, cl_max_static_entities * sizeof(entity_t));
- cl_temp_entities = Mem_Alloc(cl_entities_mempool, cl_max_temp_entities * sizeof(entity_t));
- cl_effects = Mem_Alloc(cl_entities_mempool, cl_max_effects * sizeof(cl_effect_t));
- cl_beams = Mem_Alloc(cl_entities_mempool, cl_max_beams * sizeof(beam_t));
- cl_dlights = Mem_Alloc(cl_entities_mempool, cl_max_dlights * sizeof(dlight_t));
- cl_lightstyle = Mem_Alloc(cl_entities_mempool, cl_max_lightstyle * sizeof(lightstyle_t));
- cl_brushmodel_entities = Mem_Alloc(cl_entities_mempool, cl_max_brushmodel_entities * sizeof(entity_render_t *));
+ cl.max_entities = 256;
+ cl.max_csqcentities = 256; //[515]: csqc
+ cl.max_static_entities = 256;
+ cl.max_temp_entities = 512;
+ cl.max_effects = 256;
+ cl.max_beams = 256;
+ cl.max_dlights = MAX_DLIGHTS;
+ cl.max_lightstyle = MAX_LIGHTSTYLES;
+ cl.max_brushmodel_entities = MAX_EDICTS;
+ cl.max_particles = MAX_PARTICLES;
+
+// COMMANDLINEOPTION: Client: -particles <number> changes maximum number of particles at once, default 32768
+ i = COM_CheckParm ("-particles");
+ if (i && i < com_argc - 1)
+ {
+ cl.max_particles = (int)(atoi(com_argv[i+1]));
+ if (cl.max_particles < ABSOLUTE_MIN_PARTICLES)
+ cl.max_particles = ABSOLUTE_MIN_PARTICLES;
+ }
+
+ cl.num_dlights = 0;
+ cl.num_effects = 0;
+ cl.num_beams = 0;
+
+ cl.entities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_entities * sizeof(entity_t));
+ cl.csqcentities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t)); //[515]: csqc
+ cl.entities_active = (unsigned char *)Mem_Alloc(cls.levelmempool, cl.max_brushmodel_entities * sizeof(unsigned char));
+ cl.csqcentities_active = (unsigned char *)Mem_Alloc(cls.levelmempool, cl.max_brushmodel_entities * sizeof(unsigned char)); //[515]: csqc
+ cl.static_entities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_static_entities * sizeof(entity_t));
+ cl.temp_entities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_temp_entities * sizeof(entity_t));
+ cl.effects = (cl_effect_t *)Mem_Alloc(cls.levelmempool, cl.max_effects * sizeof(cl_effect_t));
+ cl.beams = (beam_t *)Mem_Alloc(cls.levelmempool, cl.max_beams * sizeof(beam_t));
+ cl.dlights = (dlight_t *)Mem_Alloc(cls.levelmempool, cl.max_dlights * sizeof(dlight_t));
+ cl.lightstyle = (lightstyle_t *)Mem_Alloc(cls.levelmempool, cl.max_lightstyle * sizeof(lightstyle_t));
+ cl.brushmodel_entities = (int *)Mem_Alloc(cls.levelmempool, cl.max_brushmodel_entities * sizeof(int));
+ cl.particles = (particle_t *) Mem_Alloc(cls.levelmempool, cl.max_particles * sizeof(particle_t));
+
+ // LordHavoc: have to set up the baseline info for alpha and other stuff
+ for (i = 0;i < cl.max_entities;i++)
+ {
+ cl.entities[i].state_baseline = defaultstate;
+ cl.entities[i].state_previous = defaultstate;
+ cl.entities[i].state_current = defaultstate;
+ }
+
+ for (i = 0;i < cl.max_csqcentities;i++)
+ {
+ cl.csqcentities[i].state_baseline = defaultstate; //[515]: csqc
+ cl.csqcentities[i].state_previous = defaultstate; //[515]: csqc
+ cl.csqcentities[i].state_current = defaultstate; //[515]: csqc
+ cl.csqcentities[i].csqc = true;
+ cl.csqcentities[i].state_current.number = -i;
+ }
+
+ if (gamemode == GAME_NEXUIZ)
+ {
+ VectorSet(cl.playerstandmins, -16, -16, -24);
+ VectorSet(cl.playerstandmaxs, 16, 16, 45);
+ VectorSet(cl.playercrouchmins, -16, -16, -24);
+ VectorSet(cl.playercrouchmaxs, 16, 16, 25);
+ }
+ else
+ {
+ VectorSet(cl.playerstandmins, -16, -16, -24);
+ VectorSet(cl.playerstandmaxs, 16, 16, 24);
+ VectorSet(cl.playercrouchmins, -16, -16, -24);
+ VectorSet(cl.playercrouchmaxs, 16, 16, 24);
+ }
+
+ // disable until we get textures for it
+ R_ResetSkyBox();
+
+ ent = &cl.entities[0];
+ // entire entity array was cleared, so just fill in a few fields
+ ent->state_current.active = true;
+ ent->render.model = cl.worldmodel = NULL; // no world model yet
+ ent->render.scale = 1; // some of the renderer still relies on scale
+ ent->render.alpha = 1;
+ ent->render.colormap = -1; // no special coloring
+ ent->render.flags = RENDER_SHADOW | RENDER_LIGHT;
+ Matrix4x4_CreateFromQuakeEntity(&ent->render.matrix, 0, 0, 0, 0, 0, 0, 1);
+ Matrix4x4_Invert_Simple(&ent->render.inversematrix, &ent->render.matrix);
+ CL_BoundingBoxForEntity(&ent->render);
+
+ // noclip is turned off at start
+ noclip_anglehack = false;
+
+ // mark all frames invalid for delta
+ memset(cl.qw_deltasequence, -1, sizeof(cl.qw_deltasequence));