diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/CollisionSounds.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 377 |
1 files changed, 377 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs new file mode 100644 index 0000000..de82ddc --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs | |||
@@ -0,0 +1,377 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | // Ubit 2012 | ||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | |||
34 | namespace OpenSim.Region.Framework.Scenes | ||
35 | { | ||
36 | public struct CollisionForSoundInfo | ||
37 | { | ||
38 | public uint colliderID; | ||
39 | public Vector3 position; | ||
40 | public float relativeVel; | ||
41 | } | ||
42 | |||
43 | public static class CollisionSounds | ||
44 | { | ||
45 | private const int MaxMaterials = 7; | ||
46 | // part part | ||
47 | /* | ||
48 | private static UUID snd_StoneStone = new UUID("be7295c0-a158-11e1-b3dd-0800200c9a66"); | ||
49 | private static UUID snd_StoneMetal = new UUID("be7295c0-a158-11e1-b3dd-0800201c9a66"); | ||
50 | private static UUID snd_StoneGlass = new UUID("be7295c0-a158-11e1-b3dd-0800202c9a66"); | ||
51 | private static UUID snd_StoneWood = new UUID("be7295c0-a158-11e1-b3dd-0800203c9a66"); | ||
52 | private static UUID snd_StoneFlesh = new UUID("be7295c0-a158-11e1-b3dd-0800204c9a66"); | ||
53 | private static UUID snd_StonePlastic = new UUID("be7295c0-a158-11e1-b3dd-0800205c9a66"); | ||
54 | private static UUID snd_StoneRubber = new UUID("be7295c0-a158-11e1-b3dd-0800206c9a66"); | ||
55 | |||
56 | private static UUID snd_MetalStone = new UUID("be7295c0-a158-11e1-b3dd-0801200c9a66"); | ||
57 | private static UUID snd_MetalMetal = new UUID("be7295c0-a158-11e1-b3dd-0801201c9a66"); | ||
58 | private static UUID snd_MetalGlass = new UUID("be7295c0-a158-11e1-b3dd-0801202c9a66"); | ||
59 | private static UUID snd_MetalWood = new UUID("be7295c0-a158-11e1-b3dd-0801203c9a66"); | ||
60 | private static UUID snd_MetalFlesh = new UUID("be7295c0-a158-11e1-b3dd-0801204c9a66"); | ||
61 | private static UUID snd_MetalPlastic = new UUID("be7295c0-a158-11e1-b3dd-0801205c9a66"); | ||
62 | private static UUID snd_MetalRubber = new UUID("be7295c0-a158-11e1-b3dd-0801206c9a66"); | ||
63 | |||
64 | private static UUID snd_GlassStone = new UUID("be7295c0-a158-11e1-b3dd-0802200c9a66"); | ||
65 | private static UUID snd_GlassMetal = new UUID("be7295c0-a158-11e1-b3dd-0802201c9a66"); | ||
66 | private static UUID snd_GlassGlass = new UUID("be7295c0-a158-11e1-b3dd-0802202c9a66"); | ||
67 | private static UUID snd_GlassWood = new UUID("be7295c0-a158-11e1-b3dd-0802203c9a66"); | ||
68 | private static UUID snd_GlassFlesh = new UUID("be7295c0-a158-11e1-b3dd-0802204c9a66"); | ||
69 | private static UUID snd_GlassPlastic = new UUID("be7295c0-a158-11e1-b3dd-0802205c9a66"); | ||
70 | private static UUID snd_GlassRubber = new UUID("be7295c0-a158-11e1-b3dd-0802206c9a66"); | ||
71 | |||
72 | private static UUID snd_WoodStone = new UUID("be7295c0-a158-11e1-b3dd-0803200c9a66"); | ||
73 | private static UUID snd_WoodMetal = new UUID("be7295c0-a158-11e1-b3dd-0803201c9a66"); | ||
74 | private static UUID snd_WoodGlass = new UUID("be7295c0-a158-11e1-b3dd-0803202c9a66"); | ||
75 | private static UUID snd_WoodWood = new UUID("be7295c0-a158-11e1-b3dd-0803203c9a66"); | ||
76 | private static UUID snd_WoodFlesh = new UUID("be7295c0-a158-11e1-b3dd-0803204c9a66"); | ||
77 | private static UUID snd_WoodPlastic = new UUID("be7295c0-a158-11e1-b3dd-0803205c9a66"); | ||
78 | private static UUID snd_WoodRubber = new UUID("be7295c0-a158-11e1-b3dd-0803206c9a66"); | ||
79 | |||
80 | private static UUID snd_FleshStone = new UUID("be7295c0-a158-11e1-b3dd-0804200c9a66"); | ||
81 | private static UUID snd_FleshMetal = new UUID("be7295c0-a158-11e1-b3dd-0804201c9a66"); | ||
82 | private static UUID snd_FleshGlass = new UUID("be7295c0-a158-11e1-b3dd-0804202c9a66"); | ||
83 | private static UUID snd_FleshWood = new UUID("be7295c0-a158-11e1-b3dd-0804203c9a66"); | ||
84 | private static UUID snd_FleshFlesh = new UUID("be7295c0-a158-11e1-b3dd-0804204c9a66"); | ||
85 | private static UUID snd_FleshPlastic = new UUID("be7295c0-a158-11e1-b3dd-0804205c9a66"); | ||
86 | private static UUID snd_FleshRubber = new UUID("be7295c0-a158-11e1-b3dd-0804206c9a66"); | ||
87 | |||
88 | private static UUID snd_PlasticStone = new UUID("be7295c0-a158-11e1-b3dd-0805200c9a66"); | ||
89 | private static UUID snd_PlasticMetal = new UUID("be7295c0-a158-11e1-b3dd-0805201c9a66"); | ||
90 | private static UUID snd_PlasticGlass = new UUID("be7295c0-a158-11e1-b3dd-0805202c9a66"); | ||
91 | private static UUID snd_PlasticWood = new UUID("be7295c0-a158-11e1-b3dd-0805203c9a66"); | ||
92 | private static UUID snd_PlasticFlesh = new UUID("be7295c0-a158-11e1-b3dd-0805204c9a66"); | ||
93 | private static UUID snd_PlasticPlastic = new UUID("be7295c0-a158-11e1-b3dd-0805205c9a66"); | ||
94 | private static UUID snd_PlasticRubber = new UUID("be7295c0-a158-11e1-b3dd-0805206c9a66"); | ||
95 | |||
96 | private static UUID snd_RubberStone = new UUID("be7295c0-a158-11e1-b3dd-0806200c9a66"); | ||
97 | private static UUID snd_RubberMetal = new UUID("be7295c0-a158-11e1-b3dd-0806201c9a66"); | ||
98 | private static UUID snd_RubberGlass = new UUID("be7295c0-a158-11e1-b3dd-0806202c9a66"); | ||
99 | private static UUID snd_RubberWood = new UUID("be7295c0-a158-11e1-b3dd-0806203c9a66"); | ||
100 | private static UUID snd_RubberFlesh = new UUID("be7295c0-a158-11e1-b3dd-0806204c9a66"); | ||
101 | private static UUID snd_RubberPlastic = new UUID("be7295c0-a158-11e1-b3dd-0806205c9a66"); | ||
102 | private static UUID snd_RubberRubber = new UUID("be7295c0-a158-11e1-b3dd-0806206c9a66"); | ||
103 | |||
104 | // terrain part | ||
105 | private static UUID snd_TerrainStone = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
106 | private static UUID snd_TerrainMetal = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
107 | private static UUID snd_TerrainGlass = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
108 | private static UUID snd_TerrainWood = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
109 | private static UUID snd_TerrainFlesh = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
110 | private static UUID snd_TerrainPlastic = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
111 | private static UUID snd_TerrainRubber = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
112 | */ | ||
113 | private static UUID snd_StoneStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
114 | private static UUID snd_StoneMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
115 | private static UUID snd_StoneGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
116 | private static UUID snd_StoneWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
117 | private static UUID snd_StoneFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
118 | private static UUID snd_StonePlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
119 | private static UUID snd_StoneRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
120 | |||
121 | private static UUID snd_MetalMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
122 | private static UUID snd_MetalGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
123 | private static UUID snd_MetalWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
124 | private static UUID snd_MetalFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
125 | private static UUID snd_MetalPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
126 | private static UUID snd_MetalRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
127 | |||
128 | private static UUID snd_GlassGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
129 | private static UUID snd_GlassWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
130 | private static UUID snd_GlassFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
131 | private static UUID snd_GlassPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
132 | private static UUID snd_GlassRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
133 | |||
134 | private static UUID snd_WoodWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
135 | private static UUID snd_WoodFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
136 | private static UUID snd_WoodPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
137 | private static UUID snd_WoodRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
138 | |||
139 | private static UUID snd_FleshFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
140 | private static UUID snd_FleshPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
141 | private static UUID snd_FleshRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
142 | |||
143 | private static UUID snd_PlasticPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
144 | private static UUID snd_PlasticRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
145 | |||
146 | private static UUID snd_RubberRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
147 | |||
148 | // terrain part | ||
149 | private static UUID snd_TerrainStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
150 | private static UUID snd_TerrainMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
151 | private static UUID snd_TerrainGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
152 | private static UUID snd_TerrainWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
153 | private static UUID snd_TerrainFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
154 | private static UUID snd_TerrainPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
155 | private static UUID snd_TerrainRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
156 | |||
157 | public static UUID[] m_TerrainPart = { | ||
158 | snd_TerrainStone, | ||
159 | snd_TerrainMetal, | ||
160 | snd_TerrainGlass, | ||
161 | snd_TerrainWood, | ||
162 | snd_TerrainFlesh, | ||
163 | snd_TerrainPlastic, | ||
164 | snd_TerrainRubber | ||
165 | }; | ||
166 | /* | ||
167 | //full assimetric sounds | ||
168 | public static UUID[] m_PartPart = { | ||
169 | snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber, | ||
170 | snd_MetalStone, snd_MetalMetal, snd_MetalGlass, snd_MetalWood, snd_MetalFlesh, snd_MetalPlastic, snd_MetalRubber, | ||
171 | snd_GlassStone, snd_GlassMetal, snd_GlassGlass, snd_GlassWood, snd_GlassFlesh, snd_GlassPlastic, snd_GlassRubber, | ||
172 | snd_WoodStone, snd_WoodMetal, snd_WoodGlass, snd_WoodWood, snd_WoodFlesh, snd_WoodPlastic, snd_WoodRubber, | ||
173 | snd_FleshStone, snd_FleshMetal, snd_FleshGlass, snd_FleshWood, snd_FleshFlesh, snd_FleshPlastic, snd_FleshRubber, | ||
174 | snd_PlasticStone, snd_PlasticMetal, snd_PlasticGlass, snd_PlasticWood, snd_PlasticFlesh, snd_PlasticPlastic, snd_PlasticRubber, | ||
175 | snd_RubberStone, snd_RubberMetal, snd_RubberGlass, snd_RubberWood, snd_RubberFlesh, snd_RubberPlastic, snd_RubberRubber | ||
176 | }; | ||
177 | */ | ||
178 | // simetric sounds | ||
179 | public static UUID[] m_PartPart = { | ||
180 | snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber, | ||
181 | snd_StoneMetal, snd_MetalMetal, snd_MetalGlass, snd_MetalWood, snd_MetalFlesh, snd_MetalPlastic, snd_MetalRubber, | ||
182 | snd_StoneGlass, snd_MetalGlass, snd_GlassGlass, snd_GlassWood, snd_GlassFlesh, snd_GlassPlastic, snd_GlassRubber, | ||
183 | snd_StoneWood, snd_MetalWood, snd_GlassWood, snd_WoodWood, snd_WoodFlesh, snd_WoodPlastic, snd_WoodRubber, | ||
184 | snd_StoneFlesh, snd_MetalFlesh, snd_GlassFlesh, snd_WoodFlesh, snd_FleshFlesh, snd_FleshPlastic, snd_FleshRubber, | ||
185 | snd_StonePlastic, snd_MetalPlastic, snd_GlassPlastic, snd_WoodPlastic, snd_FleshPlastic, snd_PlasticPlastic, snd_PlasticRubber, | ||
186 | snd_StoneRubber, snd_MetalRubber, snd_GlassRubber, snd_WoodRubber, snd_FleshRubber, snd_PlasticRubber, snd_RubberRubber | ||
187 | }; | ||
188 | |||
189 | public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist) | ||
190 | { | ||
191 | // disable for now | ||
192 | return; | ||
193 | |||
194 | if (collidersinfolist.Count == 0 || part == null) | ||
195 | return; | ||
196 | |||
197 | if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) | ||
198 | return; | ||
199 | |||
200 | if (part.ParentGroup == null) | ||
201 | return; | ||
202 | |||
203 | if (part.CollisionSoundType < 0) | ||
204 | return; | ||
205 | |||
206 | float volume = 0.0f; | ||
207 | bool HaveSound = false; | ||
208 | |||
209 | UUID soundID = part.CollisionSound; | ||
210 | |||
211 | if (part.CollisionSoundType > 0) | ||
212 | { | ||
213 | // soundID = part.CollisionSound; | ||
214 | volume = part.CollisionSoundVolume; | ||
215 | if (volume == 0.0f) | ||
216 | return; | ||
217 | HaveSound = true; | ||
218 | } | ||
219 | |||
220 | bool doneownsound = false; | ||
221 | |||
222 | int thisMaterial = (int)part.Material; | ||
223 | if (thisMaterial >= MaxMaterials) | ||
224 | thisMaterial = 3; | ||
225 | int thisMatScaled = thisMaterial * MaxMaterials; | ||
226 | |||
227 | CollisionForSoundInfo colInfo; | ||
228 | uint id; | ||
229 | |||
230 | for(int i = 0; i< collidersinfolist.Count; i++) | ||
231 | { | ||
232 | colInfo = collidersinfolist[i]; | ||
233 | |||
234 | id = colInfo.colliderID; | ||
235 | if (id == 0) // terrain collision | ||
236 | { | ||
237 | if (!doneownsound) | ||
238 | { | ||
239 | if (!HaveSound) | ||
240 | { | ||
241 | volume = Math.Abs(colInfo.relativeVel); | ||
242 | if (volume < 0.2f) | ||
243 | continue; | ||
244 | |||
245 | volume *= volume * .0625f; // 4m/s == full volume | ||
246 | if (volume > 1.0f) | ||
247 | volume = 1.0f; | ||
248 | |||
249 | soundID = m_TerrainPart[thisMaterial]; | ||
250 | } | ||
251 | part.SendCollisionSound(soundID, volume, colInfo.position); | ||
252 | doneownsound = true; | ||
253 | } | ||
254 | continue; | ||
255 | } | ||
256 | |||
257 | SceneObjectPart otherPart = part.ParentGroup.Scene.GetSceneObjectPart(id); | ||
258 | if (otherPart != null) | ||
259 | { | ||
260 | if (otherPart.CollisionSoundType < 0 || otherPart.VolumeDetectActive) | ||
261 | continue; | ||
262 | |||
263 | if (!HaveSound) | ||
264 | { | ||
265 | if (otherPart.CollisionSoundType > 0) | ||
266 | { | ||
267 | soundID = otherPart.CollisionSound; | ||
268 | volume = otherPart.CollisionSoundVolume; | ||
269 | if (volume == 0.0f) | ||
270 | continue; | ||
271 | } | ||
272 | else | ||
273 | { | ||
274 | volume = Math.Abs(colInfo.relativeVel); | ||
275 | if (volume < 0.2f) | ||
276 | continue; | ||
277 | |||
278 | volume *= volume * .0625f; // 4m/s == full volume | ||
279 | if (volume > 1.0f) | ||
280 | volume = 1.0f; | ||
281 | |||
282 | int otherMaterial = (int)otherPart.Material; | ||
283 | if (otherMaterial >= MaxMaterials) | ||
284 | otherMaterial = 3; | ||
285 | |||
286 | soundID = m_PartPart[thisMatScaled + otherMaterial]; | ||
287 | } | ||
288 | } | ||
289 | |||
290 | if (doneownsound) | ||
291 | otherPart.SendCollisionSound(soundID, volume, colInfo.position); | ||
292 | else | ||
293 | { | ||
294 | part.SendCollisionSound(soundID, volume, colInfo.position); | ||
295 | doneownsound = true; | ||
296 | } | ||
297 | } | ||
298 | } | ||
299 | } | ||
300 | |||
301 | public static void AvatarCollisionSound(ScenePresence av, List<CollisionForSoundInfo> collidersinfolist) | ||
302 | { | ||
303 | // disable for now | ||
304 | return; | ||
305 | |||
306 | if (collidersinfolist.Count == 0 || av == null) | ||
307 | return; | ||
308 | |||
309 | UUID soundID; | ||
310 | int otherMaterial; | ||
311 | |||
312 | int thisMaterial = 4; // flesh | ||
313 | |||
314 | int thisMatScaled = thisMaterial * MaxMaterials; | ||
315 | |||
316 | // bool doneownsound = false; | ||
317 | |||
318 | CollisionForSoundInfo colInfo; | ||
319 | uint id; | ||
320 | float volume; | ||
321 | |||
322 | for(int i = 0; i< collidersinfolist.Count; i++) | ||
323 | { | ||
324 | colInfo = collidersinfolist[i]; | ||
325 | |||
326 | id = colInfo.colliderID; | ||
327 | |||
328 | if (id == 0) // no terrain collision sounds for now | ||
329 | { | ||
330 | continue; | ||
331 | // volume = Math.Abs(colInfo.relativeVel); | ||
332 | // if (volume < 0.2f) | ||
333 | // continue; | ||
334 | |||
335 | } | ||
336 | |||
337 | SceneObjectPart otherPart = av.Scene.GetSceneObjectPart(id); | ||
338 | if (otherPart != null) | ||
339 | { | ||
340 | if (otherPart.CollisionSoundType < 0) | ||
341 | continue; | ||
342 | if (otherPart.CollisionSoundType > 0 && otherPart.CollisionSoundVolume > 0f) | ||
343 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position); | ||
344 | else | ||
345 | { | ||
346 | volume = Math.Abs(colInfo.relativeVel); | ||
347 | if (volume < 0.2f) | ||
348 | continue; | ||
349 | |||
350 | volume *= volume * .0625f; // 4m/s == full volume | ||
351 | if (volume > 1.0f) | ||
352 | volume = 1.0f; | ||
353 | otherMaterial = (int)otherPart.Material; | ||
354 | if (otherMaterial >= MaxMaterials) | ||
355 | otherMaterial = 3; | ||
356 | |||
357 | soundID = m_PartPart[thisMatScaled + otherMaterial]; | ||
358 | otherPart.SendCollisionSound(soundID, volume, colInfo.position); | ||
359 | } | ||
360 | continue; | ||
361 | } | ||
362 | /* | ||
363 | else if (!doneownsound) | ||
364 | { | ||
365 | ScenePresence otherav = av.Scene.GetScenePresence(Id); | ||
366 | if (otherav != null && (!otherav.IsChildAgent)) | ||
367 | { | ||
368 | soundID = snd_FleshFlesh; | ||
369 | av.SendCollisionSound(soundID, 1.0); | ||
370 | doneownsound = true; | ||
371 | } | ||
372 | } | ||
373 | */ | ||
374 | } | ||
375 | } | ||
376 | } | ||
377 | } \ No newline at end of file | ||