components/prboom/p_floor.c
//
// T_MoveFloor()
//
// Move a floor to it's destination (up or down).
// Called once per tick for each moving floor.
//
// Passed a floormove_t structure that contains all pertinent info about the
// move. See P_SPEC.H for fields.
// No return.
//
// jff 02/08/98 all cases with labels beginning with gen added to support
// generalized line type behaviors.
T_MoveFloor()
Move a floor to it's destination (up or down).
Called once per tick for each moving floor.

Passed a floormove_t structure that contains all pertinent info about the
move.

jff 02/08/98 all cases with labels beginning with gen added to support
generalized line type behaviors.
T_MoveFloor () Move a floor to it ' s destination ( up or down ) . Called once per tick for each moving floor . Passed a floormove_t structure that contains all pertinent info about the move . jff 02 / 08 / 98 all cases with labels beginning with gen added to support generalized line type behaviors .
void T_MoveFloor(floormove_t* floor)
{
  result_e      res;
  res = T_MovePlane       
  (
    floor->sector,
    floor->speed,
    floor->floordestheight,
    floor->crush,
    0,
    floor->direction
  );
  if (!(leveltime&7))     
    S_StartSound((mobj_t *)&floor->sector->soundorg, sfx_stnmov);
  if (res == pastdest)    
  {
    if (floor->direction == 1)       
    {
      switch(floor->type) 
      {
        case donutRaise:
          floor->sector->special = floor->newspecial;
          floor->sector->floorpic = floor->texture;
          break;
        case genFloorChgT:
        case genFloorChg0:
          floor->sector->special = floor->newspecial;
          floor->sector->oldspecial = floor->oldspecial;
        case genFloorChg:
          floor->sector->floorpic = floor->texture;
          break;
        default:
          break;
      }
    }
    else if (floor->direction == -1) 
    {
      switch(floor->type) 
      {
        case lowerAndChange:
          floor->sector->special = floor->newspecial;
          floor->sector->oldspecial = floor->oldspecial;
          floor->sector->floorpic = floor->texture;
          break;
        case genFloorChgT:
        case genFloorChg0:
          floor->sector->special = floor->newspecial;
          floor->sector->oldspecial = floor->oldspecial;
        case genFloorChg:
          floor->sector->floorpic = floor->texture;
          break;
        default:
          break;
      }
    }
    floor->sector->floordata = NULL; 
    P_RemoveThinker(&floor->thinker);
    if (floor->sector->stairlock==-2) 
    {
      sector_t *sec = floor->sector;
      sec->stairlock=-1;              
      while (sec->prevsec!=-1 && sectors[sec->prevsec].stairlock!=-2)
        sec = &sectors[sec->prevsec]; 
      if (sec->prevsec==-1)           
      {
        sec = floor->sector;          
        while (sec->nextsec!=-1 && sectors[sec->nextsec].stairlock!=-2)
          sec = &sectors[sec->nextsec];
        if (sec->nextsec==-1)         
        {
          while (sec->prevsec!=-1)    
          {
            sec->stairlock = 0;
            sec = &sectors[sec->prevsec];
          }
          sec->stairlock = 0;
        }
      }
    }
    S_StartSound((mobj_t *)&floor->sector->soundorg, sfx_pstop);
  }
}
void T_MoveFloor ( floormove_t * floor ) { result_e res ; res = T_MovePlane ( floor -> sector , floor -> speed , floor -> floordestheight , floor -> crush , 0 , floor -> direction ) ; if ( ! ( leveltime & 7 ) ) S_StartSound ( ( mobj_t * ) & floor -> sector -> soundorg , sfx_stnmov ) ; if ( res == pastdest ) { if ( floor -> direction == 1 ) { switch ( floor -> type ) { case donutRaise : floor -> sector -> special = floor -> newspecial ; floor -> sector -> floorpic = floor -> texture ; break ; case genFloorChgT : case genFloorChg0 : floor -> sector -> special = floor -> newspecial ; floor -> sector -> oldspecial = floor -> oldspecial ; case genFloorChg : floor -> sector -> floorpic = floor -> texture ; break ; default : break ; } } else if ( floor -> direction == -1 ) { switch ( floor -> type ) { case lowerAndChange : floor -> sector -> special = floor -> newspecial ; floor -> sector -> oldspecial = floor -> oldspecial ; floor -> sector -> floorpic = floor -> texture ; break ; case genFloorChgT : case genFloorChg0 : floor -> sector -> special = floor -> newspecial ; floor -> sector -> oldspecial = floor -> oldspecial ; case genFloorChg : floor -> sector -> floorpic = floor -> texture ; break ; default : break ; } } floor -> sector -> floordata = NULL ; P_RemoveThinker ( & floor -> thinker ) ; if ( floor -> sector -> stairlock == -2 ) { sector_t * sec = floor -> sector ; sec -> stairlock = -1 ; while ( sec -> prevsec != -1 && sectors [ sec -> prevsec ] . stairlock != -2 ) sec = & sectors [ sec -> prevsec ] ; if ( sec -> prevsec == -1 ) { sec = floor -> sector ; while ( sec -> nextsec != -1 && sectors [ sec -> nextsec ] . stairlock != -2 ) sec = & sectors [ sec -> nextsec ] ; if ( sec -> nextsec == -1 ) { while ( sec -> prevsec != -1 ) { sec -> stairlock = 0 ; sec = & sectors [ sec -> prevsec ] ; } sec -> stairlock = 0 ; } } } S_StartSound ( ( mobj_t * ) & floor -> sector -> soundorg , sfx_pstop ) ; } }
T_MoveFloor()
Move a floor to it's destination (up or down).
T_MoveFloor () Move a floor to it ' s destination ( up or down ) .
// move the floor // make the floormove sound // if destination height is reached // going up // handle texture/type changes //jff add to fix bug in special transfers from changes //fall thru // going down // handle texture/type changes //jff add to fix bug in special transfers from changes //jff add to fix bug in special transfers from changes //fall thru //jff 2/22/98 //remove this floor from list of movers //jff 2/26/98 implement stair retrigger lockout while still building // note this only applies to the retriggerable generalized stairs // if this sector is stairlocked // thinker done, promote lock to -1 // search for a non-done thinker // if all thinkers previous are done // search forward // if all thinkers ahead are done too // clear all locks // make floor stop sound