[nq,qw] Fix broken intermission view

The idle scale was 114.591559 time too big (forgot both half angle for the
quaternion and converting from degrees to radians for the idle rotations).

Also, take the intermission view position and rotation direct from the
player entity, not viewstate, as while viewstate.origin is the same,
viewstate.rotation is the player's input, not the rotation set by the
server. Fixes the unlocked view angle.
This commit is contained in:
Bill Currie 2021-07-24 11:33:53 +09:00
parent 435009e2cd
commit d3b7f7fbc8
2 changed files with 14 additions and 6 deletions

View file

@ -516,8 +516,8 @@ idle_quat (vec4f_t axis, cvar_t *cycle, cvar_t *level)
}
float scale = sin (cl.time * cycle->value);
float ang = scale * level->value * v_idlescale->value;
float c = cos (ang);
float s = sin (ang);
float c = cos (ang * M_PI / 360);
float s = sin (ang * M_PI / 360);
return axis * s + identity * c;
}
@ -578,14 +578,18 @@ V_CalcViewRoll (void)
static void
V_CalcIntermissionRefdef (void)
{
// ent is the player model (visible when out of body)
entity_t *ent = &cl_entities[cl.viewentity];
entity_t *view;
float old;
vec4f_t origin = Transform_GetWorldPosition (ent->transform);
vec4f_t rotation = Transform_GetWorldRotation (ent->transform);
// view is the weapon model (visible only from inside body)
view = &cl.viewent;
r_data->refdef->viewposition = cl.viewstate.origin;
AngleQuat (cl.viewstate.angles, &r_data->refdef->viewrotation[0]);//FIXME
r_data->refdef->viewposition = origin;
r_data->refdef->viewrotation = rotation;
view->renderer.model = NULL;
// always idle in intermission

View file

@ -580,14 +580,18 @@ V_CalcViewRoll (void)
static void
V_CalcIntermissionRefdef (void)
{
entity_t *ent = &cl_entities[cl.viewentity];
entity_t *view;
float old;
vec4f_t origin = Transform_GetWorldPosition (ent->transform);
vec4f_t rotation = Transform_GetWorldRotation (ent->transform);
// view is the weapon model (visible only from inside body)
view = &cl.viewent;
r_data->refdef->viewposition = cl.viewstate.origin;
AngleQuat (cl.viewstate.angles, &r_data->refdef->viewrotation[0]);//FIXME
r_data->refdef->viewposition = origin;
r_data->refdef->viewrotation = rotation;
view->renderer.model = NULL;
view->renderer.model = NULL;
// always idle in intermission