components/prboom/p_spec.c
//
// P_FindNextHighestFloor()
//
// Passed a sector and a floor height, returns the fixed point value
// of the smallest floor height in a surrounding sector larger than
// the floor height passed. If no such height exists the floorheight
// passed is returned.
//
// Rewritten by Lee Killough to avoid fixed array and to be faster
//
P_FindNextHighestFloor()
Passed a sector and a floor height, returns the fixed point value
of the smallest floor height in a surrounding sector larger than
the floor height passed. If no such height exists the floorheight
passed is returned.

Rewritten by Lee Killough to avoid fixed array and to be faster
P_FindNextHighestFloor () Passed a sector and a floor height returns the fixed point value of the smallest floor height in a surrounding sector larger than the floor height passed . If no such height exists the floorheight passed is returned . Rewritten by Lee Killough to avoid fixed array and to be faster
fixed_t P_FindNextHighestFloor(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->floorheight > currentheight)
    {
      int height = other->floorheight;
      while (++i < sec->linecount)
        if ((other = getNextSector(sec->lines[i],sec)) &&
            other->floorheight < height &&
            other->floorheight > currentheight)
          height = other->floorheight;
      return height;
    }
  return (compatibility_level < doom_1666_compatibility ? 0 : currentheight);
}
fixed_t P_FindNextHighestFloor ( 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 -> floorheight > currentheight ) { int height = other -> floorheight ; while ( ++ i < sec -> linecount ) if ( ( other = getNextSector ( sec -> lines [ i ] , sec ) ) && other -> floorheight < height && other -> floorheight > currentheight ) height = other -> floorheight ; return height ; } return ( compatibility_level < doom_1666_compatibility ? 0 : currentheight ) ; }
P_FindNextHighestFloor()
Passed a sector and a floor height, returns the fixed point value
of the smallest floor height in a surrounding sector larger than
the floor height passed.
P_FindNextHighestFloor () Passed a sector and a floor height returns the fixed point value of the smallest floor height in a surrounding sector larger than the floor height passed .
/* cph - my guess at doom v1.2 - 1.4beta compatibility here.
   * If there are no higher neighbouring sectors, Heretic just returned
   * heightlist[0] (local variable), i.e. noise off the stack. 0 is right for
   * RETURN01 E1M2, so let's take that. */