コード例 #1
0
ファイル: TsItem.cs プロジェクト: edoaxyz/ts-map
        public TsCompanyItem(TsSector sector, int startOffset) : base(sector, startOffset)
        {
            Valid = true;
            var fileOffset = startOffset + 0x34; // Set position at start of flags

            var overlayId = BitConverter.ToUInt64(Sector.Stream, fileOffset += 0x05);

            Overlay = Sector.Mapper.LookupOverlay(overlayId);
            if (Overlay == null)
            {
                Valid = false;
                if (overlayId != 0)
                {
                    Log.Msg($"Could not find Company Overlay with id: {overlayId:X}, in {Path.GetFileName(Sector.FilePath)} @ {fileOffset}");
                }
            }

            var count = BitConverter.ToInt32(Sector.Stream, fileOffset += 0x20);

            count       = BitConverter.ToInt32(Sector.Stream, fileOffset += 0x04 + (0x08 * count));
            count       = BitConverter.ToInt32(Sector.Stream, fileOffset += 0x04 + (0x08 * count));
            count       = BitConverter.ToInt32(Sector.Stream, fileOffset += 0x04 + (0x08 * count));
            count       = BitConverter.ToInt32(Sector.Stream, fileOffset += 0x04 + (0x08 * count));
            fileOffset += 0x04 + (0x08 * count);
            BlockSize   = fileOffset - startOffset;
        }
コード例 #2
0
ファイル: TsItem.cs プロジェクト: KRtekTM/ts-map
        public TsCompanyItem(TsSector sector, int startOffset) : base(sector, startOffset)
        {
            Valid = true;
            var fileOffset    = startOffset + 0x34; // Set position at start of flags
            var dlcGuardCount = (Sector.Mapper.IsEts2) ? Common.Ets2DlcGuardCount : Common.AtsDlcGuardCount;

            Hidden = MemoryHelper.ReadInt8(Sector.Stream, fileOffset + 0x01) > dlcGuardCount;

            var overlayId = MemoryHelper.ReadUInt64(Sector.Stream, fileOffset += 0x05);

            Overlay = Sector.Mapper.LookupOverlay(overlayId);
            if (Overlay == null)
            {
                Valid = false;
                if (overlayId != 0)
                {
                    Log.Msg($"Could not find Company Overlay with id: {overlayId:X}, in {Path.GetFileName(Sector.FilePath)} @ {fileOffset}");
                }
            }

            var count = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x20);

            count = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x04 + (0x08 * count));
            count = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x04 + (0x08 * count));
            count = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x04 + (0x08 * count));
            count = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x04 + (0x08 * count));
            if (sector.Version >= Common.BaseFileVersion133)
            {
                count = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x04 + (0x08 * count));
            }
            fileOffset += 0x04 + (0x08 * count);
            BlockSize   = fileOffset - startOffset;
        }
コード例 #3
0
ファイル: TsItem.cs プロジェクト: KRtekTM/ts-map
        public TsTriggerItem(TsSector sector, int startOffset) : base(sector, startOffset)
        {
            Valid = true;
            var fileOffset    = startOffset + 0x34; // Set position at start of flags
            var dlcGuardCount = (Sector.Mapper.IsEts2) ? Common.Ets2DlcGuardCount : Common.AtsDlcGuardCount;

            Hidden = MemoryHelper.ReadInt8(Sector.Stream, fileOffset + 0x01) > dlcGuardCount;
            var tagCount           = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x05);
            var nodeCount          = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x04 + (0x08 * tagCount));
            var triggerActionCount = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x04 + (0x08 * nodeCount));

            fileOffset += 0x04;

            for (var i = 0; i < triggerActionCount; i++)
            {
                var action = MemoryHelper.ReadUInt64(Sector.Stream, fileOffset);
                if (action == 0x18991B7A99E279C) // hud_parking
                {
                    Overlay = Sector.Mapper.LookupOverlay(0x2358E762E112CD4);
                    if (Overlay == null)
                    {
                        Console.WriteLine("Could not find parking overlay");
                        Valid = false;
                    }
                }
                var overloadTag = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x08);
                if (overloadTag > 0)
                {
                    fileOffset += 0x04 * overloadTag;
                }
                var hasText = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x04);
                if (hasText > 0)
                {
                    var textLength = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x04);
                    fileOffset += 0x04 + textLength;
                }
                var count = MemoryHelper.ReadInt32(Sector.Stream, fileOffset += 0x04 + 0x08);
                fileOffset += 0x04 + count * 0x08;
            }

            fileOffset += 0x18;
            BlockSize   = fileOffset - startOffset;
        }
コード例 #4
0
ファイル: TsItem.cs プロジェクト: edoaxyz/ts-map
        public TsFerryItem(TsSector sector, int startOffset) : base(sector, startOffset)
        {
            Valid = true;
            var fileOffset = startOffset + 0x34; // Set position at start of flags

            Train = (Sector.Stream[fileOffset] != 0);
            if (Train)
            {
                Overlay = Sector.Mapper.LookupOverlay(ScsHash.StringToToken("train_ico"));
            }
            else
            {
                Overlay = Sector.Mapper.LookupOverlay(ScsHash.StringToToken("port_overlay"));
            }

            FerryPortId = BitConverter.ToUInt64(Sector.Stream, fileOffset += 0x05);
            sector.Mapper.AddFerryPortLocation(FerryPortId, X, Z);
            fileOffset += 0x08 + 0x1C;
            BlockSize   = fileOffset - startOffset;
        }