components/prboom/p_floor.c
//
// T_MoveElevator()
//
// Move an elevator to it's destination (up or down)
// Called once per tick for each moving floor.
//
// Passed an elevator_t structure that contains all pertinent info about the
// move. See P_SPEC.H for fields.
// No return.
//
// jff 02/22/98 added to support parallel floor/ceiling motion
//
T_MoveElevator()
Move an elevator to it's destination (up or down)
Called once per tick for each moving floor.

Passed an elevator_t structure that contains all pertinent info about the
move.

jff 02/22/98 added to support parallel floor/ceiling motion
T_MoveElevator () Move an elevator to it ' s destination ( up or down ) Called once per tick for each moving floor . Passed an elevator_t structure that contains all pertinent info about the move . jff 02 / 22 / 98 added to support parallel floor / ceiling motion
void T_MoveElevator(elevator_t* elevator)
{
  result_e      res;
  if (elevator->direction<0)      
  {
    res = T_MovePlane             
    (
      elevator->sector,
      elevator->speed,
      elevator->ceilingdestheight,
      0,
      1,                          
      elevator->direction
    );
    if (res==ok || res==pastdest) 
      T_MovePlane
      (
        elevator->sector,
        elevator->speed,
        elevator->floordestheight,
        0,
        0,                        
        elevator->direction
      );
  }
  else 
  {
    res = T_MovePlane             
    (
      elevator->sector,
      elevator->speed,
      elevator->floordestheight,
      0,
      0,                          
      elevator->direction
    );
    if (res==ok || res==pastdest) 
      T_MovePlane
      (
        elevator->sector,
        elevator->speed,
        elevator->ceilingdestheight,
        0,
        1,                        
        elevator->direction
      );
  }
  if (!(leveltime&7))
    S_StartSound((mobj_t *)&elevator->sector->soundorg, sfx_stnmov);
  if (res == pastdest)            
  {
    elevator->sector->floordata = NULL;     
    elevator->sector->ceilingdata = NULL;   
    P_RemoveThinker(&elevator->thinker);    
    S_StartSound((mobj_t *)&elevator->sector->soundorg, sfx_pstop);
  }
}
void T_MoveElevator ( elevator_t * elevator ) { result_e res ; if ( elevator -> direction < 0 ) { res = T_MovePlane ( elevator -> sector , elevator -> speed , elevator -> ceilingdestheight , 0 , 1 , elevator -> direction ) ; if ( res == ok || res == pastdest ) T_MovePlane ( elevator -> sector , elevator -> speed , elevator -> floordestheight , 0 , 0 , elevator -> direction ) ; } else { res = T_MovePlane ( elevator -> sector , elevator -> speed , elevator -> floordestheight , 0 , 0 , elevator -> direction ) ; if ( res == ok || res == pastdest ) T_MovePlane ( elevator -> sector , elevator -> speed , elevator -> ceilingdestheight , 0 , 1 , elevator -> direction ) ; } if ( ! ( leveltime & 7 ) ) S_StartSound ( ( mobj_t * ) & elevator -> sector -> soundorg , sfx_stnmov ) ; if ( res == pastdest ) { elevator -> sector -> floordata = NULL ; elevator -> sector -> ceilingdata = NULL ; P_RemoveThinker ( & elevator -> thinker ) ; S_StartSound ( ( mobj_t * ) & elevator -> sector -> soundorg , sfx_pstop ) ; } }
T_MoveElevator()
Move an elevator to it's destination (up or down)
Called once per tick for each moving floor.
T_MoveElevator () Move an elevator to it ' s destination ( up or down ) Called once per tick for each moving floor .
// moving down //jff 4/7/98 reverse order of ceiling/floor // move floor // jff 4/7/98 don't move ceil if blocked // move ceiling // up //jff 4/7/98 reverse order of ceiling/floor // move ceiling // jff 4/7/98 don't move floor if blocked // move floor // make floor move sound // if destination height acheived //jff 2/22/98 //jff 2/22/98 // remove elevator from actives // make floor stop sound