Exemple #1
0
//
// VerticalDoorThinker::reTriggerVerticalDoor
//
// haleyjd 10/13/2011: extracted logic from EV_VerticalDoor for retriggering
// and reversal of door thinkers that are in motion.
//
bool VerticalDoorThinker::reTriggerVerticalDoor(bool player)
{
   if(direction == plat_down)
      direction = plat_up;  // go back up
   else
   {
      if(!player)
         return false;           // JDC: bad guys never close doors

      direction = plat_down; // start going down immediately
   }

   // haleyjd: squash the sector's sound sequence when a door reversal
   // occurs, otherwise you get a doubled sound at the next downstroke.
   S_SquashSectorSequence(sector, SEQ_ORIGIN_SECTOR_C);
   return true;
}
Exemple #2
0
//
// EV_CeilingCrushStop()
//
// Stops all active ceilings with the right tag
//
// Passed the linedef stopping the ceilings
// Returns true if a ceiling put in stasis
//
int EV_CeilingCrushStop(const line_t* line, int tag)
{
   int rtn = 0;
   // ioanch 20160314: avoid duplicating code
   auto pauseceiling = [&rtn](CeilingThinker *ceiling)
   {
      ceiling->olddirection = ceiling->direction;
      ceiling->direction = plat_stop;
      ceiling->inStasis = true;
      // ioanch 20160314: like in vanilla, do not make click sound when stopping
      // these types
      if(ceiling->type == silentCrushAndRaise || 
         ceiling->crushflags & CeilingThinker::crushSilent)
      {
         S_SquashSectorSequence(ceiling->sector, SEQ_ORIGIN_SECTOR_C);
      }
      else
         S_StopSectorSequence(ceiling->sector, SEQ_ORIGIN_SECTOR_C); // haleyjd 09/28/06
      rtn = 1;
   };
   
   // ioanch 20160306
   bool vanillaHexen = P_LevelIsVanillaHexen();
   if(demo_compatibility || vanillaHexen)
   {
      for(int i = 0; i < vanilla_MAXCEILINGS; ++i)
      {
         CeilingThinker *ceiling = vanilla_activeceilings[i];
         if(vanillaHexen)
         {
            if(ceiling && ceiling->tag == tag)
            {
               // in Hexen, just kill the crusher thinker
               rtn = 1;
               P_RemoveActiveCeiling(ceiling);
               break;   // get out after killing a single crusher
            }
         }
         else if(ceiling && ceiling->tag == tag && 
            ceiling->direction != plat_stop)
         {
            pauseceiling(ceiling);
         }
      }
      return rtn;
   }

   // ioanch: normal setup
   ceilinglist_t *cl;
   for(cl = activeceilings; cl; cl = cl->next)
   {
      CeilingThinker *ceiling = cl->ceiling;
      if(ceiling->direction != plat_stop && ceiling->tag == tag)
      {
         pauseceiling(ceiling);
      }
   }

   // hack to emulate the Hexen

   return rtn;
}