return cliptrace;
}
-float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent, entity_render_t *ignoreent, qboolean csqcents)
+float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent, entity_render_t *ignoreent)
{
float maxfrac, maxrealfrac;
int n;
tracemins[2] = min(start[2], end[2]);
tracemaxs[2] = max(start[2], end[2]);
- if (csqcents)
- {
- Con_Printf("CL_SelectTraceline: csqc entity collisions in this function are broken and this function will be removed in the future (it is not part of the csqc spec).\n");
- return maxfrac;
- }
-
// look for embedded bmodels
for (n = 0;n < cl.num_entities;n++)
{
#define CL_COLLISION_H
trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int hitbmodels, int *hitent, int hitsupercontentsmask, qboolean hitplayers);
-float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent, entity_render_t *ignoreent, qboolean csqcents);
+float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent, entity_render_t *ignoreent);
void CL_FindNonSolidLocation(const vec3_t in, vec3_t out, vec_t radius);
int CL_PointSuperContents(const vec3_t p);
VectorSet(temp, cl.cmd.cursor_screen[2] * 1000000, cl.cmd.cursor_screen[0] * -r_view.frustum_x * 1000000, cl.cmd.cursor_screen[1] * -r_view.frustum_y * 1000000);
Matrix4x4_Transform(&r_view.matrix, temp, cl.cmd.cursor_end);
// trace from view origin to the cursor
- cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber, (chase_active.integer || cl.intermission) ? &cl.entities[cl.playerentity].render : NULL, false);
+ cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber, (chase_active.integer || cl.intermission) ? &cl.entities[cl.playerentity].render : NULL);
}
void CL_ClientMovement_InputQW(qw_usercmd_t *cmd)
cl.mviewzoom[0] = cl.mviewzoom[1] = 1;
cl.num_entities = 0;
- cl.num_csqcentities = 0; //[515]: csqc
cl.num_static_entities = 0;
cl.num_temp_entities = 0;
cl.num_brushmodel_entities = 0;
// tweak these if the game runs out
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.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.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].state_current.number = -i;
- }
-
if (gamemode == GAME_NEXUIZ)
{
VectorSet(cl.playerstandmins, -16, -16, -24);
}
}
-void CL_ExpandCSQCEntities(int num)
-{
- int i, oldmaxentities;
- entity_t *oldentities;
- if (num >= cl.max_csqcentities)
- {
- if (!cl.csqcentities)
- Sys_Error("CL_ExpandCSQCEntities: cl.csqcentities not initialized\n");
- if (num >= MAX_EDICTS)
- Host_Error("CL_ExpandCSQCEntities: num %i >= %i\n", num, MAX_EDICTS);
- oldmaxentities = cl.max_csqcentities;
- oldentities = cl.csqcentities;
- cl.max_csqcentities = (num & ~255) + 256;
- cl.csqcentities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t));
- memcpy(cl.csqcentities, oldentities, oldmaxentities * sizeof(entity_t));
- Mem_Free(oldentities);
- for (i = oldmaxentities;i < cl.max_csqcentities;i++)
- {
- cl.csqcentities[i].state_baseline = defaultstate;
- cl.csqcentities[i].state_previous = defaultstate;
- cl.csqcentities[i].state_current = defaultstate;
- cl.csqcentities[i].state_current.number = -i;
- }
- }
-}
-
void CL_VM_ShutDown (void);
/*
=====================
vec3_t playercrouchmaxs;
int max_entities;
- int max_csqcentities;
int max_static_entities;
int max_temp_entities;
int max_effects;
int max_particles;
entity_t *entities;
- entity_t *csqcentities; //[515]: csqc
unsigned char *entities_active;
- unsigned char *csqcentities_active; //[515]: csqc
entity_t *static_entities;
entity_t *temp_entities;
cl_effect_t *effects;
particle_t *particles;
int num_entities;
- int num_csqcentities; //[515]: csqc
int num_static_entities;
int num_temp_entities;
int num_brushmodel_entities;
int Sbar_GetPlayer (int index);
void Sbar_SortFrags (void);
void CL_FindNonSolidLocation(const vec3_t in, vec3_t out, vec_t radius);
-void CL_ExpandCSQCEntities(int num);
void CSQC_RelinkAllEntities (int drawmask);
void CSQC_RelinkCSQCEntities (void);
char *Key_GetBind (int key);
//============================================================================
//[515]: SCENE MANAGER builtins
extern qboolean CSQC_AddRenderEdict (prvm_edict_t *ed);//csprogs.c
-extern void CSQC_ClearCSQCEntities (void);//csprogs.c
matrix4x4_t csqc_listenermatrix;
qboolean csqc_usecsqclistener = false;//[515]: per-frame
{
VM_SAFEPARMCOUNT(0, VM_R_ClearScene);
r_refdef.numentities = 0;
-// CSQC_R_RecalcView();
- CSQC_ClearCSQCEntities();
}
//#301 void(float mask) addentities (EXT_CSQC)
// #336 void(entity ent, float effectnum, vector start, vector end[, float color]) trailparticles (EXT_CSQC)
void VM_CL_trailparticles (void)
{
- int i, entnum;
+ int i;
float *start, *end;
prvm_edict_t *t;
VM_SAFEPARMCOUNT(4, VM_CL_trailparticles);
t = PRVM_G_EDICT(OFS_PARM0);
- entnum = PRVM_NUM_FOR_EDICT(t);
i = (int)PRVM_G_FLOAT(OFS_PARM1);
start = PRVM_G_VECTOR(OFS_PARM2);
end = PRVM_G_VECTOR(OFS_PARM3);
- if (entnum >= MAX_EDICTS)
- {
- VM_Warning("CSQC_ParseBeam: invalid entity number %i\n", entnum);
- return;
- }
- if (entnum >= cl.max_csqcentities)
- CL_ExpandCSQCEntities(entnum);
-
CL_ParticleEffect(i, VectorDistance(start, end), start, end, t->fields.client->velocity, t->fields.client->velocity, NULL, (int)PRVM_G_FLOAT(OFS_PARM4));
}
csqcents = (int)PRVM_G_FLOAT(OFS_PARM3);
ent = 0;
- if((csqcents && ignore > cl.num_csqcentities) || (!csqcents && ignore > cl.num_entities))
+ if (csqcents)
{
- VM_Warning("VM_CL_selecttraceline: out of entities\n");
+ VM_Warning("VM_CL_selecttraceline: csqcents flag not supported anymore, and this function is deprecated\n");
return;
}
- else
- if(csqcents)
- prog->globals.client->trace_fraction = CL_SelectTraceLine(v1, v2, prog->globals.client->trace_endpos, prog->globals.client->trace_plane_normal, &prog->globals.client->trace_ent, &cl.csqcentities[ignore].render, csqcents);
- else
- prog->globals.client->trace_fraction = CL_SelectTraceLine(v1, v2, prog->globals.client->trace_endpos, prog->globals.client->trace_plane_normal, &ent, &cl.entities[ignore].render, csqcents);
+ prog->globals.client->trace_fraction = CL_SelectTraceLine(v1, v2, prog->globals.client->trace_endpos, prog->globals.client->trace_plane_normal, &ent, &cl.entities[ignore].render);
PRVM_G_FLOAT(OFS_RETURN) = ent;
}
return true;
}
-void CSQC_ClearCSQCEntities (void)
-{
- memset(cl.csqcentities_active, 0, sizeof(cl.csqcentities_active));
- cl.num_csqcentities = 0;
-}
-
-void CL_ExpandCSQCEntities (int num);
-
qboolean CL_VM_InputEvent (qboolean pressed, int key)
{
qboolean r;
//VectorCopy(cl.viewangles, oldangles);
*prog->time = cl.time;
CSQC_SetGlobals();
- cl.num_csqcentities = 0;
+ r_refdef.numentities = 0;
PRVM_ExecuteProgram (prog->globals.client->CSQC_UpdateView, CL_F_UPDATEVIEW);
//VectorCopy(oldangles, cl.viewangles);
CSQC_END
fs_offset_t csprogsdatasize;
int csprogsdatacrc, requiredcrc;
int requiredsize;
- entity_t *ent;
// reset csqc_progcrc after reading it, so that changing servers doesn't
// expect csqc on the next server
cl.csqc_vidvars.drawcrosshair = false;
cl.csqc_vidvars.drawenginesbar = false;
-
- // local state
- ent = &cl.csqcentities[0];
- // entire entity array was cleared, so just fill in a few fields
- ent->state_current.active = true;
- ent->render.model = cl.worldmodel = cl.model_precache[1];
- ent->render.alpha = 1;
- ent->render.flags = RENDER_SHADOW | RENDER_LIGHT;
- Matrix4x4_CreateFromQuakeEntity(&ent->render.matrix, 0, 0, 0, 0, 0, 0, 1);
- CL_UpdateRenderEntity(&ent->render);
}
void CL_VM_ShutDown (void)