-
- if (!new)
- return;
-
- V_CalcBlend ();
-}
-
-/*
-==============================================================================
-
- VIEW RENDERING
-
-==============================================================================
-*/
-
-float angledelta (float a)
-{
- a = ANGLEMOD(a);
- if (a > 180)
- a -= 360;
- return a;
-}
-
-/*
-==================
-CalcGunAngle
-==================
-*/
-void CalcGunAngle (void)
-{
- /*
- float yaw, pitch, move;
- static float oldyaw = 0;
- static float oldpitch = 0;
-
- yaw = r_refdef.viewangles[YAW];
- pitch = -r_refdef.viewangles[PITCH];
-
- yaw = angledelta(yaw - r_refdef.viewangles[YAW]) * 0.4;
- if (yaw > 10)
- yaw = 10;
- if (yaw < -10)
- yaw = -10;
- pitch = angledelta(-pitch - r_refdef.viewangles[PITCH]) * 0.4;
- if (pitch > 10)
- pitch = 10;
- if (pitch < -10)
- pitch = -10;
- move = cl.frametime*20;
- if (yaw > oldyaw)
- {
- if (oldyaw + move < yaw)
- yaw = oldyaw + move;
- }
- else
- {
- if (oldyaw - move > yaw)
- yaw = oldyaw - move;
- }
-
- if (pitch > oldpitch)
- {
- if (oldpitch + move < pitch)
- pitch = oldpitch + move;
- }
- else
- {
- if (oldpitch - move > pitch)
- pitch = oldpitch - move;
- }
-
- oldyaw = yaw;
- oldpitch = pitch;
-
- cl.viewent.angles[YAW] = r_refdef.viewangles[YAW] + yaw;
- cl.viewent.angles[PITCH] = - (r_refdef.viewangles[PITCH] + pitch);
- */
- cl.viewent.render.angles[YAW] = r_refdef.viewangles[YAW];
- cl.viewent.render.angles[PITCH] = -r_refdef.viewangles[PITCH];
-
- cl.viewent.render.angles[ROLL] -= v_idlescale.value * sin(cl.time*v_iroll_cycle.value) * v_iroll_level.value;
- cl.viewent.render.angles[PITCH] -= v_idlescale.value * sin(cl.time*v_ipitch_cycle.value) * v_ipitch_level.value;
- cl.viewent.render.angles[YAW] -= v_idlescale.value * sin(cl.time*v_iyaw_cycle.value) * v_iyaw_level.value;
-}
-
-/*
-==============
-V_BoundOffsets
-==============
-*/
-void V_BoundOffsets (void)
-{
- entity_t *ent;
-
- ent = &cl_entities[cl.viewentity];
-
-// absolutely bound refresh relative to entity clipping hull
-// so the view can never be inside a solid wall
-
- if (r_refdef.vieworg[0] < ent->render.origin[0] - 14)
- r_refdef.vieworg[0] = ent->render.origin[0] - 14;
- else if (r_refdef.vieworg[0] > ent->render.origin[0] + 14)
- r_refdef.vieworg[0] = ent->render.origin[0] + 14;
- if (r_refdef.vieworg[1] < ent->render.origin[1] - 14)
- r_refdef.vieworg[1] = ent->render.origin[1] - 14;
- else if (r_refdef.vieworg[1] > ent->render.origin[1] + 14)
- r_refdef.vieworg[1] = ent->render.origin[1] + 14;
- if (r_refdef.vieworg[2] < ent->render.origin[2] - 22)
- r_refdef.vieworg[2] = ent->render.origin[2] - 22;
- else if (r_refdef.vieworg[2] > ent->render.origin[2] + 30)
- r_refdef.vieworg[2] = ent->render.origin[2] + 30;
-}
-
-/*
-==============
-V_AddIdle
-
-Idle swaying
-==============
-*/
-void V_AddIdle (void)
-{
- r_refdef.viewangles[ROLL] += v_idlescale.value * sin(cl.time*v_iroll_cycle.value) * v_iroll_level.value;
- r_refdef.viewangles[PITCH] += v_idlescale.value * sin(cl.time*v_ipitch_cycle.value) * v_ipitch_level.value;
- r_refdef.viewangles[YAW] += v_idlescale.value * sin(cl.time*v_iyaw_cycle.value) * v_iyaw_level.value;
-}
-
-
-/*
-==============
-V_CalcViewRoll
-
-Roll is induced by movement and damage
-==============
-*/
-void V_CalcViewRoll (void)
-{
- float side;
-
- side = V_CalcRoll (cl_entities[cl.viewentity].render.angles, cl.velocity);
- r_refdef.viewangles[ROLL] += side;
-
- if (v_dmg_time > 0)
- {
- r_refdef.viewangles[ROLL] += v_dmg_time/v_kicktime.value*v_dmg_roll;
- r_refdef.viewangles[PITCH] += v_dmg_time/v_kicktime.value*v_dmg_pitch;
- v_dmg_time -= cl.frametime;
- }
-
- if (cl.stats[STAT_HEALTH] <= 0)
- {
- r_refdef.viewangles[ROLL] = 80; // dead view angle
- return;
- }
-
-}
-
-
-/*
-==================
-V_CalcIntermissionRefdef
-
-==================
-*/
-void V_CalcIntermissionRefdef (void)
-{
- entity_t *ent, *view;
- float old;
-
-// 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;
-
- VectorCopy (ent->render.origin, r_refdef.vieworg);
- VectorCopy (ent->render.angles, r_refdef.viewangles);
- view->render.model = NULL;
-
-// always idle in intermission
- old = v_idlescale.value;
- v_idlescale.value = 1;
- V_AddIdle ();
- v_idlescale.value = old;