components/prboom/p_ceilng.c
//
// T_MoveCeiling
//
// Action routine that moves ceilings. Called once per tick.
//
// Passed a ceiling_t structure that contains all the 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_MoveCeiling
Action routine that moves ceilings. Called once per tick.

Passed a ceiling_t structure that contains all the info about the move.

jff 02/08/98 all cases with labels beginning with gen added to support
generalized line type behaviors.
T_MoveCeiling Action routine that moves ceilings . Called once per tick . Passed a ceiling_t structure that contains all the info about the move . jff 02 / 08 / 98 all cases with labels beginning with gen added to support generalized line type behaviors .
void T_MoveCeiling (ceiling_t* ceiling)
{
  result_e  res;
  switch(ceiling->direction)
  {
    case 0:
      break;
    case 1:
      res = T_MovePlane
            (
              ceiling->sector,
              ceiling->speed,
              ceiling->topheight,
              false,
              1,
              ceiling->direction
            );
      if (!(leveltime&7))
      {
        switch(ceiling->type)
        {
          case silentCrushAndRaise:
          case genSilentCrusher:
            break;
          default:
            S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_stnmov);
            break;
        }
      }
      if (res == pastdest)
      {
        switch(ceiling->type)
        {
          case raiseToHighest:
          case genCeiling:
            P_RemoveActiveCeiling(ceiling);
            break;
          case genCeilingChgT:
          case genCeilingChg0:
            ceiling->sector->special = ceiling->newspecial;
            ceiling->sector->oldspecial = ceiling->oldspecial;
          case genCeilingChg:
            ceiling->sector->ceilingpic = ceiling->texture;
            P_RemoveActiveCeiling(ceiling);
            break;
          case silentCrushAndRaise:
            S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_pstop);
          case genSilentCrusher:
          case genCrusher:
          case fastCrushAndRaise:
          case crushAndRaise:
            ceiling->direction = -1;
            break;
          default:
            break;
        }
      }
      break;
    case -1:
      res = T_MovePlane
            (
              ceiling->sector,
              ceiling->speed,
              ceiling->bottomheight,
              ceiling->crush,
              1,
              ceiling->direction
            );
      if (!(leveltime&7))
      {
        switch(ceiling->type)
        {
          case silentCrushAndRaise:
          case genSilentCrusher:
            break;
          default:
            S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_stnmov);
        }
      }
      if (res == pastdest)
      {
        switch(ceiling->type)
        {
          case genSilentCrusher:
          case genCrusher:
            if (ceiling->oldspeed<CEILSPEED*3)
              ceiling->speed = ceiling->oldspeed;
            ceiling->direction = 1; 
            break;
          case silentCrushAndRaise:
            S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_pstop);
          case crushAndRaise:
            ceiling->speed = CEILSPEED;
          case fastCrushAndRaise:
            ceiling->direction = 1;
            break;
          case genCeilingChgT:
          case genCeilingChg0:
            ceiling->sector->special = ceiling->newspecial;
            ceiling->sector->oldspecial = ceiling->oldspecial;
          case genCeilingChg:
            ceiling->sector->ceilingpic = ceiling->texture;
            P_RemoveActiveCeiling(ceiling);
            break;
          case lowerAndCrush:
          case lowerToFloor:
          case lowerToLowest:
          case lowerToMaxFloor:
          case genCeiling:
            P_RemoveActiveCeiling(ceiling);
            break;
          default:
            break;
        }
      }
      else 
      {
        if (res == crushed)
        {
          switch(ceiling->type)
          {
            case genCrusher:
            case genSilentCrusher:
              if (ceiling->oldspeed < CEILSPEED*3)
                ceiling->speed = CEILSPEED / 8;
              break;
            case silentCrushAndRaise:
            case crushAndRaise:
            case lowerAndCrush:
                ceiling->speed = CEILSPEED / 8;
              break;
            default:
              break;
          }
        }
      }
      break;
  }
}
void T_MoveCeiling ( ceiling_t * ceiling ) { result_e res ; switch ( ceiling -> direction ) { case 0 : break ; case 1 : res = T_MovePlane ( ceiling -> sector , ceiling -> speed , ceiling -> topheight , false , 1 , ceiling -> direction ) ; if ( ! ( leveltime & 7 ) ) { switch ( ceiling -> type ) { case silentCrushAndRaise : case genSilentCrusher : break ; default : S_StartSound ( ( mobj_t * ) & ceiling -> sector -> soundorg , sfx_stnmov ) ; break ; } } if ( res == pastdest ) { switch ( ceiling -> type ) { case raiseToHighest : case genCeiling : P_RemoveActiveCeiling ( ceiling ) ; break ; case genCeilingChgT : case genCeilingChg0 : ceiling -> sector -> special = ceiling -> newspecial ; ceiling -> sector -> oldspecial = ceiling -> oldspecial ; case genCeilingChg : ceiling -> sector -> ceilingpic = ceiling -> texture ; P_RemoveActiveCeiling ( ceiling ) ; break ; case silentCrushAndRaise : S_StartSound ( ( mobj_t * ) & ceiling -> sector -> soundorg , sfx_pstop ) ; case genSilentCrusher : case genCrusher : case fastCrushAndRaise : case crushAndRaise : ceiling -> direction = -1 ; break ; default : break ; } } break ; case -1 : res = T_MovePlane ( ceiling -> sector , ceiling -> speed , ceiling -> bottomheight , ceiling -> crush , 1 , ceiling -> direction ) ; if ( ! ( leveltime & 7 ) ) { switch ( ceiling -> type ) { case silentCrushAndRaise : case genSilentCrusher : break ; default : S_StartSound ( ( mobj_t * ) & ceiling -> sector -> soundorg , sfx_stnmov ) ; } } if ( res == pastdest ) { switch ( ceiling -> type ) { case genSilentCrusher : case genCrusher : if ( ceiling -> oldspeed < CEILSPEED * 3 ) ceiling -> speed = ceiling -> oldspeed ; ceiling -> direction = 1 ; break ; case silentCrushAndRaise : S_StartSound ( ( mobj_t * ) & ceiling -> sector -> soundorg , sfx_pstop ) ; case crushAndRaise : ceiling -> speed = CEILSPEED ; case fastCrushAndRaise : ceiling -> direction = 1 ; break ; case genCeilingChgT : case genCeilingChg0 : ceiling -> sector -> special = ceiling -> newspecial ; ceiling -> sector -> oldspecial = ceiling -> oldspecial ; case genCeilingChg : ceiling -> sector -> ceilingpic = ceiling -> texture ; P_RemoveActiveCeiling ( ceiling ) ; break ; case lowerAndCrush : case lowerToFloor : case lowerToLowest : case lowerToMaxFloor : case genCeiling : P_RemoveActiveCeiling ( ceiling ) ; break ; default : break ; } } else { if ( res == crushed ) { switch ( ceiling -> type ) { case genCrusher : case genSilentCrusher : if ( ceiling -> oldspeed < CEILSPEED * 3 ) ceiling -> speed = CEILSPEED / 8 ; break ; case silentCrushAndRaise : case crushAndRaise : case lowerAndCrush : ceiling -> speed = CEILSPEED / 8 ; break ; default : break ; } } } break ; } }
T_MoveCeiling
Action routine that moves ceilings.
T_MoveCeiling Action routine that moves ceilings .
// If ceiling in stasis, do nothing // Ceiling is moving up // if not a silent crusher, make moving sound // handle reaching destination height // plain movers are just removed // movers with texture change, change the texture then get removed //jff 3/14/98 transfer old special field as well // crushers reverse direction at the top // Ceiling moving down // if not silent crusher type make moving sound // handle reaching destination height // 02/09/98 jff change slow crushers' speed back to normal // start back up //jff 2/22/98 make it go back up! // make platform stop at bottom of all crusher strokes // except generalized ones, reset speed, start back up // in the case of ceiling mover/changer, change the texture // then remove the active ceiling //jff add to fix bug in special transfers from changes // all other case, just remove the active ceiling // ( res != pastdest ) // handle the crusher encountering an obstacle //jff 02/08/98 slow down slow crushers on obstacle