diff --git a/project/code/LGS/Database/Chunks/Property.cs b/project/code/LGS/Database/Chunks/Property.cs index c3e6cad..147f722 100644 --- a/project/code/LGS/Database/Chunks/Property.cs +++ b/project/code/LGS/Database/Chunks/Property.cs @@ -111,3 +111,14 @@ public class PropString : Property // value = tmpName[..Math.Min(length - 1, tmpName.Length)]; } } + +public class PropFloat : Property +{ + public float value; + + public override void Read(BinaryReader reader) + { + base.Read(reader); + value = reader.ReadSingle(); + } +} diff --git a/project/code/LGS/Database/File.cs b/project/code/LGS/Database/File.cs index afe4e1b..d38d787 100644 --- a/project/code/LGS/Database/File.cs +++ b/project/code/LGS/Database/File.cs @@ -109,6 +109,7 @@ public class DbFile "P$OTxtRepr1" => new PropertyChunk(), "P$OTxtRepr2" => new PropertyChunk(), "P$OTxtRepr3" => new PropertyChunk(), + "P$RenderAlp" => new PropertyChunk(), "LD$MetaProp" => new LinkDataMetaProp(), _ when entryName.StartsWith("L$") => new LinkChunk(), _ when entryName.StartsWith("P$") => new PropertyChunk(), diff --git a/project/code/LGS/Database/ObjectHierarchy.cs b/project/code/LGS/Database/ObjectHierarchy.cs index b5f32a4..a56ff91 100644 --- a/project/code/LGS/Database/ObjectHierarchy.cs +++ b/project/code/LGS/Database/ObjectHierarchy.cs @@ -42,6 +42,7 @@ public class ObjectHierarchy db.Chunks.TryGetValue("P$OTxtRepr1", out var txtRepl1Raw) && db.Chunks.TryGetValue("P$OTxtRepr2", out var txtRepl2Raw) && db.Chunks.TryGetValue("P$OTxtRepr3", out var txtRepl3Raw) && + db.Chunks.TryGetValue("P$RenderAlp", out var renderAlphaRaw) && db.Chunks.TryGetValue("L$MetaProp", out var metaPropLinksRaw) && db.Chunks.TryGetValue("LD$MetaProp", out var metaPropLinkDataRaw)) { @@ -52,6 +53,7 @@ public class ObjectHierarchy var txtRepl1s = (PropertyChunk)txtRepl1Raw; var txtRepl2s = (PropertyChunk)txtRepl2Raw; var txtRepl3s = (PropertyChunk)txtRepl3Raw; + var renderAlpha = (PropertyChunk)renderAlphaRaw; var metaPropLinks = (LinkChunk)metaPropLinksRaw; var metaPropLinkData = (LinkDataMetaProp)metaPropLinkDataRaw; @@ -64,6 +66,7 @@ public class ObjectHierarchy gam.Chunks.TryGetValue("P$OTxtRepr1", out var gamTxtRepl1s) && gam.Chunks.TryGetValue("P$OTxtRepr2", out var gamTxtRepl2s) && gam.Chunks.TryGetValue("P$OTxtRepr3", out var gamTxtRepl3s) && + gam.Chunks.TryGetValue("P$RenderAlp", out var gamRenderAlpha) && gam.Chunks.TryGetValue("L$MetaProp", out var gamLinks) && gam.Chunks.TryGetValue("LD$MetaProp", out var gamLinkData)) { @@ -74,6 +77,7 @@ public class ObjectHierarchy txtRepl1s.properties.AddRange(((PropertyChunk)gamTxtRepl1s).properties); txtRepl2s.properties.AddRange(((PropertyChunk)gamTxtRepl2s).properties); txtRepl3s.properties.AddRange(((PropertyChunk)gamTxtRepl3s).properties); + renderAlpha.properties.AddRange(((PropertyChunk)gamRenderAlpha).properties); metaPropLinks.links.AddRange(((LinkChunk)gamLinks).links); metaPropLinkData.linkData.AddRange(((LinkDataMetaProp)gamLinkData).linkData); } @@ -140,6 +144,10 @@ public class ObjectHierarchy { TryAddProp("P$OTxtRepr3", prop); } + foreach (var prop in renderAlpha.properties) + { + TryAddProp("P$RenderAlp", prop); + } } } diff --git a/project/code/TMV/Mission.cs b/project/code/TMV/Mission.cs index dc37bcb..f5a477f 100644 --- a/project/code/TMV/Mission.cs +++ b/project/code/TMV/Mission.cs @@ -253,6 +253,7 @@ public partial class Mission : Node3D var txtRepl1 = objHierarchy.GetProperty(id, "P$OTxtRepr1"); var txtRepl2 = objHierarchy.GetProperty(id, "P$OTxtRepr2"); var txtRepl3 = objHierarchy.GetProperty(id, "P$OTxtRepr3"); + var renderAlpha = objHierarchy.GetProperty(id, "P$RenderAlp"); var renderMode = renderTypeProp == null ? PropRenderType.Mode.Normal : renderTypeProp.mode; if (modelNameProp == null || renderMode == PropRenderType.Mode.NotRendered) @@ -326,6 +327,11 @@ public partial class Mission : Node3D } } + if (renderAlpha != null) + { + model.Transparency = 1.0f - renderAlpha.value; + } + model.AddToGroup(OBJECT_MODELS_GROUP); AddChild(model);