components/prboom/p_doors.c
//
// T_VerticalDoor
//
// Passed a door structure containing all info about the door.
// See P_SPEC.H for fields.
// Returns nothing.
//
// jff 02/08/98 all cases with labels beginning with gen added to support
// generalized line type behaviors.
T_VerticalDoor
Passed a door structure containing all info about the door.

jff 02/08/98 all cases with labels beginning with gen added to support
generalized line type behaviors.
T_VerticalDoor Passed a door structure containing all info about the door . jff 02 / 08 / 98 all cases with labels beginning with gen added to support generalized line type behaviors .
void T_VerticalDoor (vldoor_t* door)
{
  result_e  res;
  switch(door->direction)
  {
    case 0:
      if (!--door->topcountdown)  
      {
        switch(door->type)
        {
          case blazeRaise:
          case genBlazeRaise:
            door->direction = -1; 
            S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdcls);
            break;
          case normal:
          case genRaise:
            door->direction = -1; 
            S_StartSound((mobj_t *)&door->sector->soundorg,sfx_dorcls);
            break;
          case close30ThenOpen:
          case genCdO:
            door->direction = 1;  
            S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn);
            break;
          case genBlazeCdO:
            door->direction = 1;  
            S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdopn);
            break;
          default:
            break;
        }
      }
      break;
    case 2:
      if (!--door->topcountdown)  
      {
        switch(door->type)
        {
          case raiseIn5Mins:
            door->direction = 1;  
            door->type = normal;  
            S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn);
            break;
          default:
            break;
        }
      }
      break;
    case -1:
      res = T_MovePlane
            (
              door->sector,
              door->speed,
              door->sector->floorheight,
              false,
              1,
              door->direction
            );
      if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level >= mbf_compatibility)
        EV_LightTurnOnPartway(door->line,
                              FixedDiv(door->sector->ceilingheight -
                                       door->sector->floorheight,
                                       door->topheight -
                                       door->sector->floorheight));
      if (res == pastdest)
      {
        switch(door->type)
        {
          case blazeRaise:
          case blazeClose:
          case genBlazeRaise:
          case genBlazeClose:
            door->sector->ceilingdata = NULL;  
            P_RemoveThinker (&door->thinker);  
            if (comp[comp_blazing])
              S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdcls);
            break;
          case normal:
          case close:
          case genRaise:
          case genClose:
            door->sector->ceilingdata = NULL; 
            P_RemoveThinker (&door->thinker);  
            break;
          case close30ThenOpen:
            door->direction = 0;
            door->topcountdown = TICRATE*30;
            break;
          case genCdO:
          case genBlazeCdO:
            door->direction = 0;
            door->topcountdown = door->topwait; 
            break;
          default:
            break;
        }
        if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level < mbf_compatibility)
          EV_LightTurnOnPartway(door->line,0);
      }
      else if (res == crushed) 
      {
        switch(door->type)
        {
          case genClose:
          case genBlazeClose:
          case blazeClose:
          case close:          
            break;
          case blazeRaise:
          case genBlazeRaise:
            door->direction = 1;
	    if (!comp[comp_blazing]) {
	      S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdopn);
	      break;
	    }
          default:             
            door->direction = 1;
            S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn);
            break;
        }
      }
      break;
    case 1:
      res = T_MovePlane
            (
              door->sector,
              door->speed,
              door->topheight,
              false,
              1,
              door->direction
            );
      if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level >= mbf_compatibility)
        EV_LightTurnOnPartway(door->line,
                              FixedDiv(door->sector->ceilingheight -
                                       door->sector->floorheight,
                                       door->topheight -
                                       door->sector->floorheight));
      if (res == pastdest)
      {
        switch(door->type)
        {
          case blazeRaise:       
          case normal:
          case genRaise:
          case genBlazeRaise:
            door->direction = 0; 
            door->topcountdown = door->topwait;
            break;
          case close30ThenOpen:  
          case blazeOpen:
          case open:
          case genBlazeOpen:
          case genOpen:
          case genCdO:
          case genBlazeCdO:
            door->sector->ceilingdata = NULL; 
            P_RemoveThinker (&door->thinker); 
            break;
          default:
            break;
        }
        if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level < mbf_compatibility)
          EV_LightTurnOnPartway(door->line,FRACUNIT);
      }
      break;
  }
}
void T_VerticalDoor ( vldoor_t * door ) { result_e res ; switch ( door -> direction ) { case 0 : if ( ! -- door -> topcountdown ) { switch ( door -> type ) { case blazeRaise : case genBlazeRaise : door -> direction = -1 ; S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_bdcls ) ; break ; case normal : case genRaise : door -> direction = -1 ; S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_dorcls ) ; break ; case close30ThenOpen : case genCdO : door -> direction = 1 ; S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_doropn ) ; break ; case genBlazeCdO : door -> direction = 1 ; S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_bdopn ) ; break ; default : break ; } } break ; case 2 : if ( ! -- door -> topcountdown ) { switch ( door -> type ) { case raiseIn5Mins : door -> direction = 1 ; door -> type = normal ; S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_doropn ) ; break ; default : break ; } } break ; case -1 : res = T_MovePlane ( door -> sector , door -> speed , door -> sector -> floorheight , false , 1 , door -> direction ) ; if ( door -> lighttag && door -> topheight - door -> sector -> floorheight && compatibility_level >= mbf_compatibility ) EV_LightTurnOnPartway ( door -> line , FixedDiv ( door -> sector -> ceilingheight - door -> sector -> floorheight , door -> topheight - door -> sector -> floorheight ) ) ; if ( res == pastdest ) { switch ( door -> type ) { case blazeRaise : case blazeClose : case genBlazeRaise : case genBlazeClose : door -> sector -> ceilingdata = NULL ; P_RemoveThinker ( & door -> thinker ) ; if ( comp [ comp_blazing ] ) S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_bdcls ) ; break ; case normal : case close : case genRaise : case genClose : door -> sector -> ceilingdata = NULL ; P_RemoveThinker ( & door -> thinker ) ; break ; case close30ThenOpen : door -> direction = 0 ; door -> topcountdown = TICRATE * 30 ; break ; case genCdO : case genBlazeCdO : door -> direction = 0 ; door -> topcountdown = door -> topwait ; break ; default : break ; } if ( door -> lighttag && door -> topheight - door -> sector -> floorheight && compatibility_level < mbf_compatibility ) EV_LightTurnOnPartway ( door -> line , 0 ) ; } else if ( res == crushed ) { switch ( door -> type ) { case genClose : case genBlazeClose : case blazeClose : case close : break ; case blazeRaise : case genBlazeRaise : door -> direction = 1 ; if ( ! comp [ comp_blazing ] ) { S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_bdopn ) ; break ; } default : door -> direction = 1 ; S_StartSound ( ( mobj_t * ) & door -> sector -> soundorg , sfx_doropn ) ; break ; } } break ; case 1 : res = T_MovePlane ( door -> sector , door -> speed , door -> topheight , false , 1 , door -> direction ) ; if ( door -> lighttag && door -> topheight - door -> sector -> floorheight && compatibility_level >= mbf_compatibility ) EV_LightTurnOnPartway ( door -> line , FixedDiv ( door -> sector -> ceilingheight - door -> sector -> floorheight , door -> topheight - door -> sector -> floorheight ) ) ; if ( res == pastdest ) { switch ( door -> type ) { case blazeRaise : case normal : case genRaise : case genBlazeRaise : door -> direction = 0 ; door -> topcountdown = door -> topwait ; break ; case close30ThenOpen : case blazeOpen : case open : case genBlazeOpen : case genOpen : case genCdO : case genBlazeCdO : door -> sector -> ceilingdata = NULL ; P_RemoveThinker ( & door -> thinker ) ; break ; default : break ; } if ( door -> lighttag && door -> topheight - door -> sector -> floorheight && compatibility_level < mbf_compatibility ) EV_LightTurnOnPartway ( door -> line , FRACUNIT ) ; } break ; } }
T_VerticalDoor
Passed a door structure containing all info about the door.
T_VerticalDoor Passed a door structure containing all info about the door .
// Is the door waiting, going up, or going down? // Door is waiting // downcount and check // time to go back down // time to go back down // time to go back up // time to go back up // Special case for sector type door that opens in 5 mins // 5 minutes up? // time to raise then // door acts just like normal 1 DR door now // Door is moving down /* killough 10/98: implement gradual lighting effects */ // e6y: "Tagged doors don't trigger special lighting" handled wrong // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943 // Old code: if (door->lighttag && door->topheight - door->sector->floorheight) // handle door reaching bottom // regular open and close doors are all done, remove them //jff 2/22/98 // unlink and free // killough 4/15/98: remove double-closing sound of blazing doors //jff 2/22/98 // unlink and free // close then open doors start waiting // jff 5/8/98 insert delay // e6y: "Tagged doors don't trigger special lighting" handled wrong // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943 /* jff 1/31/98 turn lighting off in tagged sectors of manual doors
       * killough 10/98: replaced with gradual lighting code
       */ // handle door meeting obstruction on way down // Close types do not bounce, merely wait // other types bounce off the obstruction // Door is moving up /* killough 10/98: implement gradual lighting effects */ // e6y: "Tagged doors don't trigger special lighting" handled wrong // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943 // Old code: if (door->lighttag && door->topheight - door->sector->floorheight) // handle door reaching the top // regular open/close doors start waiting // wait at top with delay // close and close/open doors are done //jff 2/22/98 // unlink and free /* jff 1/31/98 turn lighting on in tagged sectors of manual doors
   * killough 10/98: replaced with gradual lighting code */ // e6y: "Tagged doors don't trigger special lighting" handled wrong // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943