Guest User

Untitled

a guest
Dec 29th, 2014
342
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void CInput::CreateMove ( int sequence_number, float input_sample_frametime, bool active )
  2. {    
  3.     CUserCmd *cmd = &m_pCommands[ sequence_number % MULTIPLAYER_BACKUP];
  4.  
  5.     cmd->Reset();
  6.  
  7.     cmd->command_number = sequence_number;
  8.     cmd->tick_count = gpGlobals->tickcount;
  9.  
  10.     QAngle viewangles;
  11.  
  12.     if ( active || sv_noclipduringpause.GetInt() )
  13.     {
  14.         // Determine view angles
  15.         AdjustAngles ( input_sample_frametime );
  16.  
  17.         // Determine sideways movement
  18.         ComputeSideMove( cmd );
  19.  
  20.         // Determine vertical movement
  21.         ComputeUpwardMove( cmd );
  22.  
  23.         // Determine forward movement
  24.         ComputeForwardMove( cmd );
  25.  
  26.         // Scale based on holding speed key or having too fast of a velocity based on client maximum
  27.         //  speed.
  28.         ScaleMovements( cmd );
  29.  
  30.         // Allow mice and other controllers to add their inputs
  31.         ControllerMove( input_sample_frametime, cmd );
  32.     }
  33.     else
  34.     {
  35.         // need to run and reset mouse input so that there is no view pop when unpausing
  36.         if ( !m_fCameraInterceptingMouse && m_fMouseActive )
  37.         {
  38.             float mx, my;
  39.             GetAccumulatedMouseDeltasAndResetAccumulators( &mx, &my );
  40.             ResetMouse();
  41.         }
  42.     }
  43.     // Retreive view angles from engine ( could have been set in IN_AdjustAngles above )
  44.     engine->GetViewAngles( viewangles );
  45.  
  46.     // Latch and clear impulse
  47.     cmd->impulse = in_impulse;
  48.     in_impulse = 0;
  49.  
  50.     // Latch and clear weapon selection
  51.     if ( m_hSelectedWeapon != NULL )
  52.     {
  53.         C_BaseCombatWeapon *weapon = m_hSelectedWeapon;
  54.  
  55.         cmd->weaponselect = weapon->entindex();
  56.         cmd->weaponsubtype = weapon->GetSubType();
  57.  
  58.         // Always clear weapon selection
  59.         m_hSelectedWeapon = NULL;
  60.     }
  61.  
  62.     // Set button and flag bits
  63.     cmd->buttons = GetButtonBits( 1 );
  64.  
  65.     // Using joystick?
  66.     if ( in_joystick.GetInt() )
  67.     {
  68.         if ( cmd->forwardmove > 0 )
  69.         {
  70.             cmd->buttons |= IN_FORWARD;
  71.         }
  72.         else if ( cmd->forwardmove < 0 )
  73.         {
  74.             cmd->buttons |= IN_BACK;
  75.         }
  76.     }
  77.  
  78.     // Use new view angles if alive, otherwise user last angles we stored off.
  79.     if ( g_iAlive )
  80.     {
  81.         VectorCopy( viewangles, cmd->viewangles );
  82.         VectorCopy( viewangles, m_angPreviousViewAngles );
  83.     }
  84.     else
  85.     {
  86.         VectorCopy( m_angPreviousViewAngles, cmd->viewangles );
  87.     }
  88.  
  89.     // Let the move manager override anything it wants to.
  90.     if ( g_pClientMode->CreateMove( input_sample_frametime, cmd ) )
  91.     {
  92.         // Get current view angles after the client mode tweaks with it
  93.         engine->SetViewAngles( cmd->viewangles );
  94.     }
  95.  
  96.     m_flLastForwardMove = cmd->forwardmove;
  97.  
  98.     cmd->random_seed = MD5_PseudoRandom( sequence_number ) & 0x7fffffff;
  99.  
  100.     HLTVCamera()->CreateMove( cmd );
  101.  
  102. #if defined( HL2_CLIENT_DLL )
  103.     // copy backchannel data
  104.     int i;
  105.     for (i = 0; i < m_EntityGroundContact.Count(); i++)
  106.     {
  107.         cmd->entitygroundcontact.AddToTail( m_EntityGroundContact[i] );
  108.     }
  109.     m_EntityGroundContact.RemoveAll();
  110. #endif
  111. }
RAW Paste Data