2016-03-01 15:47:10 +00:00
|
|
|
#ifndef __S_SNDSEQ_H__
|
|
|
|
#define __S_SNDSEQ_H__
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "dobject.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
SEQ_PLATFORM,
|
|
|
|
SEQ_DOOR,
|
|
|
|
SEQ_ENVIRONMENT,
|
|
|
|
SEQ_NUMSEQTYPES,
|
|
|
|
SEQ_NOTRANS
|
|
|
|
} seqtype_t;
|
|
|
|
|
|
|
|
struct sector_t;
|
|
|
|
|
|
|
|
class DSeqNode : public DObject
|
|
|
|
{
|
|
|
|
DECLARE_CLASS (DSeqNode, DObject)
|
|
|
|
HAS_OBJECT_POINTERS
|
|
|
|
public:
|
2017-01-14 12:02:08 +00:00
|
|
|
void Serialize(FSerializer &arc) override;
|
2016-03-01 15:47:10 +00:00
|
|
|
void StopAndDestroy ();
|
2017-01-12 21:49:18 +00:00
|
|
|
void OnDestroy() override;
|
2016-03-01 15:47:10 +00:00
|
|
|
void Tick ();
|
|
|
|
void ChangeData (int seqOffset, int delayTics, float volume, FSoundID currentSoundID);
|
|
|
|
void AddChoice (int seqnum, seqtype_t type);
|
|
|
|
int GetModeNum() const { return m_ModeNum; }
|
|
|
|
FName GetSequenceName() const;
|
|
|
|
static void StaticMarkHead() { GC::Mark(SequenceListHead); }
|
|
|
|
|
|
|
|
virtual void MakeSound (int loop, FSoundID id) {}
|
|
|
|
virtual void *Source () { return NULL; }
|
|
|
|
virtual bool IsPlaying () { return false; }
|
|
|
|
virtual DSeqNode *SpawnChild (int seqnum) { return NULL; }
|
|
|
|
|
|
|
|
inline static DSeqNode *FirstSequence() { return SequenceListHead; }
|
|
|
|
inline DSeqNode *NextSequence() const { return m_Next; }
|
|
|
|
|
2016-09-20 08:27:53 +00:00
|
|
|
static void SerializeSequences (FSerializer &arc);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
DSeqNode ();
|
|
|
|
DSeqNode (int sequence, int modenum);
|
|
|
|
|
2017-03-03 18:35:08 +00:00
|
|
|
int32_t *m_SequencePtr;
|
2016-03-01 15:47:10 +00:00
|
|
|
int m_Sequence;
|
|
|
|
|
|
|
|
FSoundID m_CurrentSoundID;
|
|
|
|
int m_StopSound;
|
2019-01-07 16:22:38 +00:00
|
|
|
int m_DelayTics;
|
2016-03-01 15:47:10 +00:00
|
|
|
float m_Volume;
|
|
|
|
float m_Atten;
|
|
|
|
int m_ModeNum;
|
|
|
|
|
|
|
|
TArray<int> m_SequenceChoices;
|
2017-03-08 12:34:26 +00:00
|
|
|
TObjPtr<DSeqNode*> m_ChildSeqNode;
|
|
|
|
TObjPtr<DSeqNode*> m_ParentSeqNode;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static DSeqNode *SequenceListHead;
|
|
|
|
DSeqNode *m_Next, *m_Prev;
|
|
|
|
|
|
|
|
void ActivateSequence (int sequence);
|
|
|
|
|
|
|
|
friend void SN_StopAllSequences (void);
|
|
|
|
};
|
|
|
|
|
|
|
|
void SN_StopAllSequences (void);
|
|
|
|
|
|
|
|
struct FSoundSequence
|
|
|
|
{
|
|
|
|
FName SeqName;
|
|
|
|
FName Slot;
|
|
|
|
FSoundID StopSound;
|
2017-03-03 18:35:08 +00:00
|
|
|
int32_t Script[1]; // + more until end of sequence script
|
2016-03-01 15:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void S_ParseSndSeq (int levellump);
|
|
|
|
DSeqNode *SN_StartSequence (AActor *mobj, int sequence, seqtype_t type, int modenum, bool nostop=false);
|
|
|
|
DSeqNode *SN_StartSequence (AActor *mobj, const char *name, int modenum);
|
|
|
|
DSeqNode *SN_StartSequence (AActor *mobj, FName seqname, int modenum);
|
|
|
|
DSeqNode *SN_StartSequence (sector_t *sector, int chan, int sequence, seqtype_t type, int modenum, bool nostop=false);
|
|
|
|
DSeqNode *SN_StartSequence (sector_t *sector, int chan, const char *name, 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, 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);
|
|
|
|
bool SN_AreModesSame(int sequence, seqtype_t type, int mode1, int mode2);
|
2017-01-14 12:02:08 +00:00
|
|
|
bool SN_AreModesSame(FName name, int mode1, int mode2);
|
2016-03-01 15:47:10 +00:00
|
|
|
void SN_UpdateActiveSequences (void);
|
2017-03-03 18:35:08 +00:00
|
|
|
ptrdiff_t SN_GetSequenceOffset (int sequence, int32_t *sequencePtr);
|
2016-03-01 15:47:10 +00:00
|
|
|
void SN_DoStop (void *);
|
|
|
|
void SN_ChangeNodeData (int nodeNum, int seqOffset, int delayTics,
|
|
|
|
float volume, int currentSoundID);
|
|
|
|
FName SN_GetSequenceSlot (int sequence, seqtype_t type);
|
|
|
|
void SN_MarkPrecacheSounds (int sequence, seqtype_t type);
|
|
|
|
bool SN_IsMakingLoopingSound (sector_t *sector);
|
|
|
|
|
|
|
|
#endif //__S_SNDSEQ_H__
|