mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-18 15:11:46 +00:00
- Precache sounds played by ASoundSequence actors. (This includes Heretic's ambient sounds.)
SVN r3845 (trunk)
This commit is contained in:
parent
04f09d9b57
commit
69fc0142eb
3 changed files with 45 additions and 6 deletions
|
@ -105,6 +105,7 @@ public:
|
||||||
void PostBeginPlay ();
|
void PostBeginPlay ();
|
||||||
void Activate (AActor *activator);
|
void Activate (AActor *activator);
|
||||||
void Deactivate (AActor *activator);
|
void Deactivate (AActor *activator);
|
||||||
|
void MarkPrecacheSounds () const;
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_CLASS (ASoundSequence)
|
IMPLEMENT_CLASS (ASoundSequence)
|
||||||
|
@ -154,6 +155,18 @@ void ASoundSequence::PostBeginPlay ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// ASoundSequence :: MarkPrecacheSounds
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void ASoundSequence::MarkPrecacheSounds() const
|
||||||
|
{
|
||||||
|
Super::MarkPrecacheSounds();
|
||||||
|
SN_MarkPrecacheSounds(args[0], SEQ_ENVIRONMENT);
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// ASoundSequence :: Activate
|
// ASoundSequence :: Activate
|
||||||
|
@ -175,4 +188,3 @@ void ASoundSequence::Deactivate (AActor *activator)
|
||||||
{
|
{
|
||||||
SN_StopSequence (this);
|
SN_StopSequence (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -760,7 +760,7 @@ static void AddSequence (int curseq, FName seqname, FName slot, int stopsound, c
|
||||||
Sequences[curseq] = (FSoundSequence *)M_Malloc (sizeof(FSoundSequence) + sizeof(DWORD)*ScriptTemp.Size());
|
Sequences[curseq] = (FSoundSequence *)M_Malloc (sizeof(FSoundSequence) + sizeof(DWORD)*ScriptTemp.Size());
|
||||||
Sequences[curseq]->SeqName = seqname;
|
Sequences[curseq]->SeqName = seqname;
|
||||||
Sequences[curseq]->Slot = slot;
|
Sequences[curseq]->Slot = slot;
|
||||||
Sequences[curseq]->StopSound = stopsound;
|
Sequences[curseq]->StopSound = FSoundID(stopsound);
|
||||||
memcpy (Sequences[curseq]->Script, &ScriptTemp[0], sizeof(DWORD)*ScriptTemp.Size());
|
memcpy (Sequences[curseq]->Script, &ScriptTemp[0], sizeof(DWORD)*ScriptTemp.Size());
|
||||||
Sequences[curseq]->Script[ScriptTemp.Size()] = MakeCommand(SS_CMD_END, 0);
|
Sequences[curseq]->Script[ScriptTemp.Size()] = MakeCommand(SS_CMD_END, 0);
|
||||||
}
|
}
|
||||||
|
@ -1311,6 +1311,32 @@ FName SN_GetSequenceSlot (int sequence, seqtype_t type)
|
||||||
return NAME_None;
|
return NAME_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// SN_MarkPrecacheSounds
|
||||||
|
//
|
||||||
|
// Marks all sounds played by this sequence for precaching.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void SN_MarkPrecacheSounds(int sequence, seqtype_t type)
|
||||||
|
{
|
||||||
|
if (TwiddleSeqNum(sequence, type))
|
||||||
|
{
|
||||||
|
FSoundSequence *seq = Sequences[sequence];
|
||||||
|
|
||||||
|
seq->StopSound.MarkUsed();
|
||||||
|
for (int i = 0; GetCommand(seq->Script[i]) != SS_CMD_END; ++i)
|
||||||
|
{
|
||||||
|
int cmd = GetCommand(seq->Script[i]);
|
||||||
|
if (cmd == SS_CMD_PLAY || cmd == SS_CMD_PLAYREPEAT || cmd == SS_CMD_PLAYLOOP)
|
||||||
|
{
|
||||||
|
FSoundID(GetData(seq->Script[i])).MarkUsed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// SN_ChangeNodeData
|
// SN_ChangeNodeData
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct FSoundSequence
|
||||||
{
|
{
|
||||||
FName SeqName;
|
FName SeqName;
|
||||||
FName Slot;
|
FName Slot;
|
||||||
int StopSound;
|
FSoundID StopSound;
|
||||||
SDWORD Script[1]; // + more until end of sequence script
|
SDWORD Script[1]; // + more until end of sequence script
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ void SN_DoStop (void *);
|
||||||
void SN_ChangeNodeData (int nodeNum, int seqOffset, int delayTics,
|
void SN_ChangeNodeData (int nodeNum, int seqOffset, int delayTics,
|
||||||
float volume, int currentSoundID);
|
float volume, int currentSoundID);
|
||||||
FName SN_GetSequenceSlot (int sequence, seqtype_t type);
|
FName SN_GetSequenceSlot (int sequence, seqtype_t type);
|
||||||
|
void SN_MarkPrecacheSounds (int sequence, seqtype_t type);
|
||||||
bool SN_IsMakingLoopingSound (sector_t *sector);
|
bool SN_IsMakingLoopingSound (sector_t *sector);
|
||||||
|
|
||||||
#endif //__S_SNDSEQ_H__
|
#endif //__S_SNDSEQ_H__
|
||||||
|
|
Loading…
Reference in a new issue