From 87b313792821cb842fd54b568302b6877c4e53f8 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 3 May 2008 20:00:35 +0000 Subject: * Cleaned up code in Terrain, Tree and Map modules. * Fixed a bug with Terragen loader where it would do bad things on a non 256x256 sized terrain. Now loads the array correctly. * Moved MapImageModule.cs to Modules/World/WorldMap * Changed Location.RegionHandle to use Helpers.GetUlong instead of doing it ourselves. --- .../Modules/World/Terrain/FileLoaders/LLRAW.cs | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs') diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs index 5d6723f..1f6208c 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs @@ -42,12 +42,13 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders FileInfo file = new FileInfo(filename); FileStream s = file.Open(FileMode.Open, FileAccess.Read); BinaryReader bs = new BinaryReader(s); - int x, y; + int y; for (y = 0; y < retval.Height; y++) { + int x; for (x = 0; x < retval.Width; x++) { - retval[x, y] = (double) bs.ReadByte() * ((double) bs.ReadByte() / 127.0); + retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 127.0); bs.ReadBytes(11); // Advance the stream to next bytes. } } @@ -71,18 +72,21 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders // Generate a smegging big lookup table to speed the operation up (it needs it) double[] lookupHeightTable = new double[65536]; - int i, j, x, y; + int i; + int y; for (i = 0; i < 256; i++) { + int j; for (j = 0; j < 256; j++) { - lookupHeightTable[i + (j * 256)] = ((double) i * ((double) j / 127.0)); + lookupHeightTable[i + (j * 256)] = (i * (j / 127.0)); } } // Output the calculated raw for (y = 0; y < map.Height; y++) { + int x; for (x = 0; x < map.Width; x++) { double t = map[x, y]; @@ -100,15 +104,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders byte red = (byte) (index & 0xFF); byte green = (byte) ((index >> 8) & 0xFF); - byte blue = 20; - byte alpha1 = 0; // Land Parcels - byte alpha2 = 0; // For Sale Land - byte alpha3 = 0; // Public Edit Object - byte alpha4 = 0; // Public Edit Land - byte alpha5 = 255; // Safe Land - byte alpha6 = 255; // Flying Allowed - byte alpha7 = 255; // Create Landmark - byte alpha8 = 255; // Outside Scripts + const byte blue = 20; + const byte alpha1 = 0; + const byte alpha2 = 0; + const byte alpha3 = 0; + const byte alpha4 = 0; + const byte alpha5 = 255; + const byte alpha6 = 255; + const byte alpha7 = 255; + const byte alpha8 = 255; byte alpha9 = red; byte alpha10 = green; -- cgit v1.1