2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 ///////////////////////////////////////////////////////////////////////////////
7 // $Header: r:/t2repos/thief2/src/sound/psndinst.h,v 1.22 2000/01/29 13:41:46 adurant Exp $
9 // Sound propagation instance header
27 F_DECLARE_INTERFACE(IAIManager
);
29 ////////////////////////////////////////
32 const int kMaxActiveSounds
= 32;
34 ////////////////////////////////////////////////////////////////////////////////
36 EXTERN
void EndSampleCallback(int hSound
, void *ptr
);
37 EXTERN
void LoopSampleCallback(int hSound
, void *ptr
);
39 ////////////////////////////////////////////////////////////////////////////////
41 typedef cHashTableFunctions
<ObjID
> ObjIDHashFunctions
;
43 typedef cHashTable
<ObjID
, cSoundInfoList
*, ObjIDHashFunctions
> cSoundInfoTable
;
44 typedef cHashTable
<ObjID
, mxs_real
, ObjIDHashFunctions
> cSoundPropTable
;
46 typedef cDynArray
<ObjID
> cSoundObjectList
;
48 typedef cDynArray
<const cRoomPortal
*> cPortalStack
;
57 enum PrioritizationResult
64 enum eDeferredHaltType
77 ////////////////////////////////////////////////////////////////////////////////
79 class cPropSndInst
: public cRoomPAFuncs
85 // Constructor / Destructor
90 void Init(int handle
, ObjID objID
, const mxs_vector
&loc
, ObjID schemaID
, const char *sampleName
,
91 int flags
, float atten_factor
, sfx_parm
*parms
, void *data
);
94 void ApplySoundInfo();
95 void ClearSoundInfo();
97 cPlayerSoundList
*GeneratePlayerSoundList(int handle
);
99 void AddDeferredHalt(int sfx_handle
, int type
);
100 void ApplyDeferredHaltList();
102 void AddActiveSound(cSoundInfo
*pSoundInfo
);
103 void EndActiveSound(cSoundInfo
*pSoundInfo
);
105 void BumpActiveSound(cPlayerSoundList
*pPlayerList
);
107 void SetupPlayerSoundListCallbacks (cPlayerSoundList
* pCurPlayerList
);
108 BOOL
PlaySoundList (cPlayerSoundList
* pCurPlayerList
);
111 void SetDrawSoundPath(BOOL state
) { m_DrawSoundPath
= state
; };
113 void DrawActiveSounds();
114 void SpewActiveSounds();
119 ////////////////////////////
121 mxs_real m_MaxDistance
; // Maximum distance the sound can be heard
122 mxs_real m_ScaleDistance
; // Forces max distance for sound
124 ObjID m_SrcObject
; // ID of object making sound (-1 if not applicable)
125 mxs_vector m_SrcPoint
; // Coordinates of sound source
127 const char *m_SampleName
; // Name of sample being propagated
128 sfx_parm
*m_pParms
; // Parameters from schema system
130 ObjID m_SchemaID
; // ObjID of the schema
132 void *m_Data
; // Any data that wants to be propagated too
134 int m_Handle
; // Sound propagation handle
136 int m_Flags
; // Sound info flags
138 ////////////////////////////
140 cSoundInfoTable m_InfoTable
; // Hash by objid to list sounds heard this frame
141 cSoundObjectList m_InfoList
; // List of objects that have heard a sound this frame
143 cSoundInfo
*m_ActiveSound
[kMaxActiveSounds
];
144 ObjID m_ActiveObject
[kMaxActiveSounds
];
145 int m_nActiveSoundObjects
;
147 cDynArray
<sDeferredHalt
> m_deferredHaltList
;
149 short m_roomNoBlock1
;
150 short m_roomNoBlock2
;
155 BOOL m_DrawSoundPath
;
158 BOOL m_SoundFullSpew
;
159 BOOL m_SoundGhostSpew
;
160 BOOL m_SoundFullAISpew
;
161 BOOL m_SoundPathSpew
;
162 BOOL m_SoundHearSpew
;
165 void FindSoundPath(const mxs_vector
&src_pt
, const mxs_vector
&hear_pt
, const cBFRoomInfo
*room_table
, int end_room
,
166 mxs_real
*dist
, mxs_vector
*position
, mxs_real
*realDist
, mxs_real
*blockingFactor
);
167 void BackCastPath(sAnchorPt
*anchor_list
, cRoomPortal
**portal_list
, int i
, const mxs_vector
&L
, const mxs_vector
&src_pt
);
171 BOOL
MergeSounds(cSoundInfoList
*pSoundInfoList
);
173 BOOL
ActiveSound(cSoundInfo
*pSoundInfo
);
175 void ResolveActiveSounds(ObjID hearingObj
);
176 void UpdateActiveSounds();
178 void ResolveDeferredSounds(ObjID hearingObj
);
179 void UpdateDeferredSounds();
181 IAIManager
* m_pAIManager
;
184 ////////////////////////////////////////////////////////////////////////////////
186 class cPropSndInstHigh
: public cPropSndInst
194 BOOL
EnterCallback(const cRoom
*room
, const cRoomPortal
*enterPortal
, const mxs_vector
&enterPt
, mxs_real dist
);
195 void ExitCallback(const cRoom
*room
);
196 mxs_real
PortalsCallback(const cRoomPortal
*enterPortal
, const cRoomPortal
*exitPortal
, mxs_real dist
);
199 ////////////////////////////////////////////////////////////////////////////////