Compare commits

..

No commits in common. "8aa1c7c4bce36deec7a3f8b7f62da8f6d3608b5b" and "2be1bc4352534190299224970610cdd479d615ec" have entirely different histories.

3 changed files with 5 additions and 45 deletions

View File

@ -73,23 +73,3 @@ public class PropScale : Property
scale = reader.ReadVec3();
}
}
public class PropRenderType : Property
{
public enum Mode
{
Normal,
NotRendered,
Unlit,
EditorOnly,
CoronaOnly,
}
public Mode mode;
public override void Read(BinaryReader reader)
{
base.Read(reader);
mode = (Mode)reader.ReadUInt32();
}
}

View File

@ -104,7 +104,6 @@ public class DbFile
"BRLIST" => new BrList(),
"P$ModelName" => new PropertyChunk<PropModelName>(),
"P$Scale" => new PropertyChunk<PropScale>(),
"P$RenderTyp" => new PropertyChunk<PropRenderType>(),
"LD$MetaProp" => new LinkDataMetaProp(),
_ when entryName.StartsWith("L$") => new LinkChunk(),
_ => new GenericChunk(),

View File

@ -97,6 +97,7 @@ 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);
@ -105,7 +106,6 @@ 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,7 +113,6 @@ 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;
@ -134,21 +133,19 @@ 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$RenderTyp", out var gamChunk5))
gamFile.Chunks.TryGetValue("P$Scale", out var gamChunk4))
{
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, renderTypes, metaPropLinks, metaPropLinkData);
PlaceObjects(brList, modelNames, scales, metaPropLinks, metaPropLinkData);
}
}
@ -168,7 +165,6 @@ public partial class Mission : Node3D
BrList brList,
PropertyChunk<PropModelName> modelNames,
PropertyChunk<PropScale> scales,
PropertyChunk<PropRenderType> renderTypes,
LinkChunk metapropLink,
LinkDataMetaProp metaPropLinkData)
{
@ -186,8 +182,6 @@ 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
@ -216,20 +210,7 @@ public partial class Mission : Node3D
}
}
if (!renderTypeFound)
{
foreach (var prop in renderTypes.properties)
{
if (prop.objectId == id)
{
renderType = prop.mode;
renderTypeFound = true;
break;
}
}
}
if (modelName != "" && scaleFound && renderTypeFound)
if (modelName != "" && scaleFound)
{
break;
}
@ -253,7 +234,7 @@ public partial class Mission : Node3D
break;
}
}
if (modelName == "" || renderType == PropRenderType.Mode.NotRendered)
if (modelName == "")
{
continue;
}