From 75ee1e44f1d8c5177e566f6d2590636b425d2dd3 Mon Sep 17 00:00:00 2001 From: Will Date: Sat, 13 Feb 2016 21:30:37 -0700 Subject: [PATCH] Fix issues reading Game Lump in Vindictus maps. --- LibBSP/Source/Structs/BSP/Lumps/GameLump.cs | 28 ++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/LibBSP/Source/Structs/BSP/Lumps/GameLump.cs b/LibBSP/Source/Structs/BSP/Lumps/GameLump.cs index 313bb97..d7ca61c 100644 --- a/LibBSP/Source/Structs/BSP/Lumps/GameLump.cs +++ b/LibBSP/Source/Structs/BSP/Lumps/GameLump.cs @@ -56,7 +56,6 @@ namespace LibBSP { int structLength = 0; switch (type) { - case MapType.Vindictus: case MapType.TacticalInterventionEncrypted: case MapType.Source17: case MapType.Source18: @@ -69,6 +68,7 @@ namespace LibBSP { structLength = 16; break; } + case MapType.Vindictus: case MapType.DMoMaM: { structLength = 20; break; @@ -84,12 +84,28 @@ namespace LibBSP { int lowestLumpOffset = Int32.MaxValue; for (int i = 0; i < numGameLumps; ++i) { + int ident = BitConverter.ToInt32(data, (i * structLength) + 4); + int flags; + int version; + int offset; + int length; + if (type == MapType.Vindictus) { + flags = BitConverter.ToInt32(data, (i * structLength) + 8); + version = BitConverter.ToInt32(data, (i * structLength) + 12); + offset = BitConverter.ToInt32(data, (i * structLength) + 16); + length = BitConverter.ToInt32(data, (i * structLength) + 20); + } else { + flags = BitConverter.ToUInt16(data, (i * structLength) + 8); + version = BitConverter.ToUInt16(data, (i * structLength) + 10); + offset = BitConverter.ToInt32(data, (i * structLength) + 12); + length = BitConverter.ToInt32(data, (i * structLength) + 16); + } LumpInfo info = new LumpInfo { - ident = BitConverter.ToInt32(data, (i * structLength) + 4), - flags = BitConverter.ToUInt16(data, (i * structLength) + 8), - version = BitConverter.ToUInt16(data, (i * structLength) + 10), - offset = BitConverter.ToInt32(data, (i * structLength) + 12), - length = BitConverter.ToInt32(data, (i * structLength) + 16), + ident = ident, + flags = flags, + version = version, + offset = offset, + length = length, }; this[(GameLumpType)info.ident] = info;