git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1307 993157c7-ee19-0410-b2c4-bb4e9862e678

This commit is contained in:
(no author)
2007-07-18 16:15:06 +00:00
parent 471759d25c
commit b624a82567
2 changed files with 16 additions and 9 deletions

View File

@@ -43,14 +43,12 @@ namespace OpenRa.FileFormats
Width = int.Parse(map.GetValue("Width", "0")); Width = int.Parse(map.GetValue("Width", "0"));
Height = int.Parse(map.GetValue("Height", "0")); Height = int.Parse(map.GetValue("Height", "0"));
UnpackTileData(ReadMapPack(file)); UnpackTileData( ReadPackedSection( file.GetSection( "MapPack" ) ) );
ReadTrees(file); ReadTrees(file);
} }
static MemoryStream ReadMapPack(IniFile file) static MemoryStream ReadPackedSection(IniSection mapPackSection)
{ {
IniSection mapPackSection = file.GetSection("MapPack");
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 1; ; i++) for (int i = 1; ; i++)
{ {
@@ -120,6 +118,14 @@ namespace OpenRa.FileFormats
} }
} }
void UnpackOverlayData( MemoryStream ms )
{
for( int i = 0 ; i < 128 ; i++ )
for( int j = 0 ; j < 128 ; j++ )
MapTiles[ j, i ].overlay = ReadByte( ms );
}
void ReadTrees( IniFile file ) void ReadTrees( IniFile file )
{ {
IniSection terrain = file.GetSection( "TERRAIN" ); IniSection terrain = file.GetSection( "TERRAIN" );

View File

@@ -8,19 +8,20 @@ namespace OpenRa.FileFormats
{ {
public ushort tile; public ushort tile;
public byte image; public byte image;
public byte overlay;
public override int GetHashCode() { return tile.GetHashCode() ^ image.GetHashCode(); } public override int GetHashCode() { return tile.GetHashCode() ^ image.GetHashCode(); }
public override bool Equals(object obj) public override bool Equals( object obj )
{ {
if (obj == null) if( obj == null )
return false; return false;
TileReference r = (TileReference)obj; TileReference r = (TileReference)obj;
return (r.image == image && r.tile == tile); return ( r.image == image && r.tile == tile );
} }
public static bool operator ==(TileReference a, TileReference b) { return a.Equals(b); } public static bool operator ==( TileReference a, TileReference b ) { return a.Equals( b ); }
public static bool operator !=(TileReference a, TileReference b) { return !a.Equals(b); } public static bool operator !=( TileReference a, TileReference b ) { return !a.Equals( b ); }
} }
} }