Exemple #1
0
//
// T_MoveCeiling
//
// Action routine that moves ceilings. Called once per tick.
//
// Passed a ceiling_t structure that contains all the info about the move.
// see P_SPEC.H for fields. No return value.
//
// jff 02/08/98 all cases with labels beginning with gen added to support
// generalized line type behaviors.
//
void T_MoveCeiling(ceiling_t* ceiling)
{
  result_e  res;

  switch (ceiling->direction)
  {
  case 0:
    // If ceiling in stasis, do nothing
    break;

  case 1:
    // Ceiling is moving up
    res = T_MovePlane
          (
            ceiling->sector,
            ceiling->speed,
            ceiling->topheight,
            false,
            1,
            ceiling->direction
          );

    // if not a silent crusher, make moving sound
    if (!(leveltime & 7))
    {
      switch (ceiling->type)
      {
      case silentCrushAndRaise:
      case genSilentCrusher:
        break;
      default:
        S_StartSound((mobj_t*)&ceiling->sector->soundorg, sfx_stnmov);
        break;
      }
    }

    // handle reaching destination height
    if (res == pastdest)
    {
      switch (ceiling->type)
      {
        // plain movers are just removed
      case raiseToHighest:
      case genCeiling:
        P_RemoveActiveCeiling(ceiling);
        break;

        // movers with texture change, change the texture then get removed
      case genCeilingChgT:
      case genCeilingChg0:
        ceiling->sector->special = ceiling->newspecial;
        //jff 3/14/98 transfer old special field as well
        ceiling->sector->oldspecial = ceiling->oldspecial;
      case genCeilingChg:
        ceiling->sector->ceilingpic = ceiling->texture;
        P_RemoveActiveCeiling(ceiling);
        break;

        // crushers reverse direction at the top
      case silentCrushAndRaise:
        S_StartSound((mobj_t*)&ceiling->sector->soundorg, sfx_pstop);
      case genSilentCrusher:
      case genCrusher:
      case fastCrushAndRaise:
      case crushAndRaise:
        ceiling->direction = -1;
        break;

      default:
        break;
      }
    }
    break;

  case -1:
    // Ceiling moving down
    res = T_MovePlane
          (
            ceiling->sector,
            ceiling->speed,
            ceiling->bottomheight,
            ceiling->crush,
            1,
            ceiling->direction
          );

    // if not silent crusher type make moving sound
    if (!(leveltime & 7))
    {
      switch (ceiling->type)
      {
      case silentCrushAndRaise:
      case genSilentCrusher:
        break;
      default:
        S_StartSound((mobj_t*)&ceiling->sector->soundorg, sfx_stnmov);
      }
    }

    // handle reaching destination height
    if (res == pastdest)
    {
      switch (ceiling->type)
      {
        // 02/09/98 jff change slow crushers' speed back to normal
        // start back up
      case genSilentCrusher:
      case genCrusher:
        if (ceiling->oldspeed < CEILSPEED * 3)
          ceiling->speed = ceiling->oldspeed;
        ceiling->direction = 1; //jff 2/22/98 make it go back up!
        break;

        // make platform stop at bottom of all crusher strokes
        // except generalized ones, reset speed, start back up
      case silentCrushAndRaise:
        S_StartSound((mobj_t*)&ceiling->sector->soundorg, sfx_pstop);
      case crushAndRaise:
        ceiling->speed = CEILSPEED;
      case fastCrushAndRaise:
        ceiling->direction = 1;
        break;

        // in the case of ceiling mover/changer, change the texture
        // then remove the active ceiling
      case genCeilingChgT:
      case genCeilingChg0:
        ceiling->sector->special = ceiling->newspecial;
        //jff add to fix bug in special transfers from changes
        ceiling->sector->oldspecial = ceiling->oldspecial;
      case genCeilingChg:
        ceiling->sector->ceilingpic = ceiling->texture;
        P_RemoveActiveCeiling(ceiling);
        break;

        // all other case, just remove the active ceiling
      case lowerAndCrush:
      case lowerToFloor:
      case lowerToLowest:
      case lowerToMaxFloor:
      case genCeiling:
        P_RemoveActiveCeiling(ceiling);
        break;

      default:
        break;
      }
    }
    else // ( res != pastdest )
    {
      // handle the crusher encountering an obstacle
      if (res == crushed)
      {
        switch (ceiling->type)
        {
          //jff 02/08/98 slow down slow crushers on obstacle
        case genCrusher:
        case genSilentCrusher:
          if (ceiling->oldspeed < CEILSPEED * 3)
            ceiling->speed = CEILSPEED / 8;
          break;
        case silentCrushAndRaise:
        case crushAndRaise:
        case lowerAndCrush:
          ceiling->speed = CEILSPEED / 8;
          break;

        default:
          break;
        }
      }
    }
    break;
  }
}
Exemple #2
0
void T_MoveCeiling (ceiling_t* ceiling)
{
	result_e	res;
		
	switch(ceiling->direction)
	{
	  case 0:
		// IN STASIS
		break;
	  case 1:
		// UP
		res = T_MovePlane(ceiling->sector,
						  ceiling->speed,
						  ceiling->topheight,
						  false,1,ceiling->direction);
		
		if (!(leveltime&7))
		{
			switch(ceiling->type)
			{
			  case silentCrushAndRaise:
				break;
			  default:
				S_StartSound((mobj_t *)&ceiling->sector->soundorg,
							 sfx_stnmov);
				// ?
				break;
			}
		}
		
		if (res == pastdest)
		{
			switch(ceiling->type)
			{
			  case raiseToHighest:
				P_RemoveActiveCeiling(ceiling);
				break;
				
			  case silentCrushAndRaise:
				S_StartSound((mobj_t *)&ceiling->sector->soundorg,
							 sfx_pstop);
			  case fastCrushAndRaise:
			  case crushAndRaise:
				ceiling->direction = -1;
				break;
				
			  default:
				break;
			}
			
		}
		break;
		
	  case -1:
		// DOWN
		res = T_MovePlane(ceiling->sector,
						  ceiling->speed,
						  ceiling->bottomheight,
						  ceiling->crush,1,ceiling->direction);
		
		if (!(leveltime&7))
		{
			switch(ceiling->type)
			{
			  case silentCrushAndRaise: break;
			  default:
				S_StartSound((mobj_t *)&ceiling->sector->soundorg,
							 sfx_stnmov);
			}
		}
		
		if (res == pastdest)
		{
			switch(ceiling->type)
			{
			  case silentCrushAndRaise:
				S_StartSound((mobj_t *)&ceiling->sector->soundorg,
							 sfx_pstop);
			  case crushAndRaise:
				ceiling->speed = CEILSPEED;
			  case fastCrushAndRaise:
				ceiling->direction = 1;
				break;

			  case lowerAndCrush:
			  case lowerToFloor:
				P_RemoveActiveCeiling(ceiling);
				break;

			  default:
				break;
			}
		}
		else // ( res != pastdest )
		{
			if (res == crushed)
			{
				switch(ceiling->type)
				{
				  case silentCrushAndRaise:
				  case crushAndRaise:
				  case lowerAndCrush:
					ceiling->speed = CEILSPEED / 8;
					break;

				  default:
					break;
				}
			}
		}
		break;
	}
}
Exemple #3
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;
}
Exemple #4
0
//
// T_MoveCeiling
//
// Action routine that moves ceilings. Called once per tick.
//
// Passed a CeilingThinker structure that contains all the info about the move.
// see P_SPEC.H for fields. No return value.
//
// jff 02/08/98 all cases with labels beginning with gen added to support 
// generalized line type behaviors.
//
void CeilingThinker::Think()
{
   result_e  res;

   if(inStasis)
      return;

   switch(direction)
   {
   case plat_stop:
      // If ceiling in stasis, do nothing
      break;

   case plat_up:
      // Ceiling is moving up
      res = T_MoveCeilingUp(sector, speed, topheight, -1);

      // if not a silent crusher, make moving sound
      // haleyjd: now handled through sound sequences

      // handle reaching destination height
      if(res == pastdest)
      {
         switch(type)
         {
            // plain movers are just removed
         case raiseToHighest:
         case genCeiling:
         case paramHexenCrushRaiseStay:   // ioanch 20160306
         case paramHexenLowerCrush:
            P_RemoveActiveCeiling(this);
            break;

            // movers with texture change, change the texture then get removed
         case genCeilingChgT:
         case genCeilingChg0:
            //jff 3/14/98 transfer old special field as well
            P_TransferSectorSpecial(sector, &special);
         case genCeilingChg:
            P_SetSectorCeilingPic(sector, texture);
            P_RemoveActiveCeiling(this);
            break;

            // crushers reverse direction at the top
         case silentCrushAndRaise:
            // haleyjd: if not playing a looping sequence, start one
            if(!S_CheckSectorSequenceLoop(sector, SEQ_ORIGIN_SECTOR_C))
               P_CeilingSequence(sector, CNOISE_SEMISILENT);
         case genSilentCrusher:
         case genCrusher:
            // ioanch 20160314: Generic_Crusher support
            if(type != silentCrushAndRaise)
               speed = oldspeed;
         case fastCrushAndRaise:
         case crushAndRaise:
            direction = plat_down;
            break;

         // ioanch 20160305
         case paramHexenCrush:
            // preserve the weird Hexen behaviour where the crusher becomes mute
            // after any pastdest.
            if(P_LevelIsVanillaHexen())
               S_StopSectorSequence(sector, SEQ_ORIGIN_SECTOR_C);
            else if(crushflags & crushSilent &&
               !S_CheckSectorSequenceLoop(sector, SEQ_ORIGIN_SECTOR_C))
            {
               P_CeilingSequence(sector, CNOISE_SEMISILENT);
            }
            direction = plat_down;
            speed = oldspeed;   // restore the speed to the designated DOWN one
            break;
            
         default:
            break;
         }
      }
      break;
  
   case plat_down:
      // Ceiling moving down
      // ioanch 20160305: allow resting
      res = T_MoveCeilingDown(sector, speed, bottomheight, crush, 
         !!(crushflags & crushRest));

      // if not silent crusher type make moving sound
      // haleyjd: now handled through sound sequences

      // handle reaching destination height
      if(res == pastdest)
      {
         switch(this->type)
         {
            // 02/09/98 jff change slow crushers' speed back to normal
            // start back up
         case genSilentCrusher:
         case genCrusher:
            if(oldspeed < CEILSPEED*3)
               speed = this->upspeed;  // ioanch 20160314: use up speed
            direction = plat_up; //jff 2/22/98 make it go back up!
            break;
            
            // make platform stop at bottom of all crusher strokes
            // except generalized ones, reset speed, start back up
         case silentCrushAndRaise:
            // haleyjd: if not playing a looping sequence, start one
            if(!S_CheckSectorSequenceLoop(sector, SEQ_ORIGIN_SECTOR_C))
               P_CeilingSequence(sector, CNOISE_SEMISILENT);
         case crushAndRaise: 
            speed = CEILSPEED;
         case fastCrushAndRaise:
            direction = plat_up;
            break;
            
            // in the case of ceiling mover/changer, change the texture
            // then remove the active ceiling
         case genCeilingChgT:
         case genCeilingChg0:
            //jff add to fix bug in special transfers from changes
            P_TransferSectorSpecial(sector, &special);
         case genCeilingChg:
            P_SetSectorCeilingPic(sector, texture);
            P_RemoveActiveCeiling(this);
            break;

            // all other case, just remove the active ceiling
         case lowerAndCrush:
         case lowerToFloor:
         case lowerToLowest:
         case lowerToMaxFloor:
         case genCeiling:
         case paramHexenLowerCrush:
            P_RemoveActiveCeiling(this);
            break;
         // ioanch 20160305
         case paramHexenCrush:
         case paramHexenCrushRaiseStay:
            // preserve the weird Hexen behaviour where the crusher becomes mute
            // after any pastdest (only in maps for vanilla Hexen).
            if(P_LevelIsVanillaHexen())
               S_StopSectorSequence(sector, SEQ_ORIGIN_SECTOR_C);
            else if(crushflags & crushSilent &&
               !S_CheckSectorSequenceLoop(sector, SEQ_ORIGIN_SECTOR_C))
            {
               P_CeilingSequence(sector, CNOISE_SEMISILENT);
            }

            direction = plat_up;
            // keep old speed in case it was decreased by crushing like Doom.
            speed = upspeed;  // set to the different up speed
            break;
            
         default:
            break;
         }
      }
      else // ( res != pastdest )
      {
         // handle the crusher encountering an obstacle
         if(res == crushed)
         {
            switch(type)
            {
               //jff 02/08/98 slow down slow crushers on obstacle
            case genCrusher:  
            case genSilentCrusher:
               if(oldspeed < CEILSPEED*3)
                  speed = CEILSPEED / 8;
               break;
            case silentCrushAndRaise:
            case crushAndRaise:
            case lowerAndCrush:
               speed = CEILSPEED / 8;
               break;
            case paramHexenCrush:
            case paramHexenCrushRaiseStay:
            case paramHexenLowerCrush:
               // if crusher doesn't rest on victims:
               // this is like ZDoom: if a ceiling speed is set exactly to 8,
               // then apply the Doom crusher slowdown. Otherwise, keep speed
               // constant. This may not apply to all crushing specials in
               // ZDoom, but for simplicity it has been applied generally here.
               if(!(crushflags & crushRest) && (crushflags & crushParamSlow))
                  speed = CEILSPEED / 8;
               break;
               
            default:
               break;
            }
         }
      } // end else
      break;
   } // end switch
}
Exemple #5
0
//==================================================================
//
//      T_MoveCeiling
//
//==================================================================
void T_MoveCeiling(ceiling_t * ceiling)
{
	result_e res;

	switch (ceiling->direction)
	{
		//      case 0:         // IN STASIS
		//          break;
	case 1:					// UP
		res =
			T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight,
						false, 1, ceiling->direction);
		if(res == RES_PASTDEST)
		{
			SN_StopSequence((mobj_t *) &ceiling->sector->soundorg);
			switch (ceiling->type)
			{
			case CLEV_CRUSHANDRAISE:
				ceiling->direction = -1;
				ceiling->speed = ceiling->speed * 2;
				break;
			default:
				P_RemoveActiveCeiling(ceiling);
				break;
			}
		}
		break;
	case -1:					// DOWN
		res =
			T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight,
						ceiling->crush, 1, ceiling->direction);
		if(res == RES_PASTDEST)
		{
			SN_StopSequence((mobj_t *) &ceiling->sector->soundorg);
			switch (ceiling->type)
			{
			case CLEV_CRUSHANDRAISE:
			case CLEV_CRUSHRAISEANDSTAY:
				ceiling->direction = 1;
				ceiling->speed = ceiling->speed / 2;
				break;
			default:
				P_RemoveActiveCeiling(ceiling);
				break;
			}
		}
		else if(res == RES_CRUSHED)
		{
			switch (ceiling->type)
			{
			case CLEV_CRUSHANDRAISE:
			case CLEV_LOWERANDCRUSH:
			case CLEV_CRUSHRAISEANDSTAY:
				//ceiling->speed = ceiling->speed/4;
				break;
			default:
				break;
			}
		}
		break;
	}
}
Exemple #6
0
//==================================================================
//
//  T_MoveCeiling
//
//==================================================================
void T_MoveCeiling(ceiling_t * ceiling)
{
	result_e res;

	switch (ceiling->direction)
	{
	case 0:					// IN STASIS
		break;
	case 1:					// UP
		res =
			T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight,
						false, 1, ceiling->direction);
		if(!(leveltime & 7))
			//S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_dormov);
			S_SectorSound(ceiling->sector, sfx_dormov);
		//gi.Sv_PlaneSound(ceiling->sector, true, sfx_dormov, 7);
		if(res == pastdest)
			switch (ceiling->type)
			{
			case raiseToHighest:
				P_RemoveActiveCeiling(ceiling);
				break;
			case fastCrushAndRaise:
			case crushAndRaise:
				ceiling->direction = -1;
				break;
			default:
				break;
			}
		break;
	case -1:					// DOWN
		res =
			T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight,
						ceiling->crush, 1, ceiling->direction);
		if(!(leveltime & 7))
			//S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_dormov);
			S_SectorSound(ceiling->sector, sfx_dormov);
		//gi.Sv_PlaneSound(ceiling->sector, true, sfx_dormov, 7);
		if(res == pastdest)
			switch (ceiling->type)
			{
			case crushAndRaise:
				ceiling->speed = CEILSPEED;
			case fastCrushAndRaise:
				ceiling->direction = 1;
				break;
			case lowerAndCrush:
			case lowerToFloor:
				P_RemoveActiveCeiling(ceiling);
				break;
			default:
				break;
			}
		else if(res == crushed)
			switch (ceiling->type)
			{
			case crushAndRaise:
			case lowerAndCrush:
				ceiling->speed = CEILSPEED / 8;
				break;
			default:
				break;
			}
		break;
	}
}
Exemple #7
0
//
// T_MoveCeiling
//
void T_MoveCeiling(ceiling_t *ceiling)
{
    result_e    res;

    switch (ceiling->direction)
    {
        case 0:
            // IN STASIS
            break;

        case 1:
            // UP
            res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight, false, 1,
                ceiling->direction);

            if (!(leveltime & 7) && ceiling->sector->ceilingheight != ceiling->topheight)
                switch (ceiling->type)
                {
                    case silentCrushAndRaise:
                    case genSilentCrusher:
                        break;

                    default:
                        S_StartMapSound(&ceiling->sector->soundorg, sfx_stnmov);
                        break;
                }

            if (res == pastdest)
            {
                switch (ceiling->type)
                {
                    case raiseToHighest:
                    case genCeiling:
                        P_RemoveActiveCeiling(ceiling);
                        break;

                    // movers with texture change, change the texture then get removed
                    case genCeilingChgT:
                    case genCeilingChg0:
                        ceiling->sector->special = ceiling->newspecial;

                    case genCeilingChg:
                        ceiling->sector->ceilingpic = ceiling->texture;
                        P_RemoveActiveCeiling(ceiling);
                        break;

                    case silentCrushAndRaise:
                        S_StartMapSound(&ceiling->sector->soundorg, sfx_pstop);

                    case genSilentCrusher:
                    case genCrusher:
                    case fastCrushAndRaise:
                    case crushAndRaise:
                        ceiling->direction = -1;
                        break;

                    default:
                        break;
                }
            }
            break;

        case -1:
            // DOWN
            res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight,
                ceiling->crush, 1, ceiling->direction);

            if (!(leveltime & 7) && ceiling->sector->ceilingheight != ceiling->bottomheight)
                switch (ceiling->type)
                {
                    case silentCrushAndRaise:
                    case genSilentCrusher:
                        break;

                    default:
                        S_StartMapSound(&ceiling->sector->soundorg, sfx_stnmov);
                }

            if (res == pastdest)
            {
                switch (ceiling->type)
                {
                    // 02/09/98 jff change slow crushers' speed back to normal
                    // start back up
                    case genSilentCrusher:
                    case genCrusher:
                        if (ceiling->oldspeed < CEILSPEED * 3)
                            ceiling->speed = ceiling->oldspeed;
                        ceiling->direction = 1; // jff 2/22/98 make it go back up!
                        break;

                    case silentCrushAndRaise:
                        S_StartMapSound(&ceiling->sector->soundorg, sfx_pstop);

                    case crushAndRaise:
                        ceiling->speed = CEILSPEED;

                    case fastCrushAndRaise:
                        ceiling->direction = 1;
                        break;

                    // in the case of ceiling mover/changer, change the texture
                    // then remove the active ceiling
                    case genCeilingChgT:
                    case genCeilingChg0:
                        ceiling->sector->special = ceiling->newspecial;

                    case genCeilingChg:
                        ceiling->sector->ceilingpic = ceiling->texture;
                        P_RemoveActiveCeiling(ceiling);
                        break;

                    case lowerAndCrush:
                    case lowerToFloor:
                    case lowerToLowest:
                    case lowerToMaxFloor:
                    case genCeiling:
                        P_RemoveActiveCeiling(ceiling);
                        break;

                    default:
                        break;
                }
            }
            else
            {
                if (res == crushed)
                {
                    switch (ceiling->type)
                    {
                        // jff 02/08/98 slow down slow crushers on obstacle
                        case genCrusher:
                        case genSilentCrusher:
                            if (ceiling->oldspeed < CEILSPEED * 3)
                                ceiling->speed = CEILSPEED / 8;
                            break;

                        case silentCrushAndRaise:
                        case crushAndRaise:
                        case lowerAndCrush:
                            ceiling->speed = CEILSPEED / 8;
                            break;

                        default:
                            break;
                    }
                }
            }
            break;
    }
}