diff options
author | Adam Frisby | 2008-02-14 12:16:33 +0000 |
---|---|---|
committer | Adam Frisby | 2008-02-14 12:16:33 +0000 |
commit | f3afa68a2af6ad5999e6efe3e4725cb17293108d (patch) | |
tree | 4253a44bee39976d6b3dd6813439f5966cf12632 /OpenSim/Region/Physics | |
parent | * Exposed AddHandlers in response to mantis #534. Thanks, kmeisthax! (diff) | |
download | opensim-SC-f3afa68a2af6ad5999e6efe3e4725cb17293108d.zip opensim-SC-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.gz opensim-SC-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.bz2 opensim-SC-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 'OpenSim/Region/Physics')
4 files changed, 18 insertions, 18 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index a32bca5..d767eab 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
137 | { | 137 | { |
138 | actor.Position.Y = 0.1F; | 138 | actor.Position.Y = 0.1F; |
139 | } | 139 | } |
140 | else if (actor.Position.Y >= 256) | 140 | else if (actor.Position.Y >= Constants.RegionSize) |
141 | { | 141 | { |
142 | actor.Position.Y = 255.9F; | 142 | actor.Position.Y = 255.9F; |
143 | } | 143 | } |
@@ -146,16 +146,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
146 | { | 146 | { |
147 | actor.Position.X = 0.1F; | 147 | actor.Position.X = 0.1F; |
148 | } | 148 | } |
149 | else if (actor.Position.X >= 256) | 149 | else if (actor.Position.X >= Constants.RegionSize) |
150 | { | 150 | { |
151 | actor.Position.X = 255.9F; | 151 | actor.Position.X = 255.9F; |
152 | } | 152 | } |
153 | 153 | ||
154 | float height = _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 1.0f; | 154 | float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 1.0f; |
155 | if (actor.Flying) | 155 | if (actor.Flying) |
156 | { | 156 | { |
157 | if (actor.Position.Z + (actor.Velocity.Z*timeStep) < | 157 | if (actor.Position.Z + (actor.Velocity.Z*timeStep) < |
158 | _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 2) | 158 | _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2) |
159 | { | 159 | { |
160 | actor.Position.Z = height; | 160 | actor.Position.Z = height; |
161 | actor.Velocity.Z = 0; | 161 | actor.Velocity.Z = 0; |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 5a8589c..314708f 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -336,7 +336,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
336 | 336 | ||
337 | private const int minXY = 0; | 337 | private const int minXY = 0; |
338 | private const int minZ = 0; | 338 | private const int minZ = 0; |
339 | private const int maxXY = 256; | 339 | private const int maxXY = (int)Constants.RegionSize; |
340 | private const int maxZ = 4096; | 340 | private const int maxZ = 4096; |
341 | private const int maxHandles = 32766; //Why? I don't know | 341 | private const int maxHandles = 32766; //Why? I don't know |
342 | private const float gravity = 9.8f; | 342 | private const float gravity = 9.8f; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 4fbf653..3d70a3d 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -85,9 +85,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
85 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 85 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
86 | 86 | ||
87 | CollisionLocker ode; | 87 | CollisionLocker ode; |
88 | // TODO: this should be hard-coded in some common place | 88 | |
89 | private const uint m_regionWidth = 256; | 89 | private const uint m_regionWidth = Constants.RegionSize; |
90 | private const uint m_regionHeight = 256; | 90 | private const uint m_regionHeight = Constants.RegionSize; |
91 | 91 | ||
92 | private static float ODE_STEPSIZE = 0.020f; | 92 | private static float ODE_STEPSIZE = 0.020f; |
93 | private static bool RENDER_FLAG = false; | 93 | private static bool RENDER_FLAG = false; |
@@ -585,7 +585,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
585 | } | 585 | } |
586 | private float GetTerrainHeightAtXY(float x, float y) | 586 | private float GetTerrainHeightAtXY(float x, float y) |
587 | { | 587 | { |
588 | return (float)_origheightmap[(int) y*256 + (int) x]; | 588 | return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x]; |
589 | 589 | ||
590 | 590 | ||
591 | } | 591 | } |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index 7652934..3bd25f6 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | |||
@@ -203,21 +203,21 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
203 | { | 203 | { |
204 | character.Position.Y = 0.1F; | 204 | character.Position.Y = 0.1F; |
205 | } | 205 | } |
206 | else if (character.Position.Y >= 256) | 206 | else if (character.Position.Y >= Constants.RegionSize) |
207 | { | 207 | { |
208 | character.Position.Y = 255.9F; | 208 | character.Position.Y = Constants.RegionSize - 0.1f; |
209 | } | 209 | } |
210 | 210 | ||
211 | if (character.Position.X < 0) | 211 | if (character.Position.X < 0) |
212 | { | 212 | { |
213 | character.Position.X = 0.1F; | 213 | character.Position.X = 0.1F; |
214 | } | 214 | } |
215 | else if (character.Position.X >= 256) | 215 | else if (character.Position.X >= Constants.RegionSize) |
216 | { | 216 | { |
217 | character.Position.X = 255.9F; | 217 | character.Position.X = Constants.RegionSize - 0.1f; |
218 | } | 218 | } |
219 | 219 | ||
220 | float terrainheight = _heightMap[(int) character.Position.Y*256 + (int) character.Position.X]; | 220 | float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X]; |
221 | if (character.Position.Z + (character._target_velocity.Z*timeStep) < terrainheight + 2) | 221 | if (character.Position.Z + (character._target_velocity.Z*timeStep) < terrainheight + 2) |
222 | { | 222 | { |
223 | character.Position.Z = terrainheight + 1.0f; | 223 | character.Position.Z = terrainheight + 1.0f; |
@@ -269,18 +269,18 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
269 | { | 269 | { |
270 | character.Position.Y = 0.1F; | 270 | character.Position.Y = 0.1F; |
271 | } | 271 | } |
272 | else if (character.Position.Y >= 256) | 272 | else if (character.Position.Y >= Constants.RegionSize) |
273 | { | 273 | { |
274 | character.Position.Y = 255.9F; | 274 | character.Position.Y = Constants.RegionSize - 0.1f; |
275 | } | 275 | } |
276 | 276 | ||
277 | if (character.Position.X < 0) | 277 | if (character.Position.X < 0) |
278 | { | 278 | { |
279 | character.Position.X = 0.1F; | 279 | character.Position.X = 0.1F; |
280 | } | 280 | } |
281 | else if (character.Position.X >= 256) | 281 | else if (character.Position.X >= Constants.RegionSize) |
282 | { | 282 | { |
283 | character.Position.X = 255.9F; | 283 | character.Position.X = Constants.RegionSize - 0.1f; |
284 | } | 284 | } |
285 | 285 | ||
286 | character._velocity.X = (character.Position.X - oldposX)/timeStep; | 286 | character._velocity.X = (character.Position.X - oldposX)/timeStep; |