Esempio n. 1
0
        override public void Core_Update()
        {
            Pointer[] pointers = new Pointer[6]
            {
                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
            {
                CurrentSmallMap = new WorldMap_FE7_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_FE7_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();
            }
        }
Esempio n. 2
0
        void Core_InsertSmallMap(string filepath)
        {
            try
            {
                Palette palette = Core.FindPaletteFile(filepath);

                CurrentSmallMap = new WorldMap_FE7_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(false, 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(true), 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(true) + "Palette changed");

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

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

            Core.ResumeUpdate();
            Core.PerformUpdate();
        }