components/prboom/p_doors.c
//
// EV_DoDoor
//
// Handle opening a tagged door
//
// Passed the line activating the door and the type of door
// Returns true if a thinker created
//
EV_DoDoor
Handle opening a tagged door

Passed the line activating the door and the type of door
Returns true if a thinker created
EV_DoDoor Handle opening a tagged door Passed the line activating the door and the type of door Returns true if a thinker created
int EV_DoDoor
( line_t* line,
  vldoor_e  type )
{
  int   secnum,rtn;
  sector_t* sec;
  vldoor_t* door;
  secnum = -1;
  rtn = 0;
  while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
  {
    sec = &sectors[secnum];
    if (P_SectorActive(ceiling_special,sec)) 
        continue;
    rtn = 1;
    door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
    memset(door, 0, sizeof(*door));
    P_AddThinker (&door->thinker);
    sec->ceilingdata = door; 
    door->thinker.function = T_VerticalDoor;
    door->sector = sec;
    door->type = type;
    door->topwait = VDOORWAIT;
    door->speed = VDOORSPEED;
    door->line = line; 
    door->lighttag = 0; 
    switch(type)
    {
      case blazeClose:
        door->topheight = P_FindLowestCeilingSurrounding(sec);
        door->topheight -= 4*FRACUNIT;
        door->direction = -1;
        door->speed = VDOORSPEED * 4;
        S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdcls);
        break;
      case close:
        door->topheight = P_FindLowestCeilingSurrounding(sec);
        door->topheight -= 4*FRACUNIT;
        door->direction = -1;
        S_StartSound((mobj_t *)&door->sector->soundorg,sfx_dorcls);
        break;
      case close30ThenOpen:
        door->topheight = sec->ceilingheight;
        door->direction = -1;
        S_StartSound((mobj_t *)&door->sector->soundorg,sfx_dorcls);
        break;
      case blazeRaise:
      case blazeOpen:
        door->direction = 1;
        door->topheight = P_FindLowestCeilingSurrounding(sec);
        door->topheight -= 4*FRACUNIT;
        door->speed = VDOORSPEED * 4;
        if (door->topheight != sec->ceilingheight)
          S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdopn);
        break;
      case normal:
      case open:
        door->direction = 1;
        door->topheight = P_FindLowestCeilingSurrounding(sec);
        door->topheight -= 4*FRACUNIT;
        if (door->topheight != sec->ceilingheight)
          S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn);
        break;
      default:
        break;
    }
  }
  return rtn;
}
int EV_DoDoor ( line_t * line , vldoor_e type ) { int secnum , rtn ; sector_t * sec ; vldoor_t * door ; secnum = -1 ; rtn = 0 ; while ( ( secnum = P_FindSectorFromLineTag ( line , secnum ) ) >= 0 ) { sec = & sectors [ secnum ] ; if ( P_SectorActive ( ceiling_special , sec ) ) continue ; rtn = 1 ; door = Z_Malloc ( sizeof ( * door ) , PU_LEVSPEC , 0 ) ; memset ( door , 0 , sizeof ( * door ) ) ; P_AddThinker ( & door -> thinker ) ; sec -> ceilingdata = door ; door -> thinker . function = T_VerticalDoor ; door -> sector = sec ; door -> type = type ; door -> topwait = VDOORWAIT ; door -> speed = VDOORSPEED ; door -> line = line ; door -> lighttag = 0 ; switch ( type ) { case blazeClose : door -> topheight = P_FindLowestCeilingSurrounding ( sec ) ; door -> topheight -= 4 * FRACUNIT ; door -> direction = -1 ; door -> speed = VDOORSPEED * 4 ; S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_bdcls ) ; break ; case close : door -> topheight = P_FindLowestCeilingSurrounding ( sec ) ; door -> topheight -= 4 * FRACUNIT ; door -> direction = -1 ; S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_dorcls ) ; break ; case close30ThenOpen : door -> topheight = sec -> ceilingheight ; door -> direction = -1 ; S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_dorcls ) ; break ; case blazeRaise : case blazeOpen : door -> direction = 1 ; door -> topheight = P_FindLowestCeilingSurrounding ( sec ) ; door -> topheight -= 4 * FRACUNIT ; door -> speed = VDOORSPEED * 4 ; if ( door -> topheight != sec -> ceilingheight ) S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_bdopn ) ; break ; case normal : case open : door -> direction = 1 ; door -> topheight = P_FindLowestCeilingSurrounding ( sec ) ; door -> topheight -= 4 * FRACUNIT ; if ( door -> topheight != sec -> ceilingheight ) S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_doropn ) ; break ; default : break ; } } return rtn ; }
EV_DoDoor
Handle opening a tagged door
EV_DoDoor Handle opening a tagged door
// open all doors with the same tag as the activating line // if the ceiling already moving, don't start the door action //jff 2/22/98 // new door thinker //jff 2/22/98 // jff 1/31/98 remember line that triggered us /* killough 10/98: no light effects with tagged doors */ // setup door parameters according to type of door