From 1438053505fcee32eab2fd25857d150aaf270053 Mon Sep 17 00:00:00 2001 From: bob Date: Tue, 26 Jun 2007 21:25:20 +0000 Subject: [PATCH] - bugfix in Format80 - fixed heisenburg-endianness in map loader - THERES A BUG in the mix loading; I need another 4 bytes padding to load temperat.mix and snow.mix (not interior.mix, though) - ShpViewer can now load and view map files - Copy TEMPERAT, SNOW, INFERIOR (sic) mixes into $(SolutionDir) for this to work - Left-click to reload tile-ID file, middle-click scrolls - the tile-id file has some collisions between tile-sets, be careful about ordering if you change anything git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1081 993157c7-ee19-0410-b2c4-bb4e9862e678 --- OpenRa.FileFormats/Format80.cs | 18 ++- OpenRa.FileFormats/IniFile.cs | 2 +- OpenRa.FileFormats/Map.cs | 7 +- OpenRa.FileFormats/OpenRa.FileFormats.csproj | 8 +- OpenRa.FileFormats/Package.cs | 8 +- OpenRa.FileFormats/Terrain.cs | 7 +- OpenRa.FileFormats/TileSet.cs | 49 ++++++ ShpViewer/MapViewControl.cs | 65 ++++++++ ShpViewer/Program.cs | 2 +- ShpViewer/Properties/Resources.Designer.cs | 112 +++++++------- ShpViewer/Properties/Settings.Designer.cs | 34 ++--- ShpViewer/ShpViewForm.Designer.cs | 22 ++- ShpViewer/ShpViewForm.cs | 52 ++++++- ShpViewer/ShpViewer.csproj | 4 + tileSet.til | 148 +++++++++++++++++++ 15 files changed, 436 insertions(+), 102 deletions(-) create mode 100644 OpenRa.FileFormats/TileSet.cs create mode 100644 ShpViewer/MapViewControl.cs create mode 100644 tileSet.til diff --git a/OpenRa.FileFormats/Format80.cs b/OpenRa.FileFormats/Format80.cs index e24022b54e..0d3345dd58 100644 --- a/OpenRa.FileFormats/Format80.cs +++ b/OpenRa.FileFormats/Format80.cs @@ -27,14 +27,16 @@ namespace OpenRa.FileFormats if( srcIndex >= destIndex ) throw new NotImplementedException( string.Format( "srcIndex >= destIndex {0} {1}", srcIndex, destIndex ) ); - for( int i = 0 ; i < Math.Min( count, destIndex - srcIndex ) ; i++ ) - dest[ destIndex + i ] = dest[ srcIndex + i ]; - - if( srcIndex + count <= destIndex ) - return; - - for( int i = destIndex + destIndex - srcIndex ; i < destIndex + count ; i++ ) - dest[ i ] = dest[ destIndex - 1 ]; + if( destIndex - srcIndex == 1 ) + { + for( int i = 0 ; i < count ; i++ ) + dest[ destIndex + i ] = dest[ destIndex - 1 ]; + } + else + { + for( int i = 0 ; i < count ; i++ ) + dest[ destIndex + i ] = dest[ srcIndex + i ]; + } } public static int DecodeInto( MemoryStream input, byte[] dest ) diff --git a/OpenRa.FileFormats/IniFile.cs b/OpenRa.FileFormats/IniFile.cs index 0f94d30660..144fa018d2 100644 --- a/OpenRa.FileFormats/IniFile.cs +++ b/OpenRa.FileFormats/IniFile.cs @@ -4,7 +4,7 @@ using System.Text; using System.IO; using System.Text.RegularExpressions; -namespace MapViewer +namespace OpenRa.FileFormats { public class IniFile { diff --git a/OpenRa.FileFormats/Map.cs b/OpenRa.FileFormats/Map.cs index 1c303f7861..44354dac31 100644 --- a/OpenRa.FileFormats/Map.cs +++ b/OpenRa.FileFormats/Map.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Text; using System.IO; -using MapViewer; namespace OpenRa.FileFormats { @@ -98,14 +97,14 @@ namespace OpenRa.FileFormats { for( int j = 0 ; j < 128 ; j++ ) { - MapTiles[ i, j ].tile = ReadByte( ms ); - MapTiles[ i, j ].tile |= (ushort)( ReadByte( ms ) << 8 ); + MapTiles[ j, i ].tile = ReadByte( ms ); + MapTiles[ j, i ].tile |= (ushort)( ReadByte( ms ) << 8 ); } } for( int i = 0 ; i < 128 ; i++ ) for( int j = 0 ; j < 128 ; j++ ) - MapTiles[ i, j ].image = ReadByte( ms ); + MapTiles[ j, i ].image = ReadByte( ms ); } } diff --git a/OpenRa.FileFormats/OpenRa.FileFormats.csproj b/OpenRa.FileFormats/OpenRa.FileFormats.csproj index 7885bed5b8..30dea7ef72 100644 --- a/OpenRa.FileFormats/OpenRa.FileFormats.csproj +++ b/OpenRa.FileFormats/OpenRa.FileFormats.csproj @@ -35,7 +35,6 @@ - @@ -50,6 +49,13 @@ + + + + + {1B60782F-B2DD-43F1-B51D-B798485F317C} + OpenRa.Core +