From 71a52affe49847d4ddae120ddf30c1a953b7fd44 Mon Sep 17 00:00:00 2001 From: AdAstra-LD Date: Sun, 7 Feb 2021 05:05:31 +0100 Subject: [PATCH] Minor update Fixed minor bug with OW IDs [event editor] added two more movements to dictionary improved accuracy of error detection [script editor] --- DS_Map/Main Window.cs | 10 ++++++---- DS_Map/ROMFiles/ScriptAction.cs | 8 +++++++- DS_Map/ROMFiles/ScriptCommand.cs | 8 +++++++- DS_Map/Resources/PokeDatabase.cs | 4 +++- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index 0f9130b..1cb1877 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -4649,13 +4649,11 @@ namespace DSPRE { private void owIDNumericUpDown_ValueChanged(object sender, EventArgs e) { if (disableHandlers || overworldsListBox.SelectedIndex < 0) return; - if (currentEventFile.overworlds.Any() && overworldsListBox.SelectedIndex > 0) - currentEventFile.overworlds[overworldsListBox.SelectedIndex].owID = (ushort)owIDNumericUpDown.Value; + currentEventFile.overworlds[overworldsListBox.SelectedIndex].owID = (ushort)owIDNumericUpDown.Value; } private void owMovementComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (disableHandlers || overworldsListBox.SelectedIndex < 0) return; - currentEventFile.overworlds[overworldsListBox.SelectedIndex].movement = (ushort)owMovementComboBox.SelectedIndex; } private void owOrientationComboBox_SelectedIndexChanged(object sender, EventArgs e) { @@ -5933,7 +5931,11 @@ namespace DSPRE { if (disableHandlers) return; if (e.RowIndex > -1) - currentTextArchive.messages[e.RowIndex] = textEditorDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); + try { + currentTextArchive.messages[e.RowIndex] = textEditorDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); + } catch (NullReferenceException) { + currentTextArchive.messages[e.RowIndex] = ""; + } } private void textSearchResultsListBox_GoToEntryResult(object sender, MouseEventArgs e) { if (textSearchResultsListBox.SelectedIndex < 0) diff --git a/DS_Map/ROMFiles/ScriptAction.cs b/DS_Map/ROMFiles/ScriptAction.cs index 0f75738..20b1c0b 100644 --- a/DS_Map/ROMFiles/ScriptAction.cs +++ b/DS_Map/ROMFiles/ScriptAction.cs @@ -52,9 +52,15 @@ namespace DSPRE.ROMFiles { try { id = UInt16.Parse(nameParts[0], NumberStyles.HexNumber, CultureInfo.InvariantCulture); } catch (FormatException) { + string details; + if (wholeLine.Contains('@')) { + details = "Perhaps you forgot to End the Action above it...?"; + } else { + details = "Are you sure it's a proper Action Command?"; + } MessageBox.Show("This Script file could not be saved." + Environment.NewLine + "Parser failed to interpret line " + lineNumber + ": \"" + wholeLine + "\"." + - Environment.NewLine + "\nAre you sure it's a proper Action Command?", "Parser error", MessageBoxButtons.OK, MessageBoxIcon.Error); + Environment.NewLine + "\n" + details, "Parser error", MessageBoxButtons.OK, MessageBoxIcon.Error); id = UInt16.MaxValue; return; } diff --git a/DS_Map/ROMFiles/ScriptCommand.cs b/DS_Map/ROMFiles/ScriptCommand.cs index 0e450de..8895da3 100644 --- a/DS_Map/ROMFiles/ScriptCommand.cs +++ b/DS_Map/ROMFiles/ScriptCommand.cs @@ -93,9 +93,15 @@ namespace DSPRE.ROMFiles { try { id = UInt16.Parse(nameParts[0], NumberStyles.HexNumber, CultureInfo.InvariantCulture); } catch (FormatException) { + string details; + if (wholeLine.Contains('@')) { + details = "Perhaps you forgot to End the Script or Function above it...?"; + } else { + details = "Are you sure it's a proper Script Command?"; + } MessageBox.Show("This Script file could not be saved." + Environment.NewLine + "Parser failed to interpret line " + lineNumber + ": \"" + wholeLine + "\"." + - Environment.NewLine + "\nAre you sure it's a proper Script Command?", "Parser error", MessageBoxButtons.OK, MessageBoxIcon.Error); + Environment.NewLine + "\n" + details, "Parser error", MessageBoxButtons.OK, MessageBoxIcon.Error); id = UInt16.MaxValue; return; } diff --git a/DS_Map/Resources/PokeDatabase.cs b/DS_Map/Resources/PokeDatabase.cs index ce98b82..c2ff021 100644 --- a/DS_Map/Resources/PokeDatabase.cs +++ b/DS_Map/Resources/PokeDatabase.cs @@ -629,10 +629,12 @@ namespace DSPRE.Resources { [0x003A] = "JumpLeft2", [0x003B] = "JumpRight2", [0x0045] = "WaitDisappear", + [0x0047] = "LockDir", + [0x0048] = "ReleaseDir", [0x004B] = "Exclamation", [0x004C] = "WaitWalkUpSlow", [0x004D] = "WaitWalkDownSlow", - [0x004E] = "WaitWalkLeftSlow", + [0x004E] = "WaitWalkLeftSlow",//Seems to make the player run in HGSS? [0x004F] = "WaitWalkRightSlow", [0x0050] = "WaitWalkUp", [0x0051] = "WaitWalkDown",