From f1250bd291dc3fbcf375d792691a455f45727224 Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 7 Jun 2007 01:04:07 +0000 Subject: [PATCH] *When avatar crosses parcel, it updates successfully in the viewer *This includes parcel name in title bar, media and music autoplay, and parcel flag icons *Yay! --- .../world/Avatar.Update.cs | 24 ++++++++++++++++++- OpenSim/OpenSim.RegionServer/world/Avatar.cs | 7 ++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs index 29e0a15b48..77129057d1 100644 --- a/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs +++ b/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs @@ -96,7 +96,29 @@ namespace OpenSim.world } } - this.positionLastFrame = pos2; + + if (positionFrameBeforeLast != pos2) + { + this.positionFrameBeforeLast = this.positionLastFrame; + this.positionLastFrame = pos2; + int tempRoundedX = (int)Math.Round(positionLastFrame.X); + int tempRoundedY = (int)Math.Round(positionLastFrame.Y); + if (this.positionRoundedX != tempRoundedX || this.positionRoundedY != tempRoundedY) + { + + this.positionRoundedX = tempRoundedX; + this.positionRoundedY = tempRoundedY; + int currentParcelLocalID = m_world.parcelManager.getParcel(tempRoundedX, tempRoundedY).parcelData.localID; + if(currentParcelLocalID != this.positionParcelHoverLocalID) + { + + Console.WriteLine("NEW PARCEL: " + m_world.parcelManager.getParcel(tempRoundedX, tempRoundedY).parcelData.parcelName); + m_world.parcelManager.getParcel(tempRoundedX, tempRoundedY).sendParcelProperties(this.parcelUpdateSequenceIncrement, false, 0,this.ControllingClient); + this.positionParcelHoverLocalID = currentParcelLocalID; + this.parcelUpdateSequenceIncrement++; + } + } + } if (!this.ControllingClient.m_sandboxMode) { diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.cs index 4b921f0338..30999fca5c 100644 --- a/OpenSim/OpenSim.RegionServer/world/Avatar.cs +++ b/OpenSim/OpenSim.RegionServer/world/Avatar.cs @@ -57,6 +57,13 @@ namespace OpenSim.world private byte[] visualParams; private AvatarWearable[] Wearables; private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); + private LLVector3 positionFrameBeforeLast = new LLVector3(0, 0, 0); + + private int positionRoundedX = 0; + private int positionRoundedY = 0; + + private int positionParcelHoverLocalID = -1; //Local ID of the last parcel they were over + private int parcelUpdateSequenceIncrement = 1; private ulong m_regionHandle; //private Dictionary m_clientThreads; private string m_regionName;