diff --git a/src/s_sndseq.cpp b/src/s_sndseq.cpp index f9c9f50a9..d08a26732 100644 --- a/src/s_sndseq.cpp +++ b/src/s_sndseq.cpp @@ -34,6 +34,7 @@ #include "po_man.h" #include "gi.h" #include "c_dispatch.h" + #include "g_level.h" #include "serializer.h" #include "d_player.h" @@ -51,8 +52,6 @@ #define HexenEnvSeq(a) ((a) | 0x80) #define HexenLastSeq (0xff) -#define TIME_REFERENCE level.time - // TYPES ------------------------------------------------------------------- typedef enum @@ -326,7 +325,7 @@ void DSeqNode::Serialize(FSerializer &arc) if (arc.isWriting()) { seqOffset = (int)SN_GetSequenceOffset(m_Sequence, m_SequencePtr); - delayTics = m_DelayUntilTic; + delayTics = m_DelayTics; volume = m_Volume; atten = m_Atten; id = m_CurrentSoundID; @@ -373,7 +372,7 @@ void DSeqNode::Serialize(FSerializer &arc) // Can I just Destroy() here instead of erroring out? } - ChangeData (seqOffset, delayTics - TIME_REFERENCE, volume, id); + ChangeData (seqOffset, delayTics, volume, id); m_SequenceChoices.Resize(numchoices); if (numchoices > 0 && arc.BeginArray("choices")) @@ -828,7 +827,7 @@ void DSeqNode::ActivateSequence (int sequence) { m_SequencePtr = Sequences[sequence]->Script; m_Sequence = sequence; - m_DelayUntilTic = 0; + m_DelayTics = 0; m_StopSound = Sequences[sequence]->StopSound; m_CurrentSoundID = 0; m_Volume = 1; // Start at max volume... @@ -1192,9 +1191,9 @@ DEFINE_ACTION_FUNCTION(_Sector, IsMakingLoopingSound) void DSeqNode::Tick () { - if (TIME_REFERENCE < m_DelayUntilTic) + if (m_DelayTics > 0) { - return; + if (--m_DelayTics > 0) return; } for (;;) { @@ -1239,7 +1238,7 @@ void DSeqNode::Tick () // command will repeat until the sequence is stopped. m_CurrentSoundID = FSoundID(GetData(m_SequencePtr[0])); MakeSound (0, m_CurrentSoundID); - m_DelayUntilTic = TIME_REFERENCE + m_SequencePtr[1]; + m_DelayTics = m_SequencePtr[1]; return; case SS_CMD_RANDOMSEQUENCE: @@ -1274,13 +1273,13 @@ void DSeqNode::Tick () break; case SS_CMD_DELAY: - m_DelayUntilTic = TIME_REFERENCE + GetData(*m_SequencePtr); + m_DelayTics = GetData(*m_SequencePtr); m_SequencePtr++; m_CurrentSoundID = 0; return; case SS_CMD_DELAYRAND: - m_DelayUntilTic = TIME_REFERENCE + GetData(m_SequencePtr[0]) + pr_sndseq(m_SequencePtr[1]); + m_DelayTics = GetData(m_SequencePtr[0]) + pr_sndseq(m_SequencePtr[1]); m_SequencePtr += 2; m_CurrentSoundID = 0; return; @@ -1493,7 +1492,7 @@ void SN_ChangeNodeData (int nodeNum, int seqOffset, int delayTics, float volume, void DSeqNode::ChangeData (int seqOffset, int delayTics, float volume, FSoundID currentSoundID) { - m_DelayUntilTic = TIME_REFERENCE + delayTics; + m_DelayTics = delayTics; m_Volume = volume; m_SequencePtr += seqOffset; m_CurrentSoundID = currentSoundID; diff --git a/src/s_sndseq.h b/src/s_sndseq.h index c392f1178..83b0475be 100644 --- a/src/s_sndseq.h +++ b/src/s_sndseq.h @@ -49,7 +49,7 @@ protected: FSoundID m_CurrentSoundID; int m_StopSound; - int m_DelayUntilTic; + int m_DelayTics; float m_Volume; float m_Atten; int m_ModeNum;