aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorUbitUmarov2016-08-20 23:41:32 +0100
committerUbitUmarov2016-08-20 23:41:32 +0100
commit04dd2a979546c7fc2d3c8c06634a2d0ed2f5f6c0 (patch)
tree79c5f0e5e28a50544cf4326ca9966ccb7c0f59b2 /OpenSim/Region/Framework/Scenes
parentMantis #8000, don't charge for updating classifieds. Thanks, Cinder! (diff)
downloadopensim-SC-04dd2a979546c7fc2d3c8c06634a2d0ed2f5f6c0.zip
opensim-SC-04dd2a979546c7fc2d3c8c06634a2d0ed2f5f6c0.tar.gz
opensim-SC-04dd2a979546c7fc2d3c8c06634a2d0ed2f5f6c0.tar.bz2
opensim-SC-04dd2a979546c7fc2d3c8c06634a2d0ed2f5f6c0.tar.xz
fix llCollisionSound("",0.0) not disabling sounds BUT let llCollisionSound("",value [<=1.0]) play default sounds with selected volume. I really don't care if last part is not like SL
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/CollisionSounds.cs67
1 files changed, 46 insertions, 21 deletions
diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs
index 075724e..078449b 100644
--- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs
+++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs
@@ -128,18 +128,26 @@ namespace OpenSim.Region.Framework.Scenes
128 if (part.CollisionSoundType < 0) 128 if (part.CollisionSoundType < 0)
129 return; 129 return;
130 130
131 float volume = 0.0f; 131 float volume = part.CollisionSoundVolume;
132 bool HaveSound = false; 132 if (volume == 0.0f)
133 return;
133 134
134 UUID soundID = part.CollisionSound; 135 UUID soundID = part.CollisionSound;
135 136
136 if (part.CollisionSoundType > 0) 137 bool HaveSound = false;
138 switch (part.CollisionSoundType)
137 { 139 {
138 // soundID = part.CollisionSound; 140 case 0: // default sounds
139 volume = part.CollisionSoundVolume; 141 volume = 1.0f;
140 if (volume == 0.0f) 142 break;
141 return; 143 case 1: // selected sound
142 HaveSound = true; 144 if(soundID == part.invalidCollisionSoundUUID)
145 return;
146 HaveSound = true;
147 break;
148 case 2: // default sounds with volume set by script
149 default:
150 break;
143 } 151 }
144 152
145 bool doneownsound = false; 153 bool doneownsound = false;
@@ -152,7 +160,7 @@ namespace OpenSim.Region.Framework.Scenes
152 CollisionForSoundInfo colInfo; 160 CollisionForSoundInfo colInfo;
153 uint id; 161 uint id;
154 162
155 for(int i = 0; i< collidersinfolist.Count; i++) 163 for(int i = 0; i < collidersinfolist.Count; i++)
156 { 164 {
157 colInfo = collidersinfolist[i]; 165 colInfo = collidersinfolist[i];
158 166
@@ -163,15 +171,16 @@ namespace OpenSim.Region.Framework.Scenes
163 { 171 {
164 if (!HaveSound) 172 if (!HaveSound)
165 { 173 {
166 volume = Math.Abs(colInfo.relativeVel); 174 float vol = Math.Abs(colInfo.relativeVel);
167 if (volume < 0.2f) 175 if (vol < 0.2f)
168 continue; 176 continue;
169 177
170 volume *= volume * .0625f; // 4m/s == full volume 178 vol *= vol * .0625f; // 4m/s == full volume
171 if (volume > 1.0f) 179 if (vol > 1.0f)
172 volume = 1.0f; 180 vol = 1.0f;
173 181
174 soundID = m_TerrainPart[thisMaterial]; 182 soundID = m_TerrainPart[thisMaterial];
183 volume *= vol;
175 } 184 }
176 part.SendCollisionSound(soundID, volume, colInfo.position); 185 part.SendCollisionSound(soundID, volume, colInfo.position);
177 doneownsound = true; 186 doneownsound = true;
@@ -187,7 +196,7 @@ namespace OpenSim.Region.Framework.Scenes
187 196
188 if (!HaveSound) 197 if (!HaveSound)
189 { 198 {
190 if (otherPart.CollisionSoundType > 0) 199 if (otherPart.CollisionSoundType == 1)
191 { 200 {
192 soundID = otherPart.CollisionSound; 201 soundID = otherPart.CollisionSound;
193 volume = otherPart.CollisionSoundVolume; 202 volume = otherPart.CollisionSoundVolume;
@@ -196,19 +205,27 @@ namespace OpenSim.Region.Framework.Scenes
196 } 205 }
197 else 206 else
198 { 207 {
199 volume = Math.Abs(colInfo.relativeVel); 208 if (otherPart.CollisionSoundType == 2)
200 if (volume < 0.2f) 209 {
210 volume = otherPart.CollisionSoundVolume;
211 if (volume == 0.0f)
212 continue;
213 }
214
215 float vol = Math.Abs(colInfo.relativeVel);
216 if (vol < 0.2f)
201 continue; 217 continue;
202 218
203 volume *= volume * .0625f; // 4m/s == full volume 219 vol *= vol * .0625f; // 4m/s == full volume
204 if (volume > 1.0f) 220 if (vol > 1.0f)
205 volume = 1.0f; 221 vol = 1.0f;
206 222
207 int otherMaterial = (int)otherPart.Material; 223 int otherMaterial = (int)otherPart.Material;
208 if (otherMaterial >= MaxMaterials) 224 if (otherMaterial >= MaxMaterials)
209 otherMaterial = 3; 225 otherMaterial = 3;
210 226
211 soundID = m_PartPart[thisMatScaled + otherMaterial]; 227 soundID = m_PartPart[thisMatScaled + otherMaterial];
228 volume *= vol;
212 } 229 }
213 } 230 }
214 231
@@ -261,10 +278,17 @@ namespace OpenSim.Region.Framework.Scenes
261 { 278 {
262 if (otherPart.CollisionSoundType < 0) 279 if (otherPart.CollisionSoundType < 0)
263 continue; 280 continue;
264 if (otherPart.CollisionSoundType > 0 && otherPart.CollisionSoundVolume > 0f) 281 if (otherPart.CollisionSoundType == 1 && otherPart.CollisionSoundVolume > 0f)
265 otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position); 282 otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position);
266 else 283 else
267 { 284 {
285 float volmod = 1.0f;
286 if (otherPart.CollisionSoundType == 2)
287 {
288 volmod = otherPart.CollisionSoundVolume;
289 if(volmod == 0.0)
290 continue;
291 }
268 volume = Math.Abs(colInfo.relativeVel); 292 volume = Math.Abs(colInfo.relativeVel);
269 // Most noral collisions (running into walls, stairs) 293 // Most noral collisions (running into walls, stairs)
270 // should never be heard. 294 // should never be heard.
@@ -281,6 +305,7 @@ namespace OpenSim.Region.Framework.Scenes
281 if (otherMaterial >= MaxMaterials) 305 if (otherMaterial >= MaxMaterials)
282 otherMaterial = 3; 306 otherMaterial = 3;
283 307
308 volume *= volmod;
284 soundID = m_PartPart[thisMatScaled + otherMaterial]; 309 soundID = m_PartPart[thisMatScaled + otherMaterial];
285 otherPart.SendCollisionSound(soundID, volume, colInfo.position); 310 otherPart.SendCollisionSound(soundID, volume, colInfo.position);
286 } 311 }