- Precache sounds played by ASoundSequence actors. (This includes Heretic's ambient sounds.)

SVN r3845 (trunk)
This commit is contained in:
Randy Heit 2012-08-23 00:15:41 +00:00
commit 69fc0142eb
3 changed files with 45 additions and 6 deletions

View file

@ -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]->SeqName = seqname;
Sequences[curseq]->Slot = slot;
Sequences[curseq]->StopSound = stopsound;
Sequences[curseq]->StopSound = FSoundID(stopsound);
memcpy (Sequences[curseq]->Script, &ScriptTemp[0], sizeof(DWORD)*ScriptTemp.Size());
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;
}
//==========================================================================
//
// 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