components/prboom/p_floor.c
//
// EV_DoDonut()
//
// Handle donut function: lower pillar, raise surrounding pool, both to height,
// texture and type of the sector surrounding the pool.
//
// Passed the linedef that triggered the donut
// Returns whether a thinker was created
//
EV_DoDonut()
Handle donut function: lower pillar, raise surrounding pool, both to height,
texture and type of the sector surrounding the pool.

Passed the linedef that triggered the donut
Returns whether a thinker was created
EV_DoDonut () Handle donut function : lower pillar raise surrounding pool both to height texture and type of the sector surrounding the pool . Passed the linedef that triggered the donut Returns whether a thinker was created
int EV_DoDonut(line_t*  line)
{
  sector_t* s1;
  sector_t* s2;
  sector_t* s3;
  int       secnum;
  int       rtn;
  int       i;
  floormove_t* floor;
  secnum = -1;
  rtn = 0;
  while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
  {
    s1 = &sectors[secnum];                
    if (P_SectorActive(floor_special,s1)) 
      continue;
    s2 = getNextSector(s1->lines[0],s1);  
    if (!s2) continue;                    
    if (!comp[comp_floors] && P_SectorActive(floor_special,s2))
      continue;                           
    for (i = 0;i < s2->linecount;i++)
    {
      if (comp[comp_model])
      {
        if ((!s2->lines[i]->flags & ML_TWOSIDED) ||
            (s2->lines[i]->backsector == s1))
          continue;
      }
      else if (!s2->lines[i]->backsector || s2->lines[i]->backsector == s1)
        continue;
      rtn = 1; 
      s3 = s2->lines[i]->backsector;      
      floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
      memset(floor, 0, sizeof(*floor));
      P_AddThinker (&floor->thinker);
      s2->floordata = floor; 
      floor->thinker.function = T_MoveFloor;
      floor->type = donutRaise;
      floor->crush = false;
      floor->direction = 1;
      floor->sector = s2;
      floor->speed = FLOORSPEED / 2;
      floor->texture = s3->floorpic;
      floor->newspecial = 0;
      floor->floordestheight = s3->floorheight;
      floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
      memset(floor, 0, sizeof(*floor));
      P_AddThinker (&floor->thinker);
      s1->floordata = floor; 
      floor->thinker.function = T_MoveFloor;
      floor->type = lowerFloor;
      floor->crush = false;
      floor->direction = -1;
      floor->sector = s1;
      floor->speed = FLOORSPEED / 2;
      floor->floordestheight = s3->floorheight;
      break;
    }
  }
  return rtn;
}
int EV_DoDonut ( line_t * line ) { sector_t * s1 ; sector_t * s2 ; sector_t * s3 ; int secnum ; int rtn ; int i ; floormove_t * floor ; secnum = -1 ; rtn = 0 ; while ( ( secnum = P_FindSectorFromLineTag ( line , secnum ) ) >= 0 ) { s1 = & sectors [ secnum ] ; if ( P_SectorActive ( floor_special , s1 ) ) continue ; s2 = getNextSector ( s1 -> lines [ 0 ] , s1 ) ; if ( ! s2 ) continue ; if ( ! comp [ comp_floors ] && P_SectorActive ( floor_special , s2 ) ) continue ; for ( i = 0 ; i < s2 -> linecount ; i ++ ) { if ( comp [ comp_model ] ) { if ( ( ! s2 -> lines [ i ] -> flags & ML_TWOSIDED ) || ( s2 -> lines [ i ] -> backsector == s1 ) ) continue ; } else if ( ! s2 -> lines [ i ] -> backsector || s2 -> lines [ i ] -> backsector == s1 ) continue ; rtn = 1 ; s3 = s2 -> lines [ i ] -> backsector ; floor = Z_Malloc ( sizeof ( * floor ) , PU_LEVSPEC , 0 ) ; memset ( floor , 0 , sizeof ( * floor ) ) ; P_AddThinker ( & floor -> thinker ) ; s2 -> floordata = floor ; floor -> thinker . function = T_MoveFloor ; floor -> type = donutRaise ; floor -> crush = false ; floor -> direction = 1 ; floor -> sector = s2 ; floor -> speed = FLOORSPEED / 2 ; floor -> texture = s3 -> floorpic ; floor -> newspecial = 0 ; floor -> floordestheight = s3 -> floorheight ; floor = Z_Malloc ( sizeof ( * floor ) , PU_LEVSPEC , 0 ) ; memset ( floor , 0 , sizeof ( * floor ) ) ; P_AddThinker ( & floor -> thinker ) ; s1 -> floordata = floor ; floor -> thinker . function = T_MoveFloor ; floor -> type = lowerFloor ; floor -> crush = false ; floor -> direction = -1 ; floor -> sector = s1 ; floor -> speed = FLOORSPEED / 2 ; floor -> floordestheight = s3 -> floorheight ; break ; } } return rtn ; }
EV_DoDonut()
Handle donut function: lower pillar, raise surrounding pool, both to height,
texture and type of the sector surrounding the pool.
EV_DoDonut () Handle donut function : lower pillar raise surrounding pool both to height texture and type of the sector surrounding the pool .
// do function on all sectors with same tag as linedef // s1 is pillar's sector // do not start the donut if the pillar is already moving //jff 2/22/98 // s2 is pool's sector // note lowest numbered line around // pillar must be two-sided /* do not start the donut if the pool is already moving
     * cph - DEMOSYNC - was !compatibility */ //jff 5/7/98 // find a two sided line around the pool whose other side isn't the pillar //jff 3/29/98 use true two-sidedness, not the flag // killough 4/5/98: changed demo_compatibility to compatibility //jff 1/26/98 no donut action - no switch change on return // s3 is model sector for changes //  Spawn rising slime //jff 2/22/98 //  Spawn lowering donut-hole pillar //jff 2/22/98