aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-02-14 12:16:33 +0000
committerAdam Frisby2008-02-14 12:16:33 +0000
commitf3afa68a2af6ad5999e6efe3e4725cb17293108d (patch)
tree4253a44bee39976d6b3dd6813439f5966cf12632 /OpenSim/Region/Environment/Scenes/ScenePresence.cs
parent* Exposed AddHandlers in response to mantis #534. Thanks, kmeisthax! (diff)
downloadopensim-SC_OLD-f3afa68a2af6ad5999e6efe3e4725cb17293108d.zip
opensim-SC_OLD-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.gz
opensim-SC_OLD-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.bz2
opensim-SC_OLD-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.xz
* Made new Framework.Constants class, added RegionSize member.
* Converted all instances of "256" spotted to use RegionSize instead. Some approximations used for border crossings (ie 255.9f) are still using that value, but should be updated to use something based on RegionSize. * Moving Terrain to a RegionModule, implemented ITerrainChannel and TerrainModule - nonfunctional, but will be soon.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs23
1 files changed, 9 insertions, 14 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 61fce39..2b02ab9 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -1514,12 +1514,12 @@ namespace OpenSim.Region.Environment.Scenes
1514 pos2.Y = pos2.Y + (vel.Y*timeStep); 1514 pos2.Y = pos2.Y + (vel.Y*timeStep);
1515 pos2.Z = pos2.Z + (vel.Z*timeStep); 1515 pos2.Z = pos2.Z + (vel.Z*timeStep);
1516 1516
1517 if ((pos2.X < 0) || (pos2.X > 256)) 1517 if ((pos2.X < 0) || (pos2.X > Constants.RegionSize))
1518 { 1518 {
1519 CrossToNewRegion(); 1519 CrossToNewRegion();
1520 } 1520 }
1521 1521
1522 if ((pos2.Y < 0) || (pos2.Y > 256)) 1522 if ((pos2.Y < 0) || (pos2.Y > Constants.RegionSize))
1523 { 1523 {
1524 CrossToNewRegion(); 1524 CrossToNewRegion();
1525 } 1525 }
@@ -1544,17 +1544,12 @@ namespace OpenSim.Region.Environment.Scenes
1544 // distance into new region to place avatar 1544 // distance into new region to place avatar
1545 const float enterDistance = 0.1f; 1545 const float enterDistance = 0.1f;
1546 1546
1547 // region size
1548 // TODO: this should be hard-coded in some common place
1549 const float regionWidth = 256;
1550 const float regionHeight = 256;
1551
1552 if (pos.X < boundaryDistance) 1547 if (pos.X < boundaryDistance)
1553 { 1548 {
1554 neighbourx--; 1549 neighbourx--;
1555 newpos.X = regionWidth - enterDistance; 1550 newpos.X = Constants.RegionSize - enterDistance;
1556 } 1551 }
1557 else if (pos.X > regionWidth - boundaryDistance) 1552 else if (pos.X > Constants.RegionSize - boundaryDistance)
1558 { 1553 {
1559 neighbourx++; 1554 neighbourx++;
1560 newpos.X = enterDistance; 1555 newpos.X = enterDistance;
@@ -1563,16 +1558,16 @@ namespace OpenSim.Region.Environment.Scenes
1563 if (pos.Y < boundaryDistance) 1558 if (pos.Y < boundaryDistance)
1564 { 1559 {
1565 neighboury--; 1560 neighboury--;
1566 newpos.Y = regionHeight - enterDistance; 1561 newpos.Y = Constants.RegionSize - enterDistance;
1567 } 1562 }
1568 else if (pos.Y > regionHeight - boundaryDistance) 1563 else if (pos.Y > Constants.RegionSize - boundaryDistance)
1569 { 1564 {
1570 neighboury++; 1565 neighboury++;
1571 newpos.Y = enterDistance; 1566 newpos.Y = enterDistance;
1572 } 1567 }
1573 1568
1574 LLVector3 vel = m_velocity; 1569 LLVector3 vel = m_velocity;
1575 ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256)); 1570 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
1576 SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); 1571 SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
1577 if (neighbourRegion != null) 1572 if (neighbourRegion != null)
1578 { 1573 {
@@ -1622,8 +1617,8 @@ namespace OpenSim.Region.Environment.Scenes
1622 public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) 1617 public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
1623 { 1618 {
1624 // 1619 //
1625 int shiftx = ((int)rRegionX - (int)tRegionX) * 256; 1620 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
1626 int shifty = ((int)rRegionY - (int)tRegionY) * 256; 1621 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
1627 1622
1628 m_DrawDistance = cAgentData.drawdistance; 1623 m_DrawDistance = cAgentData.drawdistance;
1629 m_pos = new LLVector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z); 1624 m_pos = new LLVector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z);