- 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
This commit is contained in:
49
OpenRa.FileFormats/TileSet.cs
Normal file
49
OpenRa.FileFormats/TileSet.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
|
||||
namespace OpenRa.FileFormats
|
||||
{
|
||||
public class TileSet
|
||||
{
|
||||
public readonly Dictionary<ushort, Terrain> tiles = new Dictionary<ushort, Terrain>();
|
||||
|
||||
public TileSet( Package mixFile, string suffix, Palette pal )
|
||||
{
|
||||
StreamReader tileIdFile = File.OpenText( "../../../tileSet.til" );
|
||||
|
||||
while( true )
|
||||
{
|
||||
string countStr = tileIdFile.ReadLine();
|
||||
string startStr = tileIdFile.ReadLine();
|
||||
string pattern = tileIdFile.ReadLine() + suffix;
|
||||
if( countStr == null || startStr == null || pattern == null )
|
||||
break;
|
||||
|
||||
//try
|
||||
{
|
||||
int count = int.Parse( countStr );
|
||||
int start = int.Parse( startStr, NumberStyles.HexNumber );
|
||||
for( int i = 0 ; i < count ; i++ )
|
||||
{
|
||||
Stream s;
|
||||
try
|
||||
{
|
||||
s = mixFile.GetContent( string.Format( pattern, i + 1 ) );
|
||||
}
|
||||
catch { continue; }
|
||||
Terrain t = new Terrain( s, pal );
|
||||
if( tiles.ContainsKey( (ushort)( start + i ) ) )
|
||||
continue;
|
||||
tiles.Add( (ushort)( start + i ), t );
|
||||
}
|
||||
}
|
||||
//catch { }
|
||||
}
|
||||
|
||||
tileIdFile.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user