diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2009-10-03 13:10:33 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:32 +0000 |
commit | 3fd952a2fc79839dc2443e86a5bd5b9200db69fe (patch) | |
tree | d340aecb61ded55793ce90e24ef2a26b3911cc75 /src/cgame | |
parent | 1f2000da1ab287833af69689ddefb9fbf92039cb (diff) |
* Cleanup thirdperson spec code
- Remove the temporary manual override cvars
- Bring back cg_thirdpersonangle by request even though it's only useful in non-gameplay cases
- Move thirdperson view offset values to classconfigs where they belong
- Attempt once again to fix cg_thirdpersonpitchfollow
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_local.h | 5 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 10 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 103 |
3 files changed, 23 insertions, 95 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index c1e5dada..68895d72 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1475,13 +1475,10 @@ extern vmCvar_t cg_tracerWidth; extern vmCvar_t cg_tracerLength; extern vmCvar_t cg_autoswitch; extern vmCvar_t cg_thirdPerson; +extern vmCvar_t cg_thirdPersonAngle; extern vmCvar_t cg_thirdPersonShoulderViewMode; extern vmCvar_t cg_thirdPersonPitchFollow; extern vmCvar_t cg_thirdPersonRange; -extern vmCvar_t cg_shoulderViewOverride; -extern vmCvar_t cg_shoulderViewUp; -extern vmCvar_t cg_shoulderViewRight; -extern vmCvar_t cg_shoulderViewForward; extern vmCvar_t cg_stereoSeparation; extern vmCvar_t cg_lagometer; extern vmCvar_t cg_synchronousClients; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 44edf153..3fa458d1 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -141,13 +141,10 @@ vmCvar_t cg_tracerWidth; vmCvar_t cg_tracerLength; vmCvar_t cg_autoswitch; vmCvar_t cg_thirdPerson; +vmCvar_t cg_thirdPersonAngle; vmCvar_t cg_thirdPersonShoulderViewMode; vmCvar_t cg_thirdPersonPitchFollow; vmCvar_t cg_thirdPersonRange; -vmCvar_t cg_shoulderViewOverride; -vmCvar_t cg_shoulderViewUp; -vmCvar_t cg_shoulderViewRight; -vmCvar_t cg_shoulderViewForward; vmCvar_t cg_stereoSeparation; vmCvar_t cg_lagometer; vmCvar_t cg_synchronousClients; @@ -268,12 +265,9 @@ static cvarTable_t cvarTable[ ] = { &cg_tracerLength, "cg_tracerlength", "100", CVAR_CHEAT }, { &cg_thirdPersonRange, "cg_thirdPersonRange", "75", CVAR_ARCHIVE }, { &cg_thirdPerson, "cg_thirdPerson", "0", CVAR_CHEAT }, + { &cg_thirdPersonAngle, "cg_thirdPersonAngle", "0", CVAR_CHEAT }, { &cg_thirdPersonPitchFollow, "cg_thirdPersonPitchFollow", "0", 0 }, { &cg_thirdPersonShoulderViewMode, "cg_thirdPersonShoulderViewMode", "1", CVAR_ARCHIVE }, - { &cg_shoulderViewOverride, "cg_shoulderViewOverride", "0", 0 }, - { &cg_shoulderViewUp, "cg_shoulderViewUp", "0", 0 }, - { &cg_shoulderViewRight, "cg_shoulderViewRight", "0", 0 }, - { &cg_shoulderViewForward, "cg_shoulderViewForward", "0", 0 }, { &cg_stats, "cg_stats", "0", 0 }, { &cg_drawFriend, "cg_drawFriend", "1", CVAR_ARCHIVE }, { &cg_teamChatsOnly, "cg_teamChatsOnly", "0", CVAR_ARCHIVE }, diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 964fa705..06f621f5 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -402,6 +402,8 @@ void CG_OffsetThirdPersonView( void ) } } + rotationAngles[ YAW ] -= cg_thirdPersonAngle.value; + // Move the camera range distance back. AngleVectors( rotationAngles, forward, right, up ); VectorCopy( cg.refdef.vieworg, view ); @@ -449,87 +451,26 @@ CG_OffsetShoulderView */ void CG_OffsetShoulderView( void ) { - int i; - int cmdNum; - usercmd_t cmd, oldCmd; - vec3_t rotationAngles; - vec3_t axis[ 3 ], rotaxis[ 3 ]; - float deltaMousePitch; - static float mousePitch; - vec3_t forward, right, up; - float classFwdOffset = 0.0f, classUpOffset = 0.0f, classRightOffset = 0.0f; + int i; + int cmdNum; + usercmd_t cmd, oldCmd; + vec3_t rotationAngles; + vec3_t axis[ 3 ], rotaxis[ 3 ]; + float deltaMousePitch; + static float mousePitch; + vec3_t forward, right, up; + classConfig_t* classConfig; + + // Ignore following pitch; it's too jerky otherwise. + if( !cg_thirdPersonPitchFollow.integer ) + cg.refdefViewAngles[ PITCH ] = 0.0f; AngleVectors( cg.refdefViewAngles, forward, right, up ); - // Set a nice view by offsetting from vieworigin to get to the "shoulder" - // for each class. - // FIXME: These need to not be hard-coded so hackishly - switch( cg.snap->ps.stats[ STAT_CLASS ] ) - { - case PCL_ALIEN_BUILDER0: - case PCL_ALIEN_BUILDER0_UPG: - classFwdOffset = -8.0f; - classRightOffset = 15.0f; - classUpOffset = 13.0f; - break; - case PCL_ALIEN_LEVEL0: - classFwdOffset = -5.0f; - classRightOffset = 0.0f; - classUpOffset = 17.0f; - break; - case PCL_ALIEN_LEVEL1: - case PCL_ALIEN_LEVEL1_UPG: - classFwdOffset = -10.0f; - classRightOffset = 0.0f; - classUpOffset = 18.0f; - break; - case PCL_ALIEN_LEVEL2: - case PCL_ALIEN_LEVEL2_UPG: - classFwdOffset = 0.0f; - classRightOffset = 12.0f; - classUpOffset = 5.0f; - break; - case PCL_ALIEN_LEVEL3: - classFwdOffset = -10.0f; - classRightOffset = 15.0f; - classUpOffset = 8.0f; - break; - case PCL_ALIEN_LEVEL3_UPG: - classFwdOffset = -10.0f; - classRightOffset = 17.0f; - classUpOffset = 12.0f; - break; - case PCL_ALIEN_LEVEL4: - classFwdOffset = -20.0f; - classRightOffset = -25.0f; - classUpOffset = 30.0f; - break; - case PCL_HUMAN: - classFwdOffset = -10.0f; - classRightOffset = 15.0f; - classUpOffset = 0.0f; - break; - case PCL_HUMAN_BSUIT: - classFwdOffset = -30.0f; - classRightOffset = 25.0f; - classUpOffset = -2.0f; - break; - } - - // The override is temporary so that people can help find good offset positions for me. - // It will not remain in final code. - if( !cg_shoulderViewOverride.integer ) - { - VectorMA( cg.refdef.vieworg, classFwdOffset, forward, cg.refdef.vieworg ); - VectorMA( cg.refdef.vieworg, classUpOffset, up, cg.refdef.vieworg ); - VectorMA( cg.refdef.vieworg, classRightOffset, right, cg.refdef.vieworg ); - } - else - { - VectorMA( cg.refdef.vieworg, cg_shoulderViewForward.value, forward, cg.refdef.vieworg ); - VectorMA( cg.refdef.vieworg, cg_shoulderViewUp.value, up, cg.refdef.vieworg ); - VectorMA( cg.refdef.vieworg, cg_shoulderViewRight.value, right, cg.refdef.vieworg ); - } + classConfig = BG_ClassConfig( cg.snap->ps.stats[ STAT_CLASS ] ); + VectorMA( cg.refdef.vieworg, classConfig->shoulderOffsets[ 0 ], forward, cg.refdef.vieworg ); + VectorMA( cg.refdef.vieworg, classConfig->shoulderOffsets[ 1 ], right, cg.refdef.vieworg ); + VectorMA( cg.refdef.vieworg, classConfig->shoulderOffsets[ 2 ], up, cg.refdef.vieworg ); // If someone is playing like this, the rest is already taken care of // so just get the firstperson effects and leave. @@ -554,11 +495,7 @@ void CG_OffsetShoulderView( void ) // Handle pitch. rotationAngles[ PITCH ] = mousePitch; - // Ignore following pitch; it's too jerky otherwise. - if( cg_thirdPersonPitchFollow.integer ) - mousePitch += cg.refdefViewAngles[ PITCH ]; - - rotationAngles[ PITCH ] = AngleNormalize180( rotationAngles[ PITCH ] ); + rotationAngles[ PITCH ] = AngleNormalize180( rotationAngles[ PITCH ] + AngleNormalize180( cg.refdefViewAngles[ PITCH ] ) ); if( rotationAngles [ PITCH ] < -90.0f ) rotationAngles [ PITCH ] = -90.0f; if( rotationAngles [ PITCH ] > 90.0f ) rotationAngles [ PITCH ] = 90.0f; |