Dat151 name updates

This commit is contained in:
dexy 2019-01-22 12:57:16 +11:00
parent 239ff7fd8e
commit 56b148a070

View File

@ -587,7 +587,7 @@ namespace CodeWalker.GameFiles
case Dat151RelType.ShoreLineOcean: return new Dat151ShoreLineOcean(d, br);
case Dat151RelType.ShoreLineList: return new Dat151ShoreLineList(d, br);
case Dat151RelType.Unk114: return new Dat151Unk114(d, br);
case Dat151RelType.RadioTrackLabels: return new Dat151RadioTrackLabels(d, br);
case Dat151RelType.VehicleEngineGranular: return new Dat151VehicleEngineGranular(d, br); //maybe not just vehicle
case Dat151RelType.Vehicle: return new Dat151Vehicle(d, br);
case Dat151RelType.VehicleEngine: return new Dat151VehicleEngine(d, br);
@ -756,7 +756,7 @@ namespace CodeWalker.GameFiles
case Dat151RelType.ShoreLineRiver: return new Dat151ShoreLineRiver(this);
case Dat151RelType.ShoreLineOcean: return new Dat151ShoreLineOcean(this);
case Dat151RelType.ShoreLineList: return new Dat151ShoreLineList(this);
case Dat151RelType.Unk114: return new Dat151Unk114(this);
case Dat151RelType.RadioTrackLabels: return new Dat151RadioTrackLabels(this);
case Dat151RelType.VehicleEngineGranular: return new Dat151VehicleEngineGranular(this); //maybe not just vehicle
case Dat151RelType.Vehicle: return new Dat151Vehicle(this);
case Dat151RelType.VehicleEngine: return new Dat151VehicleEngine(this);
@ -5204,7 +5204,7 @@ namespace CodeWalker.GameFiles
Interior = 44,
Unk45 = 45,
InteriorRoom = 46,
Unk47 = 47,
Unk47 = 47, //door?
Unk48 = 48,
Unk49 = 49, //doors/gates?
WeaponAudioItem = 50,
@ -5266,7 +5266,7 @@ namespace CodeWalker.GameFiles
Unk111 = 111,
Unk112 = 112,
Unk113 = 113,
Unk114 = 114,
RadioTrackLabels = 114,
Unk115 = 115,
Unk116 = 116,
Unk117 = 117,
@ -6772,7 +6772,7 @@ namespace CodeWalker.GameFiles
[TC(typeof(EXP))] public class Dat151RadioStation : Dat151RelData
{
public FlagsUint Unk00 { get; set; }
public uint Unk01 { get; set; }
public uint WheelPosition { get; set; }
public uint Unk02 { get; set; }
public ushort Unk03 { get; set; }
public string RadioName { get; set; }
@ -6789,7 +6789,7 @@ namespace CodeWalker.GameFiles
public Dat151RadioStation(RelData d, BinaryReader br) : base(d, br)
{
Unk00 = br.ReadUInt32();
Unk01 = br.ReadUInt32();
WheelPosition = br.ReadUInt32();
Unk02 = br.ReadUInt32();
Unk03 = br.ReadUInt16();
@ -6818,7 +6818,7 @@ namespace CodeWalker.GameFiles
WriteTypeAndOffset(bw);
bw.Write(Unk00);
bw.Write(Unk01);
bw.Write(WheelPosition);
bw.Write(Unk02);
bw.Write(Unk03);
@ -6841,7 +6841,7 @@ namespace CodeWalker.GameFiles
public override void WriteXml(StringBuilder sb, int indent)
{
RelXml.ValueTag(sb, indent, "Unk00", "0x" + Unk00.Hex);
RelXml.ValueTag(sb, indent, "Unk01", Unk01.ToString());
RelXml.ValueTag(sb, indent, "WheelPosition", WheelPosition.ToString());
RelXml.ValueTag(sb, indent, "Unk02", Unk02.ToString());
RelXml.ValueTag(sb, indent, "Unk03", Unk03.ToString());
RelXml.StringTag(sb, indent, "RadioName", RadioName);
@ -6867,7 +6867,7 @@ namespace CodeWalker.GameFiles
public override void ReadXml(XmlNode node)
{
Unk00 = Xml.GetChildUIntAttribute(node, "Unk00", "value");
Unk01 = Xml.GetChildUIntAttribute(node, "Unk01", "value");
WheelPosition = Xml.GetChildUIntAttribute(node, "WheelPosition", "value");
Unk02 = Xml.GetChildUIntAttribute(node, "Unk02", "value");
Unk03 = (ushort)Xml.GetChildUIntAttribute(node, "Unk03", "value");
RadioName = Xml.GetChildInnerText(node, "RadioName");
@ -10595,40 +10595,40 @@ namespace CodeWalker.GameFiles
}
[TC(typeof(EXP))] public class Dat151Unk114 : Dat151RelData
[TC(typeof(EXP))] public class Dat151RadioTrackLabels : Dat151RelData
{
public uint ItemCount { get; set; }
public ItemValue[] Items { get; set; }
public uint LabelCount { get; set; }
public LabelData[] Labels { get; set; }
public struct ItemValue
public struct LabelData
{
public uint Unk0 { get; set; }
public uint Unk1 { get; set; }
public uint Time { get; set; }
public uint Label { get; set; }
public ItemValue(uint unk0, uint unk1)
public LabelData(uint time, uint trackID)
{
Unk0 = unk0;
Unk1 = unk1;
Time = time;
Label = trackID;
}
public override string ToString()
{
return Unk0.ToString() + ": " + Unk1.ToString();
return Time.ToString() + ": " + Label.ToString();
}
}
public Dat151Unk114(RelFile rel) : base(rel)
public Dat151RadioTrackLabels(RelFile rel) : base(rel)
{
Type = Dat151RelType.Unk114;
Type = Dat151RelType.RadioTrackLabels;
TypeID = (byte)Type;
}
public Dat151Unk114(RelData d, BinaryReader br) : base(d, br)
public Dat151RadioTrackLabels(RelData d, BinaryReader br) : base(d, br)
{
ItemCount = br.ReadUInt32();
Items = new ItemValue[ItemCount];
for (int i = 0; i < ItemCount; i++)
LabelCount = br.ReadUInt32();
Labels = new LabelData[LabelCount];
for (int i = 0; i < LabelCount; i++)
{
Items[i] = new ItemValue(br.ReadUInt32(), br.ReadUInt32());
Labels[i] = new LabelData(br.ReadUInt32(), br.ReadUInt32());
}
var bytesleft = br.BaseStream.Length - br.BaseStream.Position;
@ -10639,52 +10639,52 @@ namespace CodeWalker.GameFiles
{
WriteTypeAndOffset(bw);
bw.Write(ItemCount);
for (int i = 0; i < ItemCount; i++)
bw.Write(LabelCount);
for (int i = 0; i < LabelCount; i++)
{
bw.Write(Items[i].Unk0);
bw.Write(Items[i].Unk1);
bw.Write(Labels[i].Time);
bw.Write(Labels[i].Label);
}
}
public override void WriteXml(StringBuilder sb, int indent)
{
if (ItemCount > 0)
if (LabelCount > 0)
{
RelXml.OpenTag(sb, indent, "Items");
RelXml.OpenTag(sb, indent, "Labels");
var cind = indent + 1;
var cind2 = indent + 2;
for (int i = 0; i < ItemCount; i++)
for (int i = 0; i < LabelCount; i++)
{
RelXml.OpenTag(sb, cind, "Item");
RelXml.ValueTag(sb, cind2, "Unk0", Items[i].Unk0.ToString());
RelXml.ValueTag(sb, cind2, "Unk1", Items[i].Unk1.ToString());
RelXml.ValueTag(sb, cind2, "Time", Labels[i].Time.ToString());
RelXml.ValueTag(sb, cind2, "Label", Labels[i].Label.ToString());
RelXml.CloseTag(sb, cind, "Item");
}
RelXml.CloseTag(sb, indent, "Items");
RelXml.CloseTag(sb, indent, "Labels");
}
else
{
RelXml.SelfClosingTag(sb, indent, "Items");
RelXml.SelfClosingTag(sb, indent, "Labels");
}
}
public override void ReadXml(XmlNode node)
{
var vnode = node.SelectSingleNode("Items");
var vnode = node.SelectSingleNode("Labels");
if (vnode != null)
{
var inodes = vnode.SelectNodes("Item");
if (inodes?.Count > 0)
{
var vlist = new List<ItemValue>();
var vlist = new List<LabelData>();
foreach (XmlNode inode in inodes)
{
ItemValue v = new ItemValue();
v.Unk0 = Xml.GetChildUIntAttribute(inode, "Unk0", "value");
v.Unk1 = Xml.GetChildUIntAttribute(inode, "Unk1", "value");
LabelData v = new LabelData();
v.Time = Xml.GetChildUIntAttribute(inode, "Time", "value");
v.Label = Xml.GetChildUIntAttribute(inode, "Label", "value");
vlist.Add(v);
}
ItemCount = (uint)vlist.Count;
Items = vlist.ToArray();
LabelCount = (uint)vlist.Count;
Labels = vlist.ToArray();
}
}
}