Some cleanups. Fix compiler warnings, and move NumList into the Lumps folder.

This commit is contained in:
Will
2015-10-24 23:47:28 -06:00
parent eacbc8ff37
commit daa6ed092b
4 changed files with 15 additions and 4 deletions

View File

@@ -40,7 +40,10 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="src\Attributes\CountAttribute.cs" />
<Compile Include="src\Attributes\IndexAttribute.cs" />
<Compile Include="src\Extensions\Color32Extensions.cs" />
<Compile Include="src\Extensions\CustomAttributeExtensions.cs" />
<Compile Include="src\Extensions\PlaneExtensions.cs" />
<Compile Include="src\Extensions\RectExtensions.cs" />
<Compile Include="src\Extensions\StringExtensions.cs" />
@@ -67,7 +70,7 @@
<Compile Include="src\Structs\BSP\Texture.cs" />
<Compile Include="src\Structs\Common\Entity.cs" />
<Compile Include="src\Structs\Common\Lumps\Entities.cs" />
<Compile Include="src\Structs\Common\NumList.cs" />
<Compile Include="src\Structs\Common\Lumps\NumList.cs" />
<Compile Include="src\Structs\Common\Rect.cs" />
<Compile Include="src\Structs\Doom\Linedef.cs" />
<Compile Include="src\Structs\Doom\DoomMap.cs" />

View File

@@ -210,7 +210,6 @@ namespace LibBSP {
}
}
List<Plane> lump = new List<Plane>(data.Length / structLength);
byte[] bytes = new byte[structLength];
for (int i = 0; i < data.Length / structLength; ++i) {
Vector3 normal = new Vector3(BitConverter.ToSingle(data, data.Length * i), BitConverter.ToSingle(data, (data.Length * i) + 4), BitConverter.ToSingle(data, (data.Length * i) + 8));
float distance = BitConverter.ToSingle(data, (data.Length * i) + 12);

View File

@@ -197,6 +197,17 @@ namespace LibBSP {
/// <returns>Index for this lump, or -1 if the format doesn't have this lump or it's not implemented</returns>
public static int GetIndexForMarkBrushesLump(MapType version, out DataType dataType) {
switch (version) {
case MapType.Quake3:
case MapType.MOHAA:
case MapType.FAKK: {
dataType = DataType.UInt32;
return 6;
}
case MapType.STEF2:
case MapType.STEF2Demo: {
dataType = DataType.UInt32;
return 8;
}
case MapType.Quake2:
case MapType.SiN:
case MapType.Daikatana:

View File

@@ -7,7 +7,6 @@ namespace LibBSP {
/// Handles reading of a BSP file on-demand.
/// </summary>
public class BSPReader {
private FileInfo bspFile;
private FileStream stream;
private BinaryReader binaryReader;
@@ -26,7 +25,6 @@ namespace LibBSP {
if (!File.Exists(file.FullName)) {
throw new FileNotFoundException("Unable to open BSP file; file " + file.FullName + " not found.");
} else {
this.bspFile = file;
this.stream = new FileStream(file.FullName, FileMode.Open);
this.binaryReader = new BinaryReader(this.stream);
}