Skip to content

Commit c31fbb8

Browse files
committed
Mostly implemented NavigationMeshInfoMap and NavigationMesh, Landscape is entirely undecoded
1 parent 905fce3 commit c31fbb8

31 files changed

Lines changed: 2486 additions & 22 deletions
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.IO;
7+
using System.Xml.Linq;
8+
using ESPSharp.Enums;
9+
using ESPSharp.Enums.Flags;
10+
using ESPSharp.Interfaces;
11+
using ESPSharp.Subrecords;
12+
using ESPSharp.SubrecordCollections;
13+
using ESPSharp.DataTypes;
14+
15+
namespace ESPSharp.DataTypes
16+
{
17+
public partial class NavMeshDoor : IESPSerializable, ICloneable<NavMeshDoor>, IReferenceContainer
18+
{
19+
public FormID Door { get; set; }
20+
public UInt16 Triangle { get; set; }
21+
public Byte[] Unused { get; set; }
22+
23+
public NavMeshDoor()
24+
{
25+
Door = new FormID();
26+
Triangle = new UInt16();
27+
Unused = new byte[2];
28+
}
29+
30+
public NavMeshDoor(FormID Door, UInt16 Triangle, Byte[] Unused)
31+
{
32+
this.Door = Door;
33+
this.Triangle = Triangle;
34+
this.Unused = Unused;
35+
}
36+
37+
public NavMeshDoor(NavMeshDoor copyObject)
38+
{
39+
Door = copyObject.Door.Clone();
40+
Triangle = copyObject.Triangle;
41+
Unused = (Byte[])copyObject.Unused.Clone();
42+
}
43+
44+
public void ReadBinary(ESPReader reader)
45+
{
46+
try
47+
{
48+
Door.ReadBinary(reader);
49+
Triangle = reader.ReadUInt16();
50+
Unused = reader.ReadBytes(2);
51+
}
52+
catch
53+
{
54+
return;
55+
}
56+
}
57+
58+
public void WriteBinary(ESPWriter writer)
59+
{
60+
Door.WriteBinary(writer);
61+
writer.Write(Triangle);
62+
if (Unused == null)
63+
writer.Write(new byte[2]);
64+
else
65+
writer.Write(Unused);
66+
}
67+
68+
public void WriteXML(XElement ele, ElderScrollsPlugin master)
69+
{
70+
XElement subEle;
71+
72+
ele.TryPathTo("Door", true, out subEle);
73+
Door.WriteXML(subEle, master);
74+
75+
ele.TryPathTo("Triangle", true, out subEle);
76+
subEle.Value = Triangle.ToString();
77+
78+
ele.TryPathTo("Unused", true, out subEle);
79+
subEle.Value = Unused.ToHex();
80+
}
81+
82+
public void ReadXML(XElement ele, ElderScrollsPlugin master)
83+
{
84+
XElement subEle;
85+
86+
if (ele.TryPathTo("Door", false, out subEle))
87+
{
88+
Door.ReadXML(subEle, master);
89+
}
90+
91+
if (ele.TryPathTo("Triangle", false, out subEle))
92+
{
93+
Triangle = subEle.ToUInt16();
94+
}
95+
96+
if (ele.TryPathTo("Unused", false, out subEle))
97+
{
98+
Unused = subEle.ToBytes();
99+
}
100+
}
101+
102+
public NavMeshDoor Clone()
103+
{
104+
return new NavMeshDoor(this);
105+
}
106+
}
107+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<#@ template debug="false" hostspecific="false" language="C#" #>
2+
<#@ output extension=".cs" #>
3+
<#
4+
DataTypeTemplate template = new DataTypeTemplate();
5+
template.ClassName = "NavMeshDoor";
6+
7+
DataTypeField tempField;
8+
9+
tempField =
10+
new DataTypeField(
11+
typeof(FormID),
12+
"Door",
13+
"Door"
14+
);
15+
template.Fields.Add(tempField);
16+
17+
tempField =
18+
new DataTypeField(
19+
typeof(ushort),
20+
"Triangle",
21+
"Triangle"
22+
);
23+
template.Fields.Add(tempField);
24+
25+
tempField =
26+
new DataTypeField(
27+
typeof(byte[]),
28+
"Unused",
29+
"Unused"
30+
);
31+
tempField.byteCount = 2;
32+
template.Fields.Add(tempField);
33+
#>
34+
<#@ include file="DataTypeTemplate.t4" once="true" #>
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.IO;
7+
using System.Xml.Linq;
8+
using ESPSharp.Enums;
9+
using ESPSharp.Enums.Flags;
10+
using ESPSharp.Interfaces;
11+
using ESPSharp.Subrecords;
12+
using ESPSharp.SubrecordCollections;
13+
using ESPSharp.DataTypes;
14+
15+
namespace ESPSharp.DataTypes
16+
{
17+
public partial class NavMeshExternalConnection : IESPSerializable, ICloneable<NavMeshExternalConnection>, IReferenceContainer
18+
{
19+
public Byte[] Unknown { get; set; }
20+
public FormID NavigationMesh { get; set; }
21+
public UInt16 Triangle { get; set; }
22+
23+
public NavMeshExternalConnection()
24+
{
25+
Unknown = new byte[4];
26+
NavigationMesh = new FormID();
27+
Triangle = new UInt16();
28+
}
29+
30+
public NavMeshExternalConnection(Byte[] Unknown, FormID NavigationMesh, UInt16 Triangle)
31+
{
32+
this.Unknown = Unknown;
33+
this.NavigationMesh = NavigationMesh;
34+
this.Triangle = Triangle;
35+
}
36+
37+
public NavMeshExternalConnection(NavMeshExternalConnection copyObject)
38+
{
39+
Unknown = (Byte[])copyObject.Unknown.Clone();
40+
NavigationMesh = copyObject.NavigationMesh.Clone();
41+
Triangle = copyObject.Triangle;
42+
}
43+
44+
public void ReadBinary(ESPReader reader)
45+
{
46+
try
47+
{
48+
Unknown = reader.ReadBytes(4);
49+
NavigationMesh.ReadBinary(reader);
50+
Triangle = reader.ReadUInt16();
51+
}
52+
catch
53+
{
54+
return;
55+
}
56+
}
57+
58+
public void WriteBinary(ESPWriter writer)
59+
{
60+
if (Unknown == null)
61+
writer.Write(new byte[4]);
62+
else
63+
writer.Write(Unknown);
64+
NavigationMesh.WriteBinary(writer);
65+
writer.Write(Triangle);
66+
}
67+
68+
public void WriteXML(XElement ele, ElderScrollsPlugin master)
69+
{
70+
XElement subEle;
71+
72+
ele.TryPathTo("Unknown", true, out subEle);
73+
subEle.Value = Unknown.ToHex();
74+
75+
ele.TryPathTo("NavigationMesh", true, out subEle);
76+
NavigationMesh.WriteXML(subEle, master);
77+
78+
ele.TryPathTo("Triangle", true, out subEle);
79+
subEle.Value = Triangle.ToString();
80+
}
81+
82+
public void ReadXML(XElement ele, ElderScrollsPlugin master)
83+
{
84+
XElement subEle;
85+
86+
if (ele.TryPathTo("Unknown", false, out subEle))
87+
{
88+
Unknown = subEle.ToBytes();
89+
}
90+
91+
if (ele.TryPathTo("NavigationMesh", false, out subEle))
92+
{
93+
NavigationMesh.ReadXML(subEle, master);
94+
}
95+
96+
if (ele.TryPathTo("Triangle", false, out subEle))
97+
{
98+
Triangle = subEle.ToUInt16();
99+
}
100+
}
101+
102+
public NavMeshExternalConnection Clone()
103+
{
104+
return new NavMeshExternalConnection(this);
105+
}
106+
}
107+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<#@ template debug="false" hostspecific="false" language="C#" #>
2+
<#@ output extension=".cs" #>
3+
<#
4+
DataTypeTemplate template = new DataTypeTemplate();
5+
template.ClassName = "NavMeshExternalConnection";
6+
7+
DataTypeField tempField;
8+
9+
tempField =
10+
new DataTypeField(
11+
typeof(byte[]),
12+
"Unknown",
13+
"Unknown"
14+
);
15+
tempField.byteCount = 4;
16+
template.Fields.Add(tempField);
17+
18+
tempField =
19+
new DataTypeField(
20+
typeof(FormID),
21+
"NavigationMesh",
22+
"NavigationMesh"
23+
);
24+
template.Fields.Add(tempField);
25+
26+
tempField =
27+
new DataTypeField(
28+
typeof(ushort),
29+
"Triangle",
30+
"Triangle"
31+
);
32+
template.Fields.Add(tempField);
33+
#>
34+
<#@ include file="DataTypeTemplate.t4" once="true" #>

0 commit comments

Comments
 (0)