Пример #1
0
        void Core_InsertSmallMap(string filepath)
        {
            try
            {
                Palette palette = Core.FindPaletteFile(filepath);

                CurrentSmallMap = new WorldMap_FE8_Small(filepath, palette);
            }
            catch (Exception ex)
            {
                Program.ShowError("Could not insert the small world map image.", ex); return;
            }

            byte[] data_palette = Palette.Merge(CurrentSmallMap.Palettes).ToBytes(false);
            byte[] data_tileset = CurrentSmallMap.Graphics.ToBytes(true);
            byte[] data_tsa     = CurrentSmallMap.Tiling.ToBytes(true, true);

            Core.SuspendUpdate();

            bool cancel = Prompt.ShowRepointDialog(this, "Repoint Small World Map",
                                                   "The different parts of this image may need to be repointed upon insertion.",
                                                   CurrentEntry("Small"), new Tuple <string, Pointer, int>[] {
                Tuple.Create("Palette", Core.GetPointer("Small World Map Palette"), data_palette.Length),
                Tuple.Create("Tileset", Core.GetPointer("Small World Map Tileset"), data_tileset.Length),
                Tuple.Create("TSA", Core.GetPointer("Small World Map TSA"), data_tsa.Length)
            });

            if (cancel)
            {
                return;
            }

            Core.WriteData(this,
                           Core.GetPointer("Small World Map Palette"),
                           data_palette,
                           CurrentEntry("Small") + "Palette changed");

            Core.WriteData(this,
                           Core.GetPointer("Small World Map Tileset"),
                           data_tileset,
                           CurrentEntry("Small") + "Graphics changed");

            Core.WriteData(this,
                           Core.GetPointer("Small World Map TSA"),
                           data_tsa,
                           CurrentEntry("Small") + "TSA changed");

            Core.ResumeUpdate();
            Core.PerformUpdate();
        }
Пример #2
0
        override public void Core_Update()
        {
            Pointer[] pointers = new Pointer[8]
            {
                Core.GetPointer("Mini World Map Tileset"),
                Core.GetPointer("Mini World Map Palette"),
                Core.GetPointer("Small World Map Tileset"),
                Core.GetPointer("Small World Map Palette"),
                Core.GetPointer("Small World Map TSA"),
                Core.GetPointer("Large World Map Tileset"),
                Core.GetPointer("Large World Map Palette"),
                Core.GetPointer("Large World Map TSA"),
            };

            try
            {
                Core_LoadValues(pointers);
            }
            catch (Exception ex)
            {
                Program.ShowError("Could not properly load world map pointers.", ex);
            }

            try
            {
                CurrentMiniMap = new WorldMap_FE8_Mini(
                    pointers[MINI_MAP_PALETTE],
                    (Core.CurrentROM.Version == GameVersion.EUR) ?
                    Core.ReadPointer(pointers[MINI_MAP_TILESET] + (int)Mini_Map_NumberBox.Value * 4) :
                    pointers[MINI_MAP_TILESET]);
                Mini_Map_ImageBox.Load(CurrentMiniMap);
                Mini_Map_PaletteBox.Load(CurrentMiniMap.Colors);
            }
            catch (Exception ex)
            {
                Program.ShowError("Could not load the mini World Map.", ex);
                Mini_Map_ImageBox.Reset();
                Mini_Map_PaletteBox.Reset();
            }

            try
            {
                CurrentSmallMap = new WorldMap_FE8_Small(
                    pointers[SMALLMAP_PALETTE],
                    pointers[SMALLMAP_TILESET],
                    pointers[SMALLMAP_TSA]);
                SmallMap_ImageBox.Load(CurrentSmallMap);
                SmallMap_PaletteBox.Load(Palette.Merge(CurrentSmallMap.Palettes));
            }
            catch (Exception ex)
            {
                Program.ShowError("Could not load the small World Map.", ex);
                SmallMap_ImageBox.Reset();
                SmallMap_PaletteBox.Reset();
            }

            try
            {
                CurrentLargeMap = new WorldMap_FE8_Large(
                    pointers[LARGEMAP_PALETTE],
                    pointers[LARGEMAP_TILESET],
                    pointers[LARGEMAP_TSA]);
                LargeMap_ImageBox.Load(CurrentLargeMap);
                LargeMap_PaletteBox.Load(Palette.Merge(CurrentLargeMap.Palettes));
            }
            catch (Exception ex)
            {
                Program.ShowError("Could not load the large World Map.", ex);
                LargeMap_ImageBox.Reset();
                LargeMap_PaletteBox.Reset();
            }
        }