diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 111 |
1 files changed, 56 insertions, 55 deletions
diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs index de82ddc..d72cf41 100644 --- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs | |||
@@ -188,9 +188,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
188 | 188 | ||
189 | public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist) | 189 | public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist) |
190 | { | 190 | { |
191 | // disable for now | ||
192 | return; | ||
193 | |||
194 | if (collidersinfolist.Count == 0 || part == null) | 191 | if (collidersinfolist.Count == 0 || part == null) |
195 | return; | 192 | return; |
196 | 193 | ||
@@ -238,17 +235,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
238 | { | 235 | { |
239 | if (!HaveSound) | 236 | if (!HaveSound) |
240 | { | 237 | { |
241 | volume = Math.Abs(colInfo.relativeVel); | 238 | // TODO: Import real collision sounds and uncomment this |
242 | if (volume < 0.2f) | 239 | // volume = Math.Abs(colInfo.relativeVel); |
243 | continue; | 240 | // if (volume < 0.2f) |
244 | 241 | // continue; | |
245 | volume *= volume * .0625f; // 4m/s == full volume | 242 | // |
246 | if (volume > 1.0f) | 243 | // volume *= volume * .0625f; // 4m/s == full volume |
247 | volume = 1.0f; | 244 | // if (volume > 1.0f) |
248 | 245 | // volume = 1.0f; | |
249 | soundID = m_TerrainPart[thisMaterial]; | 246 | // |
247 | // soundID = m_TerrainPart[thisMaterial]; | ||
250 | } | 248 | } |
251 | part.SendCollisionSound(soundID, volume, colInfo.position); | 249 | else // Remove this else when uncommenting the above |
250 | part.SendCollisionSound(soundID, volume, colInfo.position); | ||
252 | doneownsound = true; | 251 | doneownsound = true; |
253 | } | 252 | } |
254 | continue; | 253 | continue; |
@@ -269,40 +268,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
269 | if (volume == 0.0f) | 268 | if (volume == 0.0f) |
270 | continue; | 269 | continue; |
271 | } | 270 | } |
271 | // TODO: Import real collision sounds and uncomment this | ||
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 (soundID != UUID.Zero) // Remove when sounds are there | ||
291 | { // Remove when sounds are there | ||
292 | if (doneownsound) | ||
293 | otherPart.SendCollisionSound(soundID, volume, colInfo.position); | ||
272 | else | 294 | else |
273 | { | 295 | { |
274 | volume = Math.Abs(colInfo.relativeVel); | 296 | part.SendCollisionSound(soundID, volume, colInfo.position); |
275 | if (volume < 0.2f) | 297 | doneownsound = true; |
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 | } | 298 | } |
288 | } | 299 | } // Remove when sounds are there |
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 | } | 300 | } |
298 | } | 301 | } |
299 | } | 302 | } |
300 | 303 | ||
301 | public static void AvatarCollisionSound(ScenePresence av, List<CollisionForSoundInfo> collidersinfolist) | 304 | public static void AvatarCollisionSound(ScenePresence av, List<CollisionForSoundInfo> collidersinfolist) |
302 | { | 305 | { |
303 | // disable for now | ||
304 | return; | ||
305 | |||
306 | if (collidersinfolist.Count == 0 || av == null) | 306 | if (collidersinfolist.Count == 0 || av == null) |
307 | return; | 307 | return; |
308 | 308 | ||
@@ -341,22 +341,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
341 | continue; | 341 | continue; |
342 | if (otherPart.CollisionSoundType > 0 && otherPart.CollisionSoundVolume > 0f) | 342 | if (otherPart.CollisionSoundType > 0 && otherPart.CollisionSoundVolume > 0f) |
343 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position); | 343 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position); |
344 | else | 344 | //TODO: uncomment below when sounds are uploaded |
345 | { | 345 | // else |
346 | volume = Math.Abs(colInfo.relativeVel); | 346 | // { |
347 | if (volume < 0.2f) | 347 | // volume = Math.Abs(colInfo.relativeVel); |
348 | continue; | 348 | // if (volume < 0.2f) |
349 | 349 | // continue; | |
350 | volume *= volume * .0625f; // 4m/s == full volume | 350 | // |
351 | if (volume > 1.0f) | 351 | // volume *= volume * .0625f; // 4m/s == full volume |
352 | volume = 1.0f; | 352 | // if (volume > 1.0f) |
353 | otherMaterial = (int)otherPart.Material; | 353 | // volume = 1.0f; |
354 | if (otherMaterial >= MaxMaterials) | 354 | // otherMaterial = (int)otherPart.Material; |
355 | otherMaterial = 3; | 355 | // if (otherMaterial >= MaxMaterials) |
356 | 356 | // otherMaterial = 3; | |
357 | soundID = m_PartPart[thisMatScaled + otherMaterial]; | 357 | // |
358 | otherPart.SendCollisionSound(soundID, volume, colInfo.position); | 358 | // soundID = m_PartPart[thisMatScaled + otherMaterial]; |
359 | } | 359 | // otherPart.SendCollisionSound(soundID, volume, colInfo.position); |
360 | // } | ||
360 | continue; | 361 | continue; |
361 | } | 362 | } |
362 | /* | 363 | /* |
@@ -374,4 +375,4 @@ namespace OpenSim.Region.Framework.Scenes | |||
374 | } | 375 | } |
375 | } | 376 | } |
376 | } | 377 | } |
377 | } \ No newline at end of file | 378 | } |