- Fixed: Closing doors early would never restart the sound sequence if it was manually placed.

SVN r2150 (trunk)
This commit is contained in:
Randy Heit 2010-02-02 05:19:43 +00:00
parent 1aa39baa4a
commit ecb9d2f24b
3 changed files with 34 additions and 14 deletions

View file

@ -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 // [RH] If this sector doesn't have a specific sound
// attached to it, start the door close sequence. // attached to it, start the door close sequence.
// Otherwise, just let the current one continue. // 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); door->DoorSound (false);
} }

View file

@ -952,6 +952,33 @@ static int FindSequence (FName seqname)
return -1; 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<DSeqSectorNode *>(node)->Channel & 7) == chan)
{
return node;
}
}
node = next;
}
return NULL;
}
//========================================================================== //==========================================================================
// //
// SN_StopSequence // SN_StopSequence
@ -965,22 +992,12 @@ void SN_StopSequence (AActor *actor)
void SN_StopSequence (sector_t *sector, int chan) void SN_StopSequence (sector_t *sector, int chan)
{ {
DSeqNode *node; DSeqNode *node = SN_CheckSequence(sector, chan);
if (node != NULL)
for (node = DSeqNode::FirstSequence(); node; )
{
DSeqNode *next = node->NextSequence();
if (node->Source() == sector)
{
assert(node->IsKindOf(RUNTIME_CLASS(DSeqSectorNode)));
if ((static_cast<DSeqSectorNode *>(node)->Channel & 7) == chan)
{ {
node->StopAndDestroy(); node->StopAndDestroy();
} }
} }
node = next;
}
}
void SN_StopSequence (FPolyObj *poly) void SN_StopSequence (FPolyObj *poly)
{ {

View file

@ -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 (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, int sequence, seqtype_t type, int modenum, bool nostop=false);
DSeqNode *SN_StartSequence (FPolyObj *poly, const char *name, int modenum); 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 (AActor *mobj);
void SN_StopSequence (sector_t *sector, int chan); void SN_StopSequence (sector_t *sector, int chan);
void SN_StopSequence (FPolyObj *poly); void SN_StopSequence (FPolyObj *poly);