示例#1
0
        public MainWindow()
        {
            InitializeComponent();

            ViewModel          = new RandoSettings();
            DataContext        = ViewModel;
            RandomMM2.Settings = ViewModel;
        }
 private static void EncodeSeedTest()
 {
     for (int i = 0; i < 100; i++)
     {
         RandoSettings.Seed = RandoSettings.NewSeed();
         Console.WriteLine("Encoding Seed: " + RandoSettings.Seed);
         foreach (string sprite in MapChanger.SpriteSeed())
         {
             Console.WriteLine("--" + sprite);
         }
     }
 }
        public MainWindowViewModel()
        {
            RandoSettings      = new RandoSettings();
            RandomMM2.Settings = RandoSettings;

            // Try to load "MM2.nes" if one is in the local directory already to save time
            string tryLocalpath = Path.Combine(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                "MM2.nes");

            if (File.Exists(tryLocalpath))
            {
                RandoSettings.ValidateFile(tryLocalpath);
                IsShowingHint = false;
            }
        }
        internal static void DisableScreenFlashing(Patch p, RandoSettings settings)
        {
            p.Add(0x3412E, 0x1F, "Disable Stage Select Flashing");
            p.Add(0x3596D, 0x0F, "Wily Map Flash Color");
            if (!settings.FastText)
            {
                // This sequence is disabled by FastText, and the patch conflicts with it.
                p.Add(0x37C98, 0x0F, "Item Get Flash Color");
            }

            p.Add(0x2CA04, 0x0F, "Flash Man Fire Flash Color");
            p.Add(0x2CC7C, 0x0F, "Metal Man Periodic Flash Color");

            p.Add(0x37A1A, 0xEA, "NOP Ending Palette Flash");
            p.Add(0x377A5, 0x00, "Disable Ending Screen Flash");

            // Dragon
            p.Add(0x2D1B2, 0x63, "Dragon Hit Flash Palette Index");
            p.Add(0x2D187, 0x63, "Dragon Hit Restore Palette Index");
            if (!settings.IsColorsRandom)
            {
                p.Add(0x2D1B0, 0x37, "Dragon Hit Flash Color");
                p.Add(0x2D185, 0x27, "Dragon Hit Restore Color");
            }
            p.Add(0x2D3A0, 0x0F, "Dragon Defeat Flash Color");

            // Guts Tank
            p.Add(0x2D661, 0x5C, "Guts Tank Flash Palette Index");
            // p.Add(0x2D65F, 0x0F, "Guts Tank Flash Color");

            // Wily Machine
            p.Add(0x2DA96, 0x63, "Wily Machine Flash Palette Index");
            p.Add(0x2DA23, 0x63, "Wily Machine Restore Palette Index");
            if (!settings.IsColorsRandom)
            {
                p.Add(0x2DA94, 0x25, "Wily Machine Flash Color");
                p.Add(0x2DA21, 0x35, "Wily Machine Restore Color");
            }

            // Alien
            p.Add(0x2DC97, 0x0F, "Alien Hit Flash Color");
            p.Add(0x2DD6C, 0x0F, "Alien Defeat Flash Color");
            p.Add(0x2DF1B, 0x0F, "Alien Explision Flash Color");
        }
        //
        // Constructor
        //

        public MainWindowViewModel()
        {
            RandoSettings      = new RandoSettings();
            RandomMM2.Settings = RandoSettings;

            // Try to load "MM2.nes" if one is in the local directory already to save time
            String tryLocalpath = Path.Combine(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                "MM2.nes");

            if (File.Exists(tryLocalpath))
            {
                this.mRandoSettings.SourcePath = tryLocalpath;
                IsShowingHint = false;
            }

            this.OpenContainingFolderCommand = ReactiveCommand.Create(this.OpenContainngFolder, this.WhenAnyValue(x => x.CanOpenContainngFolder));
            this.CreateFromGivenSeedCommand  = ReactiveCommand.Create <Window>(this.CreateFromGivenSeed, this.WhenAnyValue(x => x.RandoSettings.IsSeedValid));
            this.CreateFromRandomSeedCommand = ReactiveCommand.Create <Window>(this.CreateFromRandomSeed, this.WhenAnyValue(x => x.RandoSettings.IsHashValid));
            this.OpenRomFileCommand          = ReactiveCommand.Create <Window>(this.OpenRomFile);
        }
示例#6
0
        public static void DrawTitleScreenChanges(Patch p, int seed, RandoSettings settings)
        {
            // Adjust cursor positions
            p.Add(0x0362D4, 0x90, "Title screen Cursor top position");    // default 0x98
            p.Add(0x0362D5, 0xA0, "Title screen Cursor bottom position"); // default 0xA8

            // Draw version number
            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly(typeof(RandomMM2));
            string version = assembly.GetName().Version.ToString();

            for (int i = 0; i < version.Length; i++)
            {
                byte value = RText.IntroCipher[version[i]];
                p.Add(0x037407 + i, value, "Title Screen Version Number");
            }

            // Draw seed
            string seedAlpha = SeedConvert.ConvertBase10To26(seed);

            for (int i = 0; i < seedAlpha.Length; i++)
            {
                byte value = RText.IntroCipher[seedAlpha[i]];
                p.Add(0x0373C7 + i, value, "Title Screen Seed");
            }

            // Draw flags
            string flags = settings.GetFlagsString();

            for (int i = 0; i < flags.Length; i++)
            {
                byte value = RText.IntroCipher[flags[i]];
                if (i < 14)
                {
                    p.Add(0x037387 + i, value, $"Title Screen Flags: {flags[i]}");
                }
                else
                {
                    p.Add(0x037367 + i - 14, value, $"Title Screen Flags: {flags[i]}");
                }
            }

            // Draw tournament mode/spoiler free information
            if (settings.IsSpoilerFree)
            {
                // 0x037367 = Start of row beneath "seed"
                string flagsAlpha = "TOURNAMENT";
                for (int i = 0; i < flagsAlpha.Length; i++)
                {
                    char ch        = flagsAlpha.ElementAt(i);
                    byte charIndex = (byte)(Convert.ToByte(ch) - Convert.ToByte('A'));

                    p.Add(0x037564 + i, (byte)(0xC1 + charIndex), "Title Screen Tournament Text");
                }

                string flags2Alpha = "MODE";
                for (int i = 0; i < flags2Alpha.Length; i++)
                {
                    char ch        = flags2Alpha.ElementAt(i);
                    byte charIndex = (byte)(Convert.ToByte(ch) - Convert.ToByte('A'));

                    p.Add(0x03756F + i, (byte)(0xC1 + charIndex), "Title Screen Tournament Text");
                }

                // Draw Hash symbols
                // Use $B8-$BF with custom gfx, previously unused tiles after converting from MM2U to RM2
                //p.Add(0x037367, (byte)(0xB0), "Title Screen Flags");
                //p.Add(0x037368, (byte)(0xB1), "Title Screen Flags");
                //p.Add(0x037369, (byte)(0xB2), "Title Screen Flags");
                //p.Add(0x03736A, (byte)(0xB3), "Title Screen Flags");
            }
        }