Beispiel #1
0
        public void get_underworld_sprite_params_and_overlord()
        {
            var romData = Utilities.LoadRom("rando.sfc");

            RoomCollection rc = new RoomCollection(romData, new Random(), new SpriteGroupCollection(romData, new Random(), new SpriteRequirementCollection()), new SpriteRequirementCollection());

            rc.LoadRooms();

            // invert the masks
            byte byte0mask = (byte)~SpriteConstants.SpriteSubtypeByte0RemoveMask;
            byte byte1mask = (byte)~SpriteConstants.OverlordRemoveMask;


            foreach (var r in rc.Rooms)
            {
                var sprites = r.Sprites.Where(x => (x.byte0 & byte0mask) > 0 || (x.byte1 & byte1mask) > 0);
                if (sprites.Any())
                {
                    output.WriteLine($"room: {r.RoomId} ({r.RoomName})");
                    foreach (var s in sprites)
                    {
                        output.WriteLine($"addr: {s.Address.ToString("X8")} \tID: {((s.byte1 & byte1mask) == 0xE0 ? s.SpriteId + 0x100 : s.SpriteId).ToString("X2")} \tName: { SpriteConstants.GetSpriteName(((s.byte1 & byte1mask) == 0xE0 ? s.SpriteId + 0x100 : s.SpriteId)) } \tBits: {Convert.ToString((((s.byte0 & byte0mask) >> 2) | ((s.byte1 & byte1mask) >> 5)), 2).PadLeft(5, '0')} \tHM P: {(((s.byte0 & byte0mask) >> 2) | ((s.byte1 & byte1mask) >> 5)).ToString("X2")}");
                    }
                    output.WriteLine("");
                }
            }
        }
Beispiel #2
0
        public void get_list_of_goodies()
        {
            var romData            = Utilities.LoadRom("rando.sfc");
            var spriteRequirements = new SpriteRequirementCollection();

            SpriteGroupCollection sgc = new SpriteGroupCollection(romData, new Random(), spriteRequirements);

            sgc.LoadSpriteGroups();

            RoomCollection rc = new RoomCollection(romData, new Random(), sgc, spriteRequirements);

            rc.LoadRooms();

            OverworldAreaCollection areas = new OverworldAreaCollection(romData, new Random(), new SpriteGroupCollection(romData, new Random(), new SpriteRequirementCollection()), new SpriteRequirementCollection());


            var spriteGroupsJson = JsonConvert.SerializeObject(sgc.SpriteGroups.Select(x => new { x.GroupId, x.DungeonGroupId, x.SubGroup0, x.SubGroup1, x.SubGroup2, x.SubGroup3 }), Formatting.Indented);
            var roomJson         = JsonConvert.SerializeObject(rc.Rooms.Select(x => new { x.RoomId, x.RoomName, x.GraphicsBlockId }), Formatting.Indented);
            var roomSpritesJson  = JsonConvert.SerializeObject(rc.Rooms.Select(x => new { x.RoomId, Sprites = new { Sprites = x.Sprites.Select(y => new { y.SpriteId, y.SpriteName, y.Address, y.HasAKey, y.IsOverlord }) } }), Formatting.Indented);

            var areaJson        = JsonConvert.SerializeObject(areas.OverworldAreas.Select(x => new { x.AreaId, x.AreaName, x.GraphicsBlockId }), Formatting.Indented);
            var areaSpritesJson = JsonConvert.SerializeObject(areas.OverworldAreas.Select(x => new { x.AreaId, Sprites = new { Sprites = x.Sprites.Select(y => new { y.SpriteId, y.SpriteName }) } }), Formatting.Indented);

            output.WriteLine(spriteGroupsJson);
            output.WriteLine(roomJson);
            output.WriteLine(roomSpritesJson);
            output.WriteLine(areaJson);
            output.WriteLine(areaSpritesJson);
        }
Beispiel #3
0
        public void should_load_all_sprites_for_dungeon_rooms()
        {
            //RomData romData = Utilities.LoadRom("rando.sfc");
            RomData romData = Utilities.LoadRom("..\\..\\..\\20170104 Testing\\Enemizer 6.0 - ER_er-no-glitches-0.4.7_normal-open-ganon_297664836.sfc");
            Random  rand    = new Random(0);

            RoomCollection rc = new RoomCollection(romData, rand, new SpriteGroupCollection(romData, rand, new SpriteRequirementCollection()), new SpriteRequirementCollection());

            rc.LoadRooms();
            foreach (var r in rc.Rooms)
            {
                output.WriteLine($"RoomId: {r.RoomId}, RoomName: {r.RoomName}, RoomGfx: {r.GraphicsBlockId}, sprite count: {r.Sprites.Count}, sprites: {String.Join(",", r.Sprites.Select(x => (x.IsOverlord ? "1" : "") + x.SpriteId.ToString("X2") + (x.HasAKey ? "(HasKey)" : "") ))}");
            }
        }
Beispiel #4
0
        private void loadRomButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == true)
            {
                RomData romData            = LoadRom(ofd.FileName);
                var     spriteRequirements = new SpriteRequirementCollection();

                SpriteGroupCollection sgc = new SpriteGroupCollection(romData, new Random(), spriteRequirements);
                sgc.LoadSpriteGroups();

                RoomCollection rc = new RoomCollection(romData, new Random(), spriteRequirements);
                rc.LoadRooms();

                var vm = new VM();
                vm.spriteGroupCollection = sgc;
                vm.roomCollection        = rc;

                this.DataContext = vm;
            }
        }