Odamex
Setting the Standard in Multiplayer Doom
client/src/s_sndseq.h
Go to the documentation of this file.
00001 #ifndef __S_SNDSEQ_H__
00002 #define __S_SNDSEQ_H__
00003 
00004 #include <stddef.h>
00005 #include "actor.h"
00006 #include "s_sound.h"
00007 #include "r_defs.h"
00008 
00009 typedef enum {
00010         SEQ_PLATFORM,
00011         SEQ_DOOR,
00012         SEQ_ENVIRONMENT,
00013         SEQ_NUMSEQTYPES,
00014         SEQ_NOTRANS,
00015         MAXSEQUENCES
00016 } seqtype_t;
00017 
00018 struct sector_s;
00019 
00020 void S_ParseSndSeq (void);
00021 void SN_StartSequence (AActor *mobj, int sequence, seqtype_t type);
00022 void SN_StartSequence (AActor *mobj, const char *name);
00023 void SN_StartSequence (struct sector_s *sector, int sequence, seqtype_t type);
00024 void SN_StartSequence (struct sector_s *sector, const char *name);
00025 void SN_StartSequence (fixed_t spot[3], int sequence, seqtype_t type);
00026 void SN_StartSequence (fixed_t spot[3], const char *name);
00027 void SN_StopSequence (AActor *mobj);
00028 void SN_StopSequence (sector_t *sector);
00029 void SN_StopSequence (fixed_t spot[3]);
00030 void SN_UpdateActiveSequences (void);
00031 void SN_StopAllSequences (void);
00032 ptrdiff_t SN_GetSequenceOffset (int sequence, unsigned int *sequencePtr);
00033 void SN_ChangeNodeData (int nodeNum, int seqOffset, int delayTics,
00034         float volume, int currentSoundID);
00035 
00036 class DSeqNode : public DObject
00037 {
00038         DECLARE_SERIAL (DSeqNode, DObject)
00039 public:
00040         virtual ~DSeqNode ();
00041         virtual void MakeSound () {}
00042         virtual void MakeLoopedSound () {}
00043         virtual void *Source () { return NULL; }
00044         virtual bool IsPlaying () { return false; }
00045         void RunThink ();
00046         inline static DSeqNode *FirstSequence() { return SequenceListHead; }
00047         inline DSeqNode *NextSequence() const { return m_Next; }
00048         void ChangeData (int seqOffset, int delayTics, float volume, int currentSoundID);
00049 
00050         static void SerializeSequences (FArchive &arc);
00051 
00052 protected:
00053         DSeqNode ();
00054         DSeqNode (int sequence);
00055 
00056         unsigned int *m_SequencePtr;
00057         int m_Sequence;
00058 
00059         int m_CurrentSoundID;
00060         int m_DelayTics;
00061         float m_Volume;
00062         int m_StopSound;
00063         int m_Atten;
00064 
00065 private:
00066         static DSeqNode *SequenceListHead;
00067         DSeqNode *m_Next, *m_Prev;
00068 
00069         void ActivateSequence (int sequence);
00070 
00071         friend void SN_StopAllSequences (void);
00072 };
00073 
00074 typedef struct
00075 {
00076         char                    name[MAX_SNDNAME+1];
00077         int                             stopsound;
00078         unsigned int    script[1];      // + more until end of sequence script
00079 } sndseq_t;
00080 
00081 void SN_StartSequence (AActor *mobj, int sequence, seqtype_t type);
00082 void SN_StartSequence (AActor *mobj, const char *name);
00083 void SN_StartSequence (struct sector_s *sector, int sequence, seqtype_t type);
00084 void SN_StartSequence (struct sector_s *sector, const char *name);
00085 void SN_StartSequence (polyobj_t *poly, int sequence, seqtype_t type);
00086 void SN_StartSequence (polyobj_t *poly, const char *name);
00087 void SN_StopSequence (AActor *mobj);
00088 void SN_StopSequence (sector_t *sector);
00089 void SN_StopSequence (polyobj_t *poly);
00090 void SN_UpdateActiveSequences (void);
00091 ptrdiff_t SN_GetSequenceOffset (int sequence, unsigned int *sequencePtr);
00092 void SN_DoStop (void *);
00093 void SN_ChangeNodeData (int nodeNum, int seqOffset, int delayTics,
00094         float volume, int currentSoundID);
00095 
00096 extern sndseq_t **Sequences;
00097 extern int ActiveSequences;
00098 extern int NumSequences;
00099 
00100 #endif //__S_SNDSEQ_H__
00101 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends