diff --git a/README.md b/README.md index 2a490415d..0ca40475a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This Application reads ATS/ETS2 files to draw roads, prefabs, map overlays, ferr ![Preview of the map](/docs/preview.jpg "Preview of the map") -### **Support for 1.46** +### **Support for 1.47 Open Beta** ## Export Maps Can now export maps as a tiled web map. diff --git a/TsMap/TsItem/TsMapOverlayItem.cs b/TsMap/TsItem/TsMapOverlayItem.cs index 53b7d1e98..4794af4c5 100644 --- a/TsMap/TsItem/TsMapOverlayItem.cs +++ b/TsMap/TsItem/TsMapOverlayItem.cs @@ -18,7 +18,13 @@ public class TsMapOverlayItem : TsItem public TsMapOverlayItem(TsSector sector, int startOffset) : base(sector, startOffset) { Valid = true; - TsMapOverlayItem825(startOffset); + if (Sector.Version < 898) + TsMapOverlayItem825(startOffset); + else if (Sector.Version >= 898) + TsMapOverlayItem898(startOffset); + else + Logger.Instance.Error($"Unknown base file version ({Sector.Version}) for item {Type} " + + $"in file '{Path.GetFileName(Sector.FilePath)}' @ {startOffset} from '{Sector.GetUberFile().Entry.GetArchiveFile().GetPath()}'"); } public void TsMapOverlayItem825(int startOffset) @@ -55,6 +61,40 @@ public void TsMapOverlayItem825(int startOffset) BlockSize = fileOffset - startOffset; } + public void TsMapOverlayItem898(int startOffset) + { + var fileOffset = startOffset + 0x34; // Set position at start of flags + _zoomLevelVisibility = MemoryHelper.ReadUint8(Sector.Stream, fileOffset); + DlcGuard = MemoryHelper.ReadUint8(Sector.Stream, fileOffset + 0x01); + Hidden = _zoomLevelVisibility == 255; + _isSecret = MemoryHelper.IsBitSet(MemoryHelper.ReadUint8(Sector.Stream, fileOffset + 0x02), 1); + + var type = MemoryHelper.ReadUint8(Sector.Stream, fileOffset) & 0x0F; + var overlayToken = MemoryHelper.ReadUInt64(Sector.Stream, fileOffset += 0x05); + if (type == 1) + { + _overlayName = "parking_ico"; // parking + _type = OverlayType.Map; + } + else if (type == 4) + { + _overlayName = "photo_sight_captured"; // Landmark + _type = OverlayType.Map; + } + else + { + _overlayName = ScsToken.TokenToString(overlayToken); + } + + Nodes = new List(1) + { + MemoryHelper.ReadUInt64(Sector.Stream, fileOffset += 0x08) // 0x08(overlayToken) + }; + + fileOffset += 0x08; // 0x08(nodeUid) + BlockSize = fileOffset - startOffset; + } + internal override void Update() { if (_overlayName == "") return;