- entity_t *ent, *view;
- int i;
- vec3_t forward, right, up;
- vec3_t angles;
- float bob;
- static float oldz = 0;
-
- V_DriftPitch ();
-
-// ent is the player model (visible when out of body)
- ent = &cl_entities[cl.viewentity];
-// view is the weapon model (only visible from inside body)
- view = &cl.viewent;
-
-
-// transform the view offset by the model's matrix to get the offset from
-// model origin for the view
- if (!chase_active.value) // LordHavoc: get rid of angle problems in chase_active mode
- {
- ent->angles[YAW] = cl.viewangles[YAW]; // the model should face the view dir
- ent->angles[PITCH] = -cl.viewangles[PITCH]; // the model should face the view dir
- }
-
-
- bob = V_CalcBob ();
-
-// refresh position
- VectorCopy (ent->origin, r_refdef.vieworg);
- r_refdef.vieworg[2] += cl.viewheight + bob;
-
-// never let it sit exactly on a node line, because a water plane can
-// dissapear when viewed with the eye exactly on it.
-// the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis
- r_refdef.vieworg[0] += 1.0/32;
- r_refdef.vieworg[1] += 1.0/32;
- r_refdef.vieworg[2] += 1.0/32;
-
- if (!intimerefresh)
- {
- VectorCopy (cl.viewangles, r_refdef.viewangles);
- }
- V_CalcViewRoll ();
- V_AddIdle ();
-
-// offsets
- angles[PITCH] = -ent->angles[PITCH]; // because entity pitches are
- // actually backward
- angles[YAW] = ent->angles[YAW];
- angles[ROLL] = ent->angles[ROLL];
-
- AngleVectors (angles, forward, right, up);
-
- V_BoundOffsets ();
-
-// set up gun position
- VectorCopy (cl.viewangles, view->angles);
-
- CalcGunAngle ();
-
- VectorCopy (ent->origin, view->origin);
- view->origin[2] += cl.viewheight;
-
- for (i=0 ; i<3 ; i++)
- {
- view->origin[i] += forward[i]*bob*0.4;
-// view->origin[i] += right[i]*bob*0.4;
-// view->origin[i] += up[i]*bob*0.8;
- }
- view->origin[2] += bob;
-
-// fudge position around to keep amount of weapon visible
-// roughly equal with different FOV
-
- view->model = cl.model_precache[cl.stats[STAT_WEAPON]];
- view->frame = cl.stats[STAT_WEAPONFRAME];
- view->colormap = -1; // no special coloring
-
-// set up the refresh position
- if (!intimerefresh)