Fixed death cam.

This commit is contained in:
Andrei Drexler 2009-06-30 23:35:31 +00:00
parent b50af1df78
commit 6ca865580a
2 changed files with 6 additions and 5 deletions

View file

@ -2671,6 +2671,9 @@ void CG_Player(centity_t * cent)
{ {
memcpy(cg.headAxis, head.axis, sizeof(head.axis)); memcpy(cg.headAxis, head.axis, sizeof(head.axis));
memcpy(cg.headPos, head.origin, sizeof(head.origin)); memcpy(cg.headPos, head.origin, sizeof(head.origin));
cg.headPos[2] += 16;
if (cg.snap->ps.stats[STAT_HEALTH] > 0)
memcpy(cg.oldHeadPos, cg.headPos, sizeof(cg.headPos));
} }
head.shadowPlane = shadowPlane; head.shadowPlane = shadowPlane;

View file

@ -442,23 +442,21 @@ void CG_PositionRotatedEntityOnTag(refEntity_t * entity, const refEntity_t * par
*/ */
static void CG_DeadPlayerView() static void CG_DeadPlayerView()
{ {
if (cg.renderingThirdPerson) if (cg.renderingThirdPerson || 0 != (cg.snap->ps.eFlags & EF_HEADLESS))
{ {
cg.refdefViewAngles[ROLL] = 40; cg.refdefViewAngles[ROLL] = 40;
cg.refdefViewAngles[PITCH] = -15; cg.refdefViewAngles[PITCH] = -15;
cg.refdefViewAngles[YAW] = cg.snap->ps.stats[STAT_DEAD_YAW]; cg.refdefViewAngles[YAW] = cg.snap->ps.stats[STAT_DEAD_YAW];
cg.refdef.vieworg[2] += cg.predictedPlayerState.viewheight; cg.refdef.vieworg[2] += cg.predictedPlayerState.viewheight;
} else { } else {
vec3_t dir;
trace_t tr; trace_t tr;
memcpy(cg.refdef.vieworg, cg.headPos, sizeof(cg.headPos)); memcpy(cg.refdef.vieworg, cg.headPos, sizeof(cg.headPos));
memcpy(cg.refdef.viewaxis, cg.headAxis, sizeof(cg.headAxis)); memcpy(cg.refdef.viewaxis, cg.headAxis, sizeof(cg.headAxis));
cg.refdef.vieworg[2] += 16;
VectorSubtract(cg.refdef.vieworg, cg.oldHeadPos, dir);
CG_Trace(&tr, cg.oldHeadPos, NULL, NULL, cg.refdef.vieworg, cg.clientNum, CONTENTS_SOLID); CG_Trace(&tr, cg.oldHeadPos, NULL, NULL, cg.refdef.vieworg, cg.clientNum, CONTENTS_SOLID);
VectorCopy(tr.endpos, cg.refdef.vieworg); VectorCopy(tr.endpos, cg.refdef.vieworg);
VectorCopy(cg.refdef.vieworg, cg.oldHeadPos); VectorCopy(cg.headPos, cg.oldHeadPos);
} }
} }