From fadd19f3140107d7c09e7a82a97dfb490146ccb9 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 30 Mar 2008 09:03:38 +0000 Subject: **Big ass update warning** * Renamed plugin console message, to send a message to a plugin, use either "plugin ", or any unrecognised message will be sent ("plugin" sends explicitly) This replaces the old "script ". * Terrain commands - "terrain " now works again. "Script terrain " does not. Many of the commands have now been reimplemented, eg load-tile. However some have new syntax. * New console command handler, you can now use things like "terrain help" or "terrain save help". See TerrainModule.cs for an example of how to use the new "Commander" class. * Commander class - advanced processing of console input and also enables a script API to be generated from registered console commands. --- .../Modules/Terrain/FileLoaders/RAW32.cs | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs') diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs index ba430b7..fc81376 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs @@ -57,6 +57,43 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders return retval; } + public override string ToString() + { + return "RAW32"; + } + + public ITerrainChannel LoadFile(string filename, int fileStartX, int fileStartY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight) + { + TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight); + + FileInfo file = new FileInfo(filename); + FileStream s = file.Open(FileMode.Open, FileAccess.Read); + BinaryReader bs = new BinaryReader(s); + + // Advance to our section of the file + if (fileStartY * sectionHeight > 0) + bs.ReadBytes(fileStartY * sectionHeight); + + int x, y; + for (y = 0; y < retval.Height; y++) + { + // Advance the stream if we aren't at the start of the section in the file + if (fileStartX * sectionWidth > 0) + bs.ReadBytes(fileStartX * sectionHeight); + + for (x = 0; x < retval.Width; x++) + { + // Read a strip and continue + retval[x, y] = bs.ReadSingle(); + } + } + + bs.Close(); + s.Close(); + + return retval; + } + public void SaveFile(string filename, ITerrainChannel map) { FileInfo file = new FileInfo(filename); -- cgit v1.1