components/prboom/p_spec.c
//
// P_FindNextLowestCeiling()
//
// Passed a sector and a ceiling height, returns the fixed point value
// of the largest ceiling height in a surrounding sector smaller than
// the ceiling height passed. If no such height exists the ceiling height
// passed is returned.
//
// jff 02/03/98 Twiddled Lee's P_FindNextHighestFloor to make this
//
P_FindNextLowestCeiling()
Passed a sector and a ceiling height, returns the fixed point value
of the largest ceiling height in a surrounding sector smaller than
the ceiling height passed. If no such height exists the ceiling height
passed is returned.

jff 02/03/98 Twiddled Lee's P_FindNextHighestFloor to make this
P_FindNextLowestCeiling () Passed a sector and a ceiling height returns the fixed point value of the largest ceiling height in a surrounding sector smaller than the ceiling height passed . If no such height exists the ceiling height passed is returned . jff 02 / 03 / 98 Twiddled Lee ' s P_FindNextHighestFloor to make this
fixed_t P_FindNextLowestCeiling(sector_t *sec, int currentheight)
{
  sector_t *other;
  int i;
  for (i=0 ;i < sec->linecount ; i++)
    if ((other = getNextSector(sec->lines[i],sec)) &&
        other->ceilingheight < currentheight)
    {
      int height = other->ceilingheight;
      while (++i < sec->linecount)
        if ((other = getNextSector(sec->lines[i],sec)) &&
            other->ceilingheight > height &&
            other->ceilingheight < currentheight)
          height = other->ceilingheight;
      return height;
    }
  return currentheight;
}
fixed_t P_FindNextLowestCeiling ( sector_t * sec , int currentheight ) { sector_t * other ; int i ; for ( i = 0 ; i < sec -> linecount ; i ++ ) if ( ( other = getNextSector ( sec -> lines [ i ] , sec ) ) && other -> ceilingheight < currentheight ) { int height = other -> ceilingheight ; while ( ++ i < sec -> linecount ) if ( ( other = getNextSector ( sec -> lines [ i ] , sec ) ) && other -> ceilingheight > height && other -> ceilingheight < currentheight ) height = other -> ceilingheight ; return height ; } return currentheight ; }
P_FindNextLowestCeiling()
Passed a sector and a ceiling height, returns the fixed point value
of the largest ceiling height in a surrounding sector smaller than
the ceiling height passed.
P_FindNextLowestCeiling () Passed a sector and a ceiling height returns the fixed point value of the largest ceiling height in a surrounding sector smaller than the ceiling height passed .