diff --git a/src/actionspecials.h b/src/actionspecials.h index 4ab222b2c..9b9c38cb9 100644 --- a/src/actionspecials.h +++ b/src/actionspecials.h @@ -42,7 +42,7 @@ DEFINE_SPECIAL(Ceiling_LowerByValue, 40, 3, 5, 5) DEFINE_SPECIAL(Ceiling_RaiseByValue, 41, 3, 4, 4) DEFINE_SPECIAL(Ceiling_CrushAndRaise, 42, 3, 4, 4) DEFINE_SPECIAL(Ceiling_LowerAndCrush, 43, 3, 4, 4) -DEFINE_SPECIAL(Ceiling_CrushStop, 44, 1, 1, 1) +DEFINE_SPECIAL(Ceiling_CrushStop, 44, 1, 2, 2) DEFINE_SPECIAL(Ceiling_CrushRaiseAndStay, 45, 3, 4, 4) DEFINE_SPECIAL(Floor_CrushStop, 46, 1, 1, 1) DEFINE_SPECIAL(Ceiling_MoveToValue, 47, 3, 5, 5) @@ -59,7 +59,7 @@ DEFINE_SPECIAL(Sector_SetPortal, 57, -1, -1, 5) DEFINE_SPECIAL(Sector_CopyScroller, 58, -1, -1, 2) DEFINE_SPECIAL(Polyobj_OR_MoveToSpot, 59, 3, 3, 3) DEFINE_SPECIAL(Plat_PerpetualRaise, 60, 3, 3, 3) -DEFINE_SPECIAL(Plat_Stop, 61, 1, 1, 1) +DEFINE_SPECIAL(Plat_Stop, 61, 1, 2, 2) DEFINE_SPECIAL(Plat_DownWaitUpStay, 62, 3, 3, 3) DEFINE_SPECIAL(Plat_DownByValue, 63, 4, 4, 4) DEFINE_SPECIAL(Plat_UpWaitDownStay, 64, 3, 3, 3) diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index c635d9743..888b67b6c 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -552,21 +552,31 @@ void P_ActivateInStasisCeiling (int tag) // //============================================================================ -bool EV_CeilingCrushStop (int tag) +bool EV_CeilingCrushStop (int tag, bool remove) { bool rtn = false; DCeiling *scan; TThinkerIterator iterator; - while ( (scan = iterator.Next ()) ) + scan = iterator.Next(); + while (scan != nullptr) { + DCeiling *next = iterator.Next(); if (scan->m_Tag == tag && scan->m_Direction != 0) { - SN_StopSequence (scan->m_Sector, CHAN_CEILING); - scan->m_OldDirection = scan->m_Direction; - scan->m_Direction = 0; // in-stasis; + if (!remove) + { + SN_StopSequence(scan->m_Sector, CHAN_CEILING); + scan->m_OldDirection = scan->m_Direction; + scan->m_Direction = 0; // in-stasis; + } + else + { + scan->Destroy(); + } rtn = true; } + scan = next; } return rtn; diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index d0a56ee87..c8c7db74d 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -686,9 +686,22 @@ FUNC(LS_Ceiling_LowerAndCrushDist) } FUNC(LS_Ceiling_CrushStop) -// Ceiling_CrushStop (tag) +// Ceiling_CrushStop (tag, remove) { - return EV_CeilingCrushStop (arg0); + bool remove; + switch (arg3) + { + case 1: + remove = false; + break; + case 2: + remove = true; + break; + default: + remove = gameinfo.gametype == GAME_Hexen; + break; + } + return EV_CeilingCrushStop (arg0, remove); } FUNC(LS_Ceiling_CrushRaiseAndStay) @@ -890,9 +903,22 @@ FUNC(LS_Plat_PerpetualRaiseLip) } FUNC(LS_Plat_Stop) -// Plat_Stop (tag) +// Plat_Stop (tag, remove?) { - EV_StopPlat (arg0); + bool remove; + switch (arg3) + { + case 1: + remove = false; + break; + case 2: + remove = true; + break; + default: + remove = gameinfo.gametype == GAME_Hexen; + break; + } + EV_StopPlat(arg0, remove); return true; } diff --git a/src/p_plats.cpp b/src/p_plats.cpp index 55ba39fe5..96fec71c1 100644 --- a/src/p_plats.cpp +++ b/src/p_plats.cpp @@ -429,15 +429,21 @@ void DPlat::Stop () m_Status = in_stasis; } -void EV_StopPlat (int tag) +void EV_StopPlat (int tag, bool remove) { DPlat *scan; TThinkerIterator iterator; - while ( (scan = iterator.Next ()) ) + scan = iterator.Next(); + while (scan != nullptr) { + DPlat *next = iterator.Next(); if (scan->m_Status != DPlat::in_stasis && scan->m_Tag == tag) - scan->Stop (); + { + if (!remove) scan->Stop(); + else scan->Destroy(); + } + scan = next; } } diff --git a/src/p_spec.h b/src/p_spec.h index 125b2374e..d7abd4b42 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -212,13 +212,13 @@ private: friend bool EV_DoPlat (int tag, line_t *line, EPlatType type, double height, double speed, int delay, int lip, int change); - friend void EV_StopPlat (int tag); + friend void EV_StopPlat (int tag, bool remove); friend void P_ActivateInStasis (int tag); }; bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, double height, double speed, int delay, int lip, int change); -void EV_StopPlat (int tag); +void EV_StopPlat (int tag, bool remove); void P_ActivateInStasis (int tag); // @@ -434,14 +434,14 @@ private: DCeiling (); friend bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush); - friend bool EV_CeilingCrushStop (int tag); + friend bool EV_CeilingCrushStop (int tag, bool remove); friend void P_ActivateInStasisCeiling (int tag); }; bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush); bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush = DCeiling::ECrushMode::crushDoom); -bool EV_CeilingCrushStop (int tag); +bool EV_CeilingCrushStop (int tag, bool remove); void P_ActivateInStasisCeiling (int tag);