diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 79 |
1 files changed, 29 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index dff582b..3e278a9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -842,9 +842,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
842 | foreach (ulong handle in seeds.Keys) | 842 | foreach (ulong handle in seeds.Keys) |
843 | { | 843 | { |
844 | uint x, y; | 844 | uint x, y; |
845 | Utils.LongToUInts(handle, out x, out y); | 845 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
846 | x = x / Constants.RegionSize; | 846 | |
847 | y = y / Constants.RegionSize; | ||
848 | if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) | 847 | if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) |
849 | { | 848 | { |
850 | old.Add(handle); | 849 | old.Add(handle); |
@@ -866,9 +865,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
866 | foreach (KeyValuePair<ulong, string> kvp in KnownRegions) | 865 | foreach (KeyValuePair<ulong, string> kvp in KnownRegions) |
867 | { | 866 | { |
868 | uint x, y; | 867 | uint x, y; |
869 | Utils.LongToUInts(kvp.Key, out x, out y); | 868 | Util.RegionHandleToRegionLoc(kvp.Key, out x, out y); |
870 | x = x / Constants.RegionSize; | ||
871 | y = y / Constants.RegionSize; | ||
872 | m_log.Info(" >> "+x+", "+y+": "+kvp.Value); | 869 | m_log.Info(" >> "+x+", "+y+": "+kvp.Value); |
873 | } | 870 | } |
874 | } | 871 | } |
@@ -1170,18 +1167,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1170 | 1167 | ||
1171 | if (ParentID == 0) | 1168 | if (ParentID == 0) |
1172 | { | 1169 | { |
1173 | if (m_scene.TestBorderCross(pos, Cardinals.E)) | ||
1174 | { | ||
1175 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); | ||
1176 | pos.X = crossedBorder.BorderLine.Z - 1; | ||
1177 | } | ||
1178 | |||
1179 | if (m_scene.TestBorderCross(pos, Cardinals.N)) | ||
1180 | { | ||
1181 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); | ||
1182 | pos.Y = crossedBorder.BorderLine.Z - 1; | ||
1183 | } | ||
1184 | |||
1185 | CheckAndAdjustLandingPoint(ref pos); | 1170 | CheckAndAdjustLandingPoint(ref pos); |
1186 | 1171 | ||
1187 | if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) | 1172 | if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) |
@@ -1201,7 +1186,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1201 | 1186 | ||
1202 | float posZLimit = 0; | 1187 | float posZLimit = 0; |
1203 | 1188 | ||
1204 | if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize) | 1189 | if (pos.X < m_scene.RegionInfo.RegionSizeX && pos.Y < m_scene.RegionInfo.RegionSizeY) |
1205 | posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; | 1190 | posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; |
1206 | 1191 | ||
1207 | float newPosZ = posZLimit + localAVHeight / 2; | 1192 | float newPosZ = posZLimit + localAVHeight / 2; |
@@ -2612,7 +2597,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2612 | if (regionCombinerModule != null) | 2597 | if (regionCombinerModule != null) |
2613 | regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); | 2598 | regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); |
2614 | else | 2599 | else |
2615 | regionSize = new Vector2(Constants.RegionSize); | 2600 | regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY); |
2616 | 2601 | ||
2617 | if (pos.X < 0 || pos.X >= regionSize.X | 2602 | if (pos.X < 0 || pos.X >= regionSize.X |
2618 | || pos.Y < 0 || pos.Y >= regionSize.Y | 2603 | || pos.Y < 0 || pos.Y >= regionSize.Y |
@@ -2630,8 +2615,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2630 | // } | 2615 | // } |
2631 | 2616 | ||
2632 | // Get terrain height for sub-region in a megaregion if necessary | 2617 | // Get terrain height for sub-region in a megaregion if necessary |
2633 | int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); | 2618 | int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); |
2634 | int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); | 2619 | int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); |
2635 | GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); | 2620 | GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); |
2636 | // If X and Y is NaN, target_region will be null | 2621 | // If X and Y is NaN, target_region will be null |
2637 | if (target_region == null) | 2622 | if (target_region == null) |
@@ -2642,7 +2627,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2642 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) | 2627 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) |
2643 | targetScene = m_scene; | 2628 | targetScene = m_scene; |
2644 | 2629 | ||
2645 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)]; | 2630 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; |
2646 | // dont try to land underground | 2631 | // dont try to land underground |
2647 | terrainHeight += Appearance.AvatarHeight / 2; | 2632 | terrainHeight += Appearance.AvatarHeight / 2; |
2648 | pos.Z = Math.Max(terrainHeight, pos.Z); | 2633 | pos.Z = Math.Max(terrainHeight, pos.Z); |
@@ -3872,32 +3857,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
3872 | // m_log.DebugFormat( | 3857 | // m_log.DebugFormat( |
3873 | // "[SCENE PRESENCE]: Testing border check for projected position {0} of {1} in {2}", | 3858 | // "[SCENE PRESENCE]: Testing border check for projected position {0} of {1} in {2}", |
3874 | // pos2, Name, Scene.Name); | 3859 | // pos2, Name, Scene.Name); |
3875 | 3860 | ||
3876 | if( Scene.TestBorderCross(pos2, Cardinals.E) || | 3861 | if (Scene.PositionIsInCurrentRegion(pos2)) |
3877 | Scene.TestBorderCross(pos2, Cardinals.W) || | 3862 | return; |
3878 | Scene.TestBorderCross(pos2, Cardinals.N) || | 3863 | |
3879 | Scene.TestBorderCross(pos2, Cardinals.S) | 3864 | if (!CrossToNewRegion() && m_requestedSitTargetUUID == UUID.Zero) |
3880 | ) | ||
3881 | { | 3865 | { |
3882 | if (!CrossToNewRegion() && m_requestedSitTargetUUID == UUID.Zero) | 3866 | // we don't have entity transfer module |
3883 | { | 3867 | Vector3 pos = AbsolutePosition; |
3884 | // we don't have entity transfer module | 3868 | float px = pos.X; |
3885 | Vector3 pos = AbsolutePosition; | 3869 | if (px < 0) |
3886 | float px = pos.X; | 3870 | pos.X += Velocity.X * 2; |
3887 | if (px < 0) | 3871 | else if (px > m_scene.RegionInfo.RegionSizeX) |
3888 | pos.X += Velocity.X * 2; | 3872 | pos.X -= Velocity.X * 2; |
3889 | else if (px > m_scene.RegionInfo.RegionSizeX) | ||
3890 | pos.X -= Velocity.X * 2; | ||
3891 | 3873 | ||
3892 | float py = pos.Y; | 3874 | float py = pos.Y; |
3893 | if (py < 0) | 3875 | if (py < 0) |
3894 | pos.Y += Velocity.Y * 2; | 3876 | pos.Y += Velocity.Y * 2; |
3895 | else if (py > m_scene.RegionInfo.RegionSizeY) | 3877 | else if (py > m_scene.RegionInfo.RegionSizeY) |
3896 | pos.Y -= Velocity.Y * 2; | 3878 | pos.Y -= Velocity.Y * 2; |
3897 | 3879 | ||
3898 | Velocity = Vector3.Zero; | 3880 | Velocity = Vector3.Zero; |
3899 | AbsolutePosition = pos; | 3881 | AbsolutePosition = pos; |
3900 | } | ||
3901 | } | 3882 | } |
3902 | } | 3883 | } |
3903 | 3884 | ||
@@ -3962,7 +3943,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3962 | 3943 | ||
3963 | // Put the child agent back at the center | 3944 | // Put the child agent back at the center |
3964 | AbsolutePosition | 3945 | AbsolutePosition |
3965 | = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); | 3946 | = new Vector3(((float)m_scene.RegionInfo.RegionSizeX * 0.5f), ((float)m_scene.RegionInfo.RegionSizeY * 0.5f), 70); |
3966 | 3947 | ||
3967 | Animator.ResetAnimations(); | 3948 | Animator.ResetAnimations(); |
3968 | } | 3949 | } |
@@ -3989,9 +3970,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3989 | if (handle != Scene.RegionInfo.RegionHandle) | 3970 | if (handle != Scene.RegionInfo.RegionHandle) |
3990 | { | 3971 | { |
3991 | uint x, y; | 3972 | uint x, y; |
3992 | Utils.LongToUInts(handle, out x, out y); | 3973 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
3993 | x = x / Constants.RegionSize; | ||
3994 | y = y / Constants.RegionSize; | ||
3995 | 3974 | ||
3996 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | 3975 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); |
3997 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | 3976 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); |