Advertisement
Rolzzandik

Untitled

Jun 4th, 2021
765
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if ( LagRecord.m_SimulationTime - ( LagRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_JUMP_OR_FALL ).m_flCycle / LagRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_JUMP_OR_FALL ).m_flPlaybackRate )
  2.         >= pPlayer->m_flOldSimulationTime( ) )
  3.         LagRecord.m_Flags |= FL_ONGROUND;
  4.    
  5.     float_t flWeight = ( 1.0f - LagRecord.m_AnimationLayers.at( 11 ).m_flWeight ) / 2.8571432;
  6.     if ( flWeight > 0.0f )
  7.     {
  8.         float_t flSpeed = ( flWeight + 0.55f ) * pPlayer->GetMaxPlayerSpeed( );
  9.         if ( flSpeed > 0.0f && LagRecord.m_Velocity.Length( ) > 0.0f )
  10.             LagRecord.m_Velocity /= LagRecord.m_Velocity.Length( ) / flSpeed;
  11.     }
  12.     else if ( !( LagRecord.m_Flags & FL_ONGROUND ) )
  13.     {
  14.         float_t flCurrentVelocityDirection = Math::NormalizeAngle( RAD2DEG( atan2( LagRecord.m_Velocity.x, LagRecord.m_Velocity.y ) ) );
  15.         float_t flPreviousVelocityDirection = Math::NormalizeAngle( RAD2DEG( atan2( g_PlayerData[ pPlayer->EntIndex( ) ].m_PreviousRecord.m_Velocity.x, g_PlayerData[ pPlayer->EntIndex( ) ].m_PreviousRecord.m_Velocity.y ) ) );
  16.         float_t flAverageVelocityDirection = DEG2RAD( Math::NormalizeAngle( flCurrentVelocityDirection + ( ( flCurrentVelocityDirection - flPreviousVelocityDirection ) * 0.5f ) ) );
  17.  
  18.         float_t flDirectionCos = cos( flAverageVelocityDirection );
  19.         float_t flDirectionSin = sin( flAverageVelocityDirection );
  20.  
  21.         if ( LagRecord.m_Velocity.Length2D( ) > 0.0f )
  22.         {
  23.             LagRecord.m_Velocity.x /= LagRecord.m_Velocity.Length2D( );
  24.             LagRecord.m_Velocity.y /= LagRecord.m_Velocity.Length2D( );
  25.         }
  26.  
  27.         if ( flDirectionCos > 0.0f )
  28.             LagRecord.m_Velocity.x *= flDirectionCos;
  29.  
  30.         if ( flDirectionSin > 0.0f )
  31.             LagRecord.m_Velocity.y *= flDirectionSin;
  32.  
  33.         LagRecord.m_Velocity.z -= g_Globals.m_ConVars.m_SvGravity->GetFloat( ) * TICKS_TO_TIME( LagRecord.m_ChokedTicks ) * 0.5f;
  34.     }
  35.  
  36.     LagRecord.m_DuckAmount = pPlayer->m_flDuckAmount( );
  37.     if ( g_PlayerData[ pPlayer->EntIndex( ) ].m_bHasPreviousRecord )
  38.         LagRecord.m_DuckPerTick = ( LagRecord.m_DuckAmount - g_PlayerData[ pPlayer->EntIndex( ) ].m_PreviousRecord.m_DuckAmount ) / LagRecord.m_ChokedTicks;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement