forked from ACEmulator/ACE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegionDesc.cs
59 lines (44 loc) · 1.82 KB
/
RegionDesc.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System.IO;
using ACE.DatLoader.Entity;
namespace ACE.DatLoader.FileTypes
{
/// <summary>
/// This is the client_portal.dat file starting with 0x13 -- There is only one of these, which is why REGION_ID is a constant.
/// </summary>
[DatFileType(DatFileType.Region)]
public class RegionDesc : FileType
{
internal const uint FILE_ID = 0x13000000;
public uint RegionNumber { get; private set; }
public uint Version { get; private set; }
public string RegionName { get; private set; }
public LandDefs LandDefs { get; } = new LandDefs();
public GameTime GameTime { get; } = new GameTime();
public uint PartsMask { get; private set; }
public SkyDesc SkyInfo { get; } = new SkyDesc();
public SoundDesc SoundInfo { get; } = new SoundDesc();
public SceneDesc SceneInfo { get; } = new SceneDesc();
public TerrainDesc TerrainInfo { get; } = new TerrainDesc();
public RegionMisc RegionMisc { get; } = new RegionMisc();
public override void Unpack(BinaryReader reader)
{
Id = reader.ReadUInt32();
RegionNumber = reader.ReadUInt32();
Version = reader.ReadUInt32();
RegionName = reader.ReadPString(); // "Dereth"
reader.AlignBoundary();
LandDefs.Unpack(reader);
GameTime.Unpack(reader);
PartsMask = reader.ReadUInt32();
if ((PartsMask & 0x10) != 0)
SkyInfo.Unpack(reader);
if ((PartsMask & 0x01) != 0)
SoundInfo.Unpack(reader);
if ((PartsMask & 0x02) != 0)
SceneInfo.Unpack(reader);
TerrainInfo.Unpack(reader);
if ((PartsMask & 0x0200) != 0)
RegionMisc.Unpack(reader);
}
}
}