#include "cl_collision.h"
#include "snd_main.h"
#include "clvm_cmds.h"
+#include "prvm_cmds.h"
//============================================================================
// Client prog handling
#define CSQC_RETURNVAL prog->globals.generic[OFS_RETURN]
#define CSQC_BEGIN csqc_tmpprog=prog;prog=0;PRVM_SetProg(PRVM_CLIENTPROG);
-#define CSQC_END VM_ClearTraceGlobals(); prog=csqc_tmpprog;
-// TODO check if the clearing of trace globals takes too much CPU. If it does,
-// perform it before console command processing instead.
+#define CSQC_END prog=csqc_tmpprog;
static prvm_prog_t *csqc_tmpprog;
+void CL_VM_PreventInformationLeaks(void)
+{
+ prvm_eval_t *val;
+ if(!cl.csqc_loaded)
+ return;
+ CSQC_BEGIN
+ VM_ClearTraceGlobals();
+ if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.trace_networkentity)))
+ val->_float = 0;
+ CSQC_END
+}
+
//[515]: these are required funcs
static char *cl_required_func[] =
{
if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.alpha)) && val->_float) entrender->alpha = val->_float;
if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.scale)) && val->_float) entrender->scale = scale = val->_float;
if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.colormod)) && VectorLength2(val->vector)) VectorCopy(val->vector, entrender->colormod);
+ if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.glowmod)) && VectorLength2(val->vector)) VectorCopy(val->vector, entrender->glowmod);
if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.effects)) && val->_float) entrender->effects |= (int)val->_float;
if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.tag_entity)) && val->edict)
{
}
else
Matrix4x4_CreateIdentity(&tagmatrix);
+ if (!VectorLength2(entrender->colormod))
+ VectorSet(entrender->colormod, 1, 1, 1);
+ if (!VectorLength2(entrender->glowmod))
+ VectorSet(entrender->glowmod, 1, 1, 1);
if (renderflags & RF_USEAXIS)
{
// concat the matrices to make the entity relative to its tag
Matrix4x4_Concat(&entrender->matrix, &tagmatrix, &matrix2);
+ // transparent offset
+ if ((renderflags & RF_USETRANSPARENTOFFSET) && (val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.transparent_offset)))
+ entrender->transparent_offset = val->_float;
+
if(renderflags)
{
if(renderflags & RF_VIEWMODEL) entrender->flags |= RENDER_VIEWMODEL;
if(renderflags & RF_EXTERNALMODEL)entrender->flags |= RENDER_EXTERIORMODEL;
+ if(renderflags & RF_NOCULL) entrender->flags |= RENDER_NOCULL;
if(renderflags & RF_DEPTHHACK) entrender->effects |= EF_NODEPTHTEST;
if(renderflags & RF_ADDITIVE) entrender->effects |= EF_ADDITIVE;
+
}
c = (int)ed->fields.client->colormap;
{
World_UnlinkEdict(ed);
memset(ed->fields.client, 0, sizeof(*ed->fields.client));
+ World_Physics_RemoveFromEntity(&cl.world, ed);
+ World_Physics_RemoveJointFromEntity(&cl.world, ed);
}
void CL_VM_CB_CountEdicts(void)
prog->init_cmd = VM_CL_Cmd_Init;
prog->reset_cmd = VM_CL_Cmd_Reset;
prog->error_cmd = CL_VM_Error;
+ prog->ExecuteProgram = CLVM_ExecuteProgram;
PRVM_LoadProgs(csprogsfn, cl_numrequiredfunc, cl_required_func, 0, NULL, 0, NULL);