* Applying issue#230 - Avatar stuck at region edge (Thanks Babblefrog!)

* Fix for issue #237 - Sim startup cannot read a terrain file (Reported by CutterRubio)
afrisby
Adam Frisby 2007-07-29 06:23:07 +00:00
parent 0f90cdfed1
commit c33b29a105
2 changed files with 29 additions and 35 deletions

View File

@ -99,15 +99,12 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{ {
foreach (BasicActor actor in _actors) foreach (BasicActor actor in _actors)
{ {
if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256))
{
float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f; float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f;
actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep);
actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
if (actor.Flying) if (actor.Flying)
{ {
if (actor.Position.Z + (actor.Velocity.Z * timeStep) < if (actor.Position.Z + (actor.Velocity.Z * timeStep) < _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2)
_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2)
{ {
actor.Position.Z = height; actor.Position.Z = height;
actor.Velocity.Z = 0; actor.Velocity.Z = 0;
@ -122,9 +119,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
actor.Position.Z = height; actor.Position.Z = height;
actor.Velocity.Z = 0; actor.Velocity.Z = 0;
} }
}
else
{
if (actor.Position.Y < 0) if (actor.Position.Y < 0)
{ {
actor.Position.Y = 0; actor.Position.Y = 0;
@ -143,7 +138,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
actor.Position.X = 256; actor.Position.X = 256;
} }
} }
}
} }
public override void GetResults() public override void GetResults()

View File

@ -1010,7 +1010,7 @@ namespace OpenSim.Region.Terrain
for (int y = 0; y < copy.h; y++) for (int y = 0; y < copy.h; y++)
{ {
// 512 is the largest possible height before colours clamp // 512 is the largest possible height before colours clamp
int colorindex = (int)(Math.Max(Math.Min(1.0, copy.Get(copy.h - y, x) / 512.0), 0.0) * pallete); int colorindex = (int)(Math.Max(Math.Min(1.0, copy.Get(copy.h - y, x) / 512.0), 0.0) * (pallete - 1));
bmp.SetPixel(x, y, colours[colorindex]); bmp.SetPixel(x, y, colours[colorindex]);
} }
} }