Beispiel #1
0
        public ExtraPalettes()
        {
            // TODO: Ice golems
            LightWorldSprites = ReadOnlyIndexCollectionPerRow(0xDD218, 4, 15);
            DarkWorldSprites  = ReadOnlyIndexCollectionPerRow(0xDD290, 4, 15);
            Clothes           = ReadOnlyIndexCollectionPerRow(0xDD308, 5, 15);
            Enemies2          = ReadOnlyIndexCollectionPerRow(0xDD39E, 12, 7);
            OtherSprites      = ReadOnlyIndexCollectionPerRow(0xDD446, 11, 7);
            var enemies1 = new List <IndexCollection>(
                IndexCollectionPerRow(0xDD4E0, 24, 7));

            Sword           = ReadOnlyIndexCollectionPerRow(0xDD630, 4, 3);
            Shield          = ReadOnlyIndexCollectionPerRow(0xDD648, 3, 4);
            HUD             = ReadOnlyIndexCollectionPerRow(0xDD660, 2 * 8, 4);
            PalaceMapSprite = ReadOnlyIndexCollectionPerRow(0xDD70A, 3, 7);

            // Mix Ice Golems with Ice Palace
            var dungeons  = IndexCollectionPerRow(0xDD734, 20, 6 * 15);
            var icePalace = new List <int>(dungeons[4]);

            icePalace.AddRange(enemies1[12]);
            dungeons[4]   = new ListIndexCollection(icePalace);
            enemies1[12]  = IndexCollection.Empty;
            DungeonMainBG = new ReadOnlyCollection <IndexCollection>(dungeons);
            Enemies1      = new ReadOnlyCollection <IndexCollection>(enemies1);

            var builder = new PaletteIndexCollectionBuilder(0xDE544, 16);

            builder.AddFullRows(0, 6);
            DungeonMap = builder.Flush();

            OverworldAuxiliary3 = ReadOnlyIndexCollectionPerRow(0xDE604, 14, 7);
            MainOverworldArea   = ReadOnlyIndexCollectionPerRow(0xDE6C8, 6 * 5, 7);
            OverworldAuxiliary  = ReadOnlyIndexCollectionPerRow(0xDE86C, 20 * 3, 7);
        }
Beispiel #2
0
        ReadOnlyIndexCollectionPerRow(int startOffset, int rows, int rowSize)
        {
            var result = new ListIndexCollection[rows];

            for (var i = 0; i < rows; i++)
            {
                var baseSelection = new IndexRangeCollection(
                    rowSize * i,
                    rowSize);

                var en = PaletteConverter.GetStartOffsetAtEachIndex(
                    startOffset,
                    baseSelection);
                result[i] = new ListIndexCollection(en);
            }

            return(new ReadOnlyCollection <IndexCollection>(result));
        }
        public LightWorld(
            PaletteIndexCollectionBuilder objectBuilder,
            PaletteIndexCollectionBuilder spriteBuilder,
            PaletteIndexCollectionBuilder lightWorldSprites)
        {
            if (objectBuilder is null)
            {
                throw new ArgumentNullException(nameof(objectBuilder));
            }

            if (spriteBuilder is null)
            {
                throw new ArgumentNullException(nameof(spriteBuilder));
            }

            if (lightWorldSprites is null)
            {
                throw new ArgumentNullException(nameof(lightWorldSprites));
            }

            objectBuilder.AddRow(-7, 0, 1);
            objectBuilder.AddRow(-7, 4, 1);
            objectBuilder.AddRow(-7, 6, 1);
            objectBuilder.AddBox(0, 0, 4, 3);
            objectBuilder.AddColumn(0, 6, 2);
            objectBuilder.AddRow(2, 4, 3);
            objectBuilder.AddRow(30, 0, 1);
            objectBuilder.AddColumn(33, 0, 5);
            objectBuilder.AddRow(42, 0, 2);
            objectBuilder.AddRow(42, 6, 1);
            objectBuilder.AddRow(43, 0, 1);
            objectBuilder.AddRow(44, 0, 4);
            objectBuilder.AddRow(44, 6, 1);
            objectBuilder.AddRow(53, 3, 1);
            objectBuilder.AddColumn(55, 0, 5);
            objectBuilder.AddRow(57, 5, 2);
            HillsAndDirt = objectBuilder.Flush();

            objectBuilder.AddRow(0, 4, 2);
            objectBuilder.AddBox(3, 4, 3, 2);
            objectBuilder.AddBox(25, 0, 7, 5);
            objectBuilder.AddRow(31, 5, 2);
            objectBuilder.AddRow(32, 0, 1);
            objectBuilder.AddRow(32, 4, 3);
            objectBuilder.AddRow(34, 3, 1);
            objectBuilder.AddRow(34, 5, 1);
            objectBuilder.AddRow(35, 4, 3);
            objectBuilder.AddRow(38, 4, 2);
            objectBuilder.AddBox(42, 4, 2, 3);
            objectBuilder.AddRow(53, 0, 3);
            objectBuilder.AddRow(53, 5, 1);
            objectBuilder.AddRow(54, 0, 1);
            objectBuilder.AddColumn(54, 4, 2);
            objectBuilder.AddRow(60, 6, 1);
            objectBuilder.AddRow(62, 0, 1);
            objectBuilder.AddRow(62, 2, 5);
            objectBuilder.AddRow(61, 0, 7);
            var list = new List <int>(objectBuilder.Flush())
            {
                -0x1199C,
                -0x17F7E,
                -0x5FEE7,
                0x5FEA9,
                0x67FC6,
                0x67FE1,
                0x67FE6,
            };

            spriteBuilder.AddRow(6, 2, 2);
            spriteBuilder.AddRow(-11, 1, 1);
            spriteBuilder.AddRow(-11, 4, 3);
            list.AddRange(spriteBuilder.Flush());
            lightWorldSprites.AddRow(0, 2, 3);
            list.AddRange(lightWorldSprites.Flush());
            GrassShrubsAndTrees = new ListIndexCollection(list);
            list.Clear();

            objectBuilder.AddRow(1, 4, 2);
            objectBuilder.AddRow(32, 1, 3);
            objectBuilder.AddRow(34, 1, 2);
            objectBuilder.AddRow(55, 1, 2);
            objectBuilder.AddRow(58, 1, 6);
            objectBuilder.AddRow(59, 5, 2);
            objectBuilder.AddRow(62, 1, 1);
            list.AddRange(objectBuilder.Flush());
            spriteBuilder.AddRow(7, 2, 2);
            list.AddRange(spriteBuilder.Flush());
            DryGrassAndSand = new ListIndexCollection(list);
            list.Clear();

            objectBuilder.AddRow(-7, 1, 3);
            objectBuilder.AddRow(-7, 5, 1);
            objectBuilder.AddRow(42, 2, 2);
            objectBuilder.AddRow(43, 1, 1);
            objectBuilder.AddRow(43, 6, 1);
            objectBuilder.AddRow(60, 0, 6);
            list.AddRange(objectBuilder.Flush());
            lightWorldSprites.AddRow(1, 0, 4);
            lightWorldSprites.AddRow(1, 5, 2);
            lightWorldSprites.AddColumn(8, 14, 4);
            list.AddRange(lightWorldSprites.Flush());
            Water = new ListIndexCollection(list);
            list.Clear();

            objectBuilder.AddRow(3, 0, 4);
            objectBuilder.AddRow(31, 0, 5);
            list.AddRange(objectBuilder.Flush());
            spriteBuilder.AddBox(6, 0, 2, 2);
            spriteBuilder.AddBox(6, 5, 2, 2);
            list.AddRange(spriteBuilder.Flush());
            FlowersAndRocks = new ListIndexCollection(list);
            list.Clear();

            objectBuilder.AddRow(4, 0, 4);
            list.AddRange(objectBuilder.Flush());
            spriteBuilder.AddColumn(6, 4, 2);
            list.AddRange(spriteBuilder.Flush());
            SignsAndPosts = new ListIndexCollection(list);
            list.Clear();

            objectBuilder.AddRow(43, 2, 2);
            CaveCrest = objectBuilder.Flush();

            objectBuilder.AddRow(30, 1, 6);
            objectBuilder.AddRow(56, 1, 3);
            objectBuilder.AddRow(56, 6, 1);
            Houses = objectBuilder.Flush();

            objectBuilder.AddRow(34, 4, 1);
            objectBuilder.AddRow(34, 6, 1);
            RedTree = objectBuilder.Flush();

            objectBuilder.AddRow(35, 1, 3);
            Tombstone = objectBuilder.Flush();

            objectBuilder.AddRow(57, 1, 3);
            objectBuilder.AddRow(59, 1, 4);
            Palace = objectBuilder.Flush();

            objectBuilder.AddRow(57, 4, 1);
            DesertPrayerFloor = objectBuilder.Flush();

            objectBuilder.AddRow(-9, 1, 3);
            WarpTile = objectBuilder.Flush();

            HyruleCastle  = new HyruleCastle(objectBuilder);
            Sanctuary     = new Sanctuary(objectBuilder);
            Kakariko      = new Kakariko(objectBuilder);
            DeathMountain = new DeathMountain(objectBuilder);

            AllIndexCollections = new ReadOnlyCollection <IndexCollection>(
                new IndexCollection[]
            {
                GrassShrubsAndTrees,
                HillsAndDirt,
                Water,
                RedTree,
                Houses,
                Tombstone,
                CaveCrest,
                DryGrassAndSand,
                FlowersAndRocks,
                SignsAndPosts,
                Palace,
                DesertPrayerFloor,
                WarpTile,
            });

            MiscIndexCollections = new ReadOnlyCollection <IndexCollection>(
                new IndexCollection[]
            {
                RedTree,
                Tombstone,
                CaveCrest,
                DryGrassAndSand,
                SignsAndPosts,
                Palace,
                DesertPrayerFloor,
                WarpTile,
            });
        }
Beispiel #4
0
        public DarkWorld(
            PaletteIndexCollectionBuilder objectBuilder,
            PaletteIndexCollectionBuilder spriteBuilder,
            PaletteIndexCollectionBuilder darkWorldSprites)
        {
            if (objectBuilder is null)
            {
                throw new ArgumentNullException(nameof(objectBuilder));
            }

            if (spriteBuilder is null)
            {
                throw new ArgumentNullException(nameof(spriteBuilder));
            }

            if (darkWorldSprites is null)
            {
                throw new ArgumentNullException(nameof(darkWorldSprites));
            }

            objectBuilder.AddRow(-8, 4, 1);
            objectBuilder.AddBox(5, 0, 4, 3);
            objectBuilder.AddColumn(5, 6, 2);
            objectBuilder.AddRow(7, 4, 3);
            objectBuilder.AddRow(65, 0, 1);
            objectBuilder.AddColumn(70, 0, 6);
            objectBuilder.AddRow(72, 1, 1);
            objectBuilder.AddRow(72, 6, 1);
            objectBuilder.AddRow(74, 1, 3);
            objectBuilder.AddRow(74, 6, 1);
            objectBuilder.AddColumn(77, 0, 2);
            objectBuilder.AddColumn(82, 0, 1);
            HillsAndDirt = objectBuilder.Flush();

            objectBuilder.AddRow(5, 4, 2);
            objectBuilder.AddBox(8, 4, 3, 2);
            objectBuilder.AddRow(9, 0, 1);
            objectBuilder.AddRow(9, 3, 1);
            objectBuilder.AddBox(72, 4, 2, 3);
            objectBuilder.AddRow(79, 5, 2);
            var list = new List <int>(objectBuilder.Flush())
            {
                0x5FEB3
            };

            spriteBuilder.AddRow(8, 2, 2);
            list.AddRange(spriteBuilder.Flush());
            darkWorldSprites.AddRow(0, 2, 3);
            list.AddRange(darkWorldSprites.Flush());
            GrassShrubsAndTrees = new ListIndexCollection(list);
            list.Clear();

            objectBuilder.AddRow(6, 4, 2);
            objectBuilder.AddRow(65, 5, 2);
            objectBuilder.AddRow(71, 3, 3);
            list.AddRange(objectBuilder.Flush());
            spriteBuilder.AddRow(9, 2, 2);
            list.AddRange(spriteBuilder.Flush());
            DryGrassAndSand = new ListIndexCollection(list);
            list.Clear();

            objectBuilder.AddRow(-8, 0, 4);
            objectBuilder.AddRow(-8, 5, 1);
            objectBuilder.AddRow(69, 5, 1);
            objectBuilder.AddRow(70, 1, 1);
            objectBuilder.AddRow(71, 1, 2);
            objectBuilder.AddRow(71, 6, 1);
            objectBuilder.AddRow(72, 2, 2);
            objectBuilder.AddRow(73, 1, 1);
            objectBuilder.AddRow(73, 6, 1);
            list.AddRange(objectBuilder.Flush());
            darkWorldSprites.AddRow(1, 0, 4);
            darkWorldSprites.AddRow(1, 5, 2);
            list.AddRange(darkWorldSprites.Flush());
            Water = new ListIndexCollection(list);
            list.Clear();

            objectBuilder.AddRow(8, 0, 4);
            objectBuilder.AddRow(79, 0, 5);
            list.AddRange(objectBuilder.Flush());
            spriteBuilder.AddBox(8, 0, 2, 2);
            spriteBuilder.AddBox(8, 5, 2, 2);
            list.AddRange(spriteBuilder.Flush());
            FlowersAndRocks = new ListIndexCollection(list);
            list.Clear();

            objectBuilder.AddRow(9, 1, 2);
            list.AddRange(objectBuilder.Flush());
            spriteBuilder.AddRow(8, 4, 1);
            list.AddRange(spriteBuilder.Flush());
            SignsPostsAndBushes = new ListIndexCollection(list);
            list.Clear();

            objectBuilder.AddRow(81, 0, 7);
            PyramidBG = objectBuilder.Flush();

            objectBuilder.AddRow(83, 0, 7);
            Pyramid = objectBuilder.Flush();

            objectBuilder.AddRow(69, 0, 5);
            objectBuilder.AddRow(69, 6, 1);
            IcePalaceEntrance = objectBuilder.Flush();

            objectBuilder.AddRow(78, 1, 3);
            HouseStructure = objectBuilder.Flush();

            objectBuilder.AddRow(78, 4, 3);
            Houses = objectBuilder.Flush();

            objectBuilder.AddRow(64, 0, 4);
            objectBuilder.AddRow(76, 0, 4);
            objectBuilder.AddRow(80, 0, 4);
            list.AddRange(objectBuilder.Flush());
            spriteBuilder.AddRow(-9, 1, 1);
            spriteBuilder.AddRow(-9, 4, 3);
            list.AddRange(spriteBuilder.Flush());
            TreeWood = new ListIndexCollection(list);
            list.Clear();

            objectBuilder.AddRow(80, 4, 3);
            Trees = objectBuilder.Flush();

            objectBuilder.AddRow(64, 4, 3);
            YellowTrees = objectBuilder.Flush();

            objectBuilder.AddRow(76, 4, 3);
            PinkTrees = objectBuilder.Flush();

            objectBuilder.AddRow(82, 4, 3);
            PurpleTrees = objectBuilder.Flush();

            PalaceOfDarkness = new PalaceOfDarkness(objectBuilder);
            SkullWoods       = new SkullWoods(objectBuilder);
            ThievesTown      = new ThievesTown(objectBuilder);
            Swamp            = new Swamp(objectBuilder);
            DarkMountain     = new DarkMountain(
                objectBuilder,
                new PaletteIndexCollectionBuilder(0x3F97B, 7));

            AllIndexCollections = new ReadOnlyCollection <IndexCollection>(
                new IndexCollection[]
            {
                YellowTrees,
                SignsPostsAndBushes,
                FlowersAndRocks,
                DryGrassAndSand,
                HillsAndDirt,
                GrassShrubsAndTrees,
                TreeWood,
                IcePalaceEntrance,
                Water,
                PurpleTrees,
                Pyramid,
                PyramidBG,
                PinkTrees,
                HouseStructure,
                Houses,
                Trees,
            });

            MiscIndexCollections = new ReadOnlyCollection <IndexCollection>(
                new IndexCollection[]
            {
                YellowTrees,
                SignsPostsAndBushes,
                DryGrassAndSand,
                PurpleTrees,
                PyramidBG,
                PinkTrees,
                HouseStructure,
                Trees,
            });
        }