"CSQC_InputEvent",
"CSQC_UpdateView",
"CSQC_ConsoleCommand",
- "CSQC_Shutdown"
};
static int cl_numrequiredfunc = sizeof(cl_required_func) / sizeof(char*);
//[515]: set globals before calling R_UpdateView, WEIRD CRAP
static void CSQC_SetGlobals (void)
{
+ prvm_eval_t *val;
CSQC_BEGIN
prog->globals.client->time = cl.time;
prog->globals.client->frametime = max(0, cl.time - cl.oldtime);
VectorSet(prog->globals.client->input_movevalues, cl.movecmd[0].forwardmove, cl.movecmd[0].sidemove, cl.movecmd[0].upmove);
//VectorCopy(cl.movement_origin, cl.csqc_origin);
Matrix4x4_OriginFromMatrix(&cl.entities[cl.viewentity].render.matrix, cl.csqc_origin);
- VectorCopy(cl.csqc_origin, prog->globals.client->pmove_org);
+ if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.view_angles)))
+ VectorCopy(cl.viewangles, val->vector);
prog->globals.client->maxclients = cl.maxclients;
- //VectorCopy(cl.movement_velocity, prog->globals.client->pmove_vel);
- VectorCopy(cl.velocity, prog->globals.client->pmove_vel);
CSQC_END
}
if(!cl.csqc_loaded)
return false;
CSQC_BEGIN
- prog->globals.client->time = cl.time;
- PRVM_G_FLOAT(OFS_PARM0) = pressed;
- PRVM_G_FLOAT(OFS_PARM1) = key;
- PRVM_ExecuteProgram(prog->funcoffsets.CSQC_InputEvent, "QC function CSQC_InputEvent is missing");
- r = CSQC_RETURNVAL;
+ if (!prog->funcoffsets.CSQC_InputEvent)
+ r = false;
+ else
+ {
+ prog->globals.client->time = cl.time;
+ PRVM_G_FLOAT(OFS_PARM0) = pressed;
+ PRVM_G_FLOAT(OFS_PARM1) = key;
+ PRVM_ExecuteProgram(prog->funcoffsets.CSQC_InputEvent, "QC function CSQC_InputEvent is missing");
+ r = CSQC_RETURNVAL;
+ }
CSQC_END
return r;
}
{
int restorevm_tempstringsbuf_cursize;
qboolean r;
- if(!cl.csqc_loaded)
+ if(!cl.csqc_loaded || !prog->funcoffsets.CSQC_ConsoleCommand)
return false;
CSQC_BEGIN
prog->globals.client->time = cl.time;
void CSQC_ReadEntities (void)
{
unsigned short entnum, oldself, realentnum;
+ if(!cl.csqc_loaded)
+ {
+ Host_Error ("CSQC_ReadEntities: CSQC is not loaded");
+ return;
+ }
+
CSQC_BEGIN
prog->globals.client->time = cl.time;
oldself = prog->globals.client->self;
return;
CSQC_BEGIN
prog->globals.client->time = cl.time;
- PRVM_ExecuteProgram(prog->funcoffsets.CSQC_Shutdown, "QC function CSQC_Shutdown is missing");
+ if (prog->funcoffsets.CSQC_Shutdown)
+ PRVM_ExecuteProgram(prog->funcoffsets.CSQC_Shutdown, "QC function CSQC_Shutdown is missing");
PRVM_ResetProg();
CSQC_END
Con_Print("CSQC ^1unloaded\n");
prog->globaloffsets.v_forward = PRVM_ED_FindGlobalOffset("v_forward");
prog->globaloffsets.v_right = PRVM_ED_FindGlobalOffset("v_right");
prog->globaloffsets.v_up = PRVM_ED_FindGlobalOffset("v_up");
+ prog->globaloffsets.view_angles = PRVM_ED_FindGlobalOffset("view_angles");
prog->globaloffsets.trace_allsolid = PRVM_ED_FindGlobalOffset("trace_allsolid");
prog->globaloffsets.trace_startsolid = PRVM_ED_FindGlobalOffset("trace_startsolid");
prog->globaloffsets.trace_fraction = PRVM_ED_FindGlobalOffset("trace_fraction");