コード例 #1
0
ファイル: DebugMode.cs プロジェクト: tcprescott/Enimizer
        void RemoveKillRooms(RoomCollection rc)
        {
            if (optionFlags.DebugOpenShutterDoors)
            {
                var doc = new DungeonObjectDataPointerCollection(romData);
                foreach (var r in doc.RoomDungeonObjectDataPointers.Values.Where(x => shutterDoorRooms.Contains(x.RoomId)).ToList())
                {
                    r.MakeShutterDoorsNormal();
                }
                doc.WriteChangesToRom(AddressConstants.movedRoomObjectBaseAddress);

                var killTags = RoomTags.Tags.Where(x => x.Value.ToLower().Contains("kill")).Select(x => x.Key).ToList();

                foreach (var r in rc.Rooms.Where(x => shutterDoorRooms.Contains(x.RoomId)).ToList())
                {
                    if (killTags.Any(x => x == r.Tag1))
                    {
                        r.Tag1 = 0;
                    }
                    if (killTags.Any(x => x == r.Tag2))
                    {
                        r.Tag2 = 0;
                    }
                }
            }
        }
コード例 #2
0
ファイル: BossRandomizer.cs プロジェクト: CaitSith2/Enemizer
        private void WriteRom(RomData romData)
        {
            //DungeonShells shells = new DungeonShells();
            //shells.FillShells();

            if (optionFlags.GenerateSpoilers && spoilerFile != null)
            {
                spoilerFile.AppendLine("Bosses:");
            }

            DungeonObjectDataPointerCollection roomObjects = new DungeonObjectDataPointerCollection(romData);

            foreach (var dungeon in DungeonPool)
            {
                // spoilers
                if (optionFlags.GenerateSpoilers && spoilerFile != null)
                {
                    spoilerFile.AppendLine($"{dungeon.Name} : {dungeon.SelectedBoss.BossType}");
                    //spoilerfile.WriteLine(d.name + " : " + BossConstants.BossNames[d.boss].ToString() + "  Drop : " + ROM_DATA[BossConstants.BossDropItemAddresses[did]]);
                }

                // update boss pointer
                romData[dungeon.DungeonRoomSpritePointerAddress]     = dungeon.SelectedBoss.BossPointer[0];
                romData[dungeon.DungeonRoomSpritePointerAddress + 1] = dungeon.SelectedBoss.BossPointer[1];

                // update boss graphics
                romData[AddressConstants.dungeonHeaderBaseAddress + ((dungeon.BossRoomId * 14) + 3)] = dungeon.SelectedBoss.BossGraphics;

                // update trinexx shell
                if (dungeon.SelectedBoss.BossType == BossType.Trinexx && dungeon.BossRoomId != RoomIdConstants.R164_TurtleRock_Trinexx)
                {
                    // TODO: figure out the X/Y coord
                    roomObjects.AddShellAndMoveObjectData(dungeon.BossRoomId, dungeon.ShellX, dungeon.ShellY - 2, dungeon.ClearLayer2, 0xFF2);

                    // see "Header contents:" section of rom log
                    romData[AddressConstants.dungeonHeaderBaseAddress + ((dungeon.BossRoomId * 14) + 0)] = 0x60; // BG2 (upper 3 bits are "BG2")
                    //romData[AddressConstants.dungeonHeaderBaseAddress + ((dungeon.BossRoomId * 14) + 2)] = 13; // byte 2: gets stored to $0AA2 (blockset (tileset) in Hyrule Magic)
                    romData[AddressConstants.dungeonHeaderBaseAddress + ((dungeon.BossRoomId * 14) + 4)] = 04;   // byte 4: gets stored to $00AD ("Effect" in Hyrule Magic)
                }

                // update kholdstare shell
                if (dungeon.SelectedBoss.BossType == BossType.Kholdstare && dungeon.BossRoomId != RoomIdConstants.R222_IcePalace_Kholdstare)
                {
                    roomObjects.AddShellAndMoveObjectData(dungeon.BossRoomId, dungeon.ShellX, dungeon.ShellY, dungeon.ClearLayer2, 0xF95);

                    // TODO: fix this. "debug" flag is set on one of these bytes
                    romData[AddressConstants.dungeonHeaderBaseAddress + ((dungeon.BossRoomId * 14) + 0)] = 0xE0; // BG2
                    //romData[AddressConstants.dungeonHeaderBaseAddress + ((dungeon.BossRoomId * 14) + 2)] = 11; // I suspect this
                    romData[AddressConstants.dungeonHeaderBaseAddress + ((dungeon.BossRoomId * 14) + 4)] = 01;
                }

                // remove trinexx shell
                if (dungeon.SelectedBoss.BossType != BossType.Trinexx && dungeon.BossRoomId == RoomIdConstants.R164_TurtleRock_Trinexx)
                {
                    // TODO: figure out the X/Y coord
                    roomObjects.RemoveShellAndMoveObjectData(dungeon.BossRoomId, 0xFF2);
                }

                // remove kholdstare shell
                if (dungeon.SelectedBoss.BossType != BossType.Kholdstare && dungeon.BossRoomId == RoomIdConstants.R222_IcePalace_Kholdstare)
                {
                    // TODO: figure out the X/Y coord
                    roomObjects.RemoveShellAndMoveObjectData(dungeon.BossRoomId, 0xF95);
                }

                if (dungeon.DungeonType == DungeonType.GanonsTower1 || dungeon.DungeonType == DungeonType.GanonsTower2)
                {
                    // TODO: clean this up and move it
                    // override the sprites pointer and make some new ones in an "unused" spot in rom
                    // (in the room sprite pointer table, it has way more room than is used)
                    int startingAddress = 0x0;
                    if (dungeon.DungeonType == DungeonType.GanonsTower1)
                    {
                        startingAddress = 0x4D87E;
                    }
                    else
                    {
                        startingAddress = 0x4D8B6;
                    }

                    romData[dungeon.DungeonRoomSpritePointerAddress]     = (byte)(startingAddress & 0xFF);
                    romData[dungeon.DungeonRoomSpritePointerAddress + 1] = (byte)((startingAddress >> 8) & 0xFF);

                    romData[startingAddress++] = 0x00;
                    romData.WriteDataChunk(startingAddress, dungeon.SelectedBoss.BossSpriteArray);
                    startingAddress += dungeon.SelectedBoss.BossSpriteArray.Length;
                    // hack for arrghus
                    if (dungeon.DungeonType == DungeonType.GanonsTower1 && dungeon.SelectedBoss.BossType == BossType.Arrghus)
                    {
                        // only write 2 sprites (should be 2x fairy)
                        romData.WriteDataChunk(startingAddress, dungeon.ExtraSprites, 6);
                        startingAddress += 6;
                    }
                    else
                    {
                        romData.WriteDataChunk(startingAddress, dungeon.ExtraSprites);
                        startingAddress += dungeon.ExtraSprites.Length;
                    }
                    romData[startingAddress] = 0xFF;
                }
            }

            roomObjects.WriteChangesToRom(AddressConstants.movedRoomObjectBaseAddress);
            //shells.WriteShellsToRom(romData);
            RemoveBlindSpawnCode(romData);
            RemoveMaidenFromThievesTown(romData);
        }