VM_Warning("VM_CL_lightstyle >= MAX_LIGHTSTYLES\n");
return;
}
- strlcpy (cl.lightstyle[i].map, MSG_ReadString(), sizeof (cl.lightstyle[i].map));
+ strlcpy (cl.lightstyle[i].map, c, sizeof (cl.lightstyle[i].map));
cl.lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
cl.lightstyle[i].length = (int)strlen(cl.lightstyle[i].map);
}
extern void CSQC_Think (prvm_edict_t *ed);//csprogs.c
void VM_CL_R_AddEntities (void)
{
+ double t = Sys_DoubleTime();
int i, drawmask;
prvm_edict_t *ed;
VM_SAFEPARMCOUNT(1, VM_CL_R_AddEntities);
continue;
CSQC_AddRenderEdict(ed);
}
+
+ // callprofile fixing hack: do not include this time in what is counted for CSQC_UpdateView
+ prog->functions[prog->funcoffsets.CSQC_UpdateView].totaltime -= Sys_DoubleTime() - t;
}
//#302 void(entity ent) addentity (EXT_CSQC)
void VM_CL_R_AddEntity (void)
{
+ double t = Sys_DoubleTime();
VM_SAFEPARMCOUNT(1, VM_CL_R_AddEntity);
CSQC_AddRenderEdict(PRVM_G_EDICT(OFS_PARM0));
+ prog->functions[prog->funcoffsets.CSQC_UpdateView].totaltime -= Sys_DoubleTime() - t;
}
//#303 float(float property, ...) setproperty (EXT_CSQC)
CSQC_R_RecalcView();
break;
case VF_DRAWWORLD:
- cl.csqc_vidvars.drawworld = k;
+ cl.csqc_vidvars.drawworld = k != 0;
break;
case VF_DRAWENGINESBAR:
- cl.csqc_vidvars.drawenginesbar = k;
+ cl.csqc_vidvars.drawenginesbar = k != 0;
break;
case VF_DRAWCROSSHAIR:
- cl.csqc_vidvars.drawcrosshair = k;
+ cl.csqc_vidvars.drawcrosshair = k != 0;
break;
case VF_CL_VIEWANGLES:
VectorCopy(f, cl.viewangles);
//#305 void(vector org, float radius, vector lightcolours[, float style, string cubemapname, float pflags]) adddynamiclight (EXT_CSQC)
void VM_CL_R_AddDynamicLight (void)
{
+ double t = Sys_DoubleTime();
vec_t *org;
float radius = 300;
vec_t *col;
R_RTLight_Update(&r_refdef.scene.templights[r_refdef.scene.numlights], false, &matrix, col, style, cubemapname, castshadow, coronaintensity, coronasizescale, ambientscale, diffusescale, specularscale, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
r_refdef.scene.lights[r_refdef.scene.numlights] = &r_refdef.scene.templights[r_refdef.scene.numlights++];
+ prog->functions[prog->funcoffsets.CSQC_UpdateView].totaltime -= Sys_DoubleTime() - t;
}
//============================================================================
VM_SAFEPARMCOUNT(1, VM_CL_unproject);
f = PRVM_G_VECTOR(OFS_PARM0);
if(v_flipped.integer)
- f[0] = r_refdef.view.x + r_refdef.view.width - f[0];
- VectorSet(temp, f[2], (-1.0 + 2.0 * (f[0] - r_refdef.view.x) / r_refdef.view.width) * f[2] * -r_refdef.view.frustum_x, (-1.0 + 2.0 * (f[1] - r_refdef.view.y) / r_refdef.view.height) * f[2] * -r_refdef.view.frustum_y);
+ f[0] = (2 * r_refdef.view.x + r_refdef.view.width) * (vid_conwidth.integer / (float) vid.width) - f[0];
+ VectorSet(temp,
+ f[2],
+ (-1.0 + 2.0 * (f[0] / (vid_conwidth.integer / (float) vid.width) - r_refdef.view.x) / r_refdef.view.width) * f[2] * -r_refdef.view.frustum_x,
+ (-1.0 + 2.0 * (f[1] / (vid_conheight.integer / (float) vid.height) - r_refdef.view.y) / r_refdef.view.height) * f[2] * -r_refdef.view.frustum_y);
Matrix4x4_Transform(&r_refdef.view.matrix, temp, PRVM_G_VECTOR(OFS_RETURN));
}
Matrix4x4_Transform(&m, f, v);
if(v_flipped.integer)
v[1] = -v[1];
- VectorSet(PRVM_G_VECTOR(OFS_RETURN), r_refdef.view.x + r_refdef.view.width*0.5*(1.0+v[1]/v[0]/-r_refdef.view.frustum_x), r_refdef.view.y + r_refdef.view.height*0.5*(1.0+v[2]/v[0]/-r_refdef.view.frustum_y), v[0]);
+ VectorSet(PRVM_G_VECTOR(OFS_RETURN),
+ (vid_conwidth.integer / (float) vid.width) * (r_refdef.view.x + r_refdef.view.width*0.5*(1.0+v[1]/v[0]/-r_refdef.view.frustum_x)),
+ (vid_conheight.integer / (float) vid.height) * (r_refdef.view.y + r_refdef.view.height*0.5*(1.0+v[2]/v[0]/-r_refdef.view.frustum_y)),
+ v[0]);
}
//#330 float(float stnum) getstatf (EXT_CSQC)
static void VM_CL_setcursormode (void)
{
VM_SAFEPARMCOUNT(1, VM_CL_setcursormode);
- cl.csqc_wantsmousemove = PRVM_G_FLOAT(OFS_PARM0);
+ cl.csqc_wantsmousemove = PRVM_G_FLOAT(OFS_PARM0) != 0;
cl_ignoremousemoves = 2;
}
{
prvm_eval_t *val;
float scale;
- float pitchsign;
+ float pitchsign = 1;
dp_model_t *model;
scale = 1;
Matrix4x4_CreateFromQuakeEntity(out, cl.csqc_origin[0], cl.csqc_origin[1], cl.csqc_origin[2], cl.csqc_angles[0], cl.csqc_angles[1], cl.csqc_angles[2], scale * cl_viewmodel_scale.value);
else
{
- pitchsign = 1;
if ((model = CL_GetModelFromEdict(ent)) && model->type == mod_alias)
pitchsign = -1;
Matrix4x4_CreateFromQuakeEntity(out, ent->fields.client->origin[0], ent->fields.client->origin[1], ent->fields.client->origin[2], pitchsign * ent->fields.client->angles[0], ent->fields.client->angles[1], ent->fields.client->angles[2], scale);
// --blub
void VM_CL_R_RenderScene (void)
{
+ double t = Sys_DoubleTime();
vmpolygons_t* polys = vmpolygons + PRVM_GetProgNr();
VM_SAFEPARMCOUNT(0, VM_CL_R_RenderScene);
+
// we need to update any RENDER_VIEWMODEL entities at this point because
// csqc supplies its own view matrix
CL_UpdateViewEntities();
polys->num_vertices = polys->num_triangles = 0;
polys->progstarttime = prog->starttime;
+
+ // callprofile fixing hack: do not include this time in what is counted for CSQC_UpdateView
+ prog->functions[prog->funcoffsets.CSQC_UpdateView].totaltime -= Sys_DoubleTime() - t;
}
static void VM_ResizePolygons(vmpolygons_t *polys)