Pretend to allow screen offsets.

Because qw's maxclients is always > 1, they'll never work, though :)
This commit is contained in:
Bill Currie 2012-06-01 08:19:22 +09:00
parent e6ce44fde7
commit 81dc750857
3 changed files with 44 additions and 0 deletions

View file

@ -279,6 +279,7 @@ typedef struct {
int watervis;
int fpd;
int fbskins;
int maxclients;
// refresh related state
struct model_s *worldmodel; // cl_entitites[0].model

View file

@ -396,6 +396,8 @@ CL_ClearState (void)
memset (&cl, 0, sizeof (cl));
r_data->force_fullscreen = 0;
cl.maxclients = MAX_CLIENTS;
// Note: we should probably hack around this and give diff values for
// diff gamedirs
cl.fpd = FPD_DEFAULT;

View file

@ -55,6 +55,10 @@
especially when crossing a water boudnary.
*/
cvar_t *scr_ofsx;
cvar_t *scr_ofsy;
cvar_t *scr_ofsz;
cvar_t *cl_rollspeed;
cvar_t *cl_rollangle;
@ -518,6 +522,28 @@ CalcGunAngle (void)
cl.viewent.angles[PITCH] = -(r_data->refdef->viewangles[PITCH] + pitch);
}
static void
V_BoundOffsets (void)
{
vec_t *origin = cl.simorg;
// absolutely bound refresh reletive to entity clipping hull
// so the view can never be inside a solid wall
if (r_data->refdef->vieworg[0] < origin[0] - 14)
r_data->refdef->vieworg[0] = origin[0] - 14;
else if (r_data->refdef->vieworg[0] > origin[0] + 14)
r_data->refdef->vieworg[0] = origin[0] + 14;
if (r_data->refdef->vieworg[1] < origin[1] - 14)
r_data->refdef->vieworg[1] = origin[1] - 14;
else if (r_data->refdef->vieworg[1] > origin[1] + 14)
r_data->refdef->vieworg[1] = origin[1] + 14;
if (r_data->refdef->vieworg[2] < origin[2] - 22)
r_data->refdef->vieworg[2] = origin[2] - 22;
else if (r_data->refdef->vieworg[2] > origin[2] + 30)
r_data->refdef->vieworg[2] = origin[2] + 30;
}
/*
V_AddIdle
@ -621,6 +647,18 @@ V_CalcRefdef (void)
// offsets
AngleVectors (cl.simangles, forward, right, up);
// don't allow cheats in multiplayer
// FIXME check for dead
if (cl.maxclients == 1) {
for (i = 0; i < 3; i++) {
r_data->refdef->vieworg[i] += scr_ofsx->value * forward[i] +
scr_ofsy->value * right[i] +
scr_ofsz->value * up[i];
}
}
V_BoundOffsets ();
// set up gun position
VectorCopy (cl.simangles, view->angles);
@ -768,6 +806,9 @@ V_Init_Cvars (void)
v_idlescale = Cvar_Get ("v_idlescale", "0", CVAR_NONE, NULL,
"Toggles whether the view remains idle");
scr_ofsx = Cvar_Get ("scr_ofsx", "0", CVAR_NONE, NULL, "None");
scr_ofsy = Cvar_Get ("scr_ofsy", "0", CVAR_NONE, NULL, "None");
scr_ofsz = Cvar_Get ("scr_ofsz", "0", CVAR_NONE, NULL, "None");
cl_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, NULL,
"How quickly you straighten out after strafing");
cl_rollangle = Cvar_Get ("cl_rollangle", "2.0", CVAR_NONE, NULL,