static void CSQC_R_RecalcView (void)
{
extern matrix4x4_t viewmodelmatrix;
- Matrix4x4_CreateFromQuakeEntity(&r_refdef.view.matrix, cl.csqc_origin[0], cl.csqc_origin[1], cl.csqc_origin[2], cl.csqc_angles[0], cl.csqc_angles[1], cl.csqc_angles[2], 1);
- Matrix4x4_CreateFromQuakeEntity(&viewmodelmatrix, cl.csqc_origin[0], cl.csqc_origin[1], cl.csqc_origin[2], cl.csqc_angles[0], cl.csqc_angles[1], cl.csqc_angles[2], cl_viewmodel_scale.value);
+ Matrix4x4_CreateFromQuakeEntity(&r_refdef.view.matrix, cl.csqc_vieworigin[0], cl.csqc_vieworigin[1], cl.csqc_vieworigin[2], cl.csqc_viewangles[0], cl.csqc_viewangles[1], cl.csqc_viewangles[2], 1);
+ Matrix4x4_CreateFromQuakeEntity(&viewmodelmatrix, cl.csqc_vieworigin[0], cl.csqc_vieworigin[1], cl.csqc_vieworigin[2], cl.csqc_viewangles[0], cl.csqc_viewangles[1], cl.csqc_viewangles[2], cl_viewmodel_scale.value);
}
void CL_RelinkLightFlashes(void);
r_refdef.view.ortho_y = scr_fov.value * (3.0 / 4.0);
r_refdef.view.clear = true;
r_refdef.view.isoverlay = false;
- // FIXME: restore cl.csqc_origin
- // FIXME: restore cl.csqc_angles
+ VectorCopy(cl.csqc_vieworiginfromengine, cl.csqc_vieworigin);
+ VectorCopy(cl.csqc_viewanglesfromengine, cl.csqc_viewangles);
cl.csqc_vidvars.drawworld = r_drawworld.integer != 0;
cl.csqc_vidvars.drawenginesbar = false;
cl.csqc_vidvars.drawcrosshair = false;
PRVM_G_FLOAT(OFS_RETURN) = r_refdef.view.ortho_y;
break;
case VF_ORIGIN:
- VectorCopy(cl.csqc_origin, PRVM_G_VECTOR(OFS_RETURN));
+ VectorCopy(cl.csqc_vieworigin, PRVM_G_VECTOR(OFS_RETURN));
break;
case VF_ORIGIN_X:
- PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_origin[0];
+ PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_vieworigin[0];
break;
case VF_ORIGIN_Y:
- PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_origin[1];
+ PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_vieworigin[1];
break;
case VF_ORIGIN_Z:
- PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_origin[2];
+ PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_vieworigin[2];
break;
case VF_ANGLES:
- VectorCopy(cl.csqc_angles, PRVM_G_VECTOR(OFS_RETURN));
+ VectorCopy(cl.csqc_viewangles, PRVM_G_VECTOR(OFS_RETURN));
break;
case VF_ANGLES_X:
- PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_angles[0];
+ PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_viewangles[0];
break;
case VF_ANGLES_Y:
- PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_angles[1];
+ PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_viewangles[1];
break;
case VF_ANGLES_Z:
- PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_angles[2];
+ PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_viewangles[2];
break;
case VF_DRAWWORLD:
PRVM_G_FLOAT(OFS_RETURN) = cl.csqc_vidvars.drawworld;
r_refdef.view.frustum_y = tan(k * M_PI / 360.0);r_refdef.view.ortho_y = k;
break;
case VF_ORIGIN:
- VectorCopy(f, cl.csqc_origin);
+ VectorCopy(f, cl.csqc_vieworigin);
CSQC_R_RecalcView();
break;
case VF_ORIGIN_X:
- cl.csqc_origin[0] = k;
+ cl.csqc_vieworigin[0] = k;
CSQC_R_RecalcView();
break;
case VF_ORIGIN_Y:
- cl.csqc_origin[1] = k;
+ cl.csqc_vieworigin[1] = k;
CSQC_R_RecalcView();
break;
case VF_ORIGIN_Z:
- cl.csqc_origin[2] = k;
+ cl.csqc_vieworigin[2] = k;
CSQC_R_RecalcView();
break;
case VF_ANGLES:
- VectorCopy(f, cl.csqc_angles);
+ VectorCopy(f, cl.csqc_viewangles);
CSQC_R_RecalcView();
break;
case VF_ANGLES_X:
- cl.csqc_angles[0] = k;
+ cl.csqc_viewangles[0] = k;
CSQC_R_RecalcView();
break;
case VF_ANGLES_Y:
- cl.csqc_angles[1] = k;
+ cl.csqc_viewangles[1] = k;
CSQC_R_RecalcView();
break;
case VF_ANGLES_Z:
- cl.csqc_angles[2] = k;
+ cl.csqc_viewangles[2] = k;
CSQC_R_RecalcView();
break;
case VF_DRAWWORLD:
if (val && val->_float != 0)
scale = val->_float;
- // TODO do we need the same weird angle inverting logic here as in the server side case?
if(viewmatrix)
- 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);
+ *out = r_refdef.view.matrix;
else if ((val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.renderflags)) && ((int)val->_float & RF_USEAXIS))
{
vec3_t forward;
prog->globals.client->servercommandframe = cls.servermovesequence;
prog->globals.client->clientcommandframe = cl.movecmd[0].sequence;
VectorCopy(cl.viewangles, prog->globals.client->input_angles);
- VectorCopy(cl.viewangles, cl.csqc_angles);
// // FIXME: this actually belongs into getinputstate().. [12/17/2007 Black]
prog->globals.client->input_buttons = cl.movecmd[0].buttons;
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_vieworiginfromengine, cl.csqc_vieworigin);
+ VectorCopy(cl.csqc_viewanglesfromengine, cl.csqc_viewangles);
// LordHavoc: Spike says not to do this, but without pmove_org the
// CSQC is useless as it can't alter the view origin without
// completely replacing it
- VectorCopy(cl.csqc_origin, prog->globals.client->pmove_org);
+ Matrix4x4_OriginFromMatrix(&cl.entities[cl.viewentity].render.matrix, prog->globals.client->pmove_org);
VectorCopy(cl.movement_velocity, prog->globals.client->pmove_vel);
if ((val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.view_angles)))
Matrix4x4_CreateFromQuakeEntity(&r_refdef.view.matrix, vieworg[0], vieworg[1], vieworg[2], viewangles[0], viewangles[1], viewangles[2], 1);
// calculate a viewmodel matrix for use in view-attached entities
Matrix4x4_CreateFromQuakeEntity(&viewmodelmatrix, gunorg[0], gunorg[1], gunorg[2], gunangles[0], gunangles[1], gunangles[2], cl_viewmodel_scale.value);
- VectorCopy(vieworg, cl.csqc_origin);
- VectorCopy(viewangles, cl.csqc_angles);
+ VectorCopy(vieworg, cl.csqc_vieworiginfromengine);
+ VectorCopy(viewangles, cl.csqc_viewanglesfromengine);
}
}
}