diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 901dd172f..2cd36f7fb 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ December 24, 2009 +- Added a channel parameter to the sector overload of SN_StopSequence() so + it can be properly paired with calls to SN_StartSequence(). - Fixed: P_CheckPlayerSprites() ignored the MF4_NOSKIN flag. It now also sets the X scale, so switching skins while morphed does not produce weird stretching upon unmorphing. diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 12f957b47..4dd072a06 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -112,7 +112,7 @@ void DCeiling::Tick () m_Sector->SetTexture(sector_t::ceiling, m_Texture); // fall through default: - SN_StopSequence (m_Sector); + SN_StopSequence (m_Sector, CHAN_CEILING); Destroy (); break; } @@ -145,7 +145,7 @@ void DCeiling::Tick () m_Sector->SetTexture(sector_t::ceiling, m_Texture); // fall through default: - SN_StopSequence (m_Sector); + SN_StopSequence (m_Sector, CHAN_CEILING); Destroy (); break; } @@ -500,7 +500,7 @@ bool EV_CeilingCrushStop (int tag) { if (scan->m_Tag == tag && scan->m_Direction != 0) { - SN_StopSequence (scan->m_Sector); + SN_StopSequence (scan->m_Sector, CHAN_CEILING); scan->m_OldDirection = scan->m_Direction; scan->m_Direction = 0; // in-stasis; rtn = true; diff --git a/src/p_doors.cpp b/src/p_doors.cpp index c77ded90d..78fb9e576 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -133,7 +133,7 @@ void DDoor::Tick () if (res == pastdest) { - SN_StopSequence (m_Sector); + SN_StopSequence (m_Sector, CHAN_CEILING); switch (m_Type) { case doorRaise: @@ -179,7 +179,7 @@ void DDoor::Tick () if (res == pastdest) { - SN_StopSequence (m_Sector); + SN_StopSequence (m_Sector, CHAN_CEILING); switch (m_Type) { case doorRaise: diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 0b9a634e8..984a0f064 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -126,7 +126,7 @@ void DFloor::Tick () if (res == pastdest) { - SN_StopSequence (m_Sector); + SN_StopSequence (m_Sector, CHAN_FLOOR); if (m_Type == buildStair) m_Type = waitStair; @@ -530,7 +530,7 @@ bool EV_FloorCrushStop (int tag) if (sec->floordata && sec->floordata->IsKindOf (RUNTIME_CLASS(DFloor)) && barrier_cast(sec->floordata)->m_Type == DFloor::floorRaiseAndCrush) { - SN_StopSequence (sec); + SN_StopSequence (sec, CHAN_FLOOR); sec->floordata->Destroy (); sec->floordata = NULL; } @@ -959,7 +959,7 @@ void DElevator::Tick () if (res == pastdest) // if destination height acheived { // make floor stop sound - SN_StopSequence (m_Sector); + SN_StopSequence (m_Sector, CHAN_FLOOR); m_Sector->floordata = NULL; //jff 2/22/98 m_Sector->ceilingdata = NULL; //jff 2/22/98 diff --git a/src/p_pillar.cpp b/src/p_pillar.cpp index f20dc1ef4..1d2d5ba81 100644 --- a/src/p_pillar.cpp +++ b/src/p_pillar.cpp @@ -98,7 +98,7 @@ void DPillar::Tick () if (r == pastdest && s == pastdest) { - SN_StopSequence (m_Sector); + SN_StopSequence (m_Sector, CHAN_FLOOR); Destroy (); } else diff --git a/src/p_plats.cpp b/src/p_plats.cpp index 962447e49..87d9e6737 100644 --- a/src/p_plats.cpp +++ b/src/p_plats.cpp @@ -82,7 +82,7 @@ void DPlat::Tick () } else if (res == pastdest) { - SN_StopSequence (m_Sector); + SN_StopSequence (m_Sector, CHAN_FLOOR); if (m_Type != platToggle) { m_Count = m_Wait; @@ -121,7 +121,7 @@ void DPlat::Tick () if (res == pastdest) { - SN_StopSequence (m_Sector); + SN_StopSequence (m_Sector, CHAN_FLOOR); // if not an instant toggle, start waiting if (m_Type != platToggle) //jff 3/14/98 toggle up down { // is silent, instant, no waiting diff --git a/src/s_sndseq.cpp b/src/s_sndseq.cpp index ecfed1246..93474ae19 100644 --- a/src/s_sndseq.cpp +++ b/src/s_sndseq.cpp @@ -849,7 +849,7 @@ DSeqNode *SN_StartSequence (sector_t *sector, int chan, int sequence, seqtype_t { if (!nostop) { - SN_StopSequence (sector); + SN_StopSequence (sector, chan); } if (TwiddleSeqNum (sequence, type)) { @@ -963,9 +963,23 @@ void SN_StopSequence (AActor *actor) SN_DoStop (actor); } -void SN_StopSequence (sector_t *sector) +void SN_StopSequence (sector_t *sector, int chan) { - SN_DoStop (sector); + DSeqNode *node; + + for (node = DSeqNode::FirstSequence(); node; ) + { + DSeqNode *next = node->NextSequence(); + if (node->Source() == sector) + { + assert(node->IsKindOf(RUNTIME_CLASS(DSeqSectorNode))); + if ((static_cast(node)->Channel & 7) == chan) + { + node->StopAndDestroy (); + } + } + node = next; + } } void SN_StopSequence (FPolyObj *poly) diff --git a/src/s_sndseq.h b/src/s_sndseq.h index e54010075..434dccb6f 100644 --- a/src/s_sndseq.h +++ b/src/s_sndseq.h @@ -86,7 +86,7 @@ DSeqNode *SN_StartSequence (sector_t *sec, int chan, FName seqname, int modenum) DSeqNode *SN_StartSequence (FPolyObj *poly, int sequence, seqtype_t type, int modenum, bool nostop=false); DSeqNode *SN_StartSequence (FPolyObj *poly, const char *name, int modenum); void SN_StopSequence (AActor *mobj); -void SN_StopSequence (sector_t *sector); +void SN_StopSequence (sector_t *sector, int chan); void SN_StopSequence (FPolyObj *poly); void SN_UpdateActiveSequences (void); ptrdiff_t SN_GetSequenceOffset (int sequence, SDWORD *sequencePtr);