diff options
author | Adam Frisby | 2008-05-03 20:00:35 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-03 20:00:35 +0000 |
commit | 87b313792821cb842fd54b568302b6877c4e53f8 (patch) | |
tree | 446719156d1e8d8c12bc3bcd69546f04ba0d79ab /OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs | |
parent | * Refactor: Move MoveFolder() and PurgeFolder() into CachedUserInfo (which ar... (diff) | |
download | opensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.zip opensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.tar.gz opensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.tar.bz2 opensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.tar.xz |
* 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.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs | 30 |
1 files changed, 17 insertions, 13 deletions
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 | |||
42 | FileInfo file = new FileInfo(filename); | 42 | FileInfo file = new FileInfo(filename); |
43 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); | 43 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); |
44 | BinaryReader bs = new BinaryReader(s); | 44 | BinaryReader bs = new BinaryReader(s); |
45 | int x, y; | 45 | int y; |
46 | for (y = 0; y < retval.Height; y++) | 46 | for (y = 0; y < retval.Height; y++) |
47 | { | 47 | { |
48 | int x; | ||
48 | for (x = 0; x < retval.Width; x++) | 49 | for (x = 0; x < retval.Width; x++) |
49 | { | 50 | { |
50 | retval[x, y] = (double) bs.ReadByte() * ((double) bs.ReadByte() / 127.0); | 51 | retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 127.0); |
51 | bs.ReadBytes(11); // Advance the stream to next bytes. | 52 | bs.ReadBytes(11); // Advance the stream to next bytes. |
52 | } | 53 | } |
53 | } | 54 | } |
@@ -71,18 +72,21 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders | |||
71 | 72 | ||
72 | // Generate a smegging big lookup table to speed the operation up (it needs it) | 73 | // Generate a smegging big lookup table to speed the operation up (it needs it) |
73 | double[] lookupHeightTable = new double[65536]; | 74 | double[] lookupHeightTable = new double[65536]; |
74 | int i, j, x, y; | 75 | int i; |
76 | int y; | ||
75 | for (i = 0; i < 256; i++) | 77 | for (i = 0; i < 256; i++) |
76 | { | 78 | { |
79 | int j; | ||
77 | for (j = 0; j < 256; j++) | 80 | for (j = 0; j < 256; j++) |
78 | { | 81 | { |
79 | lookupHeightTable[i + (j * 256)] = ((double) i * ((double) j / 127.0)); | 82 | lookupHeightTable[i + (j * 256)] = (i * (j / 127.0)); |
80 | } | 83 | } |
81 | } | 84 | } |
82 | 85 | ||
83 | // Output the calculated raw | 86 | // Output the calculated raw |
84 | for (y = 0; y < map.Height; y++) | 87 | for (y = 0; y < map.Height; y++) |
85 | { | 88 | { |
89 | int x; | ||
86 | for (x = 0; x < map.Width; x++) | 90 | for (x = 0; x < map.Width; x++) |
87 | { | 91 | { |
88 | double t = map[x, y]; | 92 | double t = map[x, y]; |
@@ -100,15 +104,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders | |||
100 | 104 | ||
101 | byte red = (byte) (index & 0xFF); | 105 | byte red = (byte) (index & 0xFF); |
102 | byte green = (byte) ((index >> 8) & 0xFF); | 106 | byte green = (byte) ((index >> 8) & 0xFF); |
103 | byte blue = 20; | 107 | const byte blue = 20; |
104 | byte alpha1 = 0; // Land Parcels | 108 | const byte alpha1 = 0; |
105 | byte alpha2 = 0; // For Sale Land | 109 | const byte alpha2 = 0; |
106 | byte alpha3 = 0; // Public Edit Object | 110 | const byte alpha3 = 0; |
107 | byte alpha4 = 0; // Public Edit Land | 111 | const byte alpha4 = 0; |
108 | byte alpha5 = 255; // Safe Land | 112 | const byte alpha5 = 255; |
109 | byte alpha6 = 255; // Flying Allowed | 113 | const byte alpha6 = 255; |
110 | byte alpha7 = 255; // Create Landmark | 114 | const byte alpha7 = 255; |
111 | byte alpha8 = 255; // Outside Scripts | 115 | const byte alpha8 = 255; |
112 | byte alpha9 = red; | 116 | byte alpha9 = red; |
113 | byte alpha10 = green; | 117 | byte alpha10 = green; |
114 | 118 | ||