mirror of
https://github.com/opensim/opensim.git
synced 2026-08-13 05:05:43 +08:00
* 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.
This commit is contained in:
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||
{
|
||||
actor.Position.Y = 0.1F;
|
||||
}
|
||||
else if (actor.Position.Y >= 256)
|
||||
else if (actor.Position.Y >= Constants.RegionSize)
|
||||
{
|
||||
actor.Position.Y = 255.9F;
|
||||
}
|
||||
@@ -146,16 +146,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||
{
|
||||
actor.Position.X = 0.1F;
|
||||
}
|
||||
else if (actor.Position.X >= 256)
|
||||
else if (actor.Position.X >= Constants.RegionSize)
|
||||
{
|
||||
actor.Position.X = 255.9F;
|
||||
}
|
||||
|
||||
float height = _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 1.0f;
|
||||
float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 1.0f;
|
||||
if (actor.Flying)
|
||||
{
|
||||
if (actor.Position.Z + (actor.Velocity.Z*timeStep) <
|
||||
_heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 2)
|
||||
_heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2)
|
||||
{
|
||||
actor.Position.Z = height;
|
||||
actor.Velocity.Z = 0;
|
||||
|
||||
@@ -336,7 +336,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||
|
||||
private const int minXY = 0;
|
||||
private const int minZ = 0;
|
||||
private const int maxXY = 256;
|
||||
private const int maxXY = (int)Constants.RegionSize;
|
||||
private const int maxZ = 4096;
|
||||
private const int maxHandles = 32766; //Why? I don't know
|
||||
private const float gravity = 9.8f;
|
||||
|
||||
@@ -85,9 +85,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
CollisionLocker ode;
|
||||
// TODO: this should be hard-coded in some common place
|
||||
private const uint m_regionWidth = 256;
|
||||
private const uint m_regionHeight = 256;
|
||||
|
||||
private const uint m_regionWidth = Constants.RegionSize;
|
||||
private const uint m_regionHeight = Constants.RegionSize;
|
||||
|
||||
private static float ODE_STEPSIZE = 0.020f;
|
||||
private static bool RENDER_FLAG = false;
|
||||
@@ -585,7 +585,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
}
|
||||
private float GetTerrainHeightAtXY(float x, float y)
|
||||
{
|
||||
return (float)_origheightmap[(int) y*256 + (int) x];
|
||||
return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x];
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -203,21 +203,21 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||
{
|
||||
character.Position.Y = 0.1F;
|
||||
}
|
||||
else if (character.Position.Y >= 256)
|
||||
else if (character.Position.Y >= Constants.RegionSize)
|
||||
{
|
||||
character.Position.Y = 255.9F;
|
||||
character.Position.Y = Constants.RegionSize - 0.1f;
|
||||
}
|
||||
|
||||
if (character.Position.X < 0)
|
||||
{
|
||||
character.Position.X = 0.1F;
|
||||
}
|
||||
else if (character.Position.X >= 256)
|
||||
else if (character.Position.X >= Constants.RegionSize)
|
||||
{
|
||||
character.Position.X = 255.9F;
|
||||
character.Position.X = Constants.RegionSize - 0.1f;
|
||||
}
|
||||
|
||||
float terrainheight = _heightMap[(int) character.Position.Y*256 + (int) character.Position.X];
|
||||
float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X];
|
||||
if (character.Position.Z + (character._target_velocity.Z*timeStep) < terrainheight + 2)
|
||||
{
|
||||
character.Position.Z = terrainheight + 1.0f;
|
||||
@@ -269,18 +269,18 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||
{
|
||||
character.Position.Y = 0.1F;
|
||||
}
|
||||
else if (character.Position.Y >= 256)
|
||||
else if (character.Position.Y >= Constants.RegionSize)
|
||||
{
|
||||
character.Position.Y = 255.9F;
|
||||
character.Position.Y = Constants.RegionSize - 0.1f;
|
||||
}
|
||||
|
||||
if (character.Position.X < 0)
|
||||
{
|
||||
character.Position.X = 0.1F;
|
||||
}
|
||||
else if (character.Position.X >= 256)
|
||||
else if (character.Position.X >= Constants.RegionSize)
|
||||
{
|
||||
character.Position.X = 255.9F;
|
||||
character.Position.X = Constants.RegionSize - 0.1f;
|
||||
}
|
||||
|
||||
character._velocity.X = (character.Position.X - oldposX)/timeStep;
|
||||
|
||||
Reference in New Issue
Block a user