components/prboom/p_spec.c
//
// P_FindModelFloorSector()
//
// Passed a floor height and a sector number, return a pointer to a
// a sector with that floor height across the lowest numbered two sided
// line surrounding the sector.
//
// Note: If no sector at that height bounds the sector passed, return NULL
//
// jff 02/03/98 Add routine to find numeric model floor
//  around a sector specified by sector number
// jff 3/14/98 change first parameter to plain height to allow call
//  from routine not using floormove_t
//
P_FindModelFloorSector()
Passed a floor height and a sector number, return a pointer to a
a sector with that floor height across the lowest numbered two sided
line surrounding the sector.

If no sector at that height bounds the sector passed, return NULL

jff 02/03/98 Add routine to find numeric model floor
around a sector specified by sector number
jff 3/14/98 change first parameter to plain height to allow call
from routine not using floormove_t
P_FindModelFloorSector () Passed a floor height and a sector number return a pointer to a a sector with that floor height across the lowest numbered two sided line surrounding the sector . If no sector at that height bounds the sector passed return NULL jff 02 / 03 / 98 Add routine to find numeric model floor around a sector specified by sector number jff 3 / 14 / 98 change first parameter to plain height to allow call from routine not using floormove_t
sector_t *P_FindModelFloorSector(fixed_t floordestheight,int secnum)
{
  int i;
  sector_t *sec=NULL;
  int linecount;
  sec = &sectors[secnum]; 
  linecount = sec->linecount;
  for (i = 0; i < (demo_compatibility && sec->linecount<linecount?
                   sec->linecount : linecount); i++)
  {
    if ( twoSided(secnum, i) )
    {
      if (getSide(secnum,i,0)->sector-sectors == secnum)
          sec = getSector(secnum,i,1);
      else
          sec = getSector(secnum,i,0);
      if (sec->floorheight == floordestheight)
        return sec;
    }
  }
  return NULL;
}
sector_t * P_FindModelFloorSector ( fixed_t floordestheight , int secnum ) { int i ; sector_t * sec = NULL ; int linecount ; sec = & sectors [ secnum ] ; linecount = sec -> linecount ; for ( i = 0 ; i < ( demo_compatibility && sec -> linecount < linecount ? sec -> linecount : linecount ) ; i ++ ) { if ( twoSided ( secnum , i ) ) { if ( getSide ( secnum , i , 0 ) -> sector - sectors == secnum ) sec = getSector ( secnum , i , 1 ) ; else sec = getSector ( secnum , i , 0 ) ; if ( sec -> floorheight == floordestheight ) return sec ; } } return NULL ; }
P_FindModelFloorSector()
Passed a floor height and a sector number, return a pointer to a
a sector with that floor height across the lowest numbered two sided
line surrounding the sector.
P_FindModelFloorSector () Passed a floor height and a sector number return a pointer to a a sector with that floor height across the lowest numbered two sided line surrounding the sector .
//jff 3/2/98 woops! better do this //jff 5/23/98 don't disturb sec->linecount while searching // but allow early exit in old demos