int csqc_fieldoff_renderflags;
int csqc_fieldoff_tag_entity;
int csqc_fieldoff_tag_index;
+int csqc_fieldoff_dphitcontentsmask;
qboolean csqc_loaded = false;
-extern entity_t *cl_csqcentities;
-extern unsigned char *cl_csqcentities_active;
-extern int cl_num_csqcentities;
-
vec3_t csqc_origin, csqc_angles;
static double csqc_frametime = 0;
int csqc_buttons;
if(CSQC_Parse_Print)
{
- csqc_printtextbuf = Mem_Alloc(csqc_mempool, CSQC_PRINTBUFFERLEN);
+ csqc_printtextbuf = (char *)Mem_Alloc(csqc_mempool, CSQC_PRINTBUFFERLEN);
csqc_printtextbuf[0] = 0;
}
}
prog->globals.client->input_buttons = csqc_buttons;
VectorSet(prog->globals.client->input_movevalues, cl.cmd.forwardmove, cl.cmd.sidemove, cl.cmd.upmove);
//VectorCopy(cl.movement_origin, csqc_origin);
- VectorCopy(cl_entities[cl.viewentity].render.origin, csqc_origin);
+ VectorCopy(cl.entities[cl.viewentity].render.origin, csqc_origin);
VectorCopy(csqc_origin, prog->globals.client->pmove_org);
prog->globals.client->maxclients = cl.maxclients;
//VectorCopy(cl.movement_velocity, prog->globals.client->pmove_vel);
int i;
prvm_eval_t *val;
- i = ed->fields.client->modelindex;
+ i = (int)ed->fields.client->modelindex;
e->state_current.modelindex = 0;
if(i >= MAX_MODELS || i <= -MAX_MODELS) //[515]: make work as error ?
{
i = 0;
if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_renderflags)) && val->_float)
{
- i = val->_float;
+ i = (int)val->_float;
if(i & RF_VIEWMODEL) e->state_current.flags |= RENDER_VIEWMODEL;
if(i & RF_EXTERNALMODEL)e->state_current.flags |= RENDER_EXTERIORMODEL;
if(i & RF_DEPTHHACK) e->state_current.effects |= EF_NODEPTHTEST;
VectorCopy(ed->fields.client->origin, e->persistent.neworigin);
VectorCopy(ed->fields.client->origin, e->state_current.origin);
- e->state_current.colormap = ed->fields.client->colormap;
- e->state_current.effects = ed->fields.client->effects;
- e->state_current.frame = ed->fields.client->frame;
- e->state_current.skin = ed->fields.client->skin;
-
- if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_alpha)) && val->_float) e->state_current.alpha = val->_float*255;
- if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_scale)) && val->_float) e->state_current.scale = val->_float*16;
- if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_colormod)) && VectorLength2(val->vector)) VectorScale(val->vector, 32, e->state_current.colormod);
- if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_effects)) && val->_float) e->state_current.effects = val->_float;
+ e->state_current.colormap = (int)ed->fields.client->colormap;
+ e->state_current.effects = (int)ed->fields.client->effects;
+ e->state_current.frame = (int)ed->fields.client->frame;
+ e->state_current.skin = (int)ed->fields.client->skin;
+
+ if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_alpha)) && val->_float) e->state_current.alpha = (int)(val->_float*255);
+ if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_scale)) && val->_float) e->state_current.scale = (int)(val->_float*16);
+ if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_colormod)) && VectorLength2(val->vector)) {int j;for (j = 0;j < 3;j++) e->state_current.colormod[j] = (unsigned char)bound(0, val->vector[j] * 32.0f, 255);}
+ if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_effects)) && val->_float) e->state_current.effects = (int)val->_float;
if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_tag_entity)) && val->edict)
{
e->state_current.tagentity = val->edict;
if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_tag_index)) && val->_float)
- e->state_current.tagindex = val->_float;
+ e->state_current.tagindex = (int)val->_float;
}
return true;
void CSQC_ClearCSQCEntities (void)
{
- memset(cl_csqcentities_active, 0, sizeof(cl_csqcentities_active));
- cl_num_csqcentities = 0;
+ memset(cl.csqcentities_active, 0, sizeof(cl.csqcentities_active));
+ cl.num_csqcentities = 0;
csqc_drawmask = 0;
}
*prog->time = cl.time;
for(i=1;i<prog->num_edicts;i++)
{
- if(i >= cl_max_csqcentities)
+ if(i >= cl.max_csqcentities)
CL_ExpandCSQCEntities(i);
- e = &cl_csqcentities[i];
+ e = &cl.csqcentities[i];
ed = &prog->edicts[i];
if(ed->priv.required->free)
{
e->state_current.active = false;
- cl_csqcentities_active[i] = false;
+ cl.csqcentities_active[i] = false;
continue;
}
VectorAdd(ed->fields.client->origin, ed->fields.client->mins, ed->fields.client->absmin);
if(ed->priv.required->free)
{
e->state_current.active = false;
- cl_csqcentities_active[i] = false;
+ cl.csqcentities_active[i] = false;
continue;
}
CSQC_Predraw(ed);
if(ed->priv.required->free)
{
e->state_current.active = false;
- cl_csqcentities_active[i] = false;
+ cl.csqcentities_active[i] = false;
continue;
}
- if(!cl_csqcentities_active[i])
+ if(!cl.csqcentities_active[i])
if(!((int)ed->fields.client->drawmask & csqc_drawmask))
continue;
e->state_previous = e->state_current;
e->state_current = defaultstate;
- if((cl_csqcentities_active[i] = CSQC_EdictToEntity(ed, e)))
+ if((cl.csqcentities_active[i] = CSQC_EdictToEntity(ed, e)))
{
if(!e->state_current.active)
{
e->state_current.active = true;
}
e->persistent.lerpdeltatime = 0;//prog->globals.client->frametime;
- cl_num_csqcentities++;
+ cl.num_csqcentities++;
}
}
}
//[515]: omfg... it's all weird =/
void CSQC_AddEntity (int n)
{
- cl_csqcentities_active[n] = true;
+ cl.csqcentities_active[n] = true;
}
qboolean CL_VM_InputEvent (qboolean pressed, int key)
*prog->time = cl.time;
CSQC_SetGlobals();
csqc_drawmask = 0;
- cl_num_csqcentities = 0;
+ cl.num_csqcentities = 0;
PRVM_ExecuteProgram (prog->globals.client->CSQC_UpdateView, CL_F_UPDATEVIEW);
//VectorCopy(oldangles, cl.viewangles);
CSQC_END
PRVM_End;
csqc_loaded = true;
- csqc_sv2csqcents = Mem_Alloc(csqc_mempool, MAX_EDICTS*sizeof(unsigned short));
+ csqc_sv2csqcents = (unsigned short *)Mem_Alloc(csqc_mempool, MAX_EDICTS*sizeof(unsigned short));
memset(csqc_sv2csqcents, 0, MAX_EDICTS*sizeof(unsigned short));
cl.csqc_vidvars.drawcrosshair = false;
cl.csqc_vidvars.drawenginesbar = false;
// local state
- ent = &cl_csqcentities[0];
+ 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];