void Core_LoadValues(Pointer[] pointers) { SmallMap_PalettePointerBox.ValueChanged -= SmallMap_PalettePointerBox_ValueChanged; SmallMap_GraphicsPointerBox.ValueChanged -= SmallMap_GraphicsPointerBox_ValueChanged; LargeMap_PalettePointerBox.ValueChanged -= LargeMap_TL_PalettePointerBox_ValueChanged; LargeMap_TL_GraphicsPointerBox.ValueChanged -= LargeMap_TL_GraphicsPointerBox_ValueChanged; LargeMap_TR_GraphicsPointerBox.ValueChanged -= LargeMap_TR_GraphicsPointerBox_ValueChanged; LargeMap_BL_GraphicsPointerBox.ValueChanged -= LargeMap_BL_GraphicsPointerBox_ValueChanged; LargeMap_BR_GraphicsPointerBox.ValueChanged -= LargeMap_BR_GraphicsPointerBox_ValueChanged; SmallMap_PalettePointerBox.Value = Core.ReadPointer(pointers[SMALLMAP_PALETTE]); SmallMap_GraphicsPointerBox.Value = Core.ReadPointer(pointers[SMALLMAP_TILESET]); Pointer[] address = WorldMap_FE6_Large.GetPointerArray(pointers[LARGEMAP_PALETTE]); LargeMap_PalettePointerBox.Value = address[0]; address = WorldMap_FE6_Large.GetPointerArray(pointers[LARGEMAP_TILESET]); LargeMap_TL_GraphicsPointerBox.Value = address[0]; LargeMap_TR_GraphicsPointerBox.Value = address[1]; LargeMap_BL_GraphicsPointerBox.Value = address[2]; LargeMap_BR_GraphicsPointerBox.Value = address[3]; SmallMap_PalettePointerBox.ValueChanged += SmallMap_PalettePointerBox_ValueChanged; SmallMap_GraphicsPointerBox.ValueChanged += SmallMap_GraphicsPointerBox_ValueChanged; LargeMap_PalettePointerBox.ValueChanged += LargeMap_TL_PalettePointerBox_ValueChanged; LargeMap_TL_GraphicsPointerBox.ValueChanged += LargeMap_TL_GraphicsPointerBox_ValueChanged; LargeMap_TR_GraphicsPointerBox.ValueChanged += LargeMap_TR_GraphicsPointerBox_ValueChanged; LargeMap_BL_GraphicsPointerBox.ValueChanged += LargeMap_BL_GraphicsPointerBox_ValueChanged; LargeMap_BR_GraphicsPointerBox.ValueChanged += LargeMap_BR_GraphicsPointerBox_ValueChanged; }
override public void Core_Update() { Pointer[] pointers = new Pointer[4] { Core.GetPointer("Small World Map Tileset"), Core.GetPointer("Small World Map Palette"), Core.GetPointer("Large World Map Tileset"), Core.GetPointer("Large World Map Palette"), }; try { Core_LoadValues(pointers); } catch (Exception ex) { Program.ShowError("Could not properly load world map pointers.", ex); } try { CurrentSmallMap = new WorldMap_FE6_Small( pointers[SMALLMAP_PALETTE], pointers[SMALLMAP_TILESET]); SmallMap_ImageBox.Load(CurrentSmallMap); SmallMap_PaletteBox.Load(CurrentSmallMap.Colors); } catch (Exception ex) { Program.ShowError("Could not load the small World Map.", ex); SmallMap_ImageBox.Reset(); SmallMap_PaletteBox.Reset(); } try { CurrentLargeMap = new WorldMap_FE6_Large( pointers[LARGEMAP_PALETTE], pointers[LARGEMAP_TILESET]); LargeMap_ImageBox.Load(CurrentLargeMap); LargeMap_PaletteBox.Load(CurrentLargeMap.Graphics[0].Colors); } catch (Exception ex) { Program.ShowError("Could not load the large World Map.", ex); LargeMap_ImageBox.Reset(); LargeMap_PaletteBox.Reset(); } }
void Core_WriteLargeMap(string path) { try { CurrentLargeMap = new WorldMap_FE6_Large(new Bitmap(path)); } catch (Exception ex) { Program.ShowError("Could not insert the image.", ex); return; } Core.SuspendUpdate(); Core.WriteData(this, LargeMap_PalettePointerBox.Value, CurrentLargeMap.Graphics[0].Colors.ToBytes(true), CurrentEntry(true) + "Palette changed"); Core.WriteData(this, LargeMap_TL_GraphicsPointerBox.Value, LZ77.Compress(CurrentLargeMap.Graphics[0].ToBytes()), CurrentEntry(true) + "Graphics (TL) changed"); Core.WriteData(this, LargeMap_TR_GraphicsPointerBox.Value, LZ77.Compress(CurrentLargeMap.Graphics[1].ToBytes()), CurrentEntry(true) + "Graphics (TR) changed"); Core.WriteData(this, LargeMap_BL_GraphicsPointerBox.Value, LZ77.Compress(CurrentLargeMap.Graphics[2].ToBytes()), CurrentEntry(true) + "Graphics (BL) changed"); Core.WriteData(this, LargeMap_BR_GraphicsPointerBox.Value, LZ77.Compress(CurrentLargeMap.Graphics[3].ToBytes()), CurrentEntry(true) + "Graphics (BR) changed"); Core.ResumeUpdate(); Core.PerformUpdate(); }