diff options
author | SignpostMarv | 2012-10-05 14:04:28 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-29 23:38:57 +0000 |
commit | 6bd1f0f209bce2f158c881f525235078957e9a62 (patch) | |
tree | 34d1aedd28e7d249030c1b2eeb3422b297611a43 /OpenSim/Region | |
parent | making the max distance for sounds to be heard from their origin a configurab... (diff) | |
download | opensim-SC-6bd1f0f209bce2f158c881f525235078957e9a62.zip opensim-SC-6bd1f0f209bce2f158c881f525235078957e9a62.tar.gz opensim-SC-6bd1f0f209bce2f158c881f525235078957e9a62.tar.bz2 opensim-SC-6bd1f0f209bce2f158c881f525235078957e9a62.tar.xz |
Factoring out an if-else block in PlayAttachedSound as it was using the previously hard-coded max distance value.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index ff052ba..f3ec572 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | |||
@@ -112,6 +112,9 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
112 | 112 | ||
113 | SceneObjectGroup grp = part.ParentGroup; | 113 | SceneObjectGroup grp = part.ParentGroup; |
114 | 114 | ||
115 | if (radius == 0) | ||
116 | radius = MaxDistance; | ||
117 | |||
115 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | 118 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) |
116 | { | 119 | { |
117 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); | 120 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); |
@@ -130,9 +133,6 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
130 | float thisSpGain; | 133 | float thisSpGain; |
131 | 134 | ||
132 | // Scale by distance | 135 | // Scale by distance |
133 | if (radius == 0) | ||
134 | thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); | ||
135 | else | ||
136 | thisSpGain = (float)((double)gain * ((radius - dis) / radius)); | 136 | thisSpGain = (float)((double)gain * ((radius - dis) / radius)); |
137 | 137 | ||
138 | sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags); | 138 | sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags); |
@@ -160,6 +160,9 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | if (radius == 0) | ||
164 | radius = MaxDistance; | ||
165 | |||
163 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | 166 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) |
164 | { | 167 | { |
165 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); | 168 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); |
@@ -170,9 +173,6 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
170 | float thisSpGain; | 173 | float thisSpGain; |
171 | 174 | ||
172 | // Scale by distance | 175 | // Scale by distance |
173 | if (radius == 0) | ||
174 | thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); | ||
175 | else | ||
176 | thisSpGain = (float)((double)gain * ((radius - dis) / radius)); | 176 | thisSpGain = (float)((double)gain * ((radius - dis) / radius)); |
177 | 177 | ||
178 | sp.ControllingClient.SendTriggeredSound( | 178 | sp.ControllingClient.SendTriggeredSound( |