diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2011-01-22 15:09:59 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:52 +0000 |
commit | b5dbdb31d3b685c1eea1c35d204b371e516d2630 (patch) | |
tree | 18da9a30da3e9281aebaad3d87e6b7e33cac0956 | |
parent | 6f87303a2691565d6fad67817a8e1ec7a58948e2 (diff) |
* Implement cg_staticDeathCam to disable moving the death camera when the killer moves
-rw-r--r-- | assets/ui/ingame_options.menu | 20 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 2 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 20 |
4 files changed, 36 insertions, 8 deletions
diff --git a/assets/ui/ingame_options.menu b/assets/ui/ingame_options.menu index 5c22cdf6..f99eee8a 100644 --- a/assets/ui/ingame_options.menu +++ b/assets/ui/ingame_options.menu @@ -289,6 +289,26 @@ } } + itemDef + { + name player + group optionsGrp + type ITEM_TYPE_YESNO + text "Static Death Cam:" + cvar "cg_staticDeathCam" + rect CONTENT_X (CONTENT_Y+(6*ELEM_H)) CONTENT_W ELEM_H + textalign ALIGN_RIGHT + textvalign VALIGN_CENTER + textalignx CONTENT_OFF + textscale .25 + forecolor 1 1 1 1 + visible MENU_FALSE + action + { + play "sound/misc/menu1.wav"; + } + } + //////// HUD itemDef diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 04766f53..8aba22fe 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1139,6 +1139,7 @@ typedef struct float painBlendTarget; float healBlendValue; int lastHealth; + qboolean wasDeadLastFrame; int lastPredictedCommand; int lastServerTime; @@ -1468,6 +1469,7 @@ extern vmCvar_t cg_tracerLength; extern vmCvar_t cg_thirdPerson; extern vmCvar_t cg_thirdPersonAngle; extern vmCvar_t cg_thirdPersonShoulderViewMode; +extern vmCvar_t cg_staticDeathCam; extern vmCvar_t cg_thirdPersonPitchFollow; extern vmCvar_t cg_thirdPersonRange; extern vmCvar_t cg_stereoSeparation; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index a296aade..70d875e8 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -145,6 +145,7 @@ vmCvar_t cg_tracerLength; vmCvar_t cg_thirdPerson; vmCvar_t cg_thirdPersonAngle; vmCvar_t cg_thirdPersonShoulderViewMode; +vmCvar_t cg_staticDeathCam; vmCvar_t cg_thirdPersonPitchFollow; vmCvar_t cg_thirdPersonRange; vmCvar_t cg_stereoSeparation; @@ -273,6 +274,7 @@ static cvarTable_t cvarTable[ ] = { &cg_thirdPersonAngle, "cg_thirdPersonAngle", "0", CVAR_CHEAT }, { &cg_thirdPersonPitchFollow, "cg_thirdPersonPitchFollow", "0", 0 }, { &cg_thirdPersonShoulderViewMode, "cg_thirdPersonShoulderViewMode", "1", CVAR_ARCHIVE }, + { &cg_staticDeathCam, "cg_staticDeathCam", "0", CVAR_ARCHIVE }, { &cg_stats, "cg_stats", "0", 0 }, { &cg_drawTeamOverlay, "cg_drawTeamOverlay", "1", CVAR_ARCHIVE }, { &cg_teamOverlaySortMode, "cg_teamOverlaySortMode", "1", CVAR_ARCHIVE }, diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index ed74e9cb..7d5fe06f 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -267,6 +267,7 @@ void CG_OffsetThirdPersonView( void ) vec3_t axis[ 3 ], rotaxis[ 3 ]; float deltaPitch; static float pitch; + static vec3_t killerPos = { 0, 0, 0 }; // If cg_thirdpersonShoulderViewMode == 2, do shoulder view instead // If cg_thirdpersonShoulderViewMode == 1, do shoulder view when chasing @@ -291,18 +292,19 @@ void CG_OffsetThirdPersonView( void ) // so pretend that the player was looking at the killer, then place cam behind them. if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 ) { - int killerEntNum; - vec3_t killerPos; + int killerEntNum = cg.predictedPlayerState.stats[ STAT_VIEWLOCK ]; - killerEntNum = cg.predictedPlayerState.stats[ STAT_VIEWLOCK ]; - // already looking at ourself if( killerEntNum != cg.snap->ps.clientNum ) { - VectorCopy( cg_entities[ killerEntNum ].lerpOrigin, killerPos ); - - VectorSubtract( killerPos, cg.refdef.vieworg, killerPos ); - vectoangles( killerPos, cg.refdefViewAngles ); + vec3_t lookDirection; + if( cg.wasDeadLastFrame == qfalse || !cg_staticDeathCam.integer ) + { + VectorCopy( cg_entities[ killerEntNum ].lerpOrigin, killerPos ); + cg.wasDeadLastFrame = qtrue; + } + VectorSubtract( killerPos, cg.refdef.vieworg, lookDirection ); + vectoangles( lookDirection, cg.refdefViewAngles ); } } @@ -1303,6 +1305,8 @@ static int CG_CalcViewValues( void ) if( CG_IsParticleSystemValid( &cg.poisonCloudPS ) ) CG_DestroyParticleSystem( &cg.poisonCloudPS ); } + else + cg.wasDeadLastFrame = qfalse; if( cg.renderingThirdPerson ) { |