diff options
author | Charles Krinke | 2008-05-30 15:34:54 +0000 |
---|---|---|
committer | Charles Krinke | 2008-05-30 15:34:54 +0000 |
commit | 48d0084e5344ffaa6478a35f88516a6d7a68e26c (patch) | |
tree | 8741e650eded05d20cb665e5bb3579c3ec01cc02 /OpenSim | |
parent | * Read all files from tar archive (diff) | |
download | opensim-SC-48d0084e5344ffaa6478a35f88516a6d7a68e26c.zip opensim-SC-48d0084e5344ffaa6478a35f88516a6d7a68e26c.tar.gz opensim-SC-48d0084e5344ffaa6478a35f88516a6d7a68e26c.tar.bz2 opensim-SC-48d0084e5344ffaa6478a35f88516a6d7a68e26c.tar.xz |
Mantis#1422. Thank you kindly, Xantor for a patch that :
- volume doesn't change with a new llLoopSound(same sound, new volume);
- SendFullUpdateToClients sends 0's in all sound related fields when
there's no sound on the prim, thereby improving the amount of data being
sent out on these prims (fixes zeropack)
- Removed some code duplication between llStartSound, llLoopSound and llParticleSystem() calls
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 76 |
2 files changed, 48 insertions, 49 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 071a1bb..6a912e5 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -2229,11 +2229,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2229 | } | 2229 | } |
2230 | 2230 | ||
2231 | // Xantor 20080528: Send sound info as well | 2231 | // Xantor 20080528: Send sound info as well |
2232 | outPacket.ObjectData[0].Sound = SoundId; | 2232 | // Xantor 20080530: Zero out everything if there's no SoundId, so zerocompression will work again |
2233 | outPacket.ObjectData[0].OwnerID = ownerID; | 2233 | outPacket.ObjectData[0].Sound = SoundId; |
2234 | outPacket.ObjectData[0].Gain = (float) SoundGain; | 2234 | if (SoundId == LLUUID.Zero) |
2235 | outPacket.ObjectData[0].Radius = (float) SoundRadius; | 2235 | { |
2236 | outPacket.ObjectData[0].Flags = SoundFlags; | 2236 | outPacket.ObjectData[0].OwnerID = LLUUID.Zero; |
2237 | outPacket.ObjectData[0].Gain = 0.0f; | ||
2238 | outPacket.ObjectData[0].Radius = 0.0f; | ||
2239 | outPacket.ObjectData[0].Flags = 0; | ||
2240 | } | ||
2241 | else | ||
2242 | { | ||
2243 | outPacket.ObjectData[0].OwnerID = ownerID; | ||
2244 | outPacket.ObjectData[0].Gain = (float)SoundGain; | ||
2245 | outPacket.ObjectData[0].Radius = (float)SoundRadius; | ||
2246 | outPacket.ObjectData[0].Flags = SoundFlags; | ||
2247 | } | ||
2237 | 2248 | ||
2238 | byte[] pb = pos.GetBytes(); | 2249 | byte[] pb = pos.GetBytes(); |
2239 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); | 2250 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 518e37b..5b1408f 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -176,6 +176,31 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
176 | return LLUUID.Zero; | 176 | return LLUUID.Zero; |
177 | } | 177 | } |
178 | 178 | ||
179 | |||
180 | /// <summary> | ||
181 | /// accepts a valid LLUUID, -or- a name of an inventory item. | ||
182 | /// Returns a valid LLUUID or LLUUID.Zero if key invalid and item not found | ||
183 | /// in prim inventory. | ||
184 | /// </summary> | ||
185 | /// <param name="k"></param> | ||
186 | /// <returns></returns> | ||
187 | private LLUUID KeyOrName(string k) | ||
188 | { | ||
189 | LLUUID key = LLUUID.Zero; | ||
190 | |||
191 | // if we can parse the string as a key, use it. | ||
192 | if (LLUUID.TryParse(k, out key)) | ||
193 | { | ||
194 | return key; | ||
195 | } | ||
196 | // else try to locate the name in inventory of object. found returns key, | ||
197 | // not found returns LLUUID.Zero which will translate to the default particle texture | ||
198 | else | ||
199 | { | ||
200 | return InventoryKey(k); | ||
201 | } | ||
202 | } | ||
203 | |||
179 | public void osSetRegionWaterHeight(double height) | 204 | public void osSetRegionWaterHeight(double height) |
180 | { | 205 | { |
181 | m_host.AddScriptLPS(1); | 206 | m_host.AddScriptLPS(1); |
@@ -1391,27 +1416,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1391 | } | 1416 | } |
1392 | 1417 | ||
1393 | // Xantor 20080528 PlaySound updated so it accepts an objectinventory name -or- a key to a sound | 1418 | // Xantor 20080528 PlaySound updated so it accepts an objectinventory name -or- a key to a sound |
1419 | // 20080530 Updated to remove code duplication | ||
1394 | public void llPlaySound(string sound, double volume) | 1420 | public void llPlaySound(string sound, double volume) |
1395 | { | 1421 | { |
1396 | m_host.AddScriptLPS(1); | 1422 | m_host.AddScriptLPS(1); |
1397 | 1423 | ||
1398 | LLUUID key = LLUUID.Zero; | ||
1399 | |||
1400 | // if we can parse the string as a key, use it. | ||
1401 | if (LLUUID.TryParse(sound, out key)) | ||
1402 | { | ||
1403 | sound = key.ToString(); | ||
1404 | } | ||
1405 | // else try to locate the name in inventory of object. found returns key, | ||
1406 | // not found returns LLUUID.Zero | ||
1407 | else | ||
1408 | { | ||
1409 | sound = InventoryKey(sound).ToString(); | ||
1410 | } | ||
1411 | |||
1412 | // send the sound, once, to all clients in range | 1424 | // send the sound, once, to all clients in range |
1413 | m_host.SendSound(sound, volume, false, 0); | 1425 | m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0); |
1414 | |||
1415 | } | 1426 | } |
1416 | 1427 | ||
1417 | // Xantor 20080528 we should do this differently. | 1428 | // Xantor 20080528 we should do this differently. |
@@ -1420,24 +1431,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1420 | // just sending the sound out once doesn't work so well when other avatars come in view later on | 1431 | // just sending the sound out once doesn't work so well when other avatars come in view later on |
1421 | // or when the prim gets moved, changed, sat on, whatever | 1432 | // or when the prim gets moved, changed, sat on, whatever |
1422 | // see large number of mantises (mantes?) | 1433 | // see large number of mantises (mantes?) |
1434 | // 20080530 Updated to remove code duplication | ||
1423 | public void llLoopSound(string sound, double volume) | 1435 | public void llLoopSound(string sound, double volume) |
1424 | { | 1436 | { |
1425 | m_host.AddScriptLPS(1); | 1437 | m_host.AddScriptLPS(1); |
1426 | // m_host.SendSound(sound, volume, false, 1); | ||
1427 | LLUUID key = LLUUID.Zero; | ||
1428 | |||
1429 | // if we can parse the string as a key, use it. | ||
1430 | if (LLUUID.TryParse(sound, out key)) | ||
1431 | { | ||
1432 | m_host.Sound = key; | ||
1433 | } | ||
1434 | // else try to locate the name in inventory of object. found returns key, | ||
1435 | // not found returns LLUUID.Zero | ||
1436 | else | ||
1437 | { | ||
1438 | m_host.Sound = InventoryKey(sound.ToString()); | ||
1439 | } | ||
1440 | 1438 | ||
1439 | m_host.Sound = KeyOrName(sound); | ||
1441 | m_host.SoundGain = volume; | 1440 | m_host.SoundGain = volume; |
1442 | m_host.SoundFlags = 1; // looping | 1441 | m_host.SoundFlags = 1; // looping |
1443 | m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? | 1442 | m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? |
@@ -4117,23 +4116,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4117 | prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; | 4116 | prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; |
4118 | break; | 4117 | break; |
4119 | 4118 | ||
4120 | // Xantor 03-May-2008 | 4119 | // Xantor 20080503 |
4121 | // Wiki: PSYS_SRC_TEXTURE string inventory item name or key of the particle texture | 4120 | // Wiki: PSYS_SRC_TEXTURE string inventory item name or key of the particle texture |
4122 | // "" = default texture. | 4121 | // "" = default texture. |
4122 | // 20080530 Updated to remove code duplication | ||
4123 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_TEXTURE: | 4123 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_TEXTURE: |
4124 | LLUUID tkey = LLUUID.Zero; | 4124 | prules.Texture = KeyOrName(rules.Data[i + 1].ToString()); |
4125 | |||
4126 | // if we can parse the string as a key, use it. | ||
4127 | if (LLUUID.TryParse(rules.Data[i + 1].ToString(), out tkey)) | ||
4128 | { | ||
4129 | prules.Texture = tkey; | ||
4130 | } | ||
4131 | // else try to locate the name in inventory of object. found returns key, | ||
4132 | // not found returns LLUUID.Zero which will translate to the default particle texture | ||
4133 | else | ||
4134 | { | ||
4135 | prules.Texture = InventoryKey(rules.Data[i+1].ToString()); | ||
4136 | } | ||
4137 | break; | 4125 | break; |
4138 | 4126 | ||
4139 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_RATE: | 4127 | case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_RATE: |