From 6ca865580ae235317c59a76747d5006b31fc9f47 Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Tue, 30 Jun 2009 23:35:31 +0000 Subject: [PATCH] Fixed death cam. --- reaction/cgame/cg_players.c | 3 +++ reaction/cgame/cg_view.c | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/reaction/cgame/cg_players.c b/reaction/cgame/cg_players.c index b21e7817..b4e1ebb1 100644 --- a/reaction/cgame/cg_players.c +++ b/reaction/cgame/cg_players.c @@ -2671,6 +2671,9 @@ void CG_Player(centity_t * cent) { memcpy(cg.headAxis, head.axis, sizeof(head.axis)); 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; diff --git a/reaction/cgame/cg_view.c b/reaction/cgame/cg_view.c index cba2a32f..0f263b1a 100644 --- a/reaction/cgame/cg_view.c +++ b/reaction/cgame/cg_view.c @@ -442,23 +442,21 @@ void CG_PositionRotatedEntityOnTag(refEntity_t * entity, const refEntity_t * par */ static void CG_DeadPlayerView() { - if (cg.renderingThirdPerson) + if (cg.renderingThirdPerson || 0 != (cg.snap->ps.eFlags & EF_HEADLESS)) { cg.refdefViewAngles[ROLL] = 40; cg.refdefViewAngles[PITCH] = -15; cg.refdefViewAngles[YAW] = cg.snap->ps.stats[STAT_DEAD_YAW]; cg.refdef.vieworg[2] += cg.predictedPlayerState.viewheight; } else { - vec3_t dir; trace_t tr; + memcpy(cg.refdef.vieworg, cg.headPos, sizeof(cg.headPos)); 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); VectorCopy(tr.endpos, cg.refdef.vieworg); - VectorCopy(cg.refdef.vieworg, cg.oldHeadPos); + VectorCopy(cg.headPos, cg.oldHeadPos); } }