|
|
|
@ -97,7 +97,6 @@ public partial class Mission : Node3D
|
|
|
|
|
{
|
|
|
|
|
ClearMap();
|
|
|
|
|
|
|
|
|
|
// TODO: This shouldn't be set for things that aren't actually FMs
|
|
|
|
|
_textureLoader = new TextureLoader(_campaignName);
|
|
|
|
|
_file = new(FileName);
|
|
|
|
|
UseChunk<TxList>("TXLIST", LoadTextures);
|
|
|
|
@ -106,6 +105,7 @@ public partial class Mission : Node3D
|
|
|
|
|
_file.Chunks.TryGetValue("BRLIST", out var brListRaw) &&
|
|
|
|
|
_file.Chunks.TryGetValue("P$ModelName", out var modelNamesRaw) &&
|
|
|
|
|
_file.Chunks.TryGetValue("P$Scale", out var scalesRaw) &&
|
|
|
|
|
_file.Chunks.TryGetValue("P$RenderTyp", out var renderTypesRaw) &&
|
|
|
|
|
_file.Chunks.TryGetValue("L$MetaProp", out var metaPropLinksRaw) &&
|
|
|
|
|
_file.Chunks.TryGetValue("LD$MetaProp", out var metaPropLinkDataRaw)
|
|
|
|
|
)
|
|
|
|
@ -113,6 +113,7 @@ public partial class Mission : Node3D
|
|
|
|
|
var brList = (BrList)brListRaw;
|
|
|
|
|
var modelNames = (PropertyChunk<PropModelName>)modelNamesRaw;
|
|
|
|
|
var scales = (PropertyChunk<PropScale>)scalesRaw;
|
|
|
|
|
var renderTypes = (PropertyChunk<PropRenderType>)renderTypesRaw;
|
|
|
|
|
var metaPropLinks = (LinkChunk)metaPropLinksRaw;
|
|
|
|
|
var metaPropLinkData = (LinkDataMetaProp)metaPropLinkDataRaw;
|
|
|
|
|
|
|
|
|
@ -133,19 +134,21 @@ public partial class Mission : Node3D
|
|
|
|
|
if (gamFile.Chunks.TryGetValue("P$ModelName", out var gamChunk1) &&
|
|
|
|
|
gamFile.Chunks.TryGetValue("L$MetaProp", out var gamChunk2) &&
|
|
|
|
|
gamFile.Chunks.TryGetValue("LD$MetaProp", out var gamChunk3) &&
|
|
|
|
|
gamFile.Chunks.TryGetValue("P$Scale", out var gamChunk4))
|
|
|
|
|
gamFile.Chunks.TryGetValue("P$Scale", out var gamChunk4) &&
|
|
|
|
|
gamFile.Chunks.TryGetValue("P$RenderTyp", out var gamChunk5))
|
|
|
|
|
{
|
|
|
|
|
GD.Print($"Pre-Merged chunks: {modelNames.properties.Count} {metaPropLinks.links.Count} {metaPropLinkData.linkData.Count}");
|
|
|
|
|
modelNames.properties.AddRange(((PropertyChunk<PropModelName>)gamChunk1).properties);
|
|
|
|
|
metaPropLinks.links.AddRange(((LinkChunk)gamChunk2).links);
|
|
|
|
|
metaPropLinkData.linkData.AddRange(((LinkDataMetaProp)gamChunk3).linkData);
|
|
|
|
|
scales.properties.AddRange(((PropertyChunk<PropScale>)gamChunk4).properties);
|
|
|
|
|
renderTypes.properties.AddRange(((PropertyChunk<PropRenderType>)gamChunk5).properties);
|
|
|
|
|
GD.Print($"Post-Merged chunks: {modelNames.properties.Count} {metaPropLinks.links.Count} {metaPropLinkData.linkData.Count}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PlaceObjects(brList, modelNames, scales, metaPropLinks, metaPropLinkData);
|
|
|
|
|
PlaceObjects(brList, modelNames, scales, renderTypes, metaPropLinks, metaPropLinkData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -165,6 +168,7 @@ public partial class Mission : Node3D
|
|
|
|
|
BrList brList,
|
|
|
|
|
PropertyChunk<PropModelName> modelNames,
|
|
|
|
|
PropertyChunk<PropScale> scales,
|
|
|
|
|
PropertyChunk<PropRenderType> renderTypes,
|
|
|
|
|
LinkChunk metapropLink,
|
|
|
|
|
LinkDataMetaProp metaPropLinkData)
|
|
|
|
|
{
|
|
|
|
@ -182,6 +186,8 @@ public partial class Mission : Node3D
|
|
|
|
|
var modelName = "";
|
|
|
|
|
var scale = Vector3.One;
|
|
|
|
|
var scaleFound = false;
|
|
|
|
|
var renderType = PropRenderType.Mode.Normal;
|
|
|
|
|
var renderTypeFound = false;
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
// See if there's a modelname property
|
|
|
|
@ -210,7 +216,20 @@ public partial class Mission : Node3D
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (modelName != "" && scaleFound)
|
|
|
|
|
if (!renderTypeFound)
|
|
|
|
|
{
|
|
|
|
|
foreach (var prop in renderTypes.properties)
|
|
|
|
|
{
|
|
|
|
|
if (prop.objectId == id)
|
|
|
|
|
{
|
|
|
|
|
renderType = prop.mode;
|
|
|
|
|
renderTypeFound = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (modelName != "" && scaleFound && renderTypeFound)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -234,7 +253,7 @@ public partial class Mission : Node3D
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (modelName == "")
|
|
|
|
|
if (modelName == "" || renderType == PropRenderType.Mode.NotRendered)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|