Core/Maps: Updated vmaps and some cleaups

This commit is contained in:
hondacrx
2018-05-03 00:05:50 -04:00
parent 3ca70aae30
commit 1a7f31d4f2
14 changed files with 204 additions and 269 deletions
+7 -7
View File
@@ -61,16 +61,16 @@ namespace Framework.Constants
public const float MaxHeight = 100000.0f;
public const float MaxFallDistance = 250000.0f;
public const string MapMagic = "MAPS";
public const string MapVersionMagic = "v1.9";
public const string MapAreaMagic = "AREA";
public const string MapHeightMagic = "MHGT";
public const string MapLiquidMagic = "MLIQ";
public const uint MapMagic = 0x5350414D; //"MAPS";
public const uint MapVersionMagic = 0x392E3176; //"v1.9";
public const uint MapAreaMagic = 0x41455241; //"AREA";
public const uint MapHeightMagic = 0x5447484D; //"MHGT";
public const uint MapLiquidMagic = 0x51494C4D; //"MLIQ";
public const string mmapMagic = "MMAP";
public const uint mmapMagic = 0x4D4D4150; // 'MMAP'
public const int mmapVersion = 9;
public const string VMapMagic = "VMAP_4.7";
public const string VMapMagic = "VMAP_4.8";
public const float VMAPInvalidHeightValue = -200000.0f;
}
+2 -23
View File
@@ -294,27 +294,6 @@ namespace System
#endregion
#region BinaryReader
public static T ReadStruct<T>(this BinaryReader reader) where T : struct
{
byte[] data = reader.ReadBytes(Marshal.SizeOf(typeof(T)));
GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);
T returnObject = (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T));
handle.Free();
return returnObject;
}
public static T ReadStruct<T>(this BinaryReader reader, uint offset) where T : struct
{
reader.BaseStream.Position = offset;
byte[] data = reader.ReadBytes(Marshal.SizeOf(typeof(T)));
GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);
T returnObject = (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T));
handle.Free();
return returnObject;
}
public static string ReadCString(this BinaryReader reader)
{
byte num;
@@ -337,9 +316,9 @@ namespace System
return new string(reader.ReadChars(count));
}
public static T[] ReadArray<T>(this BinaryReader reader, int size) where T : struct
public static T[] ReadArray<T>(this BinaryReader reader, uint size) where T : struct
{
int numBytes = FastStruct<T>.Size * size;
int numBytes = FastStruct<T>.Size * (int)size;
byte[] result = reader.ReadBytes(numBytes);