Daikatana has 21 lumps, not 16. Add MOHAA lump referencing static models from leaves.

This commit is contained in:
wfowler
2021-04-16 01:59:06 -06:00
parent 37fc7c5a26
commit 2292bd9b3e
2 changed files with 38 additions and 1 deletions

View File

@@ -102,6 +102,7 @@ namespace LibBSP {
// MoHAA
private Lump<LODTerrain> _lodTerrains;
private Lump<StaticModel> _staticModels;
private NumList _leafStaticModels;
// CoD
private Lump<Patch> _patches;
private Lump<Vertex> _patchVerts;
@@ -495,6 +496,23 @@ namespace LibBSP {
}
}
/// <summary>
/// A <see cref="NumList"/> object containing the Leaf Static Models lump, if available.
/// These are a list of MOHAA static model indices, referenced by leaves.
/// </summary>
public NumList leafStaticModels {
get {
if (_leafStaticModels == null) {
NumList.DataType type;
int index = NumList.GetIndexForLeafStaticModelsLump(version, out type);
if (index >= 0) {
_leafStaticModels = NumList.LumpFactory(reader.ReadLump(this[index]), type, this, this[index]);
}
}
return _leafStaticModels;
}
}
/// <summary>
/// A <see cref="Lump{Patch}"/> of <see cref="Patch"/> objects in the BSP file, if available.
/// </summary>
@@ -727,7 +745,6 @@ namespace LibBSP {
case MapType.Quake: {
return 15;
}
case MapType.Daikatana:
case MapType.Quake2: {
return 16;
}
@@ -742,6 +759,9 @@ namespace LibBSP {
case MapType.SiN: {
return 20;
}
case MapType.Daikatana: {
return 21;
}
case MapType.SoF: {
return 22;
}

View File

@@ -344,6 +344,23 @@ namespace LibBSP {
return -1;
}
/// <summary>
/// Gets the index for the leaf static models indices lump in the BSP file for a specific map format, and the type of data the format uses.
/// </summary>
/// <param name="version">The map type.</param>
/// <param name="dataType"><c>out</c> parameter that will contain the data type this version uses.</param>
/// <returns>Index for this lump, or -1 if the format doesn't have this lump or it's not implemented.</returns>
public static int GetIndexForLeafStaticModelsLump(MapType version, out DataType dataType) {
switch (version) {
case MapType.MOHAA: {
dataType = DataType.UInt16;
return 26;
}
}
dataType = DataType.Invalid;
return -1;
}
/// <summary>
/// Gets the index for the texture table lump in the BSP file for a specific map format, and the type of data the format uses.
/// </summary>