home *** CD-ROM | disk | FTP | other *** search
/ Game Level Design / GLDesign.bin / Software / UnrealEngine2Runtime / UE2Runtime-22262001_Demo.exe / Engine / Classes / SavedMove.uc < prev    next >
Text File  |  2003-06-23  |  2KB  |  69 lines

  1. //=============================================================================
  2. // SavedMove is used during network play to buffer recent client moves,
  3. // for use when the server modifies the clients actual position, etc.
  4. // This is a built-in Unreal class and it shouldn't be modified.
  5. //=============================================================================
  6. class SavedMove extends Info;
  7.  
  8. // also stores info in Acceleration attribute
  9. var SavedMove NextMove;        // Next move in linked list.
  10. var float TimeStamp;        // Time of this move.
  11. var float Delta;            // Distance moved.
  12. var bool    bRun;
  13. var bool    bDuck;
  14. var bool    bPressedJump;
  15. var bool    bDoubleJump;
  16. var EDoubleClickDir DoubleClickMove;    // Double click info.
  17. var EPhysics SavedPhysics;
  18. var vector SavedLocation, SavedVelocity;
  19.  
  20. final function Clear()
  21. {
  22.     TimeStamp = 0;
  23.     Delta = 0;
  24.     DoubleClickMove = DCLICK_None;
  25.     Acceleration = vect(0,0,0);
  26.     bRun = false;
  27.     bDuck = false;
  28.     bPressedJump = false;
  29.     bDoubleJump = false;
  30. }
  31.  
  32. final function PostUpdate(PlayerController P)
  33. {
  34.     bDoubleJump = P.bDoubleJump || bDoubleJump;
  35.     if ( P.Pawn != None )
  36.     {
  37.         SavedLocation = P.Pawn.Location;
  38.         SavedVelocity = P.Pawn.Velocity;
  39.     }
  40. }
  41.  
  42. final function SetMoveFor(PlayerController P, float DeltaTime, vector NewAccel, EDoubleClickDir InDoubleClick)
  43. {
  44.     if ( VSize(NewAccel) > 3072 )
  45.         NewAccel = 3072 * Normal(NewAccel);
  46.     if ( Delta > 0 )
  47.         Acceleration = (DeltaTime * NewAccel + Delta * Acceleration)/(Delta + DeltaTime);
  48.     else
  49.     {
  50.         if ( P.Pawn != None )
  51.             SavedPhysics = P.Pawn.Physics;
  52.         Acceleration = NewAccel;
  53.     }
  54.     Delta += DeltaTime;
  55.     
  56.     if ( DoubleClickMove == eDoubleClickDir.DCLICK_None )
  57.         DoubleClickMove = InDoubleClick;
  58.     bRun = (P.bRun > 0);
  59.     bDuck = (P.bDuck > 0);
  60.     bPressedJump = P.bPressedJump || bPressedJump;
  61.     bDoubleJump = P.bDoubleJump || bDoubleJump;
  62.     TimeStamp = Level.TimeSeconds;
  63. }
  64.  
  65. defaultproperties
  66. {
  67.      bHidden=True
  68. }
  69.