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/JPEG.cs | 10 ++++++ .../Modules/Terrain/FileLoaders/LLRAW.cs | 10 ++++++ .../Modules/Terrain/FileLoaders/RAW32.cs | 37 ++++++++++++++++++++++ .../Modules/Terrain/FileLoaders/Terragen.cs | 10 ++++++ 4 files changed, 67 insertions(+) (limited to 'OpenSim/Region/Environment/Modules/Terrain/FileLoaders') diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs index f2bdde7..d6430cd 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs @@ -41,6 +41,16 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders throw new NotImplementedException(); } + public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) + { + throw new NotImplementedException(); + } + + public override string ToString() + { + return "JPEG"; + } + private Bitmap CreateBitmapFromMap(ITerrainChannel map) { Bitmap gradientmapLd = new Bitmap("defaultstripe.png"); diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs index 2d7d94f..7436dc5 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs @@ -58,6 +58,16 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders return retval; } + public override string ToString() + { + return "LL/SL RAW"; + } + + public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) + { + throw new NotImplementedException(); + } + public void SaveFile(string filename, ITerrainChannel map) { FileInfo file = new FileInfo(filename); 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); diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs index e136397..6a3c354 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs @@ -107,6 +107,16 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders throw new NotImplementedException(); } + public override string ToString() + { + return "Terragen"; + } + + public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) + { + throw new NotImplementedException(); + } + #endregion } } -- cgit v1.1