Guest User

Untitled

a guest
Aug 19th, 2016
52
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. int i;
  8. idAngles delta;
  9.  
  10. if ( !noclip && ( gameLocal.inCinematic || privateCameraView || gameLocal.GetCamera() || influenceActive == INFLUENCE_LEVEL2 ) ) {
  11. // no view changes at all, but we still want to update the deltas or else when
  12. // we get out of this mode, our view will snap to a kind of random angle
  13. UpdateDeltaViewAngles( viewAngles );
  14. return;
  15. }
  16.  
  17. // if dead
  18. if ( health <= 0 ) {
  19. if ( pm_thirdPersonDeath.GetBool() ) {
  20. viewAngles.roll = 0.0f;
  21. viewAngles.pitch = 30.0f;
  22. } else {
  23. viewAngles.roll = 40.0f;
  24. viewAngles.pitch = -15.0f;
  25. }
  26. return;
  27. }
  28.  
  29. // circularly clamp the angles with deltas
  30. // if( gameLocal.localClientNum == entityNumber ) {
  31. // gameLocal.Printf( "BEFORE VIEWANGLES: %s\n", viewAngles.ToString() );
  32. // gameLocal.Printf( "\tUSERCMD: <%d, %d, %d>\n", usercmd.angles[ 0 ], usercmd.angles[ 1 ], usercmd.angles[ 2 ] );
  33. // gameLocal.Printf( "\tDELTAVIEW: %s\n", deltaViewAngles.ToString() );
  34. // }
  35. for ( i = 0; i < 3; i++ ) {
  36. cmdAngles[i] = SHORT2ANGLE( usercmd.angles[i] );
  37. if ( influenceActive == INFLUENCE_LEVEL3 ) {
  38. viewAngles[i] += idMath::ClampFloat( -1.0f, 1.0f, idMath::AngleDelta( idMath::AngleNormalize180( SHORT2ANGLE( usercmd.angles[i]) + deltaViewAngles[i] ) , viewAngles[i] ) );
  39. } else {
  40. viewAngles[i] = idMath::AngleNormalize180( SHORT2ANGLE( usercmd.angles[i] ) + deltaViewAngles[i] );
  41. }
  42. }
  43. if ( !centerView.IsDone( gameLocal.time ) ) {
  44. viewAngles.pitch = centerView.GetCurrentValue( gameLocal.time );
  45. }
  46. // if( gameLocal.localClientNum == entityNumber ) {
  47. // gameLocal.Printf( "AFTER VIEWANGLES: %s\n", viewAngles.ToString() );
  48. // }
  49.  
  50. // clamp the pitch
  51. if ( noclip ) {
  52. if ( viewAngles.pitch > 89.0f ) {
  53. // don't let the player look down more than 89 degrees while noclipping
  54. viewAngles.pitch = 89.0f;
  55. } else if ( viewAngles.pitch < -89.0f ) {
  56. // don't let the player look up more than 89 degrees while noclipping
  57. viewAngles.pitch = -89.0f;
  58. }
  59. } else {
  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. UpdateDeltaViewAngles( viewAngles );
  70.  
  71. // orient the model towards the direction we're looking
  72. SetAngles( idAngles( 0, viewAngles.yaw, 0 ) );
  73.  
  74. // save in the log for analyzing weapon angle offsets
  75. loggedViewAngles[ gameLocal.framenum & (NUM_LOGGED_VIEW_ANGLES-1) ] = viewAngles;
  76. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×