コード例 #1
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/LBZ/Nemesis Art/Misc Art.bin", CompressionType.Nemesis)), -2368);
            var art = indexer.ToArray();
            var map = LevelData.ASMToBin(
                "../Levels/LBZ/Misc Object Data/Map - Cup Elevator.asm", LevelData.Game.MappingsVersion);

            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new[]
            {
                BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 3, 2)),
                BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 4, 2))
            };

            properties[0] = new PropertySpec("Height", typeof(int), "Extended",
                                             "The object's appearance.", null, new Dictionary <string, int>
            {
                { "Short", 0 },
                { "Long", 1 }
            },
                                             (obj) => (obj.SubType & 0x3F) == 0 ? 0 : 1,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xC0) | ((int)value & 0x3F)));

            properties[1] = new PropertySpec("Sonic only", typeof(bool), "Extended",
                                             "If set, the object disappears when playing as Knuckles.", null,
                                             (obj) => (obj.SubType & 0x40) != 0,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xBF) | ((bool)value ? 0x40 : 0)));
        }
コード例 #2
0
ファイル: SnowPile.cs プロジェクト: MicroshaftCorp/sldisasm
        public override void Init(ObjectData data)
        {
            var version = LevelData.Game.MappingsVersion;
            var art     = LevelData.ReadFile("../Levels/ICZ/Nemesis Art/Misc Art 2.bin", CompressionType.Nemesis);
            var map     = LevelData.ASMToBin("../Levels/ICZ/Misc Object Data/Map - Platforms.asm", version);

            subtypeNames = new Dictionary <byte, string>
            {
                { 0x00, "Snow Pile" },
                { 0x08, "Tunnel Snow (Edge)" },
                { 0x10, "Tunnel Snow" },
                { 0x90, "Tunnel Snow (Start LBZ1)" },
                { 0x18, "Snowfall" }
            };

            subtypes      = new ReadOnlyCollection <byte>(new List <byte>(subtypeNames.Keys));
            unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject);

            var emptySprite = new Sprite();

            sprites = new[]
            {
                BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 32, 2, false)),
                BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 33, 2, true)),
                BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 34, 2, true)),
                new[] { emptySprite, emptySprite, emptySprite, emptySprite }
            };
        }
コード例 #3
0
        public override void Init(ObjectData data)
        {
            base.Init(data);

            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile("LevelArt", 0)), -4608);
            var art = indexer.ToArray();

            var version = LevelData.Game.MappingsVersion;
            var map     = LevelData.ASMToBin(
                "../Levels/LRZ/Misc Object Data/Map - Solid Moving Platforms.asm", version);

            sprites = new[]
            {
                ObjectHelper.MapToBmp(art, map, 0, 2),
                ObjectHelper.MapToBmp(art, map, 1, 2)
            };

            properties = new[]
            {
                properties[0],
                new PropertySpec("Sprite", typeof(int), "Extended",
                                 "The object's appearance.", null, new Dictionary <string, int>
                {
                    { "Block", 0x00 },
                    { "Platform", 0x10 }
                },
                                 (obj) => obj.SubType & 0x70,
                                 (obj, value) => obj.SubType = (byte)((obj.SubType & 0x8F) | ((int)value & 0x70)))
            };
        }
コード例 #4
0
ファイル: ChainLink.cs プロジェクト: MicroshaftCorp/sldisasm
        public override void Init(ObjectData data)
        {
            var version = LevelData.Game.MappingsVersion;
            var art     = LevelData.ReadFile("../Levels/FBZ/Nemesis Art/Misc Art 1.bin", CompressionType.Nemesis);
            var map     = LevelData.ASMToBin("../Levels/FBZ/Misc Object Data/Map - Chain Link.asm", version);

            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new Sprite[15];

            for (var index = 0; index < sprites.Length; index++)
            {
                sprites[index] = ObjectHelper.MapToBmp(art, map, index, 2);
            }

            unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject);
            emptySprite   = new Sprite();

            properties[0] = new PropertySpec("Behavior", typeof(int), "Extended",
                                             "The object's orientation and behavior type.", null, new Dictionary <string, int>
            {
                { "Descending", 0x00 },
                { "Array", 0x80 },
                { "Array (fall off last)", 0xC0 }
            },
                                             (obj) => obj.SubType < 0x80 ? 0 : obj.SubType& 0xC0,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x3F) | ((int)value & 0xC0)));

            properties[1] = new PropertySpec("Count", typeof(int), "Extended",
                                             "The number of chain links in the object.", null,
                                             (obj) => obj.SubType & 0x3F,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xC0) | ((int)value & 0x3F)));
        }
コード例 #5
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/LBZ/Nemesis Art/Act 2 Misc Art.bin", CompressionType.Nemesis)), 0);
            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/LBZ/Nemesis Art/Misc Art.bin", CompressionType.Nemesis)), 6944);

            var version = LevelData.Game.MappingsVersion;
            var art     = indexer.ToArray();
            var map     = LevelData.ASMToBin("../Levels/LBZ/Misc Object Data/Map - Lowering Grapple.asm", version);

            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new Sprite[15];

            for (var index = 0; index < sprites.Length; index++)
            {
                sprites[index] = ObjectHelper.MapToBmp(art, map, index, 2);
            }

            unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject);

            properties[0] = new PropertySpec("Count", typeof(int), "Extended",
                                             "The number of chain links in the object.", null,
                                             (obj) => obj.SubType & 0x7F,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x80) | ((int)value & 0x7F)));

            properties[1] = new PropertySpec("Reverse", typeof(bool), "Extended",
                                             "If set, the object will start low and rise until fully retracted.", null,
                                             (obj) => obj.SubType >= 0x80,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x7F) | ((bool)value ? 0x80 : 0)));
        }
コード例 #6
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile("LevelArt", 0)), -4608);
            var art = indexer.ToArray();

            var version = LevelData.Game.MappingsVersion;
            var map     = LevelData.ASMToBin(
                "../Levels/LRZ/Misc Object Data/Map - Solid Moving Platforms.asm", version);

            properties    = new PropertySpec[1];
            subtypes      = new ReadOnlyCollection <byte>(new byte[0]);
            unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject);

            properties[0] = new PropertySpec("Movement", typeof(int), "Extended",
                                             "The object's movement pattern.", null, new Dictionary <string, int>
            {
                { "None", 0 },
                { "Vertical (64px)", 4 },
                { "Vertical (128px)", 5 },
                { "Vertical (192px)", 6 },
                { "Vertical (256px)", 8 },
                { "Horizontal (64px)", 1 },
                { "Horizontal (128px)", 2 },
                { "Horizontal (192px)", 3 },
                { "Horizontal (256px)", 7 }
            },
                                             (obj) => obj.SubType & 0x0F,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xF0) | ((int)value & 0x0F)));
        }
コード例 #7
0
        public override void Init(ObjectData data)
        {
            var version = LevelData.Game.MappingsVersion;
            var art     = LevelData.ReadFile("../Levels/MGZ/Nemesis Art/Misc Art 1.bin", CompressionType.Nemesis);
            var map     = LevelData.ASMToBin("../Levels/MGZ/Misc Object Data/Map - Swinging Spike Ball.asm", version);

            properties = new PropertySpec[1];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new Sprite[2][];

            var frames = new Sprite[4];

            for (var index = 0; index < frames.Length; index++)
            {
                frames[index] = ObjectHelper.MapToBmp(art, map, index, 1);
            }

            sprites[0] = BuildFlippedSprites(frames, true);
            sprites[1] = BuildFlippedSprites(frames, false);
            image      = frames[3];

            properties[0] = new PropertySpec("Direction", typeof(int), "Extended",
                                             "The object's orientation.", null, new Dictionary <string, int>
            {
                { "Horizontal", 0 },
                { "Vertical", 1 }
            },
                                             (obj) => obj.SubType == 0 ? 0 : 1,
                                             (obj, value) => obj.SubType = (byte)(int)value);
        }
コード例 #8
0
        public override void Init(ObjectData data)
        {
            var version = LevelData.Game.MappingsVersion;
            var art     = LevelData.ReadFile("../Levels/HCZ/Nemesis Art/Miniboss.bin", CompressionType.Nemesis);
            var map     = LevelData.ASMToBin("../Levels/HCZ/Misc Object Data/Map - Miniboss.asm", version);

            image = ObjectHelper.MapToBmp(art, map, 0, 5, true);
            var rock1 = ObjectHelper.MapToBmp(art, map, 1, 5, true);
            var rock2 = new Sprite(rock1, 24, 24);

            rock1.Offset(-24, 24);
            var rock3 = ObjectHelper.MapToBmp(art, map, 9, 5, true);
            var rock4 = new Sprite(rock3, -24, -24);

            rock3.Offset(24, -24);
            var fire = ObjectHelper.MapToBmp(art, map, 21, 0, true);

            fire.Offset(0, 36);

            extraSprite = ObjectHelper.MapToBmp(art, map, 22, 5, true);
            extraSprite.Offset(0, 328);

            subtypes = new ReadOnlyCollection <byte>(new byte[0]);
            sprite   = BuildFlippedSprites(new Sprite(image, rock1, rock2, rock3, rock4, fire));
        }
コード例 #9
0
ファイル: Ribot.cs プロジェクト: MicroshaftCorp/sldisasm
        public override void Init(ObjectData data)
        {
            var art = LevelData.ReadFile("../General/Sprites/Ribot/Ribot.bin", CompressionType.KosinskiM);
            var map = LevelData.ASMToBin("../General/Sprites/Ribot/Map - Ribot.asm", LevelData.Game.MappingsVersion);

            sprites = new Sprite[6];

            sprites[0] = ObjectHelper.MapToBmp(art, map, 0, 1);
            sprites[1] = new Sprite(sprites[0], false, true);
            sprites[2] = ObjectHelper.MapToBmp(art, map, 3, 1);
            sprites[3] = new Sprite(sprites[2], false, true);
            sprites[4] = ObjectHelper.MapToBmp(art, map, 6, 1);
            sprites[5] = ObjectHelper.MapToBmp(art, map, 7, 1);

            subtypeNames = new[]
            {
                "Vertical",
                "Horizontal",
                "Circular"
            };

            var subtypes = new byte[subtypeNames.Length];

            for (var index = 0; index < subtypes.Length; index++)
            {
                subtypes[index] = (byte)(index << 1);
            }

            this.subtypes = new ReadOnlyCollection <byte>(subtypes);
            unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject);
        }
コード例 #10
0
ファイル: Door.cs プロジェクト: MicroshaftCorp/sldisasm
        public override void Init(ObjectData data)
        {
            var map = LevelData.ASMToBin(
                "../Levels/SOZ/Misc Object Data/Map - Door.asm", LevelData.Game.MappingsVersion);

            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/SOZ/Nemesis Art/Misc Art.bin", CompressionType.Nemesis)), -4480);
            var art = indexer.ToArray();

            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new[]
            {
                BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 0, 2)),
                BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 1, 2))
            };

            properties[0] = new PropertySpec("Trigger ID", typeof(int), "Extended",
                                             "The level trigger array flag monitored by this object.", null,
                                             (obj) => obj.SubType & 0x0F,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xF0) | ((int)value & 0x0F)));

            properties[1] = new PropertySpec("Direction", typeof(int), "Extended",
                                             "The object's orientation.", null, new Dictionary <string, int>
            {
                { "Vertical", 0x00 },
                { "Horizontal", 0x10 }
            },
                                             (obj) => obj.SubType > 0x0F ? 0x10 : 0,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x0F) | (int)value));
        }
コード例 #11
0
ファイル: SpriteMask.cs プロジェクト: MicroshaftCorp/sldisasm
        public override void Init(ObjectData data)
        {
            var map = LevelData.ASMToBin(
                "../General/Sprites/Level Misc/Map - Sprite Mask.asm", LevelData.Game.MappingsVersion);

            var art = LevelData.ReadFile("LevelArt", 0);

            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new Sprite[16][];

            for (var index = 0; index < sprites.Length; index++)
            {
                sprites[index] = BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, index, 0));
            }

            properties[0] = new PropertySpec("Height", typeof(int), "Extended",
                                             "Vertical range in which the mask is active, in pixels.", null,
                                             (obj) => (obj.SubType & 0xF0) >> 1,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x07) | (((int)value << 1) & 0xF0)));

            properties[1] = new PropertySpec("Depth", typeof(int), "Extended",
                                             "The sprite depth masked by this object.", null,
                                             (obj) => (obj.SubType & 0x07) << 7,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xF0) | (((int)value >> 7) & 0x07)));
        }
コード例 #12
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile("LevelArt", 0)), -32);
            var art = indexer.ToArray();

            var version = LevelData.Game.MappingsVersion;
            var map     = LevelData.ASMToBin("../Levels/MGZ/Misc Object Data/Map - Trigger Platform.asm", version);

            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new[]
            {
                BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 0, 2)),
                BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 1, 2)),
                BuildFlippedSprites(ObjectHelper.UnknownObject)
            };

            properties[0] = new PropertySpec("Direction", typeof(int), "Extended",
                                             "The object's appearance and movement pattern.", null, new Dictionary <string, int>
            {
                { "Horizontal", 0 },
                { "Vertical (64px)", 1 },
                { "Vertical (128px)", 2 }
            },
                                             (obj) => (obj.SubType & 0x70) >> 4,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x8F) | (((int)value << 4) & 0x70)));

            properties[1] = new PropertySpec("Trigger ID", typeof(int), "Extended",
                                             "The level trigger array flag monitored by this object.", null,
                                             (obj) => obj.SubType & 0x0F,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xF0) | ((int)value & 0x0F)));
        }
コード例 #13
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/FBZ/Nemesis Art/Misc Art 1.bin", CompressionType.Nemesis)), -6464);
            var art = indexer.ToArray();

            var version = LevelData.Game.MappingsVersion;
            var map     = LevelData.ASMToBin(
                "../Levels/FBZ/Misc Object Data/Map - Magnetic Platform.asm", version);

            properties = new PropertySpec[1];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new[]
            {
                ObjectHelper.MapToBmp(art, map, 0, 1),
                ObjectHelper.MapToBmp(art, map, 1, 1),
                ObjectHelper.MapToBmp(art, map, 3, 1)
            };

            image = ObjectHelper.MapToBmp(art, map, 4, 1);
            sprites[1].Offset(0, 8);

            properties[0] = new PropertySpec("Length", typeof(int), "Extended",
                                             "The vertical range of the object's chain, in pixels.", null,
                                             (obj) => obj.SubType << 4,
                                             (obj, value) => obj.SubType = (byte)((int)value >> 4));
        }
コード例 #14
0
        protected void BuildSpritesProperties(string artfile, int frame)
        {
            var version = LevelData.Game.MappingsVersion;
            var art     = LevelData.ReadFile(artfile, CompressionType.Nemesis);
            var map     = LevelData.ASMToBin(
                "../Levels/LRZ/Misc Object Data/Map - Swinging Spike Ball.asm", version);

            properties = new PropertySpec[3];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new[]
            {
                ObjectHelper.MapToBmp(art, map, frame++, 1, true),
                ObjectHelper.MapToBmp(art, map, frame++, 0, true)
            };

            unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject);

            properties[0] = new PropertySpec("Count", typeof(int), "Extended",
                                             "The number of segments in the object.", null,
                                             (obj) => (obj.SubType & 0x0F) + 1,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xF0) | (((int)value - 1) & 0x0F)));

            properties[1] = new PropertySpec("Speed Up", typeof(bool), "Extended",
                                             "If set, the object will rotate twice as fast.", null,
                                             (obj) => obj.SubType >= 0x80,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x0F) | ((bool)value ? 0x80 : 0)));

            properties[2] = new PropertySpec("Reverse", typeof(bool), "Extended",
                                             "If set, the object will move counterclockwise.", null,
                                             (obj) => obj.XFlip,
                                             (obj, value) => obj.XFlip = (bool)value);
        }
コード例 #15
0
 public override void Init(ObjectData data)
 {
     byte[] art = LevelData.ReadFile("../objects/sonic/art.bin", CompressionType.Uncompressed);
     byte[] map = LevelData.ASMToBin("../objects/sonic/map.asm", EngineVersion.S1);
     byte[] plc = LevelData.ASMToBin("../objects/sonic/dplc.asm", EngineVersion.S2);
     img = ObjectHelper.MapDPLCToBmp(art, map, plc, 45, 0, true);
 }
コード例 #16
0
ファイル: Skorp.cs プロジェクト: MicroshaftCorp/sldisasm
        public override void Init(ObjectData data)
        {
            var art = LevelData.ReadFile(
                "../General/Sprites/Skorp/Skorp.bin", CompressionType.KosinskiM);
            var map = LevelData.ASMToBin(
                "../General/Sprites/Skorp/Map - Skorp.asm", LevelData.Game.MappingsVersion);

            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            properties = new PropertySpec[1];
            sprite     = BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 0, 1));

            var segment = ObjectHelper.MapToBmp(art, map, 3, 1);
            var tail    = new Sprite(
                new Sprite(segment, 8, 0),
                new Sprite(segment, 15, 1),
                new Sprite(segment, 23, 4),
                new Sprite(segment, 28, 10),
                new Sprite(segment, 31, 18),
                ObjectHelper.MapToBmp(art, map, 4, 1));

            tail.Offset(-23, -34);
            this.tail = new[] { tail, new Sprite(tail, true, false) };

            properties[0] = new PropertySpec("Range", typeof(int), "Extended",
                                             "Horizontal range patrolled by the object, in pixels.", null,
                                             (obj) => (int)obj.SubType,
                                             (obj, value) => obj.SubType = (byte)(int)value);
        }
コード例 #17
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/FBZ/Nemesis Art/Misc Art 1.bin", CompressionType.Nemesis)), -4736);
            var art = indexer.ToArray();
            var map = LevelData.ASMToBin(
                "../Levels/FBZ/Misc Object Data/Map - Platform Blocks.asm", LevelData.Game.MappingsVersion);

            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new Sprite[8][];

            for (var index = 0; index < 4; index++)
            {
                sprites[index] = BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, index, 2));
            }

            sprites[4] = BuildFlippedSprites(ObjectHelper.UnknownObject);
            sprites[5] = sprites[4];
            sprites[6] = sprites[4];
            sprites[7] = sprites[4];

            properties[0] = new PropertySpec("Count", typeof(int), "Extended",
                                             "The number of blocks in the object.", null,
                                             (obj) => ((obj.SubType >> 4) & 3) + 1,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x0F) | ((((int)value - 1) & 3) << 4)));

            properties[1] = new PropertySpec("Distance", typeof(int), "Extended",
                                             "How far the object will retract, in pixels.", null,
                                             (obj) => (obj.SubType & 0x0F) << 4,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xF0) | (((int)value >> 4) & 0x0F)));
        }
コード例 #18
0
        public override void Init(ObjectData data)
        {
            var version = LevelData.Game.MappingsVersion;
            var art     = LevelData.ReadFile("../Levels/SOZ/Nemesis Art/Act 2 Extra Art.bin", CompressionType.Nemesis);
            var map     = LevelData.ASMToBin("../Levels/SOZ/Misc Object Data/Map - Light Switch.asm", version);

            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new Sprite[8];

            for (var index = 0; index < sprites.Length; index++)
            {
                sprites[index] = ObjectHelper.MapToBmp(art, map, index, 0);
            }

            unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject);

            properties[0] = new PropertySpec("Count", typeof(int), "Extended",
                                             "The number of chain links in the object.", null,
                                             (obj) => obj.SubType & 0x7F,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x80) | ((int)value & 0x7F)));

            properties[1] = new PropertySpec("Floor Check", typeof(bool), "Extended",
                                             "If set, players will fall off the switch if they touch the floor.", null,
                                             (obj) => obj.SubType >= 0x80,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x7F) | ((bool)value ? 0x80 : 0)));
        }
コード例 #19
0
        public override void Init(ObjectData data)
        {
            var version = LevelData.Game.MappingsVersion;
            var art     = LevelData.ReadFile("../Levels/MGZ/Nemesis Art/Misc Art 1.bin", CompressionType.Nemesis);
            var map     = LevelData.ASMToBin("../Levels/MGZ/Misc Object Data/Map - Swinging Platform.asm", version);

            properties = new PropertySpec[3];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new Sprite[3];

            for (var index = 0; index < sprites.Length; index++)
            {
                sprites[index] = ObjectHelper.MapToBmp(art, map, index, 2);
            }

            properties[0] = new PropertySpec("Offset", typeof(int), "Extended",
                                             "The starting point of the object's movement cycle.", null,
                                             (obj) => obj.XFlip ? 256 - obj.SubType : obj.SubType,
                                             (obj, value) => obj.SubType = (byte)(obj.XFlip ? 256 - (int)value : (int)value));

            properties[1] = new PropertySpec("Reverse", typeof(bool), "Extended",
                                             "If set, the object will move counterclockwise.", null,
                                             (obj) => obj.XFlip,
                                             (obj, value) =>
            {
                obj.XFlip   = (bool)value;
                obj.SubType = (byte)(256 - obj.SubType);
            });

            properties[2] = new PropertySpec("Pivot", typeof(bool), "Extended",
                                             "If set, an extra sprite will be added at the object's center.", null,
                                             (obj) => !obj.YFlip,
                                             (obj, value) => obj.YFlip = !(bool)value);
        }
コード例 #20
0
        protected void BuildSpritesProperties(byte[] art, string mapfile, int startpal,
                                              string[] behaviors, Func <int, bool>[] getters, Func <byte, int>[] setters, Dictionary <string, int> frames)
        {
            var map           = LevelData.ASMToBin(mapfile, LevelData.Game.MappingsVersion);
            var unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject);

            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new Sprite[8][];

            for (var index = 0; index < sprites.Length; index++)
            {
                sprites[index] = unknownSprite;
            }
            foreach (var frame in frames.Values)
            {
                sprites[frame] = BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, frame * 2, startpal));
            }

            var options = new Dictionary <string, int>();

            for (var index = 0; index < behaviors.Length; index++)
            {
                options.Add(behaviors[index], index);
            }

            options.Add("Level trigger", behaviors.Length);

            properties[0] = new PropertySpec("Sprite", typeof(int), "Extended",
                                             "The object's appearance and collision size.", null, frames,
                                             (obj) => (obj.SubType & 0x0E) >> 1,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xF0) | (((int)value << 1) & 0x0E)));

            properties[1] = new PropertySpec("Behavior", typeof(int), "Extended",
                                             "The method through which the object can be destroyed.", null, options,
                                             (obj) =>
            {
                var index = getters.Length;

                while (index > 0 && getters[index - 1](obj.SubType))
                {
                    index--;
                }

                return(index);
            },
                                             (obj, value) =>
            {
                var index = (int)value;

                if (index == setters.Length)
                {
                    obj.SubType = (byte)(obj.SubType | 0x80);
                }
                if (index >= 0 && index < setters.Length)
                {
                    obj.SubType = (byte)setters[index](obj.SubType);
                }
            });
        }
コード例 #21
0
        public override void Init(ObjectData data)
        {
            var version = LevelData.Game.MappingsVersion;
            var art     = LevelData.ReadFile(
                "../Levels/ICZ/Nemesis Art/Misc Art 1.bin", CompressionType.Nemesis);
            var map = LevelData.ASMToBin(
                "../Levels/ICZ/Misc Object Data/Map - Platforms.asm", version);

            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            properties = new PropertySpec[1];
            image      = ObjectHelper.MapToBmp(art, map, 7, 1);

            var ring   = ObjectHelper.MapToBmp(art, map, 8, 2);
            var sprite = new Sprite(ring, 0, -16);

            for (var index = 0; index < 7; index++)
            {
                sprite = new Sprite(sprite, ring);
                sprite.Offset(0, -16);
            }

            sprite = new Sprite(sprite, image);
            var flipped = new Sprite(sprite, new Sprite(image, false, true));

            this.sprite = new[]
            {
                sprite, new Sprite(sprite, true, false),
                flipped, new Sprite(flipped, true, false)
            };

            properties[0] = new PropertySpec("Collapsing", typeof(bool), "Extended",
                                             "If set, the platform will break off at the apex of its swing.", null,
                                             (obj) => obj.SubType != 0,
                                             (obj, value) => obj.SubType = (byte)((bool)value ? 2 : 0));
        }
コード例 #22
0
ファイル: CorkFloor.cs プロジェクト: MicroshaftCorp/sldisasm
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile("LevelArt", 0)), -32);
            var art = indexer.ToArray();
            var map = LevelData.ASMToBin(
                "../Levels/ICZ/Misc Object Data/Map - Cork Floor.asm", LevelData.Game.MappingsVersion);

            subtypeNames = new Dictionary <byte, string>
            {
                { 0x00, "Loop x5" },
                { 0x02, "Loop x4" },
                { 0x04, "Loop x3" },
                { 0x06, "Loop x2" },
                { 0x08, "Loop x1" },
                { 0x1A, "Square" }
            };

            subtypes = new ReadOnlyCollection <byte>(new List <byte>(subtypeNames.Keys));
            sprites  = new Sprite[8][];

            for (var index = 0; index < 5; index++)
            {
                sprites[index] = BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, index * 2, 2));
            }

            sprites[5] = BuildFlippedSprites(ObjectHelper.MapToBmp(LevelData.ReadFile(
                                                                       "../Levels/ICZ/Nemesis Art/Misc Art 1.bin", CompressionType.Nemesis), map, 10, 2));
            sprites[6] = BuildFlippedSprites(ObjectHelper.UnknownObject);
            sprites[7] = sprites[6];
        }
コード例 #23
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/DEZ/Nemesis Art/Misc Art.bin", CompressionType.Nemesis)), -5984);
            var art = indexer.ToArray();

            var version = LevelData.Game.MappingsVersion;
            var map     = LevelData.ASMToBin(
                "../Levels/DEZ/Misc Object Data/Map - Conveyor Pad.asm", version);

            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new[]
            {
                BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 0, 1)),
                BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, 4, 1))
            };

            properties[0] = new PropertySpec("Distance", typeof(int), "Extended",
                                             "Vertical distance the object will travel, in pixels.", null,
                                             (obj) => (obj.SubType & 0x7F) << 3,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x80) | (((int)value & 0x7F) >> 3)));

            properties[1] = new PropertySpec("Direction", typeof(int), "Extended",
                                             "The direction of the object's movement.", null, new Dictionary <string, int>
            {
                { "Up", 0x80 },
                { "Down", 0 }
            },
                                             (obj) => obj.SubType & 0x80,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x7F) | ((int)value & 0x80)));
        }
コード例 #24
0
 public static Sprite MapASMToBmp(byte[] artfile, string mapfileloc, int frame, int startpal, bool priority = false, EngineVersion version = EngineVersion.Invalid)
 {
     if (version == EngineVersion.Invalid)
     {
         version = LevelData.Game.MappingsVersion;
     }
     return(MapToBmp(artfile, LevelData.ASMToBin(mapfileloc, version), frame, startpal, priority, version));
 }
コード例 #25
0
ファイル: HoverFan.cs プロジェクト: MicroshaftCorp/sldisasm
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/CNZ/Animated Tiles/4.bin", CompressionType.Uncompressed)), 0);
            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/CNZ/Nemesis Art/Misc Art.bin", CompressionType.Nemesis)), 2464);
            var map = LevelData.ASMToBin(
                "../Levels/CNZ/Misc Object Data/Map - Hover Fan.asm", LevelData.Game.MappingsVersion);
            var art = indexer.ToArray();

            properties = new PropertySpec[3];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new Sprite[4][];

            invisibleSprite = new Sprite();

            for (var index = 0; index < sprites.Length; index++)
            {
                var offset = (map[index * 2] << 8) | map[(index * 2) + 1];
                var length = ((map[offset++] << 8) | map[offset++]) * 6 + offset;

                while (offset < length)
                {
                    var pattern = ((map[offset + 2] << 8) | map[offset + 3]) + 228;
                    map[offset + 2] = (byte)(pattern >> 8);
                    map[offset + 3] = (byte)(pattern);
                    offset          = offset + 6;
                }

                sprites[index] = BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, index, 2));
            }

            properties[0] = new PropertySpec("Range", typeof(int), "Extended",
                                             "The minimum height at which the player will float, in pixels.", null,
                                             (obj) => ((obj.SubType & 0x0F) + 8) << 4,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xF0) | ((((int)value >> 4) - 8) & 0x0F)));

            properties[1] = new PropertySpec("Count", typeof(int), "Extended",
                                             "The number of fan blocks in the object.", null,
                                             (obj) => ((obj.SubType & 0x70) >> 4) + 1,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x8F) | ((((int)value - 1) << 4) & 0x70)));

            properties[2] = new PropertySpec("Behavior", typeof(int), "Extended",
                                             "The object's movement and appearance.", null, new Dictionary <string, int>
            {
                { "Normal", 0 },
                { "Moving", 1 },
                { "Invisible", 2 }
            },
                                             (obj) => obj.SubType < 0x80 ? 2 : obj.XFlip ? 1 : 0,
                                             (obj, value) =>
            {
                obj.XFlip   = (int)value == 1;
                obj.SubType = (byte)((obj.SubType & 0x7F) | ((int)value == 2 ? 0 : 0x80));
            });
        }
コード例 #26
0
 public static Sprite MapASMToBmp(byte[] artfile, string mapfileloc, string label, int startpal, bool priority = false, EngineVersion version = EngineVersion.Invalid)
 {
     if (version == EngineVersion.Invalid)
     {
         version = LevelData.Game.MappingsVersion;
     }
     byte[] mapfile = LevelData.ASMToBin(mapfileloc, label, version);
     return(LevelData.MapFrameToBmp(artfile, new MappingsFrame(mapfile, 0, version, string.Empty), startpal, priority));
 }
コード例 #27
0
ファイル: ScrewDoor.cs プロジェクト: MicroshaftCorp/sldisasm
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/FBZ/Nemesis Art/Misc Art 1.bin", CompressionType.Nemesis)), -2848);
            var art = indexer.ToArray();
            var map = LevelData.ASMToBin(
                "../Levels/FBZ/Misc Object Data/Map - Screw Door.asm", LevelData.Game.MappingsVersion);

            properties = new PropertySpec[3];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprites    = new Sprite[3][];

            for (var index = 0; index < sprites.Length; index++)
            {
                sprites[index] = BuildFlippedSprites(ObjectHelper.MapToBmp(art, map, index << 2, 1));
            }

            properties[0] = new PropertySpec("Trigger ID", typeof(int), "Extended",
                                             "The level trigger array flag set by this object.", null,
                                             (obj) => obj.SubType & 0x0F,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xF0) | ((int)value & 0x0F)));

            properties[1] = new PropertySpec("Direction", typeof(int), "Extended",
                                             "The object's appearance and movement pattern.", null, new Dictionary <string, int>
            {
                { "Vertical", 0x00 },
                { "Horizontal (64px)", 0x20 },
                { "Horizontal (128px)", 0x40 },
                { "Vertical (player trigger)", 0x80 }
            },
                                             (obj) =>
            {
                if ((obj.SubType & 0x80) != 0)
                {
                    return(0x80);
                }
                var direction = obj.SubType & 0xE0;
                return(direction == 0x60 ? 0x20 : direction);
            },
                                             (obj, value) =>
            {
                var direction = (int)value;
                obj.SubType  &= (byte)(direction == 0x80 ? 0x0F : 0x1F);
                obj.SubType   = (byte)(obj.SubType | (direction & 0xE0));
            });

            properties[2] = new PropertySpec("Reverse", typeof(bool), "Extended",
                                             "If set, the object will retract in the opposite direction.", null,
                                             (obj) => (obj.SubType & 0x10) != 0,
                                             (obj, value) =>
            {
                var reverse = (bool)value && (obj.SubType & 0x80) == 0 ? 0x10 : 0;
                obj.SubType = (byte)((obj.SubType & 0xEF) | reverse);
            });
        }
コード例 #28
0
		public override void Init(ObjectData data)
		{
			byte[] artfile = ObjectHelper.OpenArtFile("../objects/3dramp/art.bin", CompressionType.Nemesis);
			img_booster = ObjectHelper.MapASMToBmp(artfile, "../objects/3dramp/map.asm", 0, 0);

			artfile = LevelData.ReadFile("../objects/sonic/art.bin", CompressionType.Uncompressed);
			byte[] map = LevelData.ASMToBin("../objects/sonic/map.asm", EngineVersion.S1);
			byte[] plc = LevelData.ASMToBin("../objects/sonic/dplc.asm", EngineVersion.S2);
			img_sonic = ObjectHelper.MapDPLCToBmp(artfile, map, plc, 23, 0, true);
		}
コード例 #29
0
        protected void BuildSpritesProperties(string mapfile)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/DEZ/Nemesis Art/Misc Art.bin", CompressionType.Nemesis)), -5696);

            var art     = indexer.ToArray();
            var map     = LevelData.ASMToBin(mapfile, LevelData.Game.MappingsVersion);
            var sprites = new Sprite[4];

            for (var index = 0; index < sprites.Length; index++)
            {
                sprites[index] = ObjectHelper.MapToBmp(art, map, index, 1);
            }

            properties = new PropertySpec[3];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprite     = new Sprite(sprites);

            properties[0] = new PropertySpec("On Period", typeof(int), "Extended",
                                             "How long the object remains solid for, in frames.", null, new Dictionary <string, int>
            {
                { "64", 0x40 },
                { "96", 0x60 },
                { "128", 0x80 },
                { "160", 0xA0 },
            },
                                             (obj) => ((obj.SubType & 3) + 2) << 5,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xFC) | ((((int)value >> 5) - 2) & 3)));

            properties[1] = new PropertySpec("Period", typeof(int), "Extended",
                                             "How duration of the object's on/off cycle, in frames.", null, new Dictionary <string, int>
            {
                { "128", 0x80 },
                { "256", 0x100 },
                { "512", 0x200 },
                { "1024", 0x400 },
            },
                                             (obj) => 1 << (((obj.SubType & 0x0C) >> 2) + 7),
                                             (obj, value) =>
                    {
                    var log     = (int)Math.Log((int)value, 2);
                    obj.SubType = (byte)((obj.SubType & 0xF3) | (((log - 7) << 2) & 0x0C));
                });

            properties[2] = new PropertySpec("Offset", typeof(int), "Extended",
                                             "The starting point of the object's on/off cycle.", null,
                                             (obj) => (1 << (((obj.SubType & 0x0C) >> 2) + 3)) * (obj.SubType >> 4),
                                             (obj, value) =>
            {
                var div     = 1 << (((obj.SubType & 0x0C) >> 2) + 3);
                obj.SubType = (byte)((obj.SubType & 0x0F) | (((int)value / div) << 4));
            });
        }
コード例 #30
0
 public static Sprite MapASMDPLCToBmp(byte[] artfile, string mapfileloc, EngineVersion mapversion, string dplcloc, EngineVersion dplcversion, int frame, int startpal, bool priority = false)
 {
     if (mapversion == EngineVersion.Invalid)
     {
         mapversion = LevelData.Game.MappingsVersion;
     }
     if (dplcversion == EngineVersion.Invalid)
     {
         dplcversion = LevelData.Game.DPLCVersion;
     }
     return(MapDPLCToBmp(artfile, LevelData.ASMToBin(mapfileloc, mapversion), mapversion, LevelData.ASMToBin(dplcloc, dplcversion), dplcversion, frame, startpal, priority));
 }