Advertisement
Guest User

InterpolateServerEntities

a guest
Nov 20th, 2015
1,134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. void C_BaseEntity::InterpolateServerEntities()
  2. {
  3.     VPROF_BUDGET( "C_BaseEntity::InterpolateServerEntities", VPROF_BUDGETGROUP_INTERPOLATION );
  4.  
  5.     s_bInterpolate = cl_interpolate.GetBool();
  6.  
  7.     // Don't interpolate during timedemo playback
  8.     if ( engine->IsPlayingTimeDemo() )
  9.     {                                        
  10.         s_bInterpolate = false;
  11.     }
  12.  
  13.     // Don't interpolate, either, if we are timing out
  14.     INetChannelInfo *nci = engine->GetNetChannelInfo();
  15.     if ( nci && nci->GetTimeSinceLastReceived() > 0.5f )
  16.     {
  17.         s_bInterpolate = false;
  18.     }
  19.  
  20.     if ( IsSimulatingOnAlternateTicks() != g_bWasSkipping ||
  21.          IsEngineThreaded() != g_bWasThreaded ||
  22.          cl_interp_threadmodeticks.GetInt() != g_nThreadModeTicks )
  23.     {
  24.         g_bWasSkipping = IsSimulatingOnAlternateTicks();
  25.         g_bWasThreaded = IsEngineThreaded();
  26.         g_nThreadModeTicks = cl_interp_threadmodeticks.GetInt();
  27.  
  28.         C_BaseEntityIterator iterator;
  29.         C_BaseEntity *pEnt;
  30.         while ( (pEnt = iterator.Next()) != NULL )
  31.         {
  32.             pEnt->Interp_UpdateInterpolationAmounts( pEnt->GetVarMapping() );
  33.         }
  34.     }
  35.  
  36.     // Enable extrapolation?
  37.     CInterpolationContext context;
  38.     context.SetLastTimeStamp( engine->GetLastTimeStamp() );
  39.     if ( cl_extrapolate.GetBool() && !engine->IsPaused() )
  40.     {
  41.         context.EnableExtrapolation( true );
  42.     }
  43.  
  44.     // Smoothly interpolate position for server entities.
  45.     ProcessTeleportList();
  46.     ProcessInterpolatedList();
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement