From eb4c4da0f76b3ad21cd1b2a5212dd0fc84541d91 Mon Sep 17 00:00:00 2001 From: AdAstra-LD Date: Tue, 9 Feb 2021 20:13:02 +0100 Subject: [PATCH] More fixes [overworld sprite finder] --- DS_Map/Main Window.cs | 5 +++-- DS_Map/RomInfo.cs | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index 94deceb..6d2198f 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -4503,10 +4503,11 @@ namespace DSPRE { if (index > -1) { try { selectedEvent = currentEvFile.overworlds[index]; + Overworld selectedOw = (Overworld)selectedEvent; /* Sprite index and image controls */ - owSpriteComboBox.SelectedIndex = ((Overworld)selectedEvent).overlayTableEntry; - owSpritePictureBox.BackgroundImage = GetOverworldImage(currentEvFile.overworlds[index].overlayTableEntry, currentEvFile.overworlds[index].orientation); + owSpriteComboBox.SelectedIndex = Array.IndexOf(RomInfo.overworldTableKeys, selectedOw.overlayTableEntry); + owSpritePictureBox.BackgroundImage = GetOverworldImage(selectedOw.overlayTableEntry, selectedOw.orientation); } catch (ArgumentOutOfRangeException) { String errorMsg = "This Overworld's sprite ID couldn't be read correctly."; MessageBox.Show(errorMsg, "Something went wrong", MessageBoxButtons.OK, MessageBoxIcon.Error); diff --git a/DS_Map/RomInfo.cs b/DS_Map/RomInfo.cs index 79ec2d7..f580b6d 100644 --- a/DS_Map/RomInfo.cs +++ b/DS_Map/RomInfo.cs @@ -60,6 +60,7 @@ namespace DSPRE { public static Dictionary ScriptCommandNamesDict { get; private set; } public static Dictionary CommandParametersDict { get; private set; } public static SortedDictionary OverworldTable { get; private set; } + public static uint[] overworldTableKeys { get; private set; } #region Constructors (1) public RomInfo(string id, string workDir) { @@ -588,6 +589,7 @@ namespace DSPRE { } break; } + overworldTableKeys = OverworldTable.Keys.ToArray(); } #endregion }