diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2009-10-03 12:29:47 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:15:59 +0000 |
commit | 3a2aa83e582deb28d29f38f5a3dcb2e697863de0 (patch) | |
tree | fb4988990427400a5900c0b1010c8846a3669bbb /src | |
parent | 1de6714f3fd27682ee48d26c7280ff4dd7c22081 (diff) |
* Make dead cam follow the killer's movements instead of just looking at where they were at time of death.
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_view.c | 13 | ||||
-rw-r--r-- | src/game/g_combat.c | 12 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 9c4f05a5..e699b0c8 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -303,10 +303,17 @@ void CG_OffsetThirdPersonView( void ) // If player is dead, we want the player to be between us and the killer // so pretend that the player was looking at the killer, then place cam behind them. - // FIXME: This still fails to see killer when killer is above/below or killer moves - // out of view (relative to the dead player). if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 ) - cg.refdefViewAngles[ YAW ] = cg.predictedPlayerState.stats[ STAT_VIEWLOCK ]; + { + int killerEntNum; + vec3_t killerPos; + + killerEntNum = cg.predictedPlayerState.stats[ STAT_VIEWLOCK ]; + VectorCopy( cg_entities[ killerEntNum ].lerpOrigin, killerPos ); + + VectorSubtract( killerPos, cg.refdef.vieworg, killerPos ); + vectoangles( killerPos, cg.refdefViewAngles ); + } // get and rangecheck cg_thirdPersonRange range = cg_thirdPersonRange.value; diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 753ff673..aeba6544 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -56,19 +56,13 @@ LookAtKiller */ void LookAtKiller( gentity_t *self, gentity_t *inflictor, gentity_t *attacker ) { - vec3_t dir; if ( attacker && attacker != self ) - VectorSubtract( attacker->s.pos.trBase, self->s.pos.trBase, dir ); + self->client->ps.stats[ STAT_VIEWLOCK ] = attacker - g_entities; else if( inflictor && inflictor != self ) - VectorSubtract( inflictor->s.pos.trBase, self->s.pos.trBase, dir ); + self->client->ps.stats[ STAT_VIEWLOCK ] = inflictor - g_entities; else - { - self->client->ps.stats[ STAT_VIEWLOCK ] = self->s.angles[ YAW ]; - return; - } - - self->client->ps.stats[ STAT_VIEWLOCK ] = vectoyaw( dir ); + self->client->ps.stats[ STAT_VIEWLOCK ] = self - g_entities; } // these are just for logging, the client prints its own messages |