jewalky

Untitled

Feb 26th, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.41 KB | None | 0 0
  1. static void client_DoFloor( BYTESTREAM_s *pByteStream )
  2. {
  3.     LONG            lType;
  4.     LONG            lDirection;
  5.     LONG            FloorDestDist;
  6.     LONG            lSpeed;
  7.     LONG            lSectorID;
  8.     LONG            lFloorID;
  9.     sector_t        *pSector;
  10.     DFloor          *pFloor;
  11.  
  12.     // Read in the type of floor.
  13.     lType = NETWORK_ReadByte( pByteStream );
  14.  
  15.     // Read in the sector ID.
  16.     lSectorID = NETWORK_ReadShort( pByteStream );
  17.  
  18.     // Read in the direction of the floor.
  19.     lDirection = NETWORK_ReadByte( pByteStream );
  20.  
  21.     // Read in the speed of the floor.
  22.     lSpeed = NETWORK_ReadLong( pByteStream );
  23.  
  24.     // Read in the floor's destination height.
  25.     FloorDestDist = NETWORK_ReadLong( pByteStream );
  26.  
  27.     // Read in the floor's network ID.
  28.     lFloorID = NETWORK_ReadShort( pByteStream );
  29.  
  30.     // Since we still want to receive direction as a byte, but -1 can't be represented in byte
  31.     // form, adjust the value into something that can be represented.
  32.     lDirection = CLIENT_AdjustFloorDirection( lDirection );
  33.     if ( lDirection == INT_MAX )
  34.         return;
  35.  
  36.     // Invalid sector.
  37.     if (( lSectorID >= numsectors ) || ( lSectorID < 0 ))
  38.         return;
  39.  
  40.     pSector = &sectors[lSectorID];
  41.  
  42.     // If the sector already has activity, don't override it.
  43.     if ( pSector->floordata )
  44.         return;
  45.  
  46.     pFloor = new DFloor( pSector );
  47.     pFloor->SetType( (DFloor::EFloor)lType );
  48.     pFloor->SetDirection( lDirection );
  49.     pFloor->SetFloorDestDist( FloorDestDist );
  50.     pFloor->SetSpeed( lSpeed );
  51.     pFloor->SetID( lFloorID );
  52. }
Add Comment
Please, Sign In to add comment