Change PropModelName to PropLabel

This commit is contained in:
Jarrod Doyle 2024-09-07 10:48:30 +01:00
parent bd7005d034
commit da67a26eec
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
4 changed files with 32 additions and 34 deletions

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Numerics;
using System.Text;
namespace KeepersCompound.LGS.Database.Chunks;
@ -56,14 +54,38 @@ public class PropGeneric : Property
}
}
public class PropModelName : Property
public class PropLabel : Property
{
public string modelName;
public string value;
public override void Read(BinaryReader reader)
{
base.Read(reader);
modelName = reader.ReadNullString(length);
value = reader.ReadNullString(length);
}
}
public class PropString : Property
{
public int stringLength;
public string value;
public override void Read(BinaryReader reader)
{
base.Read(reader);
stringLength = reader.ReadInt32();
value = reader.ReadNullString(stringLength);
}
}
public class PropFloat : Property
{
public float value;
public override void Read(BinaryReader reader)
{
base.Read(reader);
value = reader.ReadSingle();
}
}
@ -97,27 +119,3 @@ public class PropRenderType : Property
mode = (Mode)reader.ReadUInt32();
}
}
public class PropString : Property
{
public int stringLength;
public string value;
public override void Read(BinaryReader reader)
{
base.Read(reader);
stringLength = reader.ReadInt32();
value = reader.ReadNullString(stringLength);
}
}
public class PropFloat : Property
{
public float value;
public override void Read(BinaryReader reader)
{
base.Read(reader);
value = reader.ReadSingle();
}
}

View File

@ -101,7 +101,7 @@ public class DbFile
"TXLIST" => new TxList(),
"WREXT" => new WorldRep(),
"BRLIST" => new BrList(),
"P$ModelName" => new PropertyChunk<PropModelName>(),
"P$ModelName" => new PropertyChunk<PropLabel>(),
"P$Scale" => new PropertyChunk<PropScale>(),
"P$RenderTyp" => new PropertyChunk<PropRenderType>(),
"P$OTxtRepr0" => new PropertyChunk<PropString>(),

View File

@ -91,7 +91,7 @@ public class ObjectHierarchy
}
}
AddProp<PropModelName>("P$ModelName");
AddProp<PropLabel>("P$ModelName");
AddProp<PropScale>("P$Scale");
AddProp<PropRenderType>("P$RenderTyp");
AddProp<PropString>("P$OTxtRepr0");

View File

@ -246,7 +246,7 @@ public partial class Mission : Node3D
}
var id = (int)brush.brushInfo;
var modelNameProp = objHierarchy.GetProperty<PropModelName>(id, "P$ModelName");
var modelNameProp = objHierarchy.GetProperty<PropLabel>(id, "P$ModelName");
var scaleProp = objHierarchy.GetProperty<PropScale>(id, "P$Scale");
var renderTypeProp = objHierarchy.GetProperty<PropRenderType>(id, "P$RenderTyp");
var txtRepl0 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr0");
@ -262,7 +262,7 @@ public partial class Mission : Node3D
}
// Let's try and place an object :)
var modelName = modelNameProp.modelName + ".bin";
var modelName = modelNameProp.value + ".bin";
var pos = brush.position.ToGodotVec3();
var rawRot = brush.angle;
var rot = new Vector3(rawRot.Y, rawRot.Z, rawRot.X) * 360 / ushort.MaxValue;