diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 180 |
1 files changed, 8 insertions, 172 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 181c4e2..cb2d9e2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -5336,14 +5336,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5336 | zc.AddUUID(sop.LastOwnerID); | 5336 | zc.AddUUID(sop.LastOwnerID); |
5337 | 5337 | ||
5338 | //name | 5338 | //name |
5339 | byte[] tmpbytes = Util.StringToBytes256(sop.Name); | 5339 | zc.AddShortString(sop.Name, 64); |
5340 | zc.AddByte((byte)tmpbytes.Length); | ||
5341 | zc.AddBytes(tmpbytes, tmpbytes.Length); | ||
5342 | 5340 | ||
5343 | //Description | 5341 | //Description |
5344 | tmpbytes = Util.StringToBytes256(sop.Description); | 5342 | zc.AddShortString(sop.Description, 128); |
5345 | zc.AddByte((byte)tmpbytes.Length); | ||
5346 | zc.AddBytes(tmpbytes, tmpbytes.Length); | ||
5347 | } | 5343 | } |
5348 | 5344 | ||
5349 | private void CreateObjectPropertiesBlock(SceneObjectPart sop, LLUDPZeroEncoder zc) | 5345 | private void CreateObjectPropertiesBlock(SceneObjectPart sop, LLUDPZeroEncoder zc) |
@@ -5387,24 +5383,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5387 | zc.AddUUID(sop.LastOwnerID); | 5383 | zc.AddUUID(sop.LastOwnerID); |
5388 | 5384 | ||
5389 | //name | 5385 | //name |
5390 | byte[] tmpbytes = Util.StringToBytes256(sop.Name); | 5386 | zc.AddShortString(sop.Name, 64); |
5391 | zc.AddByte((byte)tmpbytes.Length); | ||
5392 | zc.AddBytes(tmpbytes, tmpbytes.Length); | ||
5393 | 5387 | ||
5394 | //Description | 5388 | //Description |
5395 | tmpbytes = Util.StringToBytes256(sop.Description); | 5389 | zc.AddShortString(sop.Description, 128); |
5396 | zc.AddByte((byte)tmpbytes.Length); | ||
5397 | zc.AddBytes(tmpbytes, tmpbytes.Length); | ||
5398 | 5390 | ||
5399 | // touch name | 5391 | // touch name |
5400 | tmpbytes = Util.StringToBytes256(root.TouchName); | 5392 | zc.AddShortString(root.TouchName, 9, 37); |
5401 | zc.AddByte((byte)tmpbytes.Length); | ||
5402 | zc.AddBytes(tmpbytes, tmpbytes.Length); | ||
5403 | 5393 | ||
5404 | // sit name | 5394 | // sit name |
5405 | tmpbytes = Util.StringToBytes256(root.SitName); | 5395 | zc.AddShortString(root.SitName, 9, 37); |
5406 | zc.AddByte((byte)tmpbytes.Length); | ||
5407 | zc.AddBytes(tmpbytes, tmpbytes.Length); | ||
5408 | 5396 | ||
5409 | //texture ids block | 5397 | //texture ids block |
5410 | // still not sending, not clear the impact on viewers, if any. | 5398 | // still not sending, not clear the impact on viewers, if any. |
@@ -6349,150 +6337,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6349 | zc.AddZeros(lastzeros); | 6337 | zc.AddZeros(lastzeros); |
6350 | } | 6338 | } |
6351 | 6339 | ||
6352 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart part, ScenePresence sp) | ||
6353 | { | ||
6354 | byte[] objectData = new byte[60]; | ||
6355 | part.RelativePosition.ToBytes(objectData, 0); | ||
6356 | part.Velocity.ToBytes(objectData, 12); | ||
6357 | part.Acceleration.ToBytes(objectData, 24); | ||
6358 | |||
6359 | Quaternion rotation = part.RotationOffset; | ||
6360 | rotation.Normalize(); | ||
6361 | rotation.ToBytes(objectData, 36); | ||
6362 | part.AngularVelocity.ToBytes(objectData, 48); | ||
6363 | |||
6364 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | ||
6365 | update.ClickAction = (byte)part.ClickAction; | ||
6366 | update.CRC = 0; | ||
6367 | update.ExtraParams = part.Shape.ExtraParams ?? Utils.EmptyBytes; | ||
6368 | update.FullID = part.UUID; | ||
6369 | update.ID = part.LocalId; | ||
6370 | //update.JointAxisOrAnchor = Vector3.Zero; // These are deprecated | ||
6371 | //update.JointPivot = Vector3.Zero; | ||
6372 | //update.JointType = 0; | ||
6373 | update.Material = part.Material; | ||
6374 | |||
6375 | if (part.ParentGroup.IsAttachment) | ||
6376 | { | ||
6377 | if (part.IsRoot) | ||
6378 | { | ||
6379 | update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + part.ParentGroup.FromItemID); | ||
6380 | } | ||
6381 | else | ||
6382 | update.NameValue = Utils.EmptyBytes; | ||
6383 | |||
6384 | int st = (int)part.ParentGroup.AttachmentPoint; | ||
6385 | update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ; | ||
6386 | } | ||
6387 | else | ||
6388 | { | ||
6389 | update.NameValue = Utils.EmptyBytes; | ||
6390 | update.State = part.Shape.State; // not sure about this | ||
6391 | } | ||
6392 | |||
6393 | update.ObjectData = objectData; | ||
6394 | update.ParentID = part.ParentID; | ||
6395 | update.PathBegin = part.Shape.PathBegin; | ||
6396 | update.PathCurve = part.Shape.PathCurve; | ||
6397 | update.PathEnd = part.Shape.PathEnd; | ||
6398 | update.PathRadiusOffset = part.Shape.PathRadiusOffset; | ||
6399 | update.PathRevolutions = part.Shape.PathRevolutions; | ||
6400 | update.PathScaleX = part.Shape.PathScaleX; | ||
6401 | update.PathScaleY = part.Shape.PathScaleY; | ||
6402 | update.PathShearX = part.Shape.PathShearX; | ||
6403 | update.PathShearY = part.Shape.PathShearY; | ||
6404 | update.PathSkew = part.Shape.PathSkew; | ||
6405 | update.PathTaperX = part.Shape.PathTaperX; | ||
6406 | update.PathTaperY = part.Shape.PathTaperY; | ||
6407 | update.PathTwist = part.Shape.PathTwist; | ||
6408 | update.PathTwistBegin = part.Shape.PathTwistBegin; | ||
6409 | update.PCode = part.Shape.PCode; | ||
6410 | update.ProfileBegin = part.Shape.ProfileBegin; | ||
6411 | update.ProfileCurve = part.Shape.ProfileCurve; | ||
6412 | |||
6413 | ushort profileBegin = part.Shape.ProfileBegin; | ||
6414 | ushort profileHollow = part.Shape.ProfileHollow; | ||
6415 | |||
6416 | if(part.Shape.SculptType == (byte)SculptType.Mesh) // filter out hack | ||
6417 | { | ||
6418 | update.ProfileCurve = (byte)(part.Shape.ProfileCurve & 0x0f); | ||
6419 | // fix old values that confused viewers | ||
6420 | if(profileBegin == 1) | ||
6421 | profileBegin = 9375; | ||
6422 | if(profileHollow == 1) | ||
6423 | profileHollow = 27500; | ||
6424 | // fix torus hole size Y that also confuse some viewers | ||
6425 | if(update.ProfileCurve == (byte)ProfileShape.Circle && update.PathScaleY < 150) | ||
6426 | update.PathScaleY = 150; | ||
6427 | } | ||
6428 | else | ||
6429 | { | ||
6430 | update.ProfileCurve = part.Shape.ProfileCurve; | ||
6431 | } | ||
6432 | |||
6433 | update.ProfileHollow = profileHollow; | ||
6434 | update.ProfileBegin = profileBegin; | ||
6435 | update.ProfileEnd = part.Shape.ProfileEnd; | ||
6436 | update.PSBlock = part.ParticleSystem ?? Utils.EmptyBytes; | ||
6437 | update.TextColor = part.GetTextColor().GetBytes(false); | ||
6438 | update.TextureAnim = part.TextureAnimation ?? Utils.EmptyBytes; | ||
6439 | update.TextureEntry = part.Shape.TextureEntry ?? Utils.EmptyBytes; | ||
6440 | update.Scale = part.Shape.Scale; | ||
6441 | update.Text = Util.StringToBytes(part.Text, 255); | ||
6442 | update.MediaURL = Util.StringToBytes(part.MediaUrl, 255); | ||
6443 | |||
6444 | #region PrimFlags | ||
6445 | |||
6446 | PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(part, sp); | ||
6447 | |||
6448 | // Don't send the CreateSelected flag to everyone | ||
6449 | flags &= ~PrimFlags.CreateSelected; | ||
6450 | |||
6451 | if (sp.UUID == part.OwnerID) | ||
6452 | { | ||
6453 | if (part.CreateSelected) | ||
6454 | { | ||
6455 | // Only send this flag once, then unset it | ||
6456 | flags |= PrimFlags.CreateSelected; | ||
6457 | part.CreateSelected = false; | ||
6458 | } | ||
6459 | } | ||
6460 | |||
6461 | // m_log.DebugFormat( | ||
6462 | // "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}", | ||
6463 | // data.Name, update.FullID, flags, update.ID); | ||
6464 | |||
6465 | update.UpdateFlags = (uint)flags; | ||
6466 | |||
6467 | #endregion PrimFlags | ||
6468 | |||
6469 | bool hassound = part.Sound != UUID.Zero || part.SoundFlags != 0; | ||
6470 | if (hassound) | ||
6471 | { | ||
6472 | update.Sound = part.Sound; | ||
6473 | update.Gain = (float)part.SoundGain; | ||
6474 | update.Radius = (float)part.SoundRadius; | ||
6475 | update.Flags = part.SoundFlags; | ||
6476 | } | ||
6477 | |||
6478 | if(hassound || update.PSBlock.Length > 1) | ||
6479 | update.OwnerID = part.OwnerID; | ||
6480 | |||
6481 | switch ((PCode)part.Shape.PCode) | ||
6482 | { | ||
6483 | case PCode.Grass: | ||
6484 | case PCode.Tree: | ||
6485 | case PCode.NewTree: | ||
6486 | update.Data = new byte[] { part.Shape.State }; | ||
6487 | break; | ||
6488 | default: | ||
6489 | update.Data = Utils.EmptyBytes; | ||
6490 | break; | ||
6491 | } | ||
6492 | |||
6493 | return update; | ||
6494 | } | ||
6495 | |||
6496 | protected void CreatePrimUpdateBlock(SceneObjectPart part, ScenePresence sp, LLUDPZeroEncoder zc) | 6340 | protected void CreatePrimUpdateBlock(SceneObjectPart part, ScenePresence sp, LLUDPZeroEncoder zc) |
6497 | { | 6341 | { |
6498 | // prepare data | 6342 | // prepare data |
@@ -6725,10 +6569,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6725 | zc.AddZeros(5); | 6569 | zc.AddZeros(5); |
6726 | else | 6570 | else |
6727 | { | 6571 | { |
6728 | byte[] tbuf = Util.StringToBytes(part.Text, 254); | 6572 | zc.AddShortString(part.Text, 255); |
6729 | int len = tbuf.Length; | ||
6730 | zc.AddByte((byte)len); | ||
6731 | zc.AddBytes(tbuf, len); | ||
6732 | 6573 | ||
6733 | //textcolor | 6574 | //textcolor |
6734 | byte[] tc = part.GetTextColor().GetBytes(false); | 6575 | byte[] tc = part.GetTextColor().GetBytes(false); |
@@ -6739,12 +6580,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6739 | if (part.MediaUrl == null || part.MediaUrl.Length == 0) | 6580 | if (part.MediaUrl == null || part.MediaUrl.Length == 0) |
6740 | zc.AddZeros(1); | 6581 | zc.AddZeros(1); |
6741 | else | 6582 | else |
6742 | { | 6583 | zc.AddShortString(part.MediaUrl, 255); |
6743 | byte[] tbuf = Util.StringToBytes(part.MediaUrl, 255); | ||
6744 | int len = tbuf.Length; | ||
6745 | zc.AddByte((byte)len); | ||
6746 | zc.AddBytes(tbuf, len); | ||
6747 | } | ||
6748 | 6584 | ||
6749 | bool hasps = false; | 6585 | bool hasps = false; |
6750 | //particle system | 6586 | //particle system |