Guest User

Untitled

a guest
Aug 19th, 2016
49
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. ================
  3. idPlayer::UpdateViewAngles
  4. ================
  5. */
  6. void idPlayer::UpdateViewAngles( void ) {
  7.  
  8. if ( gameLocal.GameIsPaused() || gameLocal.IsSpectatingWinner() ) {
  9. return;
  10. }
  11.  
  12. if ( !noclip && ( IsInCinematic() || privateCameraView || gameLocal.GetCamera() || influenceActive == INFLUENCE_LEVEL2 ) ) {
  13. // no view changes at all, but we still want to update the deltas or else when
  14. // we get out of this mode, our view will snap to a kind of random angle
  15. UpdateDeltaViewAngles( viewAngles ); //winnerCam ||
  16. return;
  17. }
  18.  
  19. int i;
  20. idAngles delta;
  21.  
  22. // if dead
  23. if ( health <= 0 ) {
  24. if ( pm_thirdPersonDeath.GetBool() ) {
  25. viewAngles.roll = 0.0f;
  26. viewAngles.pitch = 30.0f;
  27. } else {
  28. viewAngles.roll = 40.0f;
  29. viewAngles.pitch = -15.0f;
  30. }
  31. return;
  32. }
  33.  
  34. if ( !IsGuidingProjectile() ) {
  35.  
  36. for ( i = 0; i < 3; i++ ) {
  37. cmdAngles[i] = SHORT2ANGLE( usercmd.angles[i] );
  38. if ( influenceActive == INFLUENCE_LEVEL3 ) {
  39. viewAngles[i] += idMath::ClampFloat( -1.0f, 1.0f, idMath::AngleDelta( idMath::AngleNormalize180( SHORT2ANGLE( usercmd.angles[i]) + deltaViewAngles[i] ) , viewAngles[i] ) );
  40. } else {
  41. viewAngles[i] = idMath::AngleNormalize180( SHORT2ANGLE( usercmd.angles[i] ) + deltaViewAngles[i] );
  42. }
  43. }
  44.  
  45. if ( !centerView.IsDone( gameLocal.time ) ) {
  46. viewAngles.pitch = centerView.GetCurrentValue( gameLocal.time );
  47. }
  48.  
  49. // clamp the pitch
  50. if ( noclip ) {
  51. if ( viewAngles.pitch > 89.0f ) {
  52. // don't let the player look down more than 89 degrees while noclipping
  53. viewAngles.pitch = 89.0f;
  54. } else if ( viewAngles.pitch < -89.0f ) {
  55. // don't let the player look up more than 89 degrees while noclipping
  56. viewAngles.pitch = -89.0f;
  57. }
  58. } else {
  59.  
  60. if ( viewAngles.pitch > pm_maxviewpitch.GetFloat() ) {
  61. // don't let the player look down enough to see the shadow of his (non-existant) feet
  62. viewAngles.pitch = pm_maxviewpitch.GetFloat();
  63. } else if ( viewAngles.pitch < pm_minviewpitch.GetFloat() ) {
  64. // don't let the player look up more than 89 degrees
  65. viewAngles.pitch = pm_minviewpitch.GetFloat();
  66. }
  67.  
  68. }
  69.  
  70. // orient the model towards the direction we're looking
  71. SetAngles( idAngles( 0, viewAngles.yaw, 0 ) );
  72.  
  73. // save in the log for analyzing weapon angle offsets
  74. loggedViewAngles[ gameLocal.framenum & (NUM_LOGGED_VIEW_ANGLES-1) ] = viewAngles;
  75.  
  76. UpdateDeltaViewAngles( viewAngles );
  77.  
  78. } else if ( IsGuidingProjectile() ) {
  79.  
  80. for ( i = 0; i < 3; i++ ) {
  81. cmdAngles[i] = SHORT2ANGLE( usercmd.angles[i] );
  82. if ( influenceActive == INFLUENCE_LEVEL3 ) {
  83. guideAngles[i] += idMath::ClampFloat( -1.0f, 1.0f, idMath::AngleDelta( idMath::AngleNormalize180( SHORT2ANGLE( usercmd.angles[i]) + deltaViewAngles[i] ) , guideAngles[i] ) );
  84. } else {
  85. guideAngles[i] = idMath::AngleNormalize180( SHORT2ANGLE( usercmd.angles[i] ) + deltaViewAngles[i] );
  86. }
  87. }
  88.  
  89. UpdateDeltaViewAngles( guideAngles );
  90.  
  91. }
  92.  
  93. }
  94.  
  95. //militia_add
  96.  
  97. /*
  98. ==============
  99. idPlayer::CameraViews
  100. ==============
  101. */
  102. void idPlayer::CameraViews( void ) {
  103.  
  104. pfl.thirdpersonView = false;
  105.  
  106. rvVehicle * vehicle = NULL;
  107. if ( IsInVehicle ( ) ) {
  108. vehicle = vehicleController.GetVehicle();
  109. }
  110.  
  111. renderView->vieworg = firstPersonViewOrigin;
  112. renderView->viewaxis = firstPersonViewAxis;
  113.  
  114. SmoothenRenderView( true );
  115.  
  116. if ( gameLocal.IsMPGameState( GAMEREVIEW ) ) {
  117.  
  118. SpectateWinner();
  119.  
  120. } else if ( IsGuidingProjectile() ) {
  121.  
  122. GuidingProjectile();
  123.  
  124. } else if ( AttackerDeathViewCheck() ) {
  125.  
  126. AttackerDeathView();
  127.  
  128. } else if ( !atl.vehicleDeath && vehicle && !IsZoomed() && !pfl.dead && ( pm_thirdPerson.GetBool() || vehicle->thirdpersonVehicle ) ) {
  129.  
  130. /*
  131. if ( !vehicle->thirdpersonCrossHair ) {
  132. HideCrosshair();
  133. } else {
  134. ShowCrosshair();
  135. }
  136. */
  137.  
  138. ThirdPersonView( pm_thirdPersonAngle.GetFloat(), (camera_zoom.GetCurrentValue( gameLocal.time )), vehicle->thirdpersonHeight, true, false, IsInVehicle() );
  139.  
  140. } else if ( !vehicle && !IsZoomed() && !pfl.dead && !atl.vehicleDeath && pm_thirdPerson.GetBool() ) {
  141.  
  142. /*
  143. if ( !pm_thirdpersonCrosshair.GetBool() ) {
  144. HideCrosshair();
  145. } else {
  146. ShowCrosshair();
  147. }
  148. */
  149.  
  150. ThirdPersonView( pm_thirdPersonAngle.GetFloat(), (camera_zoom.GetCurrentValue( gameLocal.time )), pm_thirdPersonHeight.GetFloat(), true, false, IsInVehicle() );
  151.  
  152. } else if ( ( pfl.dead || atl.vehicleDeath ) && pm_thirdPersonDeath.GetBool() ) {
  153.  
  154. if ( !pfl.thirdpersonDeath ) {
  155. pfl.thirdpersonDeath = true;
  156. deathAngle = GetLimitRandomInt( 1, 1079 );
  157. deathRange = GetLimitRandomInt( 130, 750 );
  158. deathHeight = GetLimitRandomInt( 30, 140 );
  159. }
  160.  
  161. //HideCrosshair();
  162.  
  163. ThirdPersonView( deathAngle, deathRange, deathHeight, true, true, false );
  164.  
  165. } else {
  166.  
  167. //ShowCrosshair();
  168.  
  169. renderView->vieworg = firstPersonViewOrigin;
  170. renderView->viewaxis = firstPersonViewAxis;
  171. renderView->viewID = entityNumber + 1;
  172.  
  173. }
  174.  
  175. // field of view
  176. gameLocal.CalcFov( CalcFov( IsZoomed() ), renderView->fov_x, renderView->fov_y );
  177.  
  178. pfl.cameraIsSet = true;
  179.  
  180. }
RAW Paste Data