diff --git a/src/p_doors.cpp b/src/p_doors.cpp index 78fb9e5766..29ec1fc6b3 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -422,7 +422,9 @@ bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, // [RH] If this sector doesn't have a specific sound // attached to it, start the door close sequence. // Otherwise, just let the current one continue. - if (sec->seqType == -1) + // FIXME: This should be check if the sound sequence has separate up/down + // paths, not if it was manually set. + if (sec->seqType == -1 || SN_CheckSequence(sec, CHAN_CEILING) == NULL) { door->DoorSound (false); } diff --git a/src/s_sndseq.cpp b/src/s_sndseq.cpp index 93474ae19b..381a278664 100644 --- a/src/s_sndseq.cpp +++ b/src/s_sndseq.cpp @@ -952,6 +952,33 @@ static int FindSequence (FName seqname) return -1; } +//========================================================================== +// +// SN_CheckSequence +// +// Returns the sound sequence playing in the sector on the given channel, +// if any. +// +//========================================================================== + +DSeqNode *SN_CheckSequence(sector_t *sector, int chan) +{ + for (DSeqNode *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) + { + return node; + } + } + node = next; + } + return NULL; +} + //========================================================================== // // SN_StopSequence @@ -965,20 +992,10 @@ void SN_StopSequence (AActor *actor) void SN_StopSequence (sector_t *sector, int chan) { - DSeqNode *node; - - for (node = DSeqNode::FirstSequence(); node; ) + DSeqNode *node = SN_CheckSequence(sector, chan); + if (node != NULL) { - 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; + node->StopAndDestroy(); } } diff --git a/src/s_sndseq.h b/src/s_sndseq.h index 434dccb6f7..efadc05653 100644 --- a/src/s_sndseq.h +++ b/src/s_sndseq.h @@ -85,6 +85,7 @@ DSeqNode *SN_StartSequence (sector_t *sector, int chan, const char *name, int mo 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); +DSeqNode *SN_CheckSequence (sector_t *sector, int chan); void SN_StopSequence (AActor *mobj); void SN_StopSequence (sector_t *sector, int chan); void SN_StopSequence (FPolyObj *poly);