private void cboMap_SelectedIndexChanged(object sender, EventArgs e) { if (loading) { return; } int index = cboMap.SelectedIndex; // Arrangement arrEditor.Clear(); int[] gfxEntry = GfxTownMaps.GetEntry(index * 3); var palette = GfxTownMaps.GetPalette((index * 3) + 1); var arr = GfxTownMaps.GetArr((index * 3) + 2); byte[] tileset = new byte[0x8000]; Array.Copy(M3Rom.Rom, gfxEntry[0], tileset, 0, gfxEntry[1]); arrEditor.SetTileset(tileset, 0, -1, gfxEntry[1] >> 5); arrEditor.SetArrangement(arr, 64, 64); arrEditor.SetPalette(palette); arrEditor.RenderArr(); arrEditor.RenderTileset(); arrEditor.CurrentTile = 0; arrEditor.RefreshArr(); }
private void btnApply_Click(object sender, EventArgs e) { int index = cboMap.SelectedIndex; // Arrangement GfxTownMaps.SetArr((index * 3) + 2, arrEditor.GetArrangement()); // Graphics byte[] tileset = arrEditor.GetTileset(); int[] gfxEntry = GfxTownMaps.GetEntry(index * 3); Array.Copy(tileset, 0, M3Rom.Rom, gfxEntry[0], gfxEntry[1]); // Palette int[] palEntry = GfxTownMaps.GetEntry((index * 3) + 1); var palette = arrEditor.GetPalette(); M3Rom.Rom.WritePal(palEntry[0], palette); M3Rom.IsModified = true; int currentpal = arrEditor.CurrentPalette; int currenttile = arrEditor.CurrentTile; int primarycol = arrEditor.PrimaryColorIndex; int secondarycol = arrEditor.SecondaryColorIndex; cboMap_SelectedIndexChanged(null, null); arrEditor.CurrentPalette = currentpal; arrEditor.PrimaryColorIndex = primarycol; arrEditor.SecondaryColorIndex = secondarycol; arrEditor.CurrentTile = currenttile; }