1 #ifndef __S_SNDSEQ_H__
2 #define __S_SNDSEQ_H__
3 
4 #include <stddef.h>
5 #include "actor.h"
6 #include "s_sound.h"
7 #include "r_defs.h"
8 
9 typedef enum {
10 	SEQ_PLATFORM,
11 	SEQ_DOOR,
12 	SEQ_ENVIRONMENT,
13 	SEQ_NUMSEQTYPES,
14 	SEQ_NOTRANS,
15 	MAXSEQUENCES
16 } seqtype_t;
17 
18 struct sector_s;
19 
20 void S_ParseSndSeq (void);
21 void SN_StartSequence (AActor *mobj, int sequence, seqtype_t type);
22 void SN_StartSequence (AActor *mobj, const char *name);
23 void SN_StartSequence (struct sector_s *sector, int sequence, seqtype_t type);
24 void SN_StartSequence (struct sector_s *sector, const char *name);
25 void SN_StartSequence (fixed_t spot[3], int sequence, seqtype_t type);
26 void SN_StartSequence (fixed_t spot[3], const char *name);
27 void SN_StopSequence (AActor *mobj);
28 void SN_StopSequence (sector_t *sector);
29 void SN_StopSequence (fixed_t spot[3]);
30 void SN_UpdateActiveSequences (void);
31 void SN_StopAllSequences (void);
32 ptrdiff_t SN_GetSequenceOffset (int sequence, unsigned int *sequencePtr);
33 void SN_ChangeNodeData (int nodeNum, int seqOffset, int delayTics,
34 	float volume, int currentSoundID);
35 
36 class DSeqNode : public DObject
37 {
38 	DECLARE_SERIAL (DSeqNode, DObject)
39 public:
40 	virtual ~DSeqNode ();
MakeSound()41 	virtual void MakeSound () {}
MakeLoopedSound()42 	virtual void MakeLoopedSound () {}
Source()43 	virtual void *Source () { return NULL; }
IsPlaying()44 	virtual bool IsPlaying () { return false; }
45 	void RunThink ();
FirstSequence()46 	inline static DSeqNode *FirstSequence() { return SequenceListHead; }
NextSequence()47 	inline DSeqNode *NextSequence() const { return m_Next; }
48 	void ChangeData (int seqOffset, int delayTics, float volume, int currentSoundID);
49 
50 	static void SerializeSequences (FArchive &arc);
51 
52 protected:
53 	DSeqNode ();
54 	DSeqNode (int sequence);
55 
56 	unsigned int *m_SequencePtr;
57 	int m_Sequence;
58 
59 	int m_CurrentSoundID;
60 	int m_DelayTics;
61 	float m_Volume;
62 	int m_StopSound;
63 	int m_Atten;
64 
65 private:
66 	static DSeqNode *SequenceListHead;
67 	DSeqNode *m_Next, *m_Prev;
68 
69 	void ActivateSequence (int sequence);
70 
71 	friend void SN_StopAllSequences (void);
72 };
73 
74 typedef struct
75 {
76 	char			name[MAX_SNDNAME+1];
77 	int				stopsound;
78 	unsigned int	script[1];	// + more until end of sequence script
79 } sndseq_t;
80 
81 void SN_StartSequence (AActor *mobj, int sequence, seqtype_t type);
82 void SN_StartSequence (AActor *mobj, const char *name);
83 void SN_StartSequence (struct sector_s *sector, int sequence, seqtype_t type);
84 void SN_StartSequence (struct sector_s *sector, const char *name);
85 void SN_StartSequence (polyobj_t *poly, int sequence, seqtype_t type);
86 void SN_StartSequence (polyobj_t *poly, const char *name);
87 void SN_StopSequence (AActor *mobj);
88 void SN_StopSequence (sector_t *sector);
89 void SN_StopSequence (polyobj_t *poly);
90 void SN_UpdateActiveSequences (void);
91 ptrdiff_t SN_GetSequenceOffset (int sequence, unsigned int *sequencePtr);
92 void SN_DoStop (void *);
93 void SN_ChangeNodeData (int nodeNum, int seqOffset, int delayTics,
94 	float volume, int currentSoundID);
95 
96 extern sndseq_t **Sequences;
97 extern int ActiveSequences;
98 extern int NumSequences;
99 
100 #endif //__S_SNDSEQ_H__
101 
102