예제 #1
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 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];
        }
예제 #2
0
        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));
        }
예제 #3
0
		public override void Init(ObjectData data)
		{
			base.Init(data);

			var indexer = new MultiFileIndexer<byte>();
			indexer.AddFile(new List<byte>(LevelData.ReadFile(
				"../Levels/LBZ/Nemesis Art/Act 2 Misc Art.bin", CompressionType.Nemesis)), 128);
			sprite = ObjectHelper.MapASMToBmp(indexer.ToArray(),
				"../Levels/LBZ/Misc Object Data/Map - PipePlug.asm", 7, 2);

			properties = new[]
			{
				new PropertySpec("Path ID", typeof(string), "Extended",
					"The path information associated with this object.", null,
					(obj) =>
					{
						var path = obj.SubType & 0x1F;
						return path == 0 ? "None" : path == 0x1F ? "None (water rise)" : path.ToString();
					},
					(obj, value) => obj.SubType = (byte)((obj.SubType & 0xE0) | (int.Parse((string)value) & 0x1F))),
				properties[1],
				properties[2],
				new PropertySpec("Water Pipe", typeof(bool), "Extended",
					"If set, the tunnel will remove Flame and Thunder Barriers.", null,
					(obj) => (obj.SubType & 0x20) != 0,
					(obj, value) => obj.SubType = (byte)((obj.SubType & 0xDF) | ((bool)value ? 0x20 : 0)))
			};
		}
예제 #4
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile("LevelArt", 0)), -4608);
            BuildSpritesProperties(indexer.ToArray(), 1);
        }
예제 #5
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)), -9824);

            properties = new PropertySpec[3];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            image      = ObjectHelper.MapASMToBmp(indexer.ToArray(),
                                                  "../Levels/DEZ/Misc Object Data/Map - Tilting Bridge.asm", 0, 1);

            properties[0] = new PropertySpec("Automatic", typeof(bool), "Extended",
                                             "If set, the object will be activated from the start.", null,
                                             (obj) => (obj.SubType & 1) != 0,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 6) | ((bool)value ? 1 : 0)));

            properties[1] = new PropertySpec("Behavior", typeof(int), "Extended",
                                             "The direction from which the object can be activated.", null, new Dictionary <string, int>
            {
                { "Top", 0 },
                { "Bottom", 2 }
            },
                                             (obj) => obj.SubType & 2,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 5) | ((int)value & 2)));

            properties[2] = new PropertySpec("Direction", typeof(int), "Extended",
                                             "The direction of the object's movement.", null, new Dictionary <string, int>
            {
                { "Up", 4 },
                { "Down", 0 }
            },
                                             (obj) => obj.SubType & 4,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 3) | ((int)value & 4)));
        }
예제 #6
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/HCZ/Nemesis Art/Act 2  Block Platform.bin", CompressionType.Nemesis)), -768);

            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprite     = BuildFlippedSprites(ObjectHelper.MapASMToBmp(indexer.ToArray(),
                                                                      "../Levels/HCZ/Misc Object Data/Map - Spinning Column.asm", 1, 2));

            unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject);

            properties[0] = new PropertySpec("Movement", typeof(int), "Extended",
                                             "The object's movement pattern.", null, new Dictionary <string, int>
            {
                { "None", 0x00 },
                { "Horizontal", 0x01 },
                { "Vertical", 0x02 }
            },
                                             (obj) => obj.SubType & 0x03,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xFC) | ((int)value & 0x03)));

            properties[1] = new PropertySpec("Offset", typeof(int), "Extended",
                                             "The starting point for the horizontal movement pattern.", null,
                                             (obj) => (obj.SubType & 0xF0) >> 4,
                                             (obj, value) =>
            {
                var c       = (int)value << 4;
                obj.SubType = (byte)((obj.SubType & 0x0F) | (c > 0xE0 ? 0xE0 : c < 0 ? 0 : c));
            });
        }
예제 #7
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)));
        }
예제 #8
0
		public override void Init(ObjectData data)
		{
			var indexer = new MultiFileIndexer<byte>();
			indexer.AddFile(new List<byte>(LevelData.ReadFile(
				"../Levels/CNZ/Nemesis Art/Misc Art.bin", CompressionType.Nemesis)), -608);

			properties = new PropertySpec[2];
			subtypes = new ReadOnlyCollection<byte>(new byte[0]);
			sprite = ObjectHelper.MapASMToBmp(indexer.ToArray(),
				"../General/Sprites/Level Misc/Map - Bumper.asm", 0, 2);

			var bitmap = new BitmapBits(129, 129);
			bitmap.DrawCircle(LevelData.ColorWhite, 64, 64, 64);
			overlay = new Sprite(bitmap, -64, -64);

			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);
				});
		}
예제 #9
0
        public override void Init(ObjectData data)
        {
            var art4 = LevelData.ReadFile(
                "../Levels/MHZ/Nemesis Art/Misc Art.bin", CompressionType.Nemesis);

            var indexer = new MultiFileIndexer <byte>();
            var bytes   = new List <byte>(art4);

            indexer.AddFile(bytes, -512);
            var art1 = indexer.ToArray();

            indexer.AddFile(bytes, -6368);
            var art2 = indexer.ToArray();

            indexer.AddFile(bytes, -6880);
            var art3 = indexer.ToArray();

            BuildSpritesSubtypes(
                new StillSpriteData(art1, 24, 2, true, 1, "Cliff Edge 1"),
                new StillSpriteData(art1, 25, 2, true, 1, "Cliff Edge 2"),
                new StillSpriteData(art1, 26, 2, true, 1, "Grass"),
                new StillSpriteData(art2, 27, 3, true, 1, "Wood Column Bottom"),
                new StillSpriteData(art2, 28, 3, true, 1, "Wood Column Top"),
                new StillSpriteData(art3, 29, 2, false, 4, "Parachute Vines"),
                new StillSpriteData(art4, 30, 0, false, 5, "Diagonal Spring Pedestal"));
        }
예제 #10
0
        public override void Init(ObjectData data)
        {
            subtypeNames = new[]
            {
                "Collapsing",
                "Pushable",
                "Stationary",
                "Floating"
            };

            var subtypes = new byte[subtypeNames.Length];

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

            this.subtypes = new ReadOnlyCollection <byte>(subtypes);
            sprites       = new Sprite[3][];

            sprites[0] = BuildFlippedSprites(ObjectHelper.MapASMToBmp(LevelData.ReadFile(
                                                                          "../Levels/ICZ/Nemesis Art/Misc Art 1.bin", CompressionType.Nemesis),
                                                                      "../Levels/ICZ/Misc Object Data/Map - Platforms.asm", 0, 2));

            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile("LevelArt", 0)), -32);
            var extra = ObjectHelper.MapASMToBmp(indexer.ToArray(),
                                                 "../Levels/ICZ/Misc Object Data/Map - Wall and Column.asm", 8, 2);

            extra.Offset(-16, 16);
            sprites[1] = new Sprite[4];

            for (var index = 0; index < 4; index++)
            {
                sprites[1][index] = new Sprite(extra, sprites[0][index]);
            }

            sprites[2] = BuildFlippedSprites(ObjectHelper.UnknownObject);
            overlays   = new Sprite[2];

            var overlay = new BitmapBits(0x80, 1);

            overlay.DrawLine(LevelData.ColorWhite, 0x00, 0, 0x03, 0);
            overlay.DrawLine(LevelData.ColorWhite, 0x08, 0, 0x0B, 0);
            overlay.DrawLine(LevelData.ColorWhite, 0x10, 0, 0x13, 0);
            overlay.DrawLine(LevelData.ColorWhite, 0x18, 0, 0x67, 0);
            overlay.DrawLine(LevelData.ColorWhite, 0x6C, 0, 0x6F, 0);
            overlay.DrawLine(LevelData.ColorWhite, 0x74, 0, 0x77, 0);
            overlay.DrawLine(LevelData.ColorWhite, 0x7C, 0, 0x7F, 0);
            overlays[0] = new Sprite(overlay, -0x40, 0);

            overlay = new BitmapBits(1, 0x40);
            overlay.DrawLine(LevelData.ColorWhite, 0, 0x00, 0, 0x1F);
            overlay.DrawLine(LevelData.ColorWhite, 0, 0x24, 0, 0x27);
            overlay.DrawLine(LevelData.ColorWhite, 0, 0x2C, 0, 0x2F);
            overlay.DrawLine(LevelData.ColorWhite, 0, 0x34, 0, 0x37);
            overlay.DrawLine(LevelData.ColorWhite, 0, 0x3C, 0, 0x3F);
            overlays[1] = new Sprite(overlay);
        }
예제 #11
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));
        }
예제 #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
        protected void BuildSpritesProperties(string artfile, int artoffset,
                                              string mapfile, int startpal, bool priority, string name, string description, int slope)
        {
            var art = LevelData.ReadFile(artfile, CompressionType.Nemesis);

            if (artoffset != 0)
            {
                var indexer = new MultiFileIndexer <byte>();
                indexer.AddFile(new List <byte>(art), artoffset);
                art = indexer.ToArray();
            }

            sprite = ObjectHelper.MapASMToBmp(art, mapfile, 0, startpal);
            sprite.Offset(8, 8);

            properties    = new PropertySpec[2];
            subtypes      = new ReadOnlyCollection <byte>(new byte[0]);
            this.priority = priority;
            this.slope    = slope;

            properties[0] = new PropertySpec("Count", typeof(int), "Extended",
                                             "The number of bridge segments in the object.", null,
                                             (obj) => obj.SubType & 0x7F,
                                             (obj, value) =>
            {
                var c       = (int)value & 0x7E;
                obj.SubType = (byte)((obj.SubType & 0x80) | (c > 16 ? 16 : c < 8 ? 8 : c));
            });

            properties[1] = new PropertySpec(name ?? "Collapsing", typeof(bool), "Extended",
                                             description ?? "If set, 'Count' is the trigger ID that will collapse the object.", null,
                                             (obj) => (obj.SubType & 0x80) != 0,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0x7F) | ((bool)value ? 0x80 : 0)));
        }
예제 #14
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)));
        }
예제 #15
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)))
            };
        }
예제 #16
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)));
        }
예제 #17
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)));
        }
예제 #18
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)));
        }
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile("LevelArt", 0)), -32);
            BuildSpritesProperties(indexer.ToArray(),
                                   "../Levels/MGZ/Misc Object Data/Map - Smashing Pillar.asm");
        }
예제 #20
0
        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));
            });
        }
예제 #21
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

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

            BuildSpritesProperties(indexer.ToArray(), 0, 0);
        }
예제 #22
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

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

            BuildSprites(indexer.ToArray(),
                         "../Levels/MGZ/Misc Object Data/Map - Floating Platform.asm", 0x00);
        }
예제 #23
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)), -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);
            });
        }
예제 #24
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

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

            BuildSpritesSubtypes(
                new AnimatedStillSpriteData(2, art, 9, 2, true, 4, "Lava Surface"));
        }
예제 #25
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();

            BuildSpritesSubtypes(
                new StillSpriteData(art, 46, 2, true, 2, "Indoor Sloped Edge"));
        }
예제 #26
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

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

            BuildSprites(indexer.ToArray(),
                         "../Levels/HCZ/Misc Object Data/Map - Floating Platform.asm", 0x10);
        }
예제 #27
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

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

            BuildSpritesProperties(indexer.ToArray(),
                                   "../Levels/LRZ/Misc Object Data/Map - Button.asm", null, 1);
        }
예제 #28
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));
            });
        }
예제 #29
0
        public override void Init(ObjectData data)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile("LevelArt", 0)), -32);
            indexer.AddFile(new List <byte>(LevelData.ReadFile(
                                                "../Levels/MGZ/Nemesis Art/Misc Art 2.bin", CompressionType.Nemesis)), 32704);

            subtypes = new ReadOnlyCollection <byte>(new byte[0]);
            sprite   = BuildFlippedSprites(ObjectHelper.MapASMToBmp(indexer.ToArray(),
                                                                    "../Levels/MGZ/Misc Object Data/Map - Moving Spike Platform.asm", 0, 2));
        }
예제 #30
0
        protected void BuildSpritesProperties(string mapfile,
                                              bool priority, int artoffset, bool trigger, int framebits, Dictionary <string, int> frames)
        {
            var indexer = new MultiFileIndexer <byte>();

            indexer.AddFile(new List <byte>(LevelData.ReadFile("LevelArt", 0)), artoffset);

            var art           = indexer.ToArray();
            var map           = LevelData.ASMToBin(mapfile, LevelData.Game.MappingsVersion);
            var unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject);

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

            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 * 3, 2, priority));
            }

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

            var options = new Dictionary <string, int> {
                { "Normal", 0 }
            };
            Func <ObjectEntry, object>   getter = (obj) => 0;
            Action <ObjectEntry, object> setter = (obj, value) => {};

            if (trigger)
            {
                options.Add("Level trigger", 0x80);
                getter = (obj) => obj.SubType & 0x80;
                setter = (obj, value) => obj.SubType = (byte)((obj.SubType & 0x7F) | ((int)value & 0x80));
            }

            properties[1] = new PropertySpec("Behavior", typeof(int), "Extended",
                                             "The method through which the object can be destroyed.", null, options, getter, setter);

            properties[2] = new PropertySpec("Delay", typeof(int), "Extended",
                                             "If behavior is 'level trigger', this becomes the trigger ID.", null,
                                             (obj) => obj.SubType & 0x0F,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xF0) | ((int)value & 0x0F)));
        }
 public override void Init(ObjectData data)
 {
     if (data.Art != null)
     {
         MultiFileIndexer<byte> art = new MultiFileIndexer<byte>();
         foreach (FileInfo file in data.Art)
             art.AddFile(new List<byte>(ObjectHelper.OpenArtFile(file.Filename, data.ArtCompression)), file.Offset);
         byte[] artfile = art.ToArray();
         if (data.MapFile != null)
         {
             if (data.DPLCFile != null)
                 spr = ObjectHelper.MapDPLCToBmp(artfile, ObjectHelper.OpenArtFile(data.MapFile, data.MapCompression), data.MapVersion, ObjectHelper.OpenArtFile(data.DPLCFile, data.DPLCCompression), data.MapVersion, data.Frame, data.Palette);
             else
                 spr = ObjectHelper.MapToBmp(artfile, ObjectHelper.OpenArtFile(data.MapFile, data.MapCompression), data.Frame, data.Palette, data.MapVersion);
         }
         else if (data.MapFileAsm != null)
         {
             if (data.MapAsmLabel != null)
             {
                 if (data.DPLCFileAsm != null)
                     spr = ObjectHelper.MapASMDPLCToBmp(artfile, data.MapFileAsm, data.MapAsmLabel, data.MapVersion, data.DPLCFileAsm, data.DPLCAsmLabel, data.MapVersion, data.Palette);
                 else
                     spr = ObjectHelper.MapASMToBmp(artfile, data.MapFileAsm, data.MapAsmLabel, data.Palette, data.MapVersion);
             }
             else
             {
                 if (data.DPLCFileAsm != null)
                     spr = ObjectHelper.MapASMDPLCToBmp(artfile, data.MapFileAsm, data.MapVersion, data.DPLCFileAsm, data.MapVersion, data.Frame, data.Palette);
                 else
                     spr = ObjectHelper.MapASMToBmp(artfile, data.MapFileAsm, data.Frame, data.Palette, data.MapVersion);
             }
         }
         else
             spr = ObjectHelper.UnknownObject;
         if (data.Offset != Size.Empty)
             spr.Offset = spr.Offset + data.Offset;
     }
     else if (data.Image != null)
     {
         BitmapBits img = new BitmapBits(new Bitmap(data.Image));
         spr = new Sprite(img, new Point(data.Offset));
     }
     else if (data.Sprite > -1)
         spr = ObjectHelper.GetSprite(data.Sprite);
     else
         spr = ObjectHelper.UnknownObject;
     spacing = int.Parse(data.CustomProperties.GetValueOrDefault("spacing", "24"), System.Globalization.NumberStyles.Integer, System.Globalization.NumberFormatInfo.InvariantInfo);
 }