- added Hexen compatible handling to specials that stop perpetual sector movement.

This uses the same logic as Eternity.
This commit is contained in:
Christoph Oelckers 2016-08-09 17:09:12 +02:00
parent 6b27d0c3ba
commit 7104b01193
5 changed files with 60 additions and 18 deletions

View file

@ -42,7 +42,7 @@ DEFINE_SPECIAL(Ceiling_LowerByValue, 40, 3, 5, 5)
DEFINE_SPECIAL(Ceiling_RaiseByValue, 41, 3, 4, 4) DEFINE_SPECIAL(Ceiling_RaiseByValue, 41, 3, 4, 4)
DEFINE_SPECIAL(Ceiling_CrushAndRaise, 42, 3, 4, 4) DEFINE_SPECIAL(Ceiling_CrushAndRaise, 42, 3, 4, 4)
DEFINE_SPECIAL(Ceiling_LowerAndCrush, 43, 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(Ceiling_CrushRaiseAndStay, 45, 3, 4, 4)
DEFINE_SPECIAL(Floor_CrushStop, 46, 1, 1, 1) DEFINE_SPECIAL(Floor_CrushStop, 46, 1, 1, 1)
DEFINE_SPECIAL(Ceiling_MoveToValue, 47, 3, 5, 5) 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(Sector_CopyScroller, 58, -1, -1, 2)
DEFINE_SPECIAL(Polyobj_OR_MoveToSpot, 59, 3, 3, 3) DEFINE_SPECIAL(Polyobj_OR_MoveToSpot, 59, 3, 3, 3)
DEFINE_SPECIAL(Plat_PerpetualRaise, 60, 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_DownWaitUpStay, 62, 3, 3, 3)
DEFINE_SPECIAL(Plat_DownByValue, 63, 4, 4, 4) DEFINE_SPECIAL(Plat_DownByValue, 63, 4, 4, 4)
DEFINE_SPECIAL(Plat_UpWaitDownStay, 64, 3, 3, 3) DEFINE_SPECIAL(Plat_UpWaitDownStay, 64, 3, 3, 3)

View file

@ -552,21 +552,31 @@ void P_ActivateInStasisCeiling (int tag)
// //
//============================================================================ //============================================================================
bool EV_CeilingCrushStop (int tag) bool EV_CeilingCrushStop (int tag, bool remove)
{ {
bool rtn = false; bool rtn = false;
DCeiling *scan; DCeiling *scan;
TThinkerIterator<DCeiling> iterator; TThinkerIterator<DCeiling> iterator;
while ( (scan = iterator.Next ()) ) scan = iterator.Next();
while (scan != nullptr)
{ {
DCeiling *next = iterator.Next();
if (scan->m_Tag == tag && scan->m_Direction != 0) if (scan->m_Tag == tag && scan->m_Direction != 0)
{
if (!remove)
{ {
SN_StopSequence(scan->m_Sector, CHAN_CEILING); SN_StopSequence(scan->m_Sector, CHAN_CEILING);
scan->m_OldDirection = scan->m_Direction; scan->m_OldDirection = scan->m_Direction;
scan->m_Direction = 0; // in-stasis; scan->m_Direction = 0; // in-stasis;
}
else
{
scan->Destroy();
}
rtn = true; rtn = true;
} }
scan = next;
} }
return rtn; return rtn;

View file

@ -686,9 +686,22 @@ FUNC(LS_Ceiling_LowerAndCrushDist)
} }
FUNC(LS_Ceiling_CrushStop) 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) FUNC(LS_Ceiling_CrushRaiseAndStay)
@ -890,9 +903,22 @@ FUNC(LS_Plat_PerpetualRaiseLip)
} }
FUNC(LS_Plat_Stop) 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; return true;
} }

View file

@ -429,15 +429,21 @@ void DPlat::Stop ()
m_Status = in_stasis; m_Status = in_stasis;
} }
void EV_StopPlat (int tag) void EV_StopPlat (int tag, bool remove)
{ {
DPlat *scan; DPlat *scan;
TThinkerIterator<DPlat> iterator; TThinkerIterator<DPlat> 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) if (scan->m_Status != DPlat::in_stasis && scan->m_Tag == tag)
scan->Stop (); {
if (!remove) scan->Stop();
else scan->Destroy();
}
scan = next;
} }
} }

View file

@ -212,13 +212,13 @@ private:
friend bool EV_DoPlat (int tag, line_t *line, EPlatType type, friend bool EV_DoPlat (int tag, line_t *line, EPlatType type,
double height, double speed, int delay, int lip, int change); 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); friend void P_ActivateInStasis (int tag);
}; };
bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type,
double height, double speed, int delay, int lip, int change); 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); void P_ActivateInStasis (int tag);
// //
@ -434,14 +434,14 @@ private:
DCeiling (); 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 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); 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 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_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); void P_ActivateInStasisCeiling (int tag);