diff --git a/DS_Map/DSPRE.csproj b/DS_Map/DSPRE.csproj
index 61a6b37..da93a0d 100644
--- a/DS_Map/DSPRE.csproj
+++ b/DS_Map/DSPRE.csproj
@@ -258,7 +258,9 @@
-
+
+
+
diff --git a/DS_Map/Editors/ScriptEditor.Designer.cs b/DS_Map/Editors/ScriptEditor.Designer.cs
index 9d00b3a..2c0a62c 100644
--- a/DS_Map/Editors/ScriptEditor.Designer.cs
+++ b/DS_Map/Editors/ScriptEditor.Designer.cs
@@ -28,826 +28,593 @@ namespace DSPRE.Editors
/// the contents of this method with the code editor.
///
private void InitializeComponent() {
- this.selectScriptFileComboBox = new System.Windows.Forms.ComboBox();
- this.label5 = new System.Windows.Forms.Label();
- this.scriptEditorTabControl = new System.Windows.Forms.TabControl();
- this.scriptsTabPage = new System.Windows.Forms.TabPage();
- this.PanelSearchScripts = new System.Windows.Forms.Panel();
- this.BtnNextFindScript = new System.Windows.Forms.Button();
- this.BtnPrevFindScript = new System.Windows.Forms.Button();
- this.BtnCloseFindScript = new System.Windows.Forms.Button();
- this.panelFindScriptTextBox = new System.Windows.Forms.TextBox();
- this.scintillaScriptsPanel = new System.Windows.Forms.Panel();
- this.functionsTabPage = new System.Windows.Forms.TabPage();
- this.PanelSearchFunctions = new System.Windows.Forms.Panel();
- this.BtnNextFindFunc = new System.Windows.Forms.Button();
- this.BtnPrevFindFunc = new System.Windows.Forms.Button();
- this.BtnCloseFindFunc = new System.Windows.Forms.Button();
- this.panelFindFunctionTextBox = new System.Windows.Forms.TextBox();
- this.scintillaFunctionsPanel = new System.Windows.Forms.Panel();
- this.actionsTabPage = new System.Windows.Forms.TabPage();
- this.PanelSearchActions = new System.Windows.Forms.Panel();
- this.BtnNextFindActions = new System.Windows.Forms.Button();
- this.BtnPrevFindActions = new System.Windows.Forms.Button();
- this.BtnCloseFindActions = new System.Windows.Forms.Button();
- this.panelFindActionTextBox = new System.Windows.Forms.TextBox();
- this.scintillaActionsPanel = new System.Windows.Forms.Panel();
- this.addScriptFileButton = new System.Windows.Forms.Button();
- this.removeScriptFileButton = new System.Windows.Forms.Button();
- this.saveScriptFileButton = new System.Windows.Forms.Button();
- this.exportScriptFileButton = new System.Windows.Forms.Button();
- this.importScriptFileButton = new System.Windows.Forms.Button();
- this.groupBox8 = new System.Windows.Forms.GroupBox();
- this.searchInScriptsButton = new System.Windows.Forms.Button();
- this.searchOnlyCurrentScriptCheckBox = new System.Windows.Forms.CheckBox();
- this.scrollToBlockStartcheckBox = new System.Windows.Forms.CheckBox();
- this.scriptSearchCaseSensitiveCheckBox = new System.Windows.Forms.CheckBox();
- this.searchInScriptsTextBox = new System.Windows.Forms.TextBox();
- this.label31 = new System.Windows.Forms.Label();
- this.searchProgressBar = new System.Windows.Forms.ProgressBar();
- this.label30 = new System.Windows.Forms.Label();
- this.label29 = new System.Windows.Forms.Label();
- this.searchInScriptsResultListBox = new System.Windows.Forms.ListBox();
- this.groupBox24 = new System.Windows.Forms.GroupBox();
- this.ScriptNavigatorTabControl = new System.Windows.Forms.TabControl();
- this.ScriptsNavTab = new System.Windows.Forms.TabPage();
- this.scriptsNavListbox = new System.Windows.Forms.ListBox();
- this.FunctionsNavTab = new System.Windows.Forms.TabPage();
- this.functionsNavListbox = new System.Windows.Forms.ListBox();
- this.ActionsNavTab = new System.Windows.Forms.TabPage();
- this.actionsNavListbox = new System.Windows.Forms.ListBox();
- this.openFindScriptEditorButton = new System.Windows.Forms.Button();
- this.expandScriptTextButton = new System.Windows.Forms.Button();
- this.compressScriptTextButton = new System.Windows.Forms.Button();
- this.scriptEditorWordWrapCheckbox = new System.Windows.Forms.CheckBox();
- this.scriptEditorWhitespacesCheckbox = new System.Windows.Forms.CheckBox();
- this.groupBox26 = new System.Windows.Forms.GroupBox();
- this.scriptEditorNumberFormatNoPreference = new System.Windows.Forms.RadioButton();
- this.scriptEditorNumberFormatDecimal = new System.Windows.Forms.RadioButton();
- this.scriptEditorNumberFormatHex = new System.Windows.Forms.RadioButton();
- this.viewLevelScriptButton = new System.Windows.Forms.Button();
- this.locateCurrentScriptFile = new System.Windows.Forms.Button();
- this.scriptEditorTabControl.SuspendLayout();
- this.scriptsTabPage.SuspendLayout();
- this.PanelSearchScripts.SuspendLayout();
- this.functionsTabPage.SuspendLayout();
- this.PanelSearchFunctions.SuspendLayout();
- this.actionsTabPage.SuspendLayout();
- this.PanelSearchActions.SuspendLayout();
- this.groupBox8.SuspendLayout();
- this.groupBox24.SuspendLayout();
- this.ScriptNavigatorTabControl.SuspendLayout();
- this.ScriptsNavTab.SuspendLayout();
- this.FunctionsNavTab.SuspendLayout();
- this.ActionsNavTab.SuspendLayout();
- this.groupBox26.SuspendLayout();
- this.SuspendLayout();
- //
- // selectScriptFileComboBox
- //
- this.selectScriptFileComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.selectScriptFileComboBox.FormattingEnabled = true;
- this.selectScriptFileComboBox.Location = new System.Drawing.Point(7, 24);
- this.selectScriptFileComboBox.Name = "selectScriptFileComboBox";
- this.selectScriptFileComboBox.Size = new System.Drawing.Size(152, 21);
- this.selectScriptFileComboBox.TabIndex = 0;
- this.selectScriptFileComboBox.SelectedIndexChanged += new System.EventHandler(this.selectScriptFileComboBox_SelectedIndexChanged);
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(5, 8);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(53, 13);
- this.label5.TabIndex = 1;
- this.label5.Text = "Script File";
- //
- // scriptEditorTabControl
- //
- this.scriptEditorTabControl.Controls.Add(this.scriptsTabPage);
- this.scriptEditorTabControl.Controls.Add(this.functionsTabPage);
- this.scriptEditorTabControl.Controls.Add(this.actionsTabPage);
- this.scriptEditorTabControl.Location = new System.Drawing.Point(481, 22);
- this.scriptEditorTabControl.Name = "scriptEditorTabControl";
- this.scriptEditorTabControl.SelectedIndex = 0;
- this.scriptEditorTabControl.Size = new System.Drawing.Size(692, 591);
- this.scriptEditorTabControl.TabIndex = 18;
- this.scriptEditorTabControl.SelectedIndexChanged += new System.EventHandler(this.scriptEditorTabControl_TabIndexChanged);
- //
- // scriptsTabPage
- //
- this.scriptsTabPage.Controls.Add(this.PanelSearchScripts);
- this.scriptsTabPage.Controls.Add(this.scintillaScriptsPanel);
- this.scriptsTabPage.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.scriptsTabPage.Location = new System.Drawing.Point(4, 22);
- this.scriptsTabPage.Name = "scriptsTabPage";
- this.scriptsTabPage.Padding = new System.Windows.Forms.Padding(3);
- this.scriptsTabPage.Size = new System.Drawing.Size(684, 565);
- this.scriptsTabPage.TabIndex = 0;
- this.scriptsTabPage.Text = "Scripts";
- this.scriptsTabPage.UseVisualStyleBackColor = true;
- //
- // PanelSearchScripts
- //
- this.PanelSearchScripts.BackColor = System.Drawing.Color.White;
- this.PanelSearchScripts.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.PanelSearchScripts.Controls.Add(this.BtnNextFindScript);
- this.PanelSearchScripts.Controls.Add(this.BtnPrevFindScript);
- this.PanelSearchScripts.Controls.Add(this.BtnCloseFindScript);
- this.PanelSearchScripts.Controls.Add(this.panelFindScriptTextBox);
- this.PanelSearchScripts.Location = new System.Drawing.Point(386, 3);
- this.PanelSearchScripts.Name = "PanelSearchScripts";
- this.PanelSearchScripts.Size = new System.Drawing.Size(292, 40);
- this.PanelSearchScripts.TabIndex = 14;
- this.PanelSearchScripts.Visible = false;
- //
- // BtnNextFindScript
- //
- this.BtnNextFindScript.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnNextFindScript.ForeColor = System.Drawing.Color.White;
- this.BtnNextFindScript.Image = global::DSPRE.Properties.Resources.arrowdown;
- this.BtnNextFindScript.Location = new System.Drawing.Point(233, 4);
- this.BtnNextFindScript.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnNextFindScript.Name = "BtnNextFindScript";
- this.BtnNextFindScript.Size = new System.Drawing.Size(25, 30);
- this.BtnNextFindScript.TabIndex = 32;
- this.BtnNextFindScript.Tag = "Find next (Enter)";
- this.BtnNextFindScript.UseVisualStyleBackColor = true;
- this.BtnNextFindScript.Click += new System.EventHandler(this.BtnNextFindScript_Click);
- //
- // BtnPrevFindScript
- //
- this.BtnPrevFindScript.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnPrevFindScript.ForeColor = System.Drawing.Color.White;
- this.BtnPrevFindScript.Image = global::DSPRE.Properties.Resources.arrowup;
- this.BtnPrevFindScript.Location = new System.Drawing.Point(205, 4);
- this.BtnPrevFindScript.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnPrevFindScript.Name = "BtnPrevFindScript";
- this.BtnPrevFindScript.Size = new System.Drawing.Size(25, 30);
- this.BtnPrevFindScript.TabIndex = 31;
- this.BtnPrevFindScript.Tag = "Find previous (Shift+Enter)";
- this.BtnPrevFindScript.UseVisualStyleBackColor = true;
- this.BtnPrevFindScript.Click += new System.EventHandler(this.BtnPrevFindScript_Click);
- //
- // BtnCloseFindScript
- //
- this.BtnCloseFindScript.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnCloseFindScript.ForeColor = System.Drawing.Color.White;
- this.BtnCloseFindScript.Image = global::DSPRE.Properties.Resources.Cross;
- this.BtnCloseFindScript.Location = new System.Drawing.Point(261, 4);
- this.BtnCloseFindScript.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnCloseFindScript.Name = "BtnCloseFindScript";
- this.BtnCloseFindScript.Size = new System.Drawing.Size(25, 30);
- this.BtnCloseFindScript.TabIndex = 33;
- this.BtnCloseFindScript.Tag = "Close (Esc)";
- this.BtnCloseFindScript.UseVisualStyleBackColor = true;
- this.BtnCloseFindScript.Click += new System.EventHandler(this.BtnCloseFindScript_Click);
- //
- // panelFindScriptTextBox
- //
- this.panelFindScriptTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.panelFindScriptTextBox.Font = new System.Drawing.Font("Segoe UI", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.panelFindScriptTextBox.Location = new System.Drawing.Point(10, 6);
- this.panelFindScriptTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.panelFindScriptTextBox.Name = "panelFindScriptTextBox";
- this.panelFindScriptTextBox.Size = new System.Drawing.Size(189, 25);
- this.panelFindScriptTextBox.TabIndex = 30;
- this.panelFindScriptTextBox.TextChanged += new System.EventHandler(this.panelFindScriptTextBox_TextChanged);
- this.panelFindScriptTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.scriptTxtFind_KeyDown);
- //
- // scintillaScriptsPanel
- //
- this.scintillaScriptsPanel.Dock = System.Windows.Forms.DockStyle.Fill;
- this.scintillaScriptsPanel.Location = new System.Drawing.Point(3, 3);
- this.scintillaScriptsPanel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.scintillaScriptsPanel.Name = "scintillaScriptsPanel";
- this.scintillaScriptsPanel.Size = new System.Drawing.Size(678, 559);
- this.scintillaScriptsPanel.TabIndex = 19;
- //
- // functionsTabPage
- //
- this.functionsTabPage.Controls.Add(this.PanelSearchFunctions);
- this.functionsTabPage.Controls.Add(this.scintillaFunctionsPanel);
- this.functionsTabPage.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.functionsTabPage.Location = new System.Drawing.Point(4, 22);
- this.functionsTabPage.Name = "functionsTabPage";
- this.functionsTabPage.Padding = new System.Windows.Forms.Padding(3);
- this.functionsTabPage.Size = new System.Drawing.Size(684, 565);
- this.functionsTabPage.TabIndex = 1;
- this.functionsTabPage.Text = "Functions";
- this.functionsTabPage.UseVisualStyleBackColor = true;
- //
- // PanelSearchFunctions
- //
- this.PanelSearchFunctions.BackColor = System.Drawing.Color.White;
- this.PanelSearchFunctions.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.PanelSearchFunctions.Controls.Add(this.BtnNextFindFunc);
- this.PanelSearchFunctions.Controls.Add(this.BtnPrevFindFunc);
- this.PanelSearchFunctions.Controls.Add(this.BtnCloseFindFunc);
- this.PanelSearchFunctions.Controls.Add(this.panelFindFunctionTextBox);
- this.PanelSearchFunctions.Location = new System.Drawing.Point(386, 3);
- this.PanelSearchFunctions.Name = "PanelSearchFunctions";
- this.PanelSearchFunctions.Size = new System.Drawing.Size(292, 40);
- this.PanelSearchFunctions.TabIndex = 16;
- this.PanelSearchFunctions.Visible = false;
- //
- // BtnNextFindFunc
- //
- this.BtnNextFindFunc.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnNextFindFunc.ForeColor = System.Drawing.Color.White;
- this.BtnNextFindFunc.Image = global::DSPRE.Properties.Resources.arrowdown;
- this.BtnNextFindFunc.Location = new System.Drawing.Point(233, 4);
- this.BtnNextFindFunc.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnNextFindFunc.Name = "BtnNextFindFunc";
- this.BtnNextFindFunc.Size = new System.Drawing.Size(25, 30);
- this.BtnNextFindFunc.TabIndex = 36;
- this.BtnNextFindFunc.Tag = "Find next (Enter)";
- this.BtnNextFindFunc.UseVisualStyleBackColor = true;
- this.BtnNextFindFunc.Click += new System.EventHandler(this.BtnNextFindFunc_Click);
- //
- // BtnPrevFindFunc
- //
- this.BtnPrevFindFunc.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnPrevFindFunc.ForeColor = System.Drawing.Color.White;
- this.BtnPrevFindFunc.Image = global::DSPRE.Properties.Resources.arrowup;
- this.BtnPrevFindFunc.Location = new System.Drawing.Point(205, 4);
- this.BtnPrevFindFunc.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnPrevFindFunc.Name = "BtnPrevFindFunc";
- this.BtnPrevFindFunc.Size = new System.Drawing.Size(25, 30);
- this.BtnPrevFindFunc.TabIndex = 35;
- this.BtnPrevFindFunc.Tag = "Find previous (Shift+Enter)";
- this.BtnPrevFindFunc.UseVisualStyleBackColor = true;
- this.BtnPrevFindFunc.Click += new System.EventHandler(this.BtnPrevFindFunc_Click);
- //
- // BtnCloseFindFunc
- //
- this.BtnCloseFindFunc.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnCloseFindFunc.ForeColor = System.Drawing.Color.White;
- this.BtnCloseFindFunc.Image = global::DSPRE.Properties.Resources.Cross;
- this.BtnCloseFindFunc.Location = new System.Drawing.Point(261, 4);
- this.BtnCloseFindFunc.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnCloseFindFunc.Name = "BtnCloseFindFunc";
- this.BtnCloseFindFunc.Size = new System.Drawing.Size(25, 30);
- this.BtnCloseFindFunc.TabIndex = 37;
- this.BtnCloseFindFunc.Tag = "Close (Esc)";
- this.BtnCloseFindFunc.UseVisualStyleBackColor = true;
- this.BtnCloseFindFunc.Click += new System.EventHandler(this.BtnCloseFindFunc_Click);
- //
- // panelFindFunctionTextBox
- //
- this.panelFindFunctionTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.panelFindFunctionTextBox.Font = new System.Drawing.Font("Segoe UI", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.panelFindFunctionTextBox.Location = new System.Drawing.Point(10, 6);
- this.panelFindFunctionTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.panelFindFunctionTextBox.Name = "panelFindFunctionTextBox";
- this.panelFindFunctionTextBox.Size = new System.Drawing.Size(189, 25);
- this.panelFindFunctionTextBox.TabIndex = 34;
- this.panelFindFunctionTextBox.TextChanged += new System.EventHandler(this.panelFindFunctionTextBox_TextChanged);
- this.panelFindFunctionTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.functionTxtFind_KeyDown);
- //
- // scintillaFunctionsPanel
- //
- this.scintillaFunctionsPanel.Dock = System.Windows.Forms.DockStyle.Fill;
- this.scintillaFunctionsPanel.Location = new System.Drawing.Point(3, 3);
- this.scintillaFunctionsPanel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.scintillaFunctionsPanel.Name = "scintillaFunctionsPanel";
- this.scintillaFunctionsPanel.Size = new System.Drawing.Size(678, 559);
- this.scintillaFunctionsPanel.TabIndex = 20;
- //
- // actionsTabPage
- //
- this.actionsTabPage.Controls.Add(this.PanelSearchActions);
- this.actionsTabPage.Controls.Add(this.scintillaActionsPanel);
- this.actionsTabPage.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.actionsTabPage.Location = new System.Drawing.Point(4, 22);
- this.actionsTabPage.Name = "actionsTabPage";
- this.actionsTabPage.Padding = new System.Windows.Forms.Padding(3);
- this.actionsTabPage.Size = new System.Drawing.Size(684, 565);
- this.actionsTabPage.TabIndex = 2;
- this.actionsTabPage.Text = "Actions";
- this.actionsTabPage.UseVisualStyleBackColor = true;
- //
- // PanelSearchActions
- //
- this.PanelSearchActions.BackColor = System.Drawing.Color.White;
- this.PanelSearchActions.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.PanelSearchActions.Controls.Add(this.BtnNextFindActions);
- this.PanelSearchActions.Controls.Add(this.BtnPrevFindActions);
- this.PanelSearchActions.Controls.Add(this.BtnCloseFindActions);
- this.PanelSearchActions.Controls.Add(this.panelFindActionTextBox);
- this.PanelSearchActions.Location = new System.Drawing.Point(386, 3);
- this.PanelSearchActions.Name = "PanelSearchActions";
- this.PanelSearchActions.Size = new System.Drawing.Size(292, 40);
- this.PanelSearchActions.TabIndex = 16;
- this.PanelSearchActions.Visible = false;
- //
- // BtnNextFindActions
- //
- this.BtnNextFindActions.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnNextFindActions.ForeColor = System.Drawing.Color.White;
- this.BtnNextFindActions.Image = global::DSPRE.Properties.Resources.arrowdown;
- this.BtnNextFindActions.Location = new System.Drawing.Point(233, 4);
- this.BtnNextFindActions.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnNextFindActions.Name = "BtnNextFindActions";
- this.BtnNextFindActions.Size = new System.Drawing.Size(25, 30);
- this.BtnNextFindActions.TabIndex = 40;
- this.BtnNextFindActions.Tag = "Find next (Enter)";
- this.BtnNextFindActions.UseVisualStyleBackColor = true;
- this.BtnNextFindActions.Click += new System.EventHandler(this.BtnNextFindActions_Click);
- //
- // BtnPrevFindActions
- //
- this.BtnPrevFindActions.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnPrevFindActions.ForeColor = System.Drawing.Color.White;
- this.BtnPrevFindActions.Image = global::DSPRE.Properties.Resources.arrowup;
- this.BtnPrevFindActions.Location = new System.Drawing.Point(205, 4);
- this.BtnPrevFindActions.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnPrevFindActions.Name = "BtnPrevFindActions";
- this.BtnPrevFindActions.Size = new System.Drawing.Size(25, 30);
- this.BtnPrevFindActions.TabIndex = 39;
- this.BtnPrevFindActions.Tag = "Find previous (Shift+Enter)";
- this.BtnPrevFindActions.UseVisualStyleBackColor = true;
- this.BtnPrevFindActions.Click += new System.EventHandler(this.BtnPrevFindActions_Click);
- //
- // BtnCloseFindActions
- //
- this.BtnCloseFindActions.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnCloseFindActions.ForeColor = System.Drawing.Color.White;
- this.BtnCloseFindActions.Image = global::DSPRE.Properties.Resources.Cross;
- this.BtnCloseFindActions.Location = new System.Drawing.Point(261, 4);
- this.BtnCloseFindActions.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnCloseFindActions.Name = "BtnCloseFindActions";
- this.BtnCloseFindActions.Size = new System.Drawing.Size(25, 30);
- this.BtnCloseFindActions.TabIndex = 41;
- this.BtnCloseFindActions.Tag = "Close (Esc)";
- this.BtnCloseFindActions.UseVisualStyleBackColor = true;
- this.BtnCloseFindActions.Click += new System.EventHandler(this.BtnCloseFindActions_Click);
- //
- // panelFindActionTextBox
- //
- this.panelFindActionTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.panelFindActionTextBox.Font = new System.Drawing.Font("Segoe UI", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.panelFindActionTextBox.Location = new System.Drawing.Point(10, 6);
- this.panelFindActionTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.panelFindActionTextBox.Name = "panelFindActionTextBox";
- this.panelFindActionTextBox.Size = new System.Drawing.Size(189, 25);
- this.panelFindActionTextBox.TabIndex = 38;
- this.panelFindActionTextBox.TextChanged += new System.EventHandler(this.panelFindActionTextBox_TextChanged);
- this.panelFindActionTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.actionTxtFind_KeyDown);
- //
- // scintillaActionsPanel
- //
- this.scintillaActionsPanel.Dock = System.Windows.Forms.DockStyle.Fill;
- this.scintillaActionsPanel.Location = new System.Drawing.Point(3, 3);
- this.scintillaActionsPanel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.scintillaActionsPanel.Name = "scintillaActionsPanel";
- this.scintillaActionsPanel.Size = new System.Drawing.Size(678, 559);
- this.scintillaActionsPanel.TabIndex = 21;
- //
- // addScriptFileButton
- //
- this.addScriptFileButton.Image = global::DSPRE.Properties.Resources.addIcon;
- this.addScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.addScriptFileButton.Location = new System.Drawing.Point(369, 667);
- this.addScriptFileButton.Name = "addScriptFileButton";
- this.addScriptFileButton.Size = new System.Drawing.Size(106, 25);
- this.addScriptFileButton.TabIndex = 4;
- this.addScriptFileButton.Text = "Add Script File";
- this.addScriptFileButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.addScriptFileButton.UseVisualStyleBackColor = true;
- this.addScriptFileButton.Click += new System.EventHandler(this.addScriptFileButton_Click);
- //
- // removeScriptFileButton
- //
- this.removeScriptFileButton.Image = global::DSPRE.Properties.Resources.deleteIcon;
- this.removeScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.removeScriptFileButton.Location = new System.Drawing.Point(369, 694);
- this.removeScriptFileButton.Name = "removeScriptFileButton";
- this.removeScriptFileButton.Size = new System.Drawing.Size(106, 25);
- this.removeScriptFileButton.TabIndex = 5;
- this.removeScriptFileButton.Text = "Remove Last";
- this.removeScriptFileButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.removeScriptFileButton.UseVisualStyleBackColor = true;
- this.removeScriptFileButton.Click += new System.EventHandler(this.removeScriptFileButton_Click);
- //
- // saveScriptFileButton
- //
- this.saveScriptFileButton.Image = global::DSPRE.Properties.Resources.saveButton;
- this.saveScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.saveScriptFileButton.Location = new System.Drawing.Point(6, 50);
- this.saveScriptFileButton.Name = "saveScriptFileButton";
- this.saveScriptFileButton.Size = new System.Drawing.Size(154, 23);
- this.saveScriptFileButton.TabIndex = 1;
- this.saveScriptFileButton.Text = "&Save Current File";
- this.saveScriptFileButton.UseVisualStyleBackColor = true;
- this.saveScriptFileButton.Click += new System.EventHandler(this.saveScriptFileButton_Click);
- //
- // exportScriptFileButton
- //
- this.exportScriptFileButton.Image = global::DSPRE.Properties.Resources.exportArrow;
- this.exportScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.exportScriptFileButton.Location = new System.Drawing.Point(294, 667);
- this.exportScriptFileButton.Name = "exportScriptFileButton";
- this.exportScriptFileButton.Size = new System.Drawing.Size(70, 52);
- this.exportScriptFileButton.TabIndex = 3;
- this.exportScriptFileButton.Text = "&Export \r\nFile";
- this.exportScriptFileButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.exportScriptFileButton.UseVisualStyleBackColor = true;
- this.exportScriptFileButton.Click += new System.EventHandler(this.exportScriptFileButton_Click);
- //
- // importScriptFileButton
- //
- this.importScriptFileButton.Image = global::DSPRE.Properties.Resources.importArrow;
- this.importScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.importScriptFileButton.Location = new System.Drawing.Point(219, 667);
- this.importScriptFileButton.Name = "importScriptFileButton";
- this.importScriptFileButton.Size = new System.Drawing.Size(70, 52);
- this.importScriptFileButton.TabIndex = 2;
- this.importScriptFileButton.Text = "&Import\r\nFile";
- this.importScriptFileButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.importScriptFileButton.UseVisualStyleBackColor = true;
- this.importScriptFileButton.Click += new System.EventHandler(this.importScriptFileButton_Click);
- //
- // groupBox8
- //
- this.groupBox8.Controls.Add(this.searchInScriptsButton);
- this.groupBox8.Controls.Add(this.searchOnlyCurrentScriptCheckBox);
- this.groupBox8.Controls.Add(this.scrollToBlockStartcheckBox);
- this.groupBox8.Controls.Add(this.scriptSearchCaseSensitiveCheckBox);
- this.groupBox8.Controls.Add(this.searchInScriptsTextBox);
- this.groupBox8.Controls.Add(this.label31);
- this.groupBox8.Controls.Add(this.searchProgressBar);
- this.groupBox8.Controls.Add(this.label30);
- this.groupBox8.Controls.Add(this.label29);
- this.groupBox8.Controls.Add(this.searchInScriptsResultListBox);
- this.groupBox8.Location = new System.Drawing.Point(2, 315);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(472, 298);
- this.groupBox8.TabIndex = 18;
- this.groupBox8.TabStop = false;
- this.groupBox8.Text = "Search for commands:";
- //
- // searchInScriptsButton
- //
- this.searchInScriptsButton.Image = global::DSPRE.Properties.Resources.SearchMiniIcon;
- this.searchInScriptsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.searchInScriptsButton.Location = new System.Drawing.Point(272, 27);
- this.searchInScriptsButton.Name = "searchInScriptsButton";
- this.searchInScriptsButton.Size = new System.Drawing.Size(69, 36);
- this.searchInScriptsButton.TabIndex = 13;
- this.searchInScriptsButton.Text = "Search";
- this.searchInScriptsButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.searchInScriptsButton.UseVisualStyleBackColor = true;
- this.searchInScriptsButton.Click += new System.EventHandler(this.searchInScriptsButton_Click);
- //
- // searchOnlyCurrentScriptCheckBox
- //
- this.searchOnlyCurrentScriptCheckBox.AutoSize = true;
- this.searchOnlyCurrentScriptCheckBox.Location = new System.Drawing.Point(347, 15);
- this.searchOnlyCurrentScriptCheckBox.Name = "searchOnlyCurrentScriptCheckBox";
- this.searchOnlyCurrentScriptCheckBox.Size = new System.Drawing.Size(84, 17);
- this.searchOnlyCurrentScriptCheckBox.TabIndex = 14;
- this.searchOnlyCurrentScriptCheckBox.Text = "Only Current";
- this.searchOnlyCurrentScriptCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- this.searchOnlyCurrentScriptCheckBox.UseVisualStyleBackColor = true;
- //
- // scrollToBlockStartcheckBox
- //
- this.scrollToBlockStartcheckBox.AutoSize = true;
- this.scrollToBlockStartcheckBox.Location = new System.Drawing.Point(347, 61);
- this.scrollToBlockStartcheckBox.Name = "scrollToBlockStartcheckBox";
- this.scrollToBlockStartcheckBox.Size = new System.Drawing.Size(116, 17);
- this.scrollToBlockStartcheckBox.TabIndex = 16;
- this.scrollToBlockStartcheckBox.Text = "Scroll to block start";
- this.scrollToBlockStartcheckBox.UseVisualStyleBackColor = true;
- //
- // scriptSearchCaseSensitiveCheckBox
- //
- this.scriptSearchCaseSensitiveCheckBox.AutoSize = true;
- this.scriptSearchCaseSensitiveCheckBox.Location = new System.Drawing.Point(347, 38);
- this.scriptSearchCaseSensitiveCheckBox.Name = "scriptSearchCaseSensitiveCheckBox";
- this.scriptSearchCaseSensitiveCheckBox.Size = new System.Drawing.Size(83, 17);
- this.scriptSearchCaseSensitiveCheckBox.TabIndex = 15;
- this.scriptSearchCaseSensitiveCheckBox.Text = "Match Case";
- this.scriptSearchCaseSensitiveCheckBox.UseVisualStyleBackColor = true;
- //
- // searchInScriptsTextBox
- //
- this.searchInScriptsTextBox.Location = new System.Drawing.Point(11, 36);
- this.searchInScriptsTextBox.Name = "searchInScriptsTextBox";
- this.searchInScriptsTextBox.Size = new System.Drawing.Size(255, 20);
- this.searchInScriptsTextBox.TabIndex = 12;
- this.searchInScriptsTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.searchInScriptsTextBox_KeyDown);
- //
- // label31
- //
- this.label31.AutoSize = true;
- this.label31.Location = new System.Drawing.Point(11, 261);
- this.label31.Name = "label31";
- this.label31.Size = new System.Drawing.Size(48, 13);
- this.label31.TabIndex = 37;
- this.label31.Text = "Progress";
- //
- // searchProgressBar
- //
- this.searchProgressBar.Location = new System.Drawing.Point(11, 277);
- this.searchProgressBar.Name = "searchProgressBar";
- this.searchProgressBar.Size = new System.Drawing.Size(452, 14);
- this.searchProgressBar.TabIndex = 36;
- //
- // label30
- //
- this.label30.AutoSize = true;
- this.label30.Location = new System.Drawing.Point(11, 68);
- this.label30.Name = "label30";
- this.label30.Size = new System.Drawing.Size(42, 13);
- this.label30.TabIndex = 35;
- this.label30.Text = "Results";
- //
- // label29
- //
- this.label29.AutoSize = true;
- this.label29.Location = new System.Drawing.Point(11, 20);
- this.label29.Name = "label29";
- this.label29.Size = new System.Drawing.Size(77, 13);
- this.label29.TabIndex = 33;
- this.label29.Text = "Line to search:";
- //
- // searchInScriptsResultListBox
- //
- this.searchInScriptsResultListBox.Location = new System.Drawing.Point(11, 84);
- this.searchInScriptsResultListBox.Name = "searchInScriptsResultListBox";
- this.searchInScriptsResultListBox.Size = new System.Drawing.Size(452, 173);
- this.searchInScriptsResultListBox.TabIndex = 17;
- this.searchInScriptsResultListBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.searchInScriptsResultListBox_KeyDown);
- this.searchInScriptsResultListBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.searchInScripts_GoToEntryResult);
- //
- // groupBox24
- //
- this.groupBox24.Controls.Add(this.ScriptNavigatorTabControl);
- this.groupBox24.Location = new System.Drawing.Point(3, 75);
- this.groupBox24.Name = "groupBox24";
- this.groupBox24.Size = new System.Drawing.Size(472, 234);
- this.groupBox24.TabIndex = 42;
- this.groupBox24.TabStop = false;
- this.groupBox24.Text = "Navigator";
- //
- // ScriptNavigatorTabControl
- //
- this.ScriptNavigatorTabControl.Controls.Add(this.ScriptsNavTab);
- this.ScriptNavigatorTabControl.Controls.Add(this.FunctionsNavTab);
- this.ScriptNavigatorTabControl.Controls.Add(this.ActionsNavTab);
- this.ScriptNavigatorTabControl.Location = new System.Drawing.Point(6, 16);
- this.ScriptNavigatorTabControl.Name = "ScriptNavigatorTabControl";
- this.ScriptNavigatorTabControl.SelectedIndex = 0;
- this.ScriptNavigatorTabControl.Size = new System.Drawing.Size(456, 209);
- this.ScriptNavigatorTabControl.TabIndex = 8;
- //
- // ScriptsNavTab
- //
- this.ScriptsNavTab.Controls.Add(this.scriptsNavListbox);
- this.ScriptsNavTab.Location = new System.Drawing.Point(4, 22);
- this.ScriptsNavTab.Name = "ScriptsNavTab";
- this.ScriptsNavTab.Padding = new System.Windows.Forms.Padding(3);
- this.ScriptsNavTab.Size = new System.Drawing.Size(448, 183);
- this.ScriptsNavTab.TabIndex = 0;
- this.ScriptsNavTab.Text = "Scripts";
- this.ScriptsNavTab.UseVisualStyleBackColor = true;
- //
- // scriptsNavListbox
- //
- this.scriptsNavListbox.Dock = System.Windows.Forms.DockStyle.Fill;
- this.scriptsNavListbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.scriptsNavListbox.ItemHeight = 15;
- this.scriptsNavListbox.Location = new System.Drawing.Point(3, 3);
- this.scriptsNavListbox.Name = "scriptsNavListbox";
- this.scriptsNavListbox.Size = new System.Drawing.Size(442, 177);
- this.scriptsNavListbox.TabIndex = 9;
- this.scriptsNavListbox.SelectedIndexChanged += new System.EventHandler(this.scriptsNavListbox_SelectedIndexChanged);
- //
- // FunctionsNavTab
- //
- this.FunctionsNavTab.Controls.Add(this.functionsNavListbox);
- this.FunctionsNavTab.Location = new System.Drawing.Point(4, 22);
- this.FunctionsNavTab.Name = "FunctionsNavTab";
- this.FunctionsNavTab.Padding = new System.Windows.Forms.Padding(3);
- this.FunctionsNavTab.Size = new System.Drawing.Size(448, 183);
- this.FunctionsNavTab.TabIndex = 1;
- this.FunctionsNavTab.Text = "Functions";
- this.FunctionsNavTab.UseVisualStyleBackColor = true;
- //
- // functionsNavListbox
- //
- this.functionsNavListbox.Dock = System.Windows.Forms.DockStyle.Fill;
- this.functionsNavListbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.functionsNavListbox.ItemHeight = 15;
- this.functionsNavListbox.Location = new System.Drawing.Point(3, 3);
- this.functionsNavListbox.Name = "functionsNavListbox";
- this.functionsNavListbox.Size = new System.Drawing.Size(442, 177);
- this.functionsNavListbox.TabIndex = 10;
- this.functionsNavListbox.SelectedIndexChanged += new System.EventHandler(this.functionsNavListbox_SelectedIndexChanged);
- //
- // ActionsNavTab
- //
- this.ActionsNavTab.Controls.Add(this.actionsNavListbox);
- this.ActionsNavTab.Location = new System.Drawing.Point(4, 22);
- this.ActionsNavTab.Name = "ActionsNavTab";
- this.ActionsNavTab.Padding = new System.Windows.Forms.Padding(3);
- this.ActionsNavTab.Size = new System.Drawing.Size(448, 183);
- this.ActionsNavTab.TabIndex = 2;
- this.ActionsNavTab.Text = "Actions";
- this.ActionsNavTab.UseVisualStyleBackColor = true;
- //
- // actionsNavListbox
- //
- this.actionsNavListbox.Dock = System.Windows.Forms.DockStyle.Fill;
- this.actionsNavListbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.actionsNavListbox.ItemHeight = 15;
- this.actionsNavListbox.Location = new System.Drawing.Point(3, 3);
- this.actionsNavListbox.Name = "actionsNavListbox";
- this.actionsNavListbox.Size = new System.Drawing.Size(442, 177);
- this.actionsNavListbox.TabIndex = 11;
- this.actionsNavListbox.SelectedIndexChanged += new System.EventHandler(this.actionsNavListbox_SelectedIndexChanged);
- //
- // openFindScriptEditorButton
- //
- this.openFindScriptEditorButton.Image = global::DSPRE.Properties.Resources.SearchMiniIcon;
- this.openFindScriptEditorButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.openFindScriptEditorButton.Location = new System.Drawing.Point(1079, 11);
- this.openFindScriptEditorButton.Name = "openFindScriptEditorButton";
- this.openFindScriptEditorButton.Size = new System.Drawing.Size(24, 24);
- this.openFindScriptEditorButton.TabIndex = 27;
- this.openFindScriptEditorButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.openFindScriptEditorButton.UseVisualStyleBackColor = true;
- this.openFindScriptEditorButton.Click += new System.EventHandler(this.openFindScriptEditorButton_Click);
- //
- // expandScriptTextButton
- //
- this.expandScriptTextButton.Image = global::DSPRE.Properties.Resources.expandArrow;
- this.expandScriptTextButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.expandScriptTextButton.Location = new System.Drawing.Point(1107, 11);
- this.expandScriptTextButton.Name = "expandScriptTextButton";
- this.expandScriptTextButton.Size = new System.Drawing.Size(24, 24);
- this.expandScriptTextButton.TabIndex = 28;
- this.expandScriptTextButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.expandScriptTextButton.UseVisualStyleBackColor = true;
- this.expandScriptTextButton.Click += new System.EventHandler(this.ScriptEditorExpandButton_Click);
- //
- // compressScriptTextButton
- //
- this.compressScriptTextButton.Image = global::DSPRE.Properties.Resources.compressArrow;
- this.compressScriptTextButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.compressScriptTextButton.Location = new System.Drawing.Point(1135, 11);
- this.compressScriptTextButton.Name = "compressScriptTextButton";
- this.compressScriptTextButton.Size = new System.Drawing.Size(24, 24);
- this.compressScriptTextButton.TabIndex = 29;
- this.compressScriptTextButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.compressScriptTextButton.UseVisualStyleBackColor = true;
- this.compressScriptTextButton.Click += new System.EventHandler(this.ScriptEditorCollapseButton_Click);
- //
- // scriptEditorWordWrapCheckbox
- //
- this.scriptEditorWordWrapCheckbox.Appearance = System.Windows.Forms.Appearance.Button;
- this.scriptEditorWordWrapCheckbox.AutoSize = true;
- this.scriptEditorWordWrapCheckbox.Checked = true;
- this.scriptEditorWordWrapCheckbox.CheckState = System.Windows.Forms.CheckState.Checked;
- this.scriptEditorWordWrapCheckbox.Location = new System.Drawing.Point(907, 12);
- this.scriptEditorWordWrapCheckbox.Name = "scriptEditorWordWrapCheckbox";
- this.scriptEditorWordWrapCheckbox.Size = new System.Drawing.Size(72, 23);
- this.scriptEditorWordWrapCheckbox.TabIndex = 25;
- this.scriptEditorWordWrapCheckbox.Text = "Word Wrap";
- this.scriptEditorWordWrapCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- this.scriptEditorWordWrapCheckbox.UseVisualStyleBackColor = true;
- this.scriptEditorWordWrapCheckbox.CheckedChanged += new System.EventHandler(this.scriptEditorWordWrapCheckbox_CheckedChanged);
- //
- // scriptEditorWhitespacesCheckbox
- //
- this.scriptEditorWhitespacesCheckbox.Appearance = System.Windows.Forms.Appearance.Button;
- this.scriptEditorWhitespacesCheckbox.AutoSize = true;
- this.scriptEditorWhitespacesCheckbox.Location = new System.Drawing.Point(981, 12);
- this.scriptEditorWhitespacesCheckbox.Name = "scriptEditorWhitespacesCheckbox";
- this.scriptEditorWhitespacesCheckbox.Size = new System.Drawing.Size(79, 23);
- this.scriptEditorWhitespacesCheckbox.TabIndex = 26;
- this.scriptEditorWhitespacesCheckbox.Text = "Whitespaces";
- this.scriptEditorWhitespacesCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- this.scriptEditorWhitespacesCheckbox.UseVisualStyleBackColor = true;
- this.scriptEditorWhitespacesCheckbox.CheckedChanged += new System.EventHandler(this.viewWhiteSpacesButton_Click);
- //
- // groupBox26
- //
- this.groupBox26.Controls.Add(this.scriptEditorNumberFormatNoPreference);
- this.groupBox26.Controls.Add(this.scriptEditorNumberFormatDecimal);
- this.groupBox26.Controls.Add(this.scriptEditorNumberFormatHex);
- this.groupBox26.Location = new System.Drawing.Point(700, 4);
- this.groupBox26.Name = "groupBox26";
- this.groupBox26.Size = new System.Drawing.Size(190, 36);
- this.groupBox26.TabIndex = 50;
- this.groupBox26.TabStop = false;
- this.groupBox26.Text = "Number Format Preference";
- //
- // scriptEditorNumberFormatNoPreference
- //
- this.scriptEditorNumberFormatNoPreference.AutoSize = true;
- this.scriptEditorNumberFormatNoPreference.Checked = true;
- this.scriptEditorNumberFormatNoPreference.Location = new System.Drawing.Point(11, 14);
- this.scriptEditorNumberFormatNoPreference.Name = "scriptEditorNumberFormatNoPreference";
- this.scriptEditorNumberFormatNoPreference.Size = new System.Drawing.Size(47, 17);
- this.scriptEditorNumberFormatNoPreference.TabIndex = 22;
- this.scriptEditorNumberFormatNoPreference.TabStop = true;
- this.scriptEditorNumberFormatNoPreference.Text = "Auto";
- this.scriptEditorNumberFormatNoPreference.UseVisualStyleBackColor = true;
- this.scriptEditorNumberFormatNoPreference.CheckedChanged += new System.EventHandler(this.UpdateScriptNumberFormatNoPref);
- //
- // scriptEditorNumberFormatDecimal
- //
- this.scriptEditorNumberFormatDecimal.AutoSize = true;
- this.scriptEditorNumberFormatDecimal.Location = new System.Drawing.Point(121, 14);
- this.scriptEditorNumberFormatDecimal.Name = "scriptEditorNumberFormatDecimal";
- this.scriptEditorNumberFormatDecimal.Size = new System.Drawing.Size(63, 17);
- this.scriptEditorNumberFormatDecimal.TabIndex = 24;
- this.scriptEditorNumberFormatDecimal.Text = "Decimal";
- this.scriptEditorNumberFormatDecimal.UseVisualStyleBackColor = true;
- this.scriptEditorNumberFormatDecimal.CheckedChanged += new System.EventHandler(this.UpdateScriptNumberFormatDec);
- //
- // scriptEditorNumberFormatHex
- //
- this.scriptEditorNumberFormatHex.AutoSize = true;
- this.scriptEditorNumberFormatHex.Location = new System.Drawing.Point(68, 14);
- this.scriptEditorNumberFormatHex.Name = "scriptEditorNumberFormatHex";
- this.scriptEditorNumberFormatHex.Size = new System.Drawing.Size(44, 17);
- this.scriptEditorNumberFormatHex.TabIndex = 23;
- this.scriptEditorNumberFormatHex.Text = "Hex";
- this.scriptEditorNumberFormatHex.UseVisualStyleBackColor = true;
- this.scriptEditorNumberFormatHex.CheckedChanged += new System.EventHandler(this.UpdateScriptNumberFormatHex);
- //
- // viewLevelScriptButton
- //
- this.viewLevelScriptButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.viewLevelScriptButton.Location = new System.Drawing.Point(481, 681);
- this.viewLevelScriptButton.Name = "viewLevelScriptButton";
- this.viewLevelScriptButton.Size = new System.Drawing.Size(91, 25);
- this.viewLevelScriptButton.TabIndex = 6;
- this.viewLevelScriptButton.Text = "View level script";
- this.viewLevelScriptButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.viewLevelScriptButton.UseVisualStyleBackColor = true;
- this.viewLevelScriptButton.Click += new System.EventHandler(this.viewLevelScriptButton_Click);
- //
- // locateCurrentScriptFile
- //
- this.locateCurrentScriptFile.Image = global::DSPRE.Properties.Resources.open_file;
- this.locateCurrentScriptFile.Location = new System.Drawing.Point(423, 29);
- this.locateCurrentScriptFile.Name = "locateCurrentScriptFile";
- this.locateCurrentScriptFile.Size = new System.Drawing.Size(42, 40);
- this.locateCurrentScriptFile.TabIndex = 7;
- this.locateCurrentScriptFile.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.locateCurrentScriptFile.UseVisualStyleBackColor = true;
- this.locateCurrentScriptFile.Click += new System.EventHandler(this.locateCurrentScriptFile_Click);
- //
- // ScriptEditor
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.locateCurrentScriptFile);
- this.Controls.Add(this.groupBox24);
- this.Controls.Add(this.viewLevelScriptButton);
- this.Controls.Add(this.selectScriptFileComboBox);
- this.Controls.Add(this.groupBox26);
- this.Controls.Add(this.label5);
- this.Controls.Add(this.scriptEditorWhitespacesCheckbox);
- this.Controls.Add(this.scriptEditorWordWrapCheckbox);
- this.Controls.Add(this.addScriptFileButton);
- this.Controls.Add(this.compressScriptTextButton);
- this.Controls.Add(this.removeScriptFileButton);
- this.Controls.Add(this.expandScriptTextButton);
- this.Controls.Add(this.saveScriptFileButton);
- this.Controls.Add(this.openFindScriptEditorButton);
- this.Controls.Add(this.exportScriptFileButton);
- this.Controls.Add(this.importScriptFileButton);
- this.Controls.Add(this.groupBox8);
- this.Controls.Add(this.scriptEditorTabControl);
- this.Name = "ScriptEditor";
- this.Size = new System.Drawing.Size(1177, 735);
- this.scriptEditorTabControl.ResumeLayout(false);
- this.scriptsTabPage.ResumeLayout(false);
- this.PanelSearchScripts.ResumeLayout(false);
- this.PanelSearchScripts.PerformLayout();
- this.functionsTabPage.ResumeLayout(false);
- this.PanelSearchFunctions.ResumeLayout(false);
- this.PanelSearchFunctions.PerformLayout();
- this.actionsTabPage.ResumeLayout(false);
- this.PanelSearchActions.ResumeLayout(false);
- this.PanelSearchActions.PerformLayout();
- this.groupBox8.ResumeLayout(false);
- this.groupBox8.PerformLayout();
- this.groupBox24.ResumeLayout(false);
- this.ScriptNavigatorTabControl.ResumeLayout(false);
- this.ScriptsNavTab.ResumeLayout(false);
- this.FunctionsNavTab.ResumeLayout(false);
- this.ActionsNavTab.ResumeLayout(false);
- this.groupBox26.ResumeLayout(false);
- this.groupBox26.PerformLayout();
- this.ResumeLayout(false);
- this.PerformLayout();
+ this.selectScriptFileComboBox = new System.Windows.Forms.ComboBox();
+ this.label5 = new System.Windows.Forms.Label();
+ this.PanelSearchScripts = new System.Windows.Forms.Panel();
+ this.BtnNextFindScript = new System.Windows.Forms.Button();
+ this.BtnPrevFindScript = new System.Windows.Forms.Button();
+ this.BtnCloseFindScript = new System.Windows.Forms.Button();
+ this.panelFindScriptTextBox = new System.Windows.Forms.TextBox();
+ this.scintillaScriptsPanel = new System.Windows.Forms.Panel();
+ this.addScriptFileButton = new System.Windows.Forms.Button();
+ this.removeScriptFileButton = new System.Windows.Forms.Button();
+ this.saveScriptFileButton = new System.Windows.Forms.Button();
+ this.exportScriptFileButton = new System.Windows.Forms.Button();
+ this.importScriptFileButton = new System.Windows.Forms.Button();
+ this.groupBox8 = new System.Windows.Forms.GroupBox();
+ this.searchInScriptsButton = new System.Windows.Forms.Button();
+ this.searchOnlyCurrentScriptCheckBox = new System.Windows.Forms.CheckBox();
+ this.scrollToBlockStartcheckBox = new System.Windows.Forms.CheckBox();
+ this.scriptSearchCaseSensitiveCheckBox = new System.Windows.Forms.CheckBox();
+ this.searchInScriptsTextBox = new System.Windows.Forms.TextBox();
+ this.label31 = new System.Windows.Forms.Label();
+ this.searchProgressBar = new System.Windows.Forms.ProgressBar();
+ this.label30 = new System.Windows.Forms.Label();
+ this.label29 = new System.Windows.Forms.Label();
+ this.searchInScriptsResultListBox = new System.Windows.Forms.ListBox();
+ this.groupBox24 = new System.Windows.Forms.GroupBox();
+ this.ScriptNavigatorTabControl = new System.Windows.Forms.TabControl();
+ this.ScriptsNavTab = new System.Windows.Forms.TabPage();
+ this.scriptsNavListbox = new System.Windows.Forms.ListBox();
+ this.FunctionsNavTab = new System.Windows.Forms.TabPage();
+ this.functionsNavListbox = new System.Windows.Forms.ListBox();
+ this.ActionsNavTab = new System.Windows.Forms.TabPage();
+ this.actionsNavListbox = new System.Windows.Forms.ListBox();
+ this.openFindScriptEditorButton = new System.Windows.Forms.Button();
+ this.expandScriptTextButton = new System.Windows.Forms.Button();
+ this.compressScriptTextButton = new System.Windows.Forms.Button();
+ this.scriptEditorWordWrapCheckbox = new System.Windows.Forms.CheckBox();
+ this.scriptEditorWhitespacesCheckbox = new System.Windows.Forms.CheckBox();
+ this.groupBox26 = new System.Windows.Forms.GroupBox();
+ this.scriptEditorNumberFormatNoPreference = new System.Windows.Forms.RadioButton();
+ this.scriptEditorNumberFormatDecimal = new System.Windows.Forms.RadioButton();
+ this.scriptEditorNumberFormatHex = new System.Windows.Forms.RadioButton();
+ this.viewLevelScriptButton = new System.Windows.Forms.Button();
+ this.locateCurrentScriptFile = new System.Windows.Forms.Button();
+ this.PanelSearchScripts.SuspendLayout();
+ this.scintillaScriptsPanel.SuspendLayout();
+ this.groupBox8.SuspendLayout();
+ this.groupBox24.SuspendLayout();
+ this.ScriptNavigatorTabControl.SuspendLayout();
+ this.ScriptsNavTab.SuspendLayout();
+ this.FunctionsNavTab.SuspendLayout();
+ this.ActionsNavTab.SuspendLayout();
+ this.groupBox26.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // selectScriptFileComboBox
+ //
+ this.selectScriptFileComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.selectScriptFileComboBox.FormattingEnabled = true;
+ this.selectScriptFileComboBox.Location = new System.Drawing.Point(7, 24);
+ this.selectScriptFileComboBox.Name = "selectScriptFileComboBox";
+ this.selectScriptFileComboBox.Size = new System.Drawing.Size(152, 21);
+ this.selectScriptFileComboBox.TabIndex = 0;
+ this.selectScriptFileComboBox.SelectedIndexChanged += new System.EventHandler(this.selectScriptFileComboBox_SelectedIndexChanged);
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(5, 8);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(53, 13);
+ this.label5.TabIndex = 1;
+ this.label5.Text = "Script File";
+ //
+ // PanelSearchScripts
+ //
+ this.PanelSearchScripts.BackColor = System.Drawing.Color.White;
+ this.PanelSearchScripts.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.PanelSearchScripts.Controls.Add(this.BtnNextFindScript);
+ this.PanelSearchScripts.Controls.Add(this.BtnPrevFindScript);
+ this.PanelSearchScripts.Controls.Add(this.BtnCloseFindScript);
+ this.PanelSearchScripts.Controls.Add(this.panelFindScriptTextBox);
+ this.PanelSearchScripts.Location = new System.Drawing.Point(383, 3);
+ this.PanelSearchScripts.Name = "PanelSearchScripts";
+ this.PanelSearchScripts.Size = new System.Drawing.Size(292, 40);
+ this.PanelSearchScripts.TabIndex = 14;
+ this.PanelSearchScripts.Visible = false;
+ //
+ // BtnNextFindScript
+ //
+ this.BtnNextFindScript.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.BtnNextFindScript.ForeColor = System.Drawing.Color.White;
+ this.BtnNextFindScript.Image = global::DSPRE.Properties.Resources.arrowdown;
+ this.BtnNextFindScript.Location = new System.Drawing.Point(233, 4);
+ this.BtnNextFindScript.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+ this.BtnNextFindScript.Name = "BtnNextFindScript";
+ this.BtnNextFindScript.Size = new System.Drawing.Size(25, 30);
+ this.BtnNextFindScript.TabIndex = 32;
+ this.BtnNextFindScript.Tag = "Find next (Enter)";
+ this.BtnNextFindScript.UseVisualStyleBackColor = true;
+ this.BtnNextFindScript.Click += new System.EventHandler(this.BtnNextFindScript_Click);
+ //
+ // BtnPrevFindScript
+ //
+ this.BtnPrevFindScript.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.BtnPrevFindScript.ForeColor = System.Drawing.Color.White;
+ this.BtnPrevFindScript.Image = global::DSPRE.Properties.Resources.arrowup;
+ this.BtnPrevFindScript.Location = new System.Drawing.Point(205, 4);
+ this.BtnPrevFindScript.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+ this.BtnPrevFindScript.Name = "BtnPrevFindScript";
+ this.BtnPrevFindScript.Size = new System.Drawing.Size(25, 30);
+ this.BtnPrevFindScript.TabIndex = 31;
+ this.BtnPrevFindScript.Tag = "Find previous (Shift+Enter)";
+ this.BtnPrevFindScript.UseVisualStyleBackColor = true;
+ this.BtnPrevFindScript.Click += new System.EventHandler(this.BtnPrevFindScript_Click);
+ //
+ // BtnCloseFindScript
+ //
+ this.BtnCloseFindScript.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.BtnCloseFindScript.ForeColor = System.Drawing.Color.White;
+ this.BtnCloseFindScript.Image = global::DSPRE.Properties.Resources.Cross;
+ this.BtnCloseFindScript.Location = new System.Drawing.Point(261, 4);
+ this.BtnCloseFindScript.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+ this.BtnCloseFindScript.Name = "BtnCloseFindScript";
+ this.BtnCloseFindScript.Size = new System.Drawing.Size(25, 30);
+ this.BtnCloseFindScript.TabIndex = 33;
+ this.BtnCloseFindScript.Tag = "Close (Esc)";
+ this.BtnCloseFindScript.UseVisualStyleBackColor = true;
+ this.BtnCloseFindScript.Click += new System.EventHandler(this.BtnCloseFindScript_Click);
+ //
+ // panelFindScriptTextBox
+ //
+ this.panelFindScriptTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.panelFindScriptTextBox.Font = new System.Drawing.Font("Segoe UI", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.panelFindScriptTextBox.Location = new System.Drawing.Point(10, 6);
+ this.panelFindScriptTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+ this.panelFindScriptTextBox.Name = "panelFindScriptTextBox";
+ this.panelFindScriptTextBox.Size = new System.Drawing.Size(189, 25);
+ this.panelFindScriptTextBox.TabIndex = 30;
+ this.panelFindScriptTextBox.TextChanged += new System.EventHandler(this.panelFindScriptTextBox_TextChanged);
+ this.panelFindScriptTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.scriptTxtFind_KeyDown);
+ //
+ // scintillaScriptsPanel
+ //
+ this.scintillaScriptsPanel.Controls.Add(this.PanelSearchScripts);
+ this.scintillaScriptsPanel.Location = new System.Drawing.Point(483, 50);
+ this.scintillaScriptsPanel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+ this.scintillaScriptsPanel.Name = "scintillaScriptsPanel";
+ this.scintillaScriptsPanel.Size = new System.Drawing.Size(678, 559);
+ this.scintillaScriptsPanel.TabIndex = 19;
+ //
+ // addScriptFileButton
+ //
+ this.addScriptFileButton.Image = global::DSPRE.Properties.Resources.addIcon;
+ this.addScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.addScriptFileButton.Location = new System.Drawing.Point(369, 667);
+ this.addScriptFileButton.Name = "addScriptFileButton";
+ this.addScriptFileButton.Size = new System.Drawing.Size(106, 25);
+ this.addScriptFileButton.TabIndex = 4;
+ this.addScriptFileButton.Text = "Add Script File";
+ this.addScriptFileButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.addScriptFileButton.UseVisualStyleBackColor = true;
+ this.addScriptFileButton.Click += new System.EventHandler(this.addScriptFileButton_Click);
+ //
+ // removeScriptFileButton
+ //
+ this.removeScriptFileButton.Image = global::DSPRE.Properties.Resources.deleteIcon;
+ this.removeScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.removeScriptFileButton.Location = new System.Drawing.Point(369, 694);
+ this.removeScriptFileButton.Name = "removeScriptFileButton";
+ this.removeScriptFileButton.Size = new System.Drawing.Size(106, 25);
+ this.removeScriptFileButton.TabIndex = 5;
+ this.removeScriptFileButton.Text = "Remove Last";
+ this.removeScriptFileButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.removeScriptFileButton.UseVisualStyleBackColor = true;
+ this.removeScriptFileButton.Click += new System.EventHandler(this.removeScriptFileButton_Click);
+ //
+ // saveScriptFileButton
+ //
+ this.saveScriptFileButton.Image = global::DSPRE.Properties.Resources.saveButton;
+ this.saveScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.saveScriptFileButton.Location = new System.Drawing.Point(6, 50);
+ this.saveScriptFileButton.Name = "saveScriptFileButton";
+ this.saveScriptFileButton.Size = new System.Drawing.Size(154, 23);
+ this.saveScriptFileButton.TabIndex = 1;
+ this.saveScriptFileButton.Text = "&Save Current File";
+ this.saveScriptFileButton.UseVisualStyleBackColor = true;
+ this.saveScriptFileButton.Click += new System.EventHandler(this.saveScriptFileButton_Click);
+ //
+ // exportScriptFileButton
+ //
+ this.exportScriptFileButton.Image = global::DSPRE.Properties.Resources.exportArrow;
+ this.exportScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.exportScriptFileButton.Location = new System.Drawing.Point(294, 667);
+ this.exportScriptFileButton.Name = "exportScriptFileButton";
+ this.exportScriptFileButton.Size = new System.Drawing.Size(70, 52);
+ this.exportScriptFileButton.TabIndex = 3;
+ this.exportScriptFileButton.Text = "&Export \r\nFile";
+ this.exportScriptFileButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.exportScriptFileButton.UseVisualStyleBackColor = true;
+ this.exportScriptFileButton.Click += new System.EventHandler(this.exportScriptFileButton_Click);
+ //
+ // importScriptFileButton
+ //
+ this.importScriptFileButton.Image = global::DSPRE.Properties.Resources.importArrow;
+ this.importScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.importScriptFileButton.Location = new System.Drawing.Point(219, 667);
+ this.importScriptFileButton.Name = "importScriptFileButton";
+ this.importScriptFileButton.Size = new System.Drawing.Size(70, 52);
+ this.importScriptFileButton.TabIndex = 2;
+ this.importScriptFileButton.Text = "&Import\r\nFile";
+ this.importScriptFileButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.importScriptFileButton.UseVisualStyleBackColor = true;
+ this.importScriptFileButton.Click += new System.EventHandler(this.importScriptFileButton_Click);
+ //
+ // groupBox8
+ //
+ this.groupBox8.Controls.Add(this.searchInScriptsButton);
+ this.groupBox8.Controls.Add(this.searchOnlyCurrentScriptCheckBox);
+ this.groupBox8.Controls.Add(this.scrollToBlockStartcheckBox);
+ this.groupBox8.Controls.Add(this.scriptSearchCaseSensitiveCheckBox);
+ this.groupBox8.Controls.Add(this.searchInScriptsTextBox);
+ this.groupBox8.Controls.Add(this.label31);
+ this.groupBox8.Controls.Add(this.searchProgressBar);
+ this.groupBox8.Controls.Add(this.label30);
+ this.groupBox8.Controls.Add(this.label29);
+ this.groupBox8.Controls.Add(this.searchInScriptsResultListBox);
+ this.groupBox8.Location = new System.Drawing.Point(2, 315);
+ this.groupBox8.Name = "groupBox8";
+ this.groupBox8.Size = new System.Drawing.Size(472, 298);
+ this.groupBox8.TabIndex = 18;
+ this.groupBox8.TabStop = false;
+ this.groupBox8.Text = "Search for commands:";
+ //
+ // searchInScriptsButton
+ //
+ this.searchInScriptsButton.Image = global::DSPRE.Properties.Resources.SearchMiniIcon;
+ this.searchInScriptsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.searchInScriptsButton.Location = new System.Drawing.Point(272, 27);
+ this.searchInScriptsButton.Name = "searchInScriptsButton";
+ this.searchInScriptsButton.Size = new System.Drawing.Size(69, 36);
+ this.searchInScriptsButton.TabIndex = 13;
+ this.searchInScriptsButton.Text = "Search";
+ this.searchInScriptsButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.searchInScriptsButton.UseVisualStyleBackColor = true;
+ this.searchInScriptsButton.Click += new System.EventHandler(this.searchInScriptsButton_Click);
+ //
+ // searchOnlyCurrentScriptCheckBox
+ //
+ this.searchOnlyCurrentScriptCheckBox.AutoSize = true;
+ this.searchOnlyCurrentScriptCheckBox.Location = new System.Drawing.Point(347, 15);
+ this.searchOnlyCurrentScriptCheckBox.Name = "searchOnlyCurrentScriptCheckBox";
+ this.searchOnlyCurrentScriptCheckBox.Size = new System.Drawing.Size(84, 17);
+ this.searchOnlyCurrentScriptCheckBox.TabIndex = 14;
+ this.searchOnlyCurrentScriptCheckBox.Text = "Only Current";
+ this.searchOnlyCurrentScriptCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.searchOnlyCurrentScriptCheckBox.UseVisualStyleBackColor = true;
+ //
+ // scrollToBlockStartcheckBox
+ //
+ this.scrollToBlockStartcheckBox.AutoSize = true;
+ this.scrollToBlockStartcheckBox.Location = new System.Drawing.Point(347, 61);
+ this.scrollToBlockStartcheckBox.Name = "scrollToBlockStartcheckBox";
+ this.scrollToBlockStartcheckBox.Size = new System.Drawing.Size(116, 17);
+ this.scrollToBlockStartcheckBox.TabIndex = 16;
+ this.scrollToBlockStartcheckBox.Text = "Scroll to block start";
+ this.scrollToBlockStartcheckBox.UseVisualStyleBackColor = true;
+ //
+ // scriptSearchCaseSensitiveCheckBox
+ //
+ this.scriptSearchCaseSensitiveCheckBox.AutoSize = true;
+ this.scriptSearchCaseSensitiveCheckBox.Location = new System.Drawing.Point(347, 38);
+ this.scriptSearchCaseSensitiveCheckBox.Name = "scriptSearchCaseSensitiveCheckBox";
+ this.scriptSearchCaseSensitiveCheckBox.Size = new System.Drawing.Size(83, 17);
+ this.scriptSearchCaseSensitiveCheckBox.TabIndex = 15;
+ this.scriptSearchCaseSensitiveCheckBox.Text = "Match Case";
+ this.scriptSearchCaseSensitiveCheckBox.UseVisualStyleBackColor = true;
+ //
+ // searchInScriptsTextBox
+ //
+ this.searchInScriptsTextBox.Location = new System.Drawing.Point(11, 36);
+ this.searchInScriptsTextBox.Name = "searchInScriptsTextBox";
+ this.searchInScriptsTextBox.Size = new System.Drawing.Size(255, 20);
+ this.searchInScriptsTextBox.TabIndex = 12;
+ this.searchInScriptsTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.searchInScriptsTextBox_KeyDown);
+ //
+ // label31
+ //
+ this.label31.AutoSize = true;
+ this.label31.Location = new System.Drawing.Point(11, 261);
+ this.label31.Name = "label31";
+ this.label31.Size = new System.Drawing.Size(48, 13);
+ this.label31.TabIndex = 37;
+ this.label31.Text = "Progress";
+ //
+ // searchProgressBar
+ //
+ this.searchProgressBar.Location = new System.Drawing.Point(11, 277);
+ this.searchProgressBar.Name = "searchProgressBar";
+ this.searchProgressBar.Size = new System.Drawing.Size(452, 14);
+ this.searchProgressBar.TabIndex = 36;
+ //
+ // label30
+ //
+ this.label30.AutoSize = true;
+ this.label30.Location = new System.Drawing.Point(11, 68);
+ this.label30.Name = "label30";
+ this.label30.Size = new System.Drawing.Size(42, 13);
+ this.label30.TabIndex = 35;
+ this.label30.Text = "Results";
+ //
+ // label29
+ //
+ this.label29.AutoSize = true;
+ this.label29.Location = new System.Drawing.Point(11, 20);
+ this.label29.Name = "label29";
+ this.label29.Size = new System.Drawing.Size(77, 13);
+ this.label29.TabIndex = 33;
+ this.label29.Text = "Line to search:";
+ //
+ // searchInScriptsResultListBox
+ //
+ this.searchInScriptsResultListBox.Location = new System.Drawing.Point(11, 84);
+ this.searchInScriptsResultListBox.Name = "searchInScriptsResultListBox";
+ this.searchInScriptsResultListBox.Size = new System.Drawing.Size(452, 173);
+ this.searchInScriptsResultListBox.TabIndex = 17;
+ this.searchInScriptsResultListBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.searchInScriptsResultListBox_KeyDown);
+ this.searchInScriptsResultListBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.searchInScripts_GoToEntryResult);
+ //
+ // groupBox24
+ //
+ this.groupBox24.Controls.Add(this.ScriptNavigatorTabControl);
+ this.groupBox24.Location = new System.Drawing.Point(3, 75);
+ this.groupBox24.Name = "groupBox24";
+ this.groupBox24.Size = new System.Drawing.Size(472, 234);
+ this.groupBox24.TabIndex = 42;
+ this.groupBox24.TabStop = false;
+ this.groupBox24.Text = "Navigator";
+ //
+ // ScriptNavigatorTabControl
+ //
+ this.ScriptNavigatorTabControl.Controls.Add(this.ScriptsNavTab);
+ this.ScriptNavigatorTabControl.Controls.Add(this.FunctionsNavTab);
+ this.ScriptNavigatorTabControl.Controls.Add(this.ActionsNavTab);
+ this.ScriptNavigatorTabControl.Location = new System.Drawing.Point(6, 16);
+ this.ScriptNavigatorTabControl.Name = "ScriptNavigatorTabControl";
+ this.ScriptNavigatorTabControl.SelectedIndex = 0;
+ this.ScriptNavigatorTabControl.Size = new System.Drawing.Size(456, 209);
+ this.ScriptNavigatorTabControl.TabIndex = 8;
+ //
+ // ScriptsNavTab
+ //
+ this.ScriptsNavTab.Controls.Add(this.scriptsNavListbox);
+ this.ScriptsNavTab.Location = new System.Drawing.Point(4, 22);
+ this.ScriptsNavTab.Name = "ScriptsNavTab";
+ this.ScriptsNavTab.Padding = new System.Windows.Forms.Padding(3);
+ this.ScriptsNavTab.Size = new System.Drawing.Size(448, 183);
+ this.ScriptsNavTab.TabIndex = 0;
+ this.ScriptsNavTab.Text = "Scripts";
+ this.ScriptsNavTab.UseVisualStyleBackColor = true;
+ //
+ // scriptsNavListbox
+ //
+ this.scriptsNavListbox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.scriptsNavListbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.scriptsNavListbox.ItemHeight = 15;
+ this.scriptsNavListbox.Location = new System.Drawing.Point(3, 3);
+ this.scriptsNavListbox.Name = "scriptsNavListbox";
+ this.scriptsNavListbox.Size = new System.Drawing.Size(442, 177);
+ this.scriptsNavListbox.TabIndex = 9;
+ this.scriptsNavListbox.SelectedIndexChanged += new System.EventHandler(this.scriptsNavListbox_SelectedIndexChanged);
+ //
+ // FunctionsNavTab
+ //
+ this.FunctionsNavTab.Controls.Add(this.functionsNavListbox);
+ this.FunctionsNavTab.Location = new System.Drawing.Point(4, 22);
+ this.FunctionsNavTab.Name = "FunctionsNavTab";
+ this.FunctionsNavTab.Padding = new System.Windows.Forms.Padding(3);
+ this.FunctionsNavTab.Size = new System.Drawing.Size(448, 183);
+ this.FunctionsNavTab.TabIndex = 1;
+ this.FunctionsNavTab.Text = "Functions";
+ this.FunctionsNavTab.UseVisualStyleBackColor = true;
+ //
+ // functionsNavListbox
+ //
+ this.functionsNavListbox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.functionsNavListbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.functionsNavListbox.ItemHeight = 15;
+ this.functionsNavListbox.Location = new System.Drawing.Point(3, 3);
+ this.functionsNavListbox.Name = "functionsNavListbox";
+ this.functionsNavListbox.Size = new System.Drawing.Size(442, 177);
+ this.functionsNavListbox.TabIndex = 10;
+ this.functionsNavListbox.SelectedIndexChanged += new System.EventHandler(this.functionsNavListbox_SelectedIndexChanged);
+ //
+ // ActionsNavTab
+ //
+ this.ActionsNavTab.Controls.Add(this.actionsNavListbox);
+ this.ActionsNavTab.Location = new System.Drawing.Point(4, 22);
+ this.ActionsNavTab.Name = "ActionsNavTab";
+ this.ActionsNavTab.Padding = new System.Windows.Forms.Padding(3);
+ this.ActionsNavTab.Size = new System.Drawing.Size(448, 183);
+ this.ActionsNavTab.TabIndex = 2;
+ this.ActionsNavTab.Text = "Actions";
+ this.ActionsNavTab.UseVisualStyleBackColor = true;
+ //
+ // actionsNavListbox
+ //
+ this.actionsNavListbox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.actionsNavListbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.actionsNavListbox.ItemHeight = 15;
+ this.actionsNavListbox.Location = new System.Drawing.Point(3, 3);
+ this.actionsNavListbox.Name = "actionsNavListbox";
+ this.actionsNavListbox.Size = new System.Drawing.Size(442, 177);
+ this.actionsNavListbox.TabIndex = 11;
+ this.actionsNavListbox.SelectedIndexChanged += new System.EventHandler(this.actionsNavListbox_SelectedIndexChanged);
+ //
+ // openFindScriptEditorButton
+ //
+ this.openFindScriptEditorButton.Image = global::DSPRE.Properties.Resources.SearchMiniIcon;
+ this.openFindScriptEditorButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.openFindScriptEditorButton.Location = new System.Drawing.Point(1079, 11);
+ this.openFindScriptEditorButton.Name = "openFindScriptEditorButton";
+ this.openFindScriptEditorButton.Size = new System.Drawing.Size(24, 24);
+ this.openFindScriptEditorButton.TabIndex = 27;
+ this.openFindScriptEditorButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.openFindScriptEditorButton.UseVisualStyleBackColor = true;
+ this.openFindScriptEditorButton.Click += new System.EventHandler(this.openFindScriptEditorButton_Click);
+ //
+ // expandScriptTextButton
+ //
+ this.expandScriptTextButton.Image = global::DSPRE.Properties.Resources.expandArrow;
+ this.expandScriptTextButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.expandScriptTextButton.Location = new System.Drawing.Point(1107, 11);
+ this.expandScriptTextButton.Name = "expandScriptTextButton";
+ this.expandScriptTextButton.Size = new System.Drawing.Size(24, 24);
+ this.expandScriptTextButton.TabIndex = 28;
+ this.expandScriptTextButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.expandScriptTextButton.UseVisualStyleBackColor = true;
+ this.expandScriptTextButton.Click += new System.EventHandler(this.ScriptEditorExpandButton_Click);
+ //
+ // compressScriptTextButton
+ //
+ this.compressScriptTextButton.Image = global::DSPRE.Properties.Resources.compressArrow;
+ this.compressScriptTextButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.compressScriptTextButton.Location = new System.Drawing.Point(1135, 11);
+ this.compressScriptTextButton.Name = "compressScriptTextButton";
+ this.compressScriptTextButton.Size = new System.Drawing.Size(24, 24);
+ this.compressScriptTextButton.TabIndex = 29;
+ this.compressScriptTextButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.compressScriptTextButton.UseVisualStyleBackColor = true;
+ this.compressScriptTextButton.Click += new System.EventHandler(this.ScriptEditorCollapseButton_Click);
+ //
+ // scriptEditorWordWrapCheckbox
+ //
+ this.scriptEditorWordWrapCheckbox.Appearance = System.Windows.Forms.Appearance.Button;
+ this.scriptEditorWordWrapCheckbox.AutoSize = true;
+ this.scriptEditorWordWrapCheckbox.Checked = true;
+ this.scriptEditorWordWrapCheckbox.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.scriptEditorWordWrapCheckbox.Location = new System.Drawing.Point(907, 12);
+ this.scriptEditorWordWrapCheckbox.Name = "scriptEditorWordWrapCheckbox";
+ this.scriptEditorWordWrapCheckbox.Size = new System.Drawing.Size(72, 23);
+ this.scriptEditorWordWrapCheckbox.TabIndex = 25;
+ this.scriptEditorWordWrapCheckbox.Text = "Word Wrap";
+ this.scriptEditorWordWrapCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.scriptEditorWordWrapCheckbox.UseVisualStyleBackColor = true;
+ this.scriptEditorWordWrapCheckbox.CheckedChanged += new System.EventHandler(this.scriptEditorWordWrapCheckbox_CheckedChanged);
+ //
+ // scriptEditorWhitespacesCheckbox
+ //
+ this.scriptEditorWhitespacesCheckbox.Appearance = System.Windows.Forms.Appearance.Button;
+ this.scriptEditorWhitespacesCheckbox.AutoSize = true;
+ this.scriptEditorWhitespacesCheckbox.Location = new System.Drawing.Point(981, 12);
+ this.scriptEditorWhitespacesCheckbox.Name = "scriptEditorWhitespacesCheckbox";
+ this.scriptEditorWhitespacesCheckbox.Size = new System.Drawing.Size(79, 23);
+ this.scriptEditorWhitespacesCheckbox.TabIndex = 26;
+ this.scriptEditorWhitespacesCheckbox.Text = "Whitespaces";
+ this.scriptEditorWhitespacesCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.scriptEditorWhitespacesCheckbox.UseVisualStyleBackColor = true;
+ this.scriptEditorWhitespacesCheckbox.CheckedChanged += new System.EventHandler(this.viewWhiteSpacesButton_Click);
+ //
+ // groupBox26
+ //
+ this.groupBox26.Controls.Add(this.scriptEditorNumberFormatNoPreference);
+ this.groupBox26.Controls.Add(this.scriptEditorNumberFormatDecimal);
+ this.groupBox26.Controls.Add(this.scriptEditorNumberFormatHex);
+ this.groupBox26.Location = new System.Drawing.Point(700, 4);
+ this.groupBox26.Name = "groupBox26";
+ this.groupBox26.Size = new System.Drawing.Size(190, 36);
+ this.groupBox26.TabIndex = 50;
+ this.groupBox26.TabStop = false;
+ this.groupBox26.Text = "Number Format Preference";
+ //
+ // scriptEditorNumberFormatNoPreference
+ //
+ this.scriptEditorNumberFormatNoPreference.AutoSize = true;
+ this.scriptEditorNumberFormatNoPreference.Checked = true;
+ this.scriptEditorNumberFormatNoPreference.Location = new System.Drawing.Point(11, 14);
+ this.scriptEditorNumberFormatNoPreference.Name = "scriptEditorNumberFormatNoPreference";
+ this.scriptEditorNumberFormatNoPreference.Size = new System.Drawing.Size(47, 17);
+ this.scriptEditorNumberFormatNoPreference.TabIndex = 22;
+ this.scriptEditorNumberFormatNoPreference.TabStop = true;
+ this.scriptEditorNumberFormatNoPreference.Text = "Auto";
+ this.scriptEditorNumberFormatNoPreference.UseVisualStyleBackColor = true;
+ this.scriptEditorNumberFormatNoPreference.CheckedChanged += new System.EventHandler(this.UpdateScriptNumberFormatNoPref);
+ //
+ // scriptEditorNumberFormatDecimal
+ //
+ this.scriptEditorNumberFormatDecimal.AutoSize = true;
+ this.scriptEditorNumberFormatDecimal.Location = new System.Drawing.Point(121, 14);
+ this.scriptEditorNumberFormatDecimal.Name = "scriptEditorNumberFormatDecimal";
+ this.scriptEditorNumberFormatDecimal.Size = new System.Drawing.Size(63, 17);
+ this.scriptEditorNumberFormatDecimal.TabIndex = 24;
+ this.scriptEditorNumberFormatDecimal.Text = "Decimal";
+ this.scriptEditorNumberFormatDecimal.UseVisualStyleBackColor = true;
+ this.scriptEditorNumberFormatDecimal.CheckedChanged += new System.EventHandler(this.UpdateScriptNumberFormatDec);
+ //
+ // scriptEditorNumberFormatHex
+ //
+ this.scriptEditorNumberFormatHex.AutoSize = true;
+ this.scriptEditorNumberFormatHex.Location = new System.Drawing.Point(68, 14);
+ this.scriptEditorNumberFormatHex.Name = "scriptEditorNumberFormatHex";
+ this.scriptEditorNumberFormatHex.Size = new System.Drawing.Size(44, 17);
+ this.scriptEditorNumberFormatHex.TabIndex = 23;
+ this.scriptEditorNumberFormatHex.Text = "Hex";
+ this.scriptEditorNumberFormatHex.UseVisualStyleBackColor = true;
+ this.scriptEditorNumberFormatHex.CheckedChanged += new System.EventHandler(this.UpdateScriptNumberFormatHex);
+ //
+ // viewLevelScriptButton
+ //
+ this.viewLevelScriptButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.viewLevelScriptButton.Location = new System.Drawing.Point(481, 681);
+ this.viewLevelScriptButton.Name = "viewLevelScriptButton";
+ this.viewLevelScriptButton.Size = new System.Drawing.Size(91, 25);
+ this.viewLevelScriptButton.TabIndex = 6;
+ this.viewLevelScriptButton.Text = "View level script";
+ this.viewLevelScriptButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.viewLevelScriptButton.UseVisualStyleBackColor = true;
+ this.viewLevelScriptButton.Click += new System.EventHandler(this.viewLevelScriptButton_Click);
+ //
+ // locateCurrentScriptFile
+ //
+ this.locateCurrentScriptFile.Image = global::DSPRE.Properties.Resources.open_file;
+ this.locateCurrentScriptFile.Location = new System.Drawing.Point(423, 29);
+ this.locateCurrentScriptFile.Name = "locateCurrentScriptFile";
+ this.locateCurrentScriptFile.Size = new System.Drawing.Size(42, 40);
+ this.locateCurrentScriptFile.TabIndex = 7;
+ this.locateCurrentScriptFile.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.locateCurrentScriptFile.UseVisualStyleBackColor = true;
+ this.locateCurrentScriptFile.Click += new System.EventHandler(this.locateCurrentScriptFile_Click);
+ //
+ // ScriptEditor
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.scintillaScriptsPanel);
+ this.Controls.Add(this.locateCurrentScriptFile);
+ this.Controls.Add(this.groupBox24);
+ this.Controls.Add(this.viewLevelScriptButton);
+ this.Controls.Add(this.selectScriptFileComboBox);
+ this.Controls.Add(this.groupBox26);
+ this.Controls.Add(this.label5);
+ this.Controls.Add(this.scriptEditorWhitespacesCheckbox);
+ this.Controls.Add(this.scriptEditorWordWrapCheckbox);
+ this.Controls.Add(this.addScriptFileButton);
+ this.Controls.Add(this.compressScriptTextButton);
+ this.Controls.Add(this.removeScriptFileButton);
+ this.Controls.Add(this.expandScriptTextButton);
+ this.Controls.Add(this.saveScriptFileButton);
+ this.Controls.Add(this.openFindScriptEditorButton);
+ this.Controls.Add(this.exportScriptFileButton);
+ this.Controls.Add(this.importScriptFileButton);
+ this.Controls.Add(this.groupBox8);
+ this.Name = "ScriptEditor";
+ this.Size = new System.Drawing.Size(1177, 735);
+ this.PanelSearchScripts.ResumeLayout(false);
+ this.PanelSearchScripts.PerformLayout();
+ this.scintillaScriptsPanel.ResumeLayout(false);
+ this.groupBox8.ResumeLayout(false);
+ this.groupBox8.PerformLayout();
+ this.groupBox24.ResumeLayout(false);
+ this.ScriptNavigatorTabControl.ResumeLayout(false);
+ this.ScriptsNavTab.ResumeLayout(false);
+ this.FunctionsNavTab.ResumeLayout(false);
+ this.ActionsNavTab.ResumeLayout(false);
+ this.groupBox26.ResumeLayout(false);
+ this.groupBox26.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -857,28 +624,12 @@ namespace DSPRE.Editors
public System.Windows.Forms.ComboBox selectScriptFileComboBox;
private System.Windows.Forms.Label label5;
- public System.Windows.Forms.TabControl scriptEditorTabControl;
- private System.Windows.Forms.TabPage scriptsTabPage;
private System.Windows.Forms.Panel PanelSearchScripts;
private System.Windows.Forms.Button BtnNextFindScript;
private System.Windows.Forms.Button BtnPrevFindScript;
private System.Windows.Forms.Button BtnCloseFindScript;
private System.Windows.Forms.TextBox panelFindScriptTextBox;
private System.Windows.Forms.Panel scintillaScriptsPanel;
- private System.Windows.Forms.TabPage functionsTabPage;
- private System.Windows.Forms.Panel PanelSearchFunctions;
- private System.Windows.Forms.Button BtnNextFindFunc;
- private System.Windows.Forms.Button BtnPrevFindFunc;
- private System.Windows.Forms.Button BtnCloseFindFunc;
- private System.Windows.Forms.TextBox panelFindFunctionTextBox;
- private System.Windows.Forms.Panel scintillaFunctionsPanel;
- private System.Windows.Forms.TabPage actionsTabPage;
- private System.Windows.Forms.Panel PanelSearchActions;
- private System.Windows.Forms.Button BtnNextFindActions;
- private System.Windows.Forms.Button BtnPrevFindActions;
- private System.Windows.Forms.Button BtnCloseFindActions;
- private System.Windows.Forms.TextBox panelFindActionTextBox;
- private System.Windows.Forms.Panel scintillaActionsPanel;
private System.Windows.Forms.Button addScriptFileButton;
private System.Windows.Forms.Button removeScriptFileButton;
private System.Windows.Forms.Button saveScriptFileButton;
diff --git a/DS_Map/Editors/ScriptEditor.cs b/DS_Map/Editors/ScriptEditor.cs
index 9e1a3d0..d55df6e 100644
--- a/DS_Map/Editors/ScriptEditor.cs
+++ b/DS_Map/Editors/ScriptEditor.cs
@@ -13,14 +13,8 @@ using System.Globalization;
namespace DSPRE.Editors {
public partial class ScriptEditor : UserControl {
public bool scriptEditorIsReady { get; set; } = false;
- private Scintilla ScriptTextArea;
- private Scintilla FunctionTextArea;
- private Scintilla ActionTextArea;
private SearchManager scriptSearchManager;
- private SearchManager functionSearchManager;
- private SearchManager actionSearchManager;
- private Scintilla currentScintillaEditor;
- private SearchManager currentSearchManager;
+ private Scintilla ScriptTextArea;
private bool scriptsDirty = false;
private bool functionsDirty = false;
private bool actionsDirty = false;
@@ -118,7 +112,6 @@ namespace DSPRE.Editors {
public void OpenScriptEditor(MainProgram parent, int scriptFileID) {
SetupScriptEditor(parent);
- scriptEditorTabControl.SelectedIndex = 0;
selectScriptFileComboBox.SelectedIndex = scriptFileID;
EditorPanels.mainTabControl.SelectedTab = EditorPanels.scriptEditorTabPage;
}
@@ -132,9 +125,6 @@ namespace DSPRE.Editors {
secondaryKeyWords = String.Join(" ", RomInfo.ScriptComparisonOperatorsDict.Values) +
" " + String.Join(" ", ScriptDatabase.specialOverworlds.Values) +
" " + String.Join(" ", ScriptDatabase.overworldDirections.Values) +
- " " + ScriptFile.ContainerTypes.Script.ToString() +
- " " + ScriptFile.ContainerTypes.Function.ToString() +
- " " + ScriptFile.ContainerTypes.Action.ToString() +
" " + Event.EventType.Overworld +
" " + Overworld.MovementCodeKW;
secondaryKeyWords += " " + secondaryKeyWords.ToUpper() + " " + secondaryKeyWords.ToLower();
@@ -145,52 +135,25 @@ namespace DSPRE.Editors {
scintillaScriptsPanel.Controls.Clear();
scintillaScriptsPanel.Controls.Add(ScriptTextArea);
- FunctionTextArea = new Scintilla();
- functionSearchManager = new SearchManager(EditorPanels.MainProgram, FunctionTextArea, panelFindFunctionTextBox, PanelSearchFunctions);
- scintillaFunctionsPanel.Controls.Clear();
- scintillaFunctionsPanel.Controls.Add(FunctionTextArea);
-
- ActionTextArea = new Scintilla();
- actionSearchManager = new SearchManager(EditorPanels.MainProgram, ActionTextArea, panelFindActionTextBox, PanelSearchActions);
- scintillaActionsPanel.Controls.Clear();
- scintillaActionsPanel.Controls.Add(ActionTextArea);
-
- currentScintillaEditor = ScriptTextArea;
- currentSearchManager = scriptSearchManager;
-
// BASIC CONFIG
ScriptTextArea.TextChanged += (OnTextChangedScript);
- FunctionTextArea.TextChanged += (OnTextChangedFunction);
- ActionTextArea.TextChanged += (OnTextChangedAction);
// INITIAL VIEW CONFIG
InitialViewConfig(ScriptTextArea);
- InitialViewConfig(FunctionTextArea);
- InitialViewConfig(ActionTextArea);
InitSyntaxColoring(ScriptTextArea);
- InitSyntaxColoring(FunctionTextArea);
- InitSyntaxColoring(ActionTextArea);
// NUMBER MARGIN
InitNumberMargin(ScriptTextArea, ScriptTextArea_MarginClick);
- InitNumberMargin(FunctionTextArea, FunctionTextArea_MarginClick);
- InitNumberMargin(ActionTextArea, ActionTextArea_MarginClick);
// BOOKMARK MARGIN
InitBookmarkMargin(ScriptTextArea);
- InitBookmarkMargin(FunctionTextArea);
- InitBookmarkMargin(ActionTextArea);
// CODE FOLDING MARGIN
InitCodeFolding(ScriptTextArea);
- InitCodeFolding(FunctionTextArea);
- InitCodeFolding(ActionTextArea);
// INIT HOTKEYS
InitHotkeys(ScriptTextArea, scriptSearchManager);
- InitHotkeys(FunctionTextArea, functionSearchManager);
- InitHotkeys(ActionTextArea, actionSearchManager);
// INIT TOOLTIPS DWELLING
/*
@@ -202,6 +165,8 @@ namespace DSPRE.Editors {
FunctionTextArea.DwellEnd += TextArea_DwellEnd;
FunctionTextArea.DwellStart += TextArea_DwellStart;
*/
+
+ // Style for prefixed words (label_*, script_*)
}
private void populate_selectScriptFileComboBox(int selectedIndex = 0) {
@@ -227,7 +192,6 @@ namespace DSPRE.Editors {
}
private void InitSyntaxColoring(Scintilla textArea) {
- // Configure the default style
textArea.StyleResetDefault();
textArea.Styles[Style.Default].Font = "Consolas";
textArea.Styles[Style.Default].Size = 12;
@@ -245,10 +209,62 @@ namespace DSPRE.Editors {
textArea.Styles[Style.Python.Word].ForeColor = Color.FromArgb(0x48A8EE);
textArea.Styles[Style.Python.Word2].ForeColor = Color.FromArgb(0xF98906);
+ // Set the lexer and keywords
textArea.Lexer = Lexer.Python;
-
textArea.SetKeywords(0, cmdKeyWords);
textArea.SetKeywords(1, secondaryKeyWords);
+
+ // Configure indicators for prefix highlighting
+ textArea.Indicators[0].Style = IndicatorStyle.TextFore;
+ textArea.Indicators[0].ForeColor = Color.FromArgb(0x8A2BE2); // Purple for label_*
+
+ textArea.Indicators[1].Style = IndicatorStyle.TextFore;
+ textArea.Indicators[1].ForeColor = Color.FromArgb(0x00CED1); // Cyan for script_*
+
+ // Apply the highlighting
+ textArea.TextChanged += (sender, e) => HighlightPrefixedWords(textArea);
+
+ // Initial highlighting
+ HighlightPrefixedWords(textArea);
+ }
+
+ private void HighlightPrefixedWords(Scintilla textArea) {
+ // Clear existing indicators
+ textArea.IndicatorCurrent = 0;
+ textArea.IndicatorClearRange(0, textArea.TextLength);
+ textArea.IndicatorCurrent = 1;
+ textArea.IndicatorClearRange(0, textArea.TextLength);
+
+ // Use Scintilla-specific regex syntax
+ // Enable regex mode
+ textArea.SearchFlags = SearchFlags.Regex;
+
+ // Search for label_* words
+ textArea.IndicatorCurrent = 0;
+ textArea.TargetStart = 0;
+ textArea.TargetEnd = textArea.TextLength;
+
+ // Using \< and \> for word boundaries in Scintilla
+ string labelPattern = "\\";
+
+ while (textArea.SearchInTarget(labelPattern) != -1) {
+ textArea.IndicatorFillRange(textArea.TargetStart, textArea.TargetEnd - textArea.TargetStart);
+ textArea.TargetStart = textArea.TargetEnd;
+ textArea.TargetEnd = textArea.TextLength;
+ }
+
+ // Search for script_* words
+ textArea.IndicatorCurrent = 1;
+ textArea.TargetStart = 0;
+ textArea.TargetEnd = textArea.TextLength;
+
+ string scriptPattern = "\\";
+
+ while (textArea.SearchInTarget(scriptPattern) != -1) {
+ textArea.IndicatorFillRange(textArea.TargetStart, textArea.TargetEnd - textArea.TargetStart);
+ textArea.TargetStart = textArea.TargetEnd;
+ textArea.TargetEnd = textArea.TextLength;
+ }
}
private void InitNumberMargin(Scintilla textArea, EventHandler textArea_MarginClick) {
@@ -372,10 +388,8 @@ namespace DSPRE.Editors {
private void ScriptEditorSetClean() {
Helpers.DisableHandlers();
- scriptsTabPage.Text = ScriptFile.ContainerTypes.Script.ToString() + "s";
- functionsTabPage.Text = ScriptFile.ContainerTypes.Function.ToString() + "s";
- actionsTabPage.Text = ScriptFile.ContainerTypes.Action.ToString() + "s";
- scriptsDirty = functionsDirty = actionsDirty = false;
+ //scriptsTabPage.Text = ScriptFile.ContainerTypes.Script.ToString() + "s";
+ scriptsDirty = false;
Helpers.EnableHandlers();
}
@@ -383,33 +397,13 @@ namespace DSPRE.Editors {
private void OnTextChangedScript(object sender, EventArgs e) {
ScriptTextArea.Margins[NUMBER_MARGIN].Width = ScriptTextArea.Lines.Count.ToString().Length * 13;
scriptsDirty = true;
- scriptsTabPage.Text = ScriptFile.ContainerTypes.Script.ToString() + "s" + "*";
- }
-
- private void OnTextChangedFunction(object sender, EventArgs e) {
- FunctionTextArea.Margins[NUMBER_MARGIN].Width = FunctionTextArea.Lines.Count.ToString().Length * 13;
- functionsDirty = true;
- functionsTabPage.Text = ScriptFile.ContainerTypes.Function.ToString() + "s" + "*";
- }
-
- private void OnTextChangedAction(object sender, EventArgs e) {
- ActionTextArea.Margins[NUMBER_MARGIN].Width = ActionTextArea.Lines.Count.ToString().Length * 13;
- actionsDirty = true;
- actionsTabPage.Text = ScriptFile.ContainerTypes.Action.ToString() + "s" + "*";
+ //scriptsTabPage.Text = ScriptFile.ContainerTypes.Script.ToString() + "s" + "*";
}
private void ScriptTextArea_MarginClick(object sender, MarginClickEventArgs e) {
MarginClick(ScriptTextArea, e);
}
- private void FunctionTextArea_MarginClick(object sender, MarginClickEventArgs e) {
- MarginClick(FunctionTextArea, e);
- }
-
- private void ActionTextArea_MarginClick(object sender, MarginClickEventArgs e) {
- MarginClick(ActionTextArea, e);
- }
-
private void MarginClick(Scintilla textArea, MarginClickEventArgs e) {
if (e.Margin == BOOKMARK_MARGIN) {
// Do we have a marker for this line?
@@ -480,12 +474,12 @@ namespace DSPRE.Editors {
return false;
}
+ // Keep all the code that handles unsaved changes
if (scriptsDirty || functionsDirty || actionsDirty) {
DialogResult d = MessageBox.Show("There are unsaved changes in this Script File.\nDo you wish to discard them?", "Unsaved work", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (!d.Equals(DialogResult.Yes)) {
Helpers.DisableHandlers();
- // selectScriptFileComboBox.SelectedItem = currentScriptFile;
selectScriptFileComboBox.SelectedIndex = (int)currentScriptFile.fileID;
Helpers.EnableHandlers();
return false;
@@ -495,18 +489,13 @@ namespace DSPRE.Editors {
Helpers.DisableHandlers();
ScriptFile lastScriptFile = currentScriptFile;
- // currentScriptFile = (ScriptFile)selectScriptFileComboBox.SelectedItem;
- currentScriptFile = new ScriptFile(selectScriptFileComboBox.SelectedIndex); // Load script file
+ // Load the script file using our new label-based constructor
+ currentScriptFile = new ScriptFile(selectScriptFileComboBox.SelectedIndex);
+ // Clear only the script text area and nav listbox
ScriptTextArea.ClearAll();
- FunctionTextArea.ClearAll();
- ActionTextArea.ClearAll();
-
scriptsNavListbox.Items.Clear();
- functionsNavListbox.Items.Clear();
- actionsNavListbox.Items.Clear();
- //prevent buttons from flickering when the combobox selection changes
bool typeChanged = true;
if (lastScriptFile != null) {
typeChanged = lastScriptFile.isLevelScript != currentScriptFile.isLevelScript;
@@ -545,9 +534,7 @@ namespace DSPRE.Editors {
}
if (!currentScriptFile.isLevelScript) {
- displayScriptFile(ScriptFile.ContainerTypes.Script, currentScriptFile.allScripts, scriptsNavListbox, ScriptTextArea);
- displayScriptFile(ScriptFile.ContainerTypes.Function, currentScriptFile.allFunctions, functionsNavListbox, FunctionTextArea);
- displayScriptFileActions(ScriptFile.ContainerTypes.Action, currentScriptFile.allActions, actionsNavListbox, ActionTextArea);
+ displayScriptFile(scriptsNavListbox, ScriptTextArea);
}
ScriptEditorSetClean();
@@ -558,84 +545,35 @@ namespace DSPRE.Editors {
return true;
}
- static void displayScriptFile(ScriptFile.ContainerTypes containerType, List commandList, ListBox navListBox, Scintilla textArea) {
- string buffer = "";
- /* Add commands */
- for (int i = 0; i < commandList.Count; i++) {
- ScriptCommandContainer scriptCommandContainer = commandList[i];
-
- /* Write header */
- string header = containerType + " " + (i + 1);
- buffer += header + ':' + Environment.NewLine;
- navListBox.Items.Add(header);
-
- /* If current command is identical to another, print UseScript instead of commands */
- if (scriptCommandContainer.usedScriptID < 0) {
- for (int j = 0; j < scriptCommandContainer.commands.Count; j++) {
- ScriptCommand command = scriptCommandContainer.commands[j];
- if (!ScriptDatabase.endCodes.Contains(command.id)) {
- buffer += '\t';
- }
-
- buffer += command.name + Environment.NewLine;
- }
- } else {
- buffer += '\t' + "UseScript_#" + scriptCommandContainer.usedScriptID + Environment.NewLine;
- }
-
- textArea.AppendText(buffer + Environment.NewLine);
- buffer = "";
+ private void displayScriptFile(ListBox navListBox, Scintilla textArea) {
+ if (currentScriptFile.CommandSequence == null || currentScriptFile.CommandSequence.Count == 0) {
+ return;
}
- }
- static void displayScriptFileActions(ScriptFile.ContainerTypes containerType, List commandList, ListBox navListBox, Scintilla textArea) {
- /* Add movements */
- string buffer = "";
- for (int i = 0; i < commandList.Count; i++) {
- ScriptActionContainer currentCommand = commandList[i];
-
- string header = containerType + " " + (i + 1);
- buffer += header + ':' + Environment.NewLine;
- navListBox.Items.Add(header);
-
- for (int j = 0; j < currentCommand.commands.Count; j++) {
- ScriptAction command = currentCommand.commands[j];
- if (!ScriptDatabase.movementEndCodes.Contains(command.id)) {
- buffer += '\t';
- }
-
- buffer += command.name + Environment.NewLine;
+ // First add all labels to the nav listbox
+ HashSet addedLabels = new HashSet();
+ foreach (var cmdPos in currentScriptFile.CommandSequence) {
+ if (!string.IsNullOrEmpty(cmdPos.Label) && !addedLabels.Contains(cmdPos.Label)) {
+ navListBox.Items.Add(cmdPos.Label);
+ addedLabels.Add(cmdPos.Label);
}
-
- textArea.AppendText(buffer + Environment.NewLine);
- buffer = "";
}
+
+ // Generate the script text
+ string scriptText = currentScriptFile.ToText();
+ textArea.Text = scriptText;
}
private void scriptEditorZoomInButton_Click(object sender, EventArgs e) {
- ZoomIn(currentScintillaEditor);
+ ZoomIn(ScriptTextArea);
}
private void scriptEditorZoomOutButton_Click(object sender, EventArgs e) {
- ZoomOut(currentScintillaEditor);
+ ZoomOut(ScriptTextArea);
}
private void scriptEditorZoomResetButton_Click(object sender, EventArgs e) {
- ZoomDefault(currentScintillaEditor);
- }
-
- private void scriptEditorTabControl_TabIndexChanged(object sender, EventArgs e) {
- if (scriptEditorTabControl.SelectedTab == scriptsTabPage) {
- currentSearchManager = scriptSearchManager;
- currentScintillaEditor = ScriptTextArea;
- } else if (scriptEditorTabControl.SelectedTab == functionsTabPage) {
- currentSearchManager = functionSearchManager;
- currentScintillaEditor = FunctionTextArea;
- } else {
- //Actions
- currentSearchManager = actionSearchManager;
- currentScintillaEditor = ActionTextArea;
- }
+ ZoomDefault(ScriptTextArea);
}
private void removeScriptFileButton_Click(object sender, EventArgs e) {
@@ -660,18 +598,20 @@ namespace DSPRE.Editors {
/* Add new event file to event folder */
int fileID = selectScriptFileComboBox.Items.Count;
- ScriptFile scriptFile = new ScriptFile(
- scriptLines: new Scintilla { Text = "Script 1:\nEnd" }.Lines.ToStringsList(trim: true),
- functionLines: null,
- actionLines: null,
- fileID
- );
+ // Create a simple script with one labeled section
+ List scriptLines = new List {
+ "script_0:",
+ "\tEnd"
+ };
- //check if ScriptFile instance was created successfully
+ // Use the new constructor that just takes script lines
+ ScriptFile scriptFile = new ScriptFile(scriptLines, fileID);
+
+ // Check if ScriptFile instance was created successfully
if (scriptFile.SaveToFileDefaultDir(fileID, showSuccessMessage: false)) {
/* Update ComboBox and select new file */
- selectScriptFileComboBox.Items.Add(scriptFile);
- selectScriptFileComboBox.SelectedItem = scriptFile;
+ selectScriptFileComboBox.Items.Add($"Script File {fileID}");
+ selectScriptFileComboBox.SelectedIndex = selectScriptFileComboBox.Items.Count - 1;
}
}
@@ -679,19 +619,13 @@ namespace DSPRE.Editors {
/* Create new ScriptFile object using the values in the script editor */
int fileID = currentScriptFile.fileID;
+ // We only need the script text area now, not function or action areas
ScriptFile userEdited = new ScriptFile(
- scriptLines: ScriptTextArea.Lines.ToStringsList(trim: true),
- functionLines: FunctionTextArea.Lines.ToStringsList(trim: true),
- actionLines: ActionTextArea.Lines.ToStringsList(trim: true),
- fileID
+ ScriptTextArea.Lines.ToStringsList(trim: true),
+ fileID
);
- if (userEdited.hasNoScripts) {
- MessageBox.Show("This " + nameof(ScriptFile) + " couldn't be saved. A minimum of one script is required.", "Can't save", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
-
- //check if ScriptFile instance was created successfully
+ // Check if ScriptFile instance was created successfully
if (userEdited.SaveToFileDefaultDir(fileID)) {
currentScriptFile = userEdited;
ScriptEditorSetClean();
@@ -779,98 +713,54 @@ namespace DSPRE.Editors {
scriptSearchManager.CloseSearch();
}
- private void BtnNextFindFunc_Click(object sender, EventArgs e) {
- findNext(functionSearchManager);
- }
-
- private void BtnPrevFindFunc_Click(object sender, EventArgs e) {
- findNext(functionSearchManager);
- }
-
- private void panelFindFunctionTextBox_TextChanged(object sender, EventArgs e) {
- findNext(functionSearchManager);
- }
-
- private void functionTxtFind_KeyDown(object sender, KeyEventArgs e) {
- TxtFindKeyDown(functionSearchManager, e);
- }
-
- private void BtnCloseFindFunc_Click(object sender, EventArgs e) {
- functionSearchManager.CloseSearch();
- }
-
- private void BtnNextFindActions_Click(object sender, EventArgs e) {
- findNext(actionSearchManager);
- }
-
- private void BtnPrevFindActions_Click(object sender, EventArgs e) {
- findNext(actionSearchManager);
- }
-
- private void panelFindActionTextBox_TextChanged(object sender, EventArgs e) {
- findNext(actionSearchManager);
- }
-
- private void actionTxtFind_KeyDown(object sender, KeyEventArgs e) {
- TxtFindKeyDown(actionSearchManager, e);
- }
-
- private void BtnCloseFindActions_Click(object sender, EventArgs e) {
- actionSearchManager.CloseSearch();
- }
void scrollResultToTop(SearchManager searchManager) {
int resultStart = searchManager.textAreaScintilla.CurrentLine - ScriptEditorSearchResult.ResultsPadding;
searchManager.textAreaScintilla.FirstVisibleLine = resultStart;
}
- private void NavigatorGoTo(ListBox listBox, TabPage tabPage, SearchManager searchManager, ScriptFile.ContainerTypes containerType) {
+ private void NavigatorGoTo(ListBox listBox, ScriptFile.ContainerTypes containerType) {
if (listBox.SelectedIndex < 0) {
return;
}
- scriptEditorTabControl.SelectedTab = tabPage;
int commandNumber = listBox.SelectedIndex + 1;
string CommandBlockOpen = $"{containerType} {commandNumber}:";
- searchManager.Find(true, false, CommandBlockOpen);
+ scriptSearchManager.Find(true, false, CommandBlockOpen);
- scrollResultToTop(searchManager);
+ scrollResultToTop(scriptSearchManager);
}
private void scriptsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
- NavigatorGoTo((ListBox)sender, scriptsTabPage, scriptSearchManager, ScriptFile.ContainerTypes.Script);
+ NavigatorGoTo((ListBox)sender, ScriptFile.ContainerTypes.Script);
}
private void functionsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
- NavigatorGoTo((ListBox)sender, functionsTabPage, functionSearchManager, ScriptFile.ContainerTypes.Function);
+ //NavigatorGoTo((ListBox)sender, functionsTabPage, functionSearchManager, ScriptFile.ContainerTypes.Function);
}
private void actionsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
- NavigatorGoTo((ListBox)sender, actionsTabPage, actionSearchManager, ScriptFile.ContainerTypes.Action);
+ //NavigatorGoTo((ListBox)sender, actionsTabPage, actionSearchManager, ScriptFile.ContainerTypes.Action);
}
private void openFindScriptEditorButton_Click(object sender, EventArgs e) {
- currentSearchManager.OpenSearch();
+ scriptSearchManager.OpenSearch();
}
private void ScriptEditorExpandButton_Click(object sender, EventArgs e) {
- currentScintillaEditor.FoldAll(FoldAction.Expand);
+ ScriptTextArea.FoldAll(FoldAction.Expand);
}
private void ScriptEditorCollapseButton_Click(object sender, EventArgs e) {
- currentScintillaEditor.FoldAll(FoldAction.Contract);
+ ScriptTextArea.FoldAll(FoldAction.Contract);
}
private void scriptEditorWordWrapCheckbox_CheckedChanged(object sender, EventArgs e) {
ScriptTextArea.WrapMode = scriptEditorWordWrapCheckbox.Checked ? WrapMode.Word : WrapMode.None;
- FunctionTextArea.WrapMode = scriptEditorWordWrapCheckbox.Checked ? WrapMode.Word : WrapMode.None;
- ActionTextArea.WrapMode = scriptEditorWordWrapCheckbox.Checked ? WrapMode.Word : WrapMode.None;
}
private void viewWhiteSpacesButton_Click(object sender, EventArgs e) {
ScriptTextArea.ViewWhitespace = scriptEditorWhitespacesCheckbox.Checked ? WhitespaceMode.VisibleAlways : WhitespaceMode.Invisible;
- FunctionTextArea.ViewWhitespace = scriptEditorWhitespacesCheckbox.Checked ? WhitespaceMode.VisibleAlways : WhitespaceMode.Invisible;
- ActionTextArea.ViewWhitespace = scriptEditorWhitespacesCheckbox.Checked ? WhitespaceMode.VisibleAlways : WhitespaceMode.Invisible;
}
private void searchInScriptsTextBox_KeyDown(object sender, KeyEventArgs e) {
@@ -925,17 +815,20 @@ namespace DSPRE.Editors {
List scriptsToSearch = getScriptsToSearch();
string searchString = searchInScriptsTextBox.Text;
- Func searchCriteriaCS = (string s) => s.IndexOf(searchString, StringComparison.InvariantCulture) >= 0;
- Func searchCriteriaCI = (string s) => s.IndexOf(searchString, StringComparison.InvariantCultureIgnoreCase) >= 0;
- Func searchCriteria = scriptSearchCaseSensitiveCheckBox.Checked ? searchCriteriaCS : searchCriteriaCI;
+ bool searchCriteriaCS(string s) => s.IndexOf(searchString, StringComparison.InvariantCulture) >= 0;
+ bool searchCriteriaCI(string s) => s.IndexOf(searchString, StringComparison.InvariantCultureIgnoreCase) >= 0;
+
+ Func searchCriteria;
+ if (scriptSearchCaseSensitiveCheckBox.Checked) {
+ searchCriteria = searchCriteriaCS;
+ } else {
+ searchCriteria = searchCriteriaCI;
+ }
List results = new List();
foreach (ScriptFile scriptFile in scriptsToSearch) {
- List scriptResults = SearchInScripts(scriptFile, scriptFile.allScripts, searchCriteria);
- List functionResults = SearchInScripts(scriptFile, scriptFile.allFunctions, searchCriteria);
- // List actionResults = SearchInScripts(scriptFile, scriptFile.allActions, searchCriteria);
+ List scriptResults = SearchInScripts(scriptFile, searchCriteria);
results.AddRange(scriptResults);
- results.AddRange(functionResults);
// results.AddRange(actionResults);
}
@@ -948,21 +841,9 @@ namespace DSPRE.Editors {
bw.RunWorkerAsync();
}
- private List SearchInScripts(ScriptFile scriptFile, List commandContainers, Func criteria) {
+ private List SearchInScripts(ScriptFile scriptFile, Func criteria) {
List results = new List();
- for (int j = 0; j < commandContainers.Count; j++) {
- if (commandContainers[j].commands is null) {
- continue;
- }
-
- ScriptCommandContainer scriptCommandContainer = commandContainers[j];
- foreach (ScriptCommand scriptCommand in scriptCommandContainer.commands) {
- if (criteria(scriptCommand.name)) {
- results.Add(new ScriptEditorSearchResult(scriptFile, scriptCommandContainer.containerType, j + 1, scriptCommand));
- }
- }
- }
return results;
}
@@ -987,19 +868,11 @@ namespace DSPRE.Editors {
selectScriptFileComboBox.SelectedIndex = scriptFile.fileID;
if (containerType == ScriptFile.ContainerTypes.Script) {
- displaySearchResult(scriptsTabPage, scriptSearchManager, searchResult);
- } else if (containerType == ScriptFile.ContainerTypes.Function) {
- displaySearchResult(functionsTabPage, functionSearchManager, searchResult);
- } else if (containerType == ScriptFile.ContainerTypes.Action) {
- displaySearchResult(actionsTabPage, actionSearchManager, searchResult);
+ displaySearchResult(scriptSearchManager, searchResult);
}
}
- private void displaySearchResult(TabPage tabPage, SearchManager searchManager, ScriptEditorSearchResult searchResult) {
- if (scriptEditorTabControl.SelectedTab != tabPage) {
- scriptEditorTabControl.SelectedTab = tabPage;
- }
-
+ private void displaySearchResult(SearchManager searchManager, ScriptEditorSearchResult searchResult) {
searchManager.Find(true, false, searchResult.CommandBlockOpen);
int blockStart = searchManager.textAreaScintilla.CurrentLine - ScriptEditorSearchResult.ResultsPadding;
diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs
index 242e83e..d0555cc 100644
--- a/DS_Map/Main Window.cs
+++ b/DS_Map/Main Window.cs
@@ -5422,12 +5422,12 @@ namespace DSPRE {
} else {
ScriptFile itemScript = new ScriptFile(RomInfo.itemScriptFileNumber);
owItemComboBox.Items.Clear();
- foreach (ScriptCommandContainer cont in itemScript.allScripts) {
- if (cont.commands.Count > 4) {
- continue;
- }
- owItemComboBox.Items.Add(BitConverter.ToUInt16(cont.commands[1].cmdParams[1], 0) + "x " + itemNames[BitConverter.ToUInt16(cont.commands[0].cmdParams[1], 0)]);
- }
+ //foreach (ScriptCommandContainer cont in itemScript.allScripts) {
+ // if (cont.commands.Count > 4) {
+ // continue;
+ // }
+ // owItemComboBox.Items.Add(BitConverter.ToUInt16(cont.commands[1].Parameters[1].RawData, 0) + "x " + itemNames[BitConverter.ToUInt16(cont.commands[0].Parameters[1].RawData, 0)]);
+ //}
}
/* Add ow movement list to box */
diff --git a/DS_Map/PatchToolboxDialog.cs b/DS_Map/PatchToolboxDialog.cs
index f9dfd87..8f0aa9f 100644
--- a/DS_Map/PatchToolboxDialog.cs
+++ b/DS_Map/PatchToolboxDialog.cs
@@ -258,18 +258,18 @@ namespace DSPRE
public static bool CheckScriptsStandardizedItemNumbers()
{
ScriptFile itemScript = new ScriptFile(RomInfo.itemScriptFileNumber);
- if (itemScript.allScripts.Count - 1 < new TextArchive(RomInfo.itemNamesTextNumber).messages.Count)
- {
- return false;
- }
+ //if (itemScript.allScripts.Count - 1 < new TextArchive(RomInfo.itemNamesTextNumber).messages.Count)
+ //{
+ // return false;
+ //}
- for (ushort i = 0; i < itemScript.allScripts.Count - 1; i++)
- {
- if (BitConverter.ToUInt16(itemScript.allScripts[i].commands[0].cmdParams[1], 0) != i || BitConverter.ToUInt16(itemScript.allScripts[i].commands[1].cmdParams[1], 0) != 1)
- {
- return false;
- }
- }
+ //for (ushort i = 0; i < itemScript.allScripts.Count - 1; i++)
+ //{
+ // if (BitConverter.ToUInt16(itemScript.allScripts[i].commands[0].Parameters[1].RawData, 0) != i || BitConverter.ToUInt16(itemScript.allScripts[i].commands[1].Parameters[1].RawData, 0) != 1)
+ // {
+ // return false;
+ // }
+ //}
return true;
}
@@ -590,12 +590,12 @@ namespace DSPRE
ScriptFile itemScriptFile = new ScriptFile(RomInfo.itemScriptFileNumber);
// Create map for: script no. -> vanilla item
- int[] vanillaItemsArray = new int[itemScriptFile.allScripts.Count - 1];
-
- for (int i = 0; i < itemScriptFile.allScripts.Count - 1; i++)
- {
- vanillaItemsArray[i] = BitConverter.ToInt16(itemScriptFile.allScripts[i].commands[0].cmdParams[1], 0);
- };
+ //int[] vanillaItemsArray = new int[itemScriptFile.allScripts.Count - 1];
+ //
+ //for (int i = 0; i < itemScriptFile.allScripts.Count - 1; i++)
+ //{
+ // vanillaItemsArray[i] = BitConverter.ToInt16(itemScriptFile.allScripts[i].commands[0].Parameters[1].RawData, 0);
+ //};
// Parse all event files and fix instances of ground items according to the new order
int cnt = Filesystem.GetEventFileCount();
@@ -617,7 +617,7 @@ namespace DSPRE
if (isItem)
{
int itemScriptID = eventFile.overworlds[j].scriptNumber - (itemScrMin - 1);
- eventFile.overworlds[j].scriptNumber = (ushort)(itemScrMin + vanillaItemsArray[itemScriptID - 1]);
+ //eventFile.overworlds[j].scriptNumber = (ushort)(itemScrMin + vanillaItemsArray[itemScriptID - 1]);
dirty = true;
}
}
@@ -644,29 +644,29 @@ namespace DSPRE
using (DSUtils.EasyWriter ewr = new DSUtils.EasyWriter(ow9path, ow9offs))
{
- ewr.Write((ushort)(itemScrMin + vanillaItemsArray[itemScriptID - 1]));
+ //ewr.Write((ushort)(itemScrMin + vanillaItemsArray[itemScriptID - 1]));
}
}
// Sort scripts in the Script File according to item indices
int itemCount = new TextArchive(RomInfo.itemNamesTextNumber).messages.Count;
- ScriptCommandContainer executeGive = new ScriptCommandContainer((uint)itemCount + 1, itemScriptFile.allScripts[itemScriptFile.allScripts.Count - 1]);
+ //ScriptCommandContainer executeGive = new ScriptCommandContainer((uint)itemCount + 1, itemScriptFile.allScripts[itemScriptFile.allScripts.Count - 1]);
- itemScriptFile.allScripts.Clear();
+ //itemScriptFile.allScripts.Clear();
- for (ushort i = 0; i < itemCount; i++)
- {
- List cmdList = new List {
- new ScriptCommand("SetVar 0x8008 " + i),
- new ScriptCommand("SetVar 0x8009 0x1"),
- new ScriptCommand("Jump Function_#1")
- };
-
- itemScriptFile.allScripts.Add(new ScriptCommandContainer((ushort)(i + 1), ScriptFile.ContainerTypes.Script, commandList: cmdList));
- }
-
- itemScriptFile.allScripts.Add(executeGive);
- itemScriptFile.allFunctions[0].usedScriptID = itemCount + 1;
+ //for (ushort i = 0; i < itemCount; i++)
+ //{
+ // List cmdList = new List {
+ // new ScriptCommand("SetVar 0x8008 " + i),
+ // new ScriptCommand("SetVar 0x8009 0x1"),
+ // new ScriptCommand("Jump Function_#1")
+ // };
+ //
+ // itemScriptFile.allScripts.Add(new ScriptCommandContainer((ushort)(i + 1), ScriptFile.ContainerTypes.Script, commandList: cmdList));
+ //}
+ //
+ //itemScriptFile.allScripts.Add(executeGive);
+ //itemScriptFile.allFunctions[0].usedScriptID = itemCount + 1;
itemScriptFile.SaveToFileDefaultDir(RomInfo.itemScriptFileNumber, showSuccessMessage: false);
MessageBox.Show("Operation successful.", "Process completed.", MessageBoxButtons.OK, MessageBoxIcon.Information);
diff --git a/DS_Map/ROMFiles/ScriptCommand.cs b/DS_Map/ROMFiles/ScriptCommand.cs
index 57d5394..a21a23f 100644
--- a/DS_Map/ROMFiles/ScriptCommand.cs
+++ b/DS_Map/ROMFiles/ScriptCommand.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
+using System.Text;
using System.Windows.Forms;
namespace DSPRE.ROMFiles {
@@ -16,15 +17,17 @@ namespace DSPRE.ROMFiles {
OW_DIRECTION,
FUNCTION_ID,
ACTION_ID,
- CMD_NUMBER
+ CMD_NUMBER,
+ LABEL_REF
};
public ushort? id;
- public List cmdParams;
+ public List Parameters { get; set; } = new List();
public string name;
- public ScriptCommand(ushort id, List parametersList) {
- if (parametersList is null) {
+ // CHANGE: Update the constructor to use ScriptParameter
+ public ScriptCommand(ushort id, List parameters) {
+ if (parameters is null) {
this.id = null;
return;
}
@@ -36,47 +39,48 @@ namespace DSPRE.ROMFiles {
switch (id) {
case 0x0016: // Jump
case 0x001A: // Call
- name += $" {FormatNumber(parametersList[0], ParamTypeEnum.FUNCTION_ID)}";
+ name += $" {FormatParameter(parameters[0], ParamTypeEnum.FUNCTION_ID)}";
break;
case 0x0017: // JumpIfObjID
case 0x0018: // JumpIfEventID
- name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1])}";
+ name += $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1])}";
break;
case 0x0019: // JumpIfPlayerDir
- name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_DIRECTION)} {FormatNumber(parametersList[1], ParamTypeEnum.FUNCTION_ID)}";
+ name += $" {FormatParameter(parameters[0], ParamTypeEnum.OW_DIRECTION)} {FormatParameter(parameters[1], ParamTypeEnum.FUNCTION_ID)}";
break;
case 0x001C: // JumpIf
case 0x001D: // CallIf
{
- string number = FormatNumber(parametersList[1], ParamTypeEnum.FUNCTION_ID);
+ string number = FormatParameter(parameters[1], ParamTypeEnum.FUNCTION_ID);
- if (RomInfo.ScriptComparisonOperatorsDict.TryGetValue(parametersList[0][0], out string v)) {
+ // Access the byte value from the parameter's raw data
+ if (RomInfo.ScriptComparisonOperatorsDict.TryGetValue(parameters[0].RawData[0], out string v)) {
name += $" {v} {number}";
} else {
- name += $" {parametersList[0][0]} {number}";
+ name += $" {parameters[0].RawData[0]} {number}";
}
break;
}
case 0x005E: // Movement
- name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.ACTION_ID)}";
+ name += $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1], ParamTypeEnum.ACTION_ID)}";
break;
case 0x006A: // GetOverworldPosition
- name += FormatCmd_Overworld_TwoParams(parametersList);
+ name += FormatCmd_Overworld_TwoParams(parameters);
break;
case 0x0062: // Lock
case 0x0063: // Release
case 0x0064: // AddOW
case 0x0065: // RemoveOW
- name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)}";
+ name += $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)}";
break;
case 0x006D: // SetOverworldMovement
- name += FormatCmd_Overworld_Move(parametersList);
+ name += FormatCmd_Overworld_Move(parameters);
break;
case 0x00B0: // Warp [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
- name += FormatCmd_Warp(parametersList);
+ name += FormatCmd_Warp(parameters);
} else {
goto default;
}
@@ -84,7 +88,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0152: // SetOverworldDefaultPosition [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
- name += FormatCmd_Overworld_TwoParams(parametersList);
+ name += FormatCmd_Overworld_TwoParams(parameters);
} else {
goto default;
}
@@ -92,7 +96,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0153: // SetOverworldPosition [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
- name += FormatCmd_Overworld_3Coords_Dir(parametersList);
+ name += FormatCmd_Overworld_3Coords_Dir(parameters);
} else {
goto default;
}
@@ -100,7 +104,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0154: // SetOverworldDefaultMovement [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
- name += FormatCmd_Overworld_Move(parametersList);
+ name += FormatCmd_Overworld_Move(parameters);
} else {
goto default;
}
@@ -108,7 +112,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0155: // SetOverworldDefaultDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
- name += FormatCmd_Overworld_Dir(parametersList);
+ name += FormatCmd_Overworld_Dir(parameters);
} else {
goto default;
}
@@ -116,7 +120,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0158: // SetOverworldDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
- name += FormatCmd_Overworld_Dir(parametersList);
+ name += FormatCmd_Overworld_Dir(parameters);
} else {
goto default;
}
@@ -125,7 +129,7 @@ namespace DSPRE.ROMFiles {
case 0x00BE: // Warp [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
- name += FormatCmd_Warp(parametersList);
+ name += FormatCmd_Warp(parameters);
} else {
goto default;
}
@@ -133,7 +137,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0186: // SetOverworldDefaultPosition [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
- name += FormatCmd_Overworld_TwoParams(parametersList);
+ name += FormatCmd_Overworld_TwoParams(parameters);
} else {
goto default;
}
@@ -141,7 +145,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0187: // SetOverworldPosition [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
- name += FormatCmd_Overworld_3Coords_Dir(parametersList);
+ name += FormatCmd_Overworld_3Coords_Dir(parameters);
} else {
goto default;
}
@@ -149,7 +153,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0188: // SetOverworldDefaultMovement [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
- name += FormatCmd_Overworld_Move(parametersList);
+ name += FormatCmd_Overworld_Move(parameters);
} else {
goto default;
}
@@ -157,7 +161,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0189: // SetOverworldDefaultDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
- name += FormatCmd_Overworld_Dir(parametersList);
+ name += FormatCmd_Overworld_Dir(parameters);
} else {
goto default;
}
@@ -165,47 +169,47 @@ namespace DSPRE.ROMFiles {
break;
case 0x018C: // SetOverworldDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
- name += FormatCmd_Overworld_Dir(parametersList);
+ name += FormatCmd_Overworld_Dir(parameters);
} else {
goto default;
}
break;
+
default:
- for (int i = 0; i < parametersList.Count; i++) {
- name += $" {FormatNumber(parametersList[i])}";
+ for (int i = 0; i < parameters.Count; i++) {
+ name += $" {FormatParameter(parameters[i])}";
}
break;
}
this.id = id;
- this.cmdParams = parametersList;
+ this.Parameters = parameters;
}
- private string FormatCmd_Warp(List parametersList) {
- return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2])} {FormatNumber(parametersList[3])} {FormatNumber(parametersList[4], ParamTypeEnum.OW_DIRECTION)}";
+ private string FormatCmd_Warp(List parameters) {
+ return $" {FormatParameter(parameters[0])} {FormatParameter(parameters[1])} {FormatParameter(parameters[2])} {FormatParameter(parameters[3])} {FormatParameter(parameters[4], ParamTypeEnum.OW_DIRECTION)}";
}
- private string FormatCmd_Overworld_TwoParams(List parametersList) {
- return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2])}";
+ private string FormatCmd_Overworld_TwoParams(List parameters) {
+ return $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1])} {FormatParameter(parameters[2])}";
}
- private string FormatCmd_Overworld_Move(List parametersList) {
- return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.OW_MOVEMENT_TYPE)}";
+ private string FormatCmd_Overworld_Move(List parameters) {
+ return $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1], ParamTypeEnum.OW_MOVEMENT_TYPE)}";
}
- private string FormatCmd_Overworld_3Coords_Dir(List parametersList) {
- return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2])} {FormatNumber(parametersList[3])} {FormatNumber(parametersList[4], ParamTypeEnum.OW_DIRECTION)}";
+ private string FormatCmd_Overworld_3Coords_Dir(List parameters) {
+ return $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1])} {FormatParameter(parameters[2])} {FormatParameter(parameters[3])} {FormatParameter(parameters[4], ParamTypeEnum.OW_DIRECTION)}";
}
- private string FormatCmd_Overworld_Dir(List parametersList) {
- return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.OW_DIRECTION)}";
+ private string FormatCmd_Overworld_Dir(List parameters) {
+ return $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1], ParamTypeEnum.OW_DIRECTION)}";
}
-
public ScriptCommand(string wholeLine, int lineNumber = 0) {
name = wholeLine;
- cmdParams = new List();
+ Parameters = new List();
string[] nameParts = wholeLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); // Separate command code from parameters
/* Get command id, which is always first in the description */
@@ -229,9 +233,8 @@ namespace DSPRE.ROMFiles {
return;
}
}
- /* Read parameters from remainder of the description */
- //Console.WriteLine("ID = " + ((ushort)id).ToString("X4"));
+ /* Read parameters from remainder of the description */
byte[] parametersSizeArr = RomInfo.ScriptCommandParametersDict[(ushort)id];
int paramLength = 0;
@@ -241,7 +244,7 @@ namespace DSPRE.ROMFiles {
int firstParamValue = int.Parse(nameParts[1].PurgeSpecial(ScriptFile.specialChars), nameParts[1].GetNumberStyle());
byte firstParamSize = parametersSizeArr[1];
- cmdParams.Add(firstParamValue.ToByteArrayChooseSize(firstParamSize));
+ Parameters.Add(new ScriptParameter(firstParamValue.ToByteArrayChooseSize(firstParamSize)));
paramsProcessed++;
int i = 2;
@@ -303,7 +306,8 @@ namespace DSPRE.ROMFiles {
Console.WriteLine($"Parameter #{i}: {nameParts[i + 1]}");
if (RomInfo.ScriptComparisonOperatorsReverseDict.TryGetValue(nameParts[i + 1].ToLower(), out cmdID)) { //Check succeeds when command is like "asdfg LESS" or "asdfg DIFFERENT"
- cmdParams.Add(new byte[] { (byte)cmdID });
+ // Create parameter with byte array
+ Parameters.Add(new ScriptParameter(new byte[] { (byte)cmdID }));
} else { //Not a comparison
/* Convert strings of parameters to the correct datatypes */
NumberStyles numStyle = nameParts[i + 1].GetNumberStyle();
@@ -312,6 +316,16 @@ namespace DSPRE.ROMFiles {
int result = 0;
try {
+ // Check if this is a label reference
+ if (nameParts[i + 1].StartsWith("label") || nameParts[i + 1].StartsWith("script")) {
+ // This is a label reference
+ ScriptParameter labelParam = new ScriptParameter(0, nameParts[i + 1]) {
+ Type = ScriptParameter.ParameterType.RelativeJump
+ };
+ Parameters.Add(labelParam);
+ continue;
+ }
+
result = int.Parse(nameParts[i + 1], numStyle);
} catch {
if (string.IsNullOrWhiteSpace(nameParts[i + 1])) {
@@ -338,7 +352,8 @@ namespace DSPRE.ROMFiles {
}
try {
- cmdParams.Add(result.ToByteArrayChooseSize(parametersSizeArr[i]));
+ byte[] paramData = result.ToByteArrayChooseSize(parametersSizeArr[i]);
+ Parameters.Add(new ScriptParameter(paramData));
} catch (OverflowException) {
MessageBox.Show($"Argument {nameParts[i + 1]} at line {lineNumber} is not in the range [0, {Math.Pow(2, 8 * parametersSizeArr[i]) - 1}].", "Argument error", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = null;
@@ -354,6 +369,10 @@ namespace DSPRE.ROMFiles {
}
private string FormatNumber(byte[] par, ParamTypeEnum paramType = ParamTypeEnum.INTEGER) {
+ if (paramType == ParamTypeEnum.LABEL_REF && par.Length > 0) {
+ return FormatLabelReference(Encoding.ASCII.GetString(par));
+ }
+
//number acquisition
uint num;
if (par.Length == 0) {
@@ -390,9 +409,6 @@ namespace DSPRE.ROMFiles {
case ParamTypeEnum.CMD_NUMBER:
return "CMD_" + prefix + num.ToString(formatOverride + '3');
- case ParamTypeEnum.FUNCTION_ID:
- return ScriptFile.ContainerTypes.Function.ToString() + "#" + num;
-
case ParamTypeEnum.ACTION_ID:
return ScriptFile.ContainerTypes.Action.ToString() + "#" + num;
@@ -440,8 +456,21 @@ namespace DSPRE.ROMFiles {
return outp;
}
+ private string FormatParameter(ScriptParameter param, ParamTypeEnum paramType = ParamTypeEnum.INTEGER) {
+ // For jump-to-label parameters, return the label name
+ if (param.Type == ScriptParameter.ParameterType.RelativeJump && !string.IsNullOrEmpty(param.TargetLabel)) {
+ return param.TargetLabel;
+ }
+
+ // Otherwise handle the numeric value
+ return FormatNumber(param.RawData, paramType);
+ }
public override string ToString() {
return name + " (" + ((ushort)id).ToString("X") + ")";
}
+
+ private string FormatLabelReference(string labelName) {
+ return labelName;
+ }
}
}
diff --git a/DS_Map/ROMFiles/ScriptCommandContainer.cs b/DS_Map/ROMFiles/ScriptCommandContainer.cs
deleted file mode 100644
index 5654980..0000000
--- a/DS_Map/ROMFiles/ScriptCommandContainer.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System.Collections.Generic;
-
-namespace DSPRE.ROMFiles {
- public class ScriptCommandContainer {
- public List commands;
- public uint manualUserID;
- public int usedScriptID; //useScript ID referenced by this Script/Function
- public ScriptFile.ContainerTypes containerType;
- internal static readonly string functionStart;
-
- public ScriptCommandContainer(uint scriptNumber, ScriptFile.ContainerTypes containerType, int usedScriptID = -1, List commandList = null) {
- manualUserID = scriptNumber;
- this.usedScriptID = usedScriptID;
- this.containerType = containerType;
- commands = commandList;
- }
-
- public ScriptCommandContainer(uint newID, ScriptCommandContainer toCopy) {
- manualUserID = newID;
- usedScriptID = toCopy.usedScriptID;
- containerType = toCopy.containerType;
- commands = new List(toCopy.commands); //command parameters need to be copied recursively
- }
- }
-}
diff --git a/DS_Map/ROMFiles/ScriptCommandPosition.cs b/DS_Map/ROMFiles/ScriptCommandPosition.cs
new file mode 100644
index 0000000..953a310
--- /dev/null
+++ b/DS_Map/ROMFiles/ScriptCommandPosition.cs
@@ -0,0 +1,20 @@
+// ScriptCommandPosition.cs
+using System;
+
+namespace DSPRE.ROMFiles {
+ public class ScriptCommandPosition {
+ public ScriptCommand Command { get; set; }
+ public int Offset { get; set; }
+ public string Label { get; set; } // null if no label needed
+ public bool IsEntryPoint { get; set; }
+ public int EntryPointIndex { get; set; } // -1 if not an entry point
+
+ public ScriptCommandPosition(ScriptCommand cmd, int offset, string label = null, bool isEntryPoint = false, int entryPointIndex = -1) {
+ Command = cmd;
+ Offset = offset;
+ Label = label;
+ IsEntryPoint = isEntryPoint;
+ EntryPointIndex = entryPointIndex;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DS_Map/ROMFiles/ScriptFile.cs b/DS_Map/ROMFiles/ScriptFile.cs
index 3873518..f037539 100644
--- a/DS_Map/ROMFiles/ScriptFile.cs
+++ b/DS_Map/ROMFiles/ScriptFile.cs
@@ -1,8 +1,8 @@
-using DSPRE.Resources;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Text;
using System.Windows.Forms;
using static DSPRE.RomInfo;
@@ -11,11 +11,12 @@ namespace DSPRE.ROMFiles {
/// Class to store script file data in Pokémon NDS games
///
public class ScriptFile : RomFile {
- //this enum doesn't really make much sense now but it will, once scripts can be called and jumped to
+ public List CommandSequence { get; set; } = new List();
+ public Dictionary OffsetToLabelMap { get; set; } = new Dictionary();
public enum ContainerTypes {
- Function,
Action,
- Script
+ Script,
+ Label
};
public struct ContainerReference {
@@ -23,31 +24,32 @@ namespace DSPRE.ROMFiles {
public uint offsetInFile;
}
- public List allScripts = new List();
- public List allFunctions = new List();
- public List allActions = new List();
public int fileID = -1;
public bool isLevelScript = new bool();
- public bool hasNoScripts { get { return fileID == int.MaxValue; } }
+ public bool HasNoScripts { get { return fileID == int.MaxValue; } }
public static readonly char[] specialChars = { 'x', 'X', '#', '.', '_' };
- public ScriptFile(Stream fs, bool readFunctions = true, bool readActions = true) {
- List scriptOffsets = new List();
- List functionOffsets = new List();
- List movementOffsets = new List();
+ public ScriptFile(Stream fs) {
+ // Initialize collections
+ CommandSequence = new List();
+ OffsetToLabelMap = new Dictionary();
using (BinaryReader br = new BinaryReader(fs)) {
- /* Read script offsets from the header */
- isLevelScript = true; // Is Level Script as long as magic number FD13 doesn't exist
+ // Read header to find entry points
+ List entryPointOffsets = new List();
+ isLevelScript = true; // Is Level Script until proved otherwise
+
try {
+ int entryPointIndex = 0;
while (true) {
+ long headerPos = br.BaseStream.Position;
uint checker = br.ReadUInt16();
br.BaseStream.Position -= 0x2;
uint value = br.ReadUInt32();
- if (value == 0 && scriptOffsets.Count == 0) {
+ if (value == 0 && entryPointOffsets.Count == 0) {
isLevelScript = true;
break;
}
@@ -58,12 +60,17 @@ namespace DSPRE.ROMFiles {
break;
}
- int offsetFromStart = (int)(value + br.BaseStream.Position); // Don't change order of addition
- scriptOffsets.Add(offsetFromStart);
+ int offsetFromStart = (int)(value + headerPos + 4);
+ entryPointOffsets.Add(offsetFromStart);
+
+ // Create entry point label
+ string entryLabel = $"script_{entryPointIndex}";
+ OffsetToLabelMap[offsetFromStart] = entryLabel;
+ entryPointIndex++;
}
} catch (EndOfStreamException) {
if (!isLevelScript) {
- MessageBox.Show("Script File couldn't be read correctly.", "Unexpected EOF", MessageBoxButtons.OK, MessageBoxIcon.Error); // Now this may appear in a few level scripts that don't have a 4-byte aligned "00 00 00 00"
+ MessageBox.Show("Script File couldn't be read correctly.", "Unexpected EOF", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
@@ -71,90 +78,56 @@ namespace DSPRE.ROMFiles {
return;
}
- /* Read scripts */
- for (uint current = 0; current < scriptOffsets.Count; current++) {
- int index = scriptOffsets.FindIndex(x => x == scriptOffsets[(int)current]); // Check for UseScript
+ // Skip the 0xFD13 marker
+ br.ReadUInt16();
- if (index == current) {
- br.BaseStream.Position = scriptOffsets[(int)current];
+ // Process commands until end of file
+ while (br.BaseStream.Position < br.BaseStream.Length) {
+ int currentOffset = (int)br.BaseStream.Position;
- List cmdList = new List();
- bool endScript = new bool();
- while (!endScript) {
- ScriptCommand cmd = ReadCommand(br, ref functionOffsets, ref movementOffsets);
- if (cmd.cmdParams is null) {
- return;
- }
+ // Sometimes we might hit padding bytes - try to detect and skip
+ if (br.BaseStream.Position + 2 <= br.BaseStream.Length) {
+ byte[] peekBytes = br.ReadBytes(2);
+ br.BaseStream.Position -= 2;
- cmdList.Add(cmd);
-
- if (ScriptDatabase.endCodes.Contains((ushort)cmd.id)) {
- endScript = true;
- }
- }
-
- allScripts.Add(new ScriptCommandContainer(current + 1, ContainerTypes.Script, commandList: cmdList));
- } else {
- allScripts.Add(new ScriptCommandContainer(current + 1, ContainerTypes.Script, usedScriptID: index + 1));
- }
- }
-
- /* Read functions */
- if (readFunctions) {
- for (uint current = 0; current < functionOffsets.Count; current++) {
- br.BaseStream.Position = functionOffsets[(int)current];
- int posInList = scriptOffsets.IndexOf(functionOffsets[(int)current]); // Check for UseScript
-
- if (posInList == -1) {
- List cmdList = new List();
- bool endFunction = new bool();
- while (!endFunction) {
- ScriptCommand command = ReadCommand(br, ref functionOffsets, ref movementOffsets);
- if (command.cmdParams is null) {
- return;
- }
-
- cmdList.Add(command);
- if (ScriptDatabase.endCodes.Contains((ushort)command.id)) {
- endFunction = true;
- }
- }
-
- allFunctions.Add(new ScriptCommandContainer(current + 1, ContainerTypes.Function, commandList: cmdList));
- } else {
- allFunctions.Add(new ScriptCommandContainer(current + 1, ContainerTypes.Function, usedScriptID: posInList + 1));
+ // Check if these look like padding
+ if (peekBytes[0] == 0 && peekBytes[1] == 0) {
+ // Skip padding byte
+ br.ReadByte();
+ continue;
}
}
- }
- if (readActions) {
- /* Read movements */
- for (uint current = 0; current < movementOffsets.Count; current++) {
- br.BaseStream.Position = movementOffsets[(int)current];
-
- List cmdList = new List();
- bool endMovement = new bool();
- while (!endMovement) {
- ushort id = br.ReadUInt16();
- if (id == 0xFE) {
- endMovement = true;
- cmdList.Add(new ScriptAction(id, 0));
- } else {
- cmdList.Add(new ScriptAction(id, br.ReadUInt16()));
- }
- }
-
- allActions.Add(new ScriptActionContainer(current + 1, commands: cmdList));
+ ScriptCommand cmd = ReadCommand(br);
+ if (cmd == null || cmd.id == null) {
+ break; // End of file or error
}
+
+ // Check if this is an entry point or jump target
+ bool isEntryPoint = false;
+ int entryPointIndex = -1;
+ string label = null;
+
+ if (OffsetToLabelMap.TryGetValue(currentOffset, out string existingLabel)) {
+ label = existingLabel;
+ isEntryPoint = existingLabel.StartsWith("script_");
+ if (isEntryPoint) {
+ entryPointIndex = int.Parse(existingLabel.Substring("script_".Length));
+ }
+ }
+
+ // Add to command sequence
+ CommandSequence.Add(new ScriptCommandPosition(
+ cmd, currentOffset, label, isEntryPoint, entryPointIndex));
}
}
}
- public ScriptFile(int fileID, bool readFunctions = true, bool readActions = true) : this(getFileStream(fileID), readFunctions, readActions) {
+ public ScriptFile(int fileID) : this(getFileStream(fileID)) {
this.fileID = fileID;
}
- static FileStream getFileStream(int fileID) {
+ public static FileStream getFileStream(int fileID) {
string path = Filesystem.GetScriptPath(fileID);
return new FileStream(path, FileMode.OpenOrCreate);
}
@@ -164,732 +137,441 @@ namespace DSPRE.ROMFiles {
return $"{prefix}Script File " + this.fileID;
}
- public ScriptFile(List scripts, List functions, List movements, int fileID = -1) {
- allScripts = scripts;
- allFunctions = functions;
- allActions = movements;
- isLevelScript = false;
- }
-
- public ScriptFile(IEnumerable scriptLines, IEnumerable functionLines, IEnumerable actionLines, int fileID = -1) {
- //TODO: give user the possibility to jump to/call a script
- //once it's done, this Predicate below will be the only one needed, since there will be no distinction between
- //a script and a function
- bool functionEndCondition(List<(int linenum, string text)> source, int x, ushort? id) {
- return source[x].text.TrimEnd().IgnoreCaseEquals(RomInfo.ScriptCommandNamesDict[0x0002]) //End
- || source[x].text.IndexOf(RomInfo.ScriptCommandNamesDict[0x0016] + ' ' + ContainerTypes.Function.ToString(), StringComparison.InvariantCultureIgnoreCase) >= 0 //Jump Function_#
- || source[x].text.TrimEnd().IgnoreCaseEquals(RomInfo.ScriptCommandNamesDict[0x001B])
- || ScriptDatabase.endCodes.Contains(id);
- } //Return
-
- bool scriptEndCondition(List<(int linenum, string text)> source, int x, ushort? id) {
- return source[x].text.TrimEnd().IgnoreCaseEquals(RomInfo.ScriptCommandNamesDict[0x0002]) //End
- || source[x].text.IndexOf(RomInfo.ScriptCommandNamesDict[0x0016] + ' ' + ContainerTypes.Function.ToString()) >= 0 //Jump Function_#
- || ScriptDatabase.endCodes.Contains(id);
- }
-
- allScripts = ReadCommandsFromLines(scriptLines.ToList(), ContainerTypes.Script, scriptEndCondition); //Jump + whitespace
- if (allScripts is null) {
- return;
- }
-
- if (allScripts.Count <= 0) {
- this.fileID = int.MaxValue;
- return;
- }
-
- if (functionLines != null) {
- allFunctions = ReadCommandsFromLines(functionLines.ToList(), ContainerTypes.Function, functionEndCondition); //Jump + whitespace
- if (allFunctions is null) {
- return;
- }
- }
-
- if (actionLines != null) {
- allActions = ReadActionsFromLines(actionLines.ToList());
- if (allActions is null) {
- return;
- }
- }
-
+ public ScriptFile(IEnumerable lines, int fileID = -1) {
+ CommandSequence = new List();
+ OffsetToLabelMap = new Dictionary();
this.fileID = fileID;
+
+ int currentOffset = 0;
+ string currentLabel = null;
+ int entryPointIndex = 0;
+ bool isCurrentLabelEntryPoint = false; // Track this instead
+
+ // Parse each line
+ foreach (var line in lines) {
+ string trimmedLine = line.Trim();
+
+ // Skip empty lines
+ if (string.IsNullOrWhiteSpace(trimmedLine)) {
+ continue;
+ }
+
+ // Check if this is a label
+ if (trimmedLine.EndsWith(":")) {
+ currentLabel = trimmedLine.Substring(0, trimmedLine.Length - 1);
+
+ // Track if it's an entry point
+ isCurrentLabelEntryPoint = currentLabel.StartsWith("script_");
+ if (isCurrentLabelEntryPoint) {
+ if (int.TryParse(currentLabel.Substring("script_".Length), out int index)) {
+ entryPointIndex = index;
+ }
+ }
+
+ continue;
+ }
+
+ // Parse the command
+ ScriptCommand cmd = new ScriptCommand(trimmedLine);
+ if (cmd.id == null) {
+ continue; // Skip invalid commands
+ }
+
+ // Calculate the size of this command for offset tracking
+ int cmdSize = 2; // Command ID (2 bytes)
+ foreach (var param in cmd.Parameters) {
+ cmdSize += param.RawData.Length;
+ }
+
+ // Use the tracked entry point flag
+ int epIndex = isCurrentLabelEntryPoint ? entryPointIndex : -1;
+
+ CommandSequence.Add(new ScriptCommandPosition(
+ cmd, currentOffset, currentLabel, isCurrentLabelEntryPoint, epIndex));
+
+ // Map the offset to the label for jump targets
+ if (currentLabel != null) {
+ OffsetToLabelMap[currentOffset] = currentLabel;
+ currentLabel = null; // Reset label
+ isCurrentLabelEntryPoint = false; // Reset entry point flag
+ }
+
+ // Update offset for next command
+ currentOffset += cmdSize;
+ }
}
- private ScriptCommand ReadCommand(BinaryReader dataReader, ref List functionOffsets, ref List actionOffsets) {
- ushort id = dataReader.ReadUInt16();
- List parameterList = new List();
+ private ScriptCommand ReadCommand(BinaryReader br) {
+ // Check if we've reached the end of the file
+ if (br.BaseStream.Position >= br.BaseStream.Length) {
+ return null;
+ }
- /* How to read parameters for different commands for DPPt*/
- switch (RomInfo.gameFamily) {
- case GameFamilies.DP:
- case GameFamilies.Plat:
- switch (id) {
- case 0x16: //Jump
- case 0x1A: //Call
- ProcessRelativeJump(dataReader, ref parameterList, ref functionOffsets);
- break;
- case 0x17: //JumpIfObjID
- case 0x18: //JumpIfBgID
- case 0x19: //JumpIfPlayerDir
- case 0x1C: //JumpIf
- case 0x1D: //CallIf
- //in the case of JumpIf and CallIf, the first param is a comparisonOperator
- //for JumpIfPlayerDir it's a directionID
- //for JumpIfObjID, it's an EventID
- parameterList.Add(new byte[] { dataReader.ReadByte() });
- ProcessRelativeJump(dataReader, ref parameterList, ref functionOffsets);
- break;
- case 0x5E: // Movement
- parameterList.Add(BitConverter.GetBytes(dataReader.ReadUInt16()));
- ProcessRelativeJump(dataReader, ref parameterList, ref actionOffsets);
- break;
- case 0x1CF:
- case 0x1D0:
- case 0x1D1: {
- byte parameter1 = dataReader.ReadByte();
- parameterList.Add(new byte[] { parameter1 });
- if (parameter1 == 0x2) {
- parameterList.Add(dataReader.ReadBytes(2)); //Read additional u16 if first param read is 2
- }
- }
- break;
- case 0x21D: {
- ushort parameter1 = dataReader.ReadUInt16();
- parameterList.Add(BitConverter.GetBytes(parameter1));
+ try {
+ ushort id = br.ReadUInt16();
+ List parameters = new List();
- switch (parameter1) {
- case 0:
- case 1:
- case 2:
- case 3:
- parameterList.Add(dataReader.ReadBytes(2));
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- case 4:
- case 5:
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- case 6:
- break;
- }
- }
- break;
- case 0x235: {
- short parameter1 = dataReader.ReadInt16();
- parameterList.Add(BitConverter.GetBytes(parameter1));
+ // Track the original position for jump calculations
+ long commandStartPos = br.BaseStream.Position - 2;
- switch (parameter1) {
- case 0x1:
- case 0x3:
- parameterList.Add(dataReader.ReadBytes(2));
- parameterList.Add(dataReader.ReadBytes(2));
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- case 0x4:
- parameterList.Add(dataReader.ReadBytes(2));
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- case 0x0:
- case 0x6:
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- default:
- break;
- }
- }
- break;
- case 0x23E: {
- short parameter1 = dataReader.ReadInt16();
- parameterList.Add(BitConverter.GetBytes(parameter1));
+ switch (gameFamily) {
+ case GameFamilies.Plat:
+ switch (id) {
+ case 0x16: // Jump
+ case 0x1A: // Call
+ ProcessRelativeJumpLinear(br, parameters);
+ break;
- switch (parameter1) {
- case 0x1:
- case 0x3:
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- case 0x5:
- case 0x6:
- parameterList.Add(dataReader.ReadBytes(2));
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- default:
- break;
+ case 0x17: // JumpIfObjID
+ case 0x18: // JumpIfEventID
+ case 0x19: // JumpIfPlayerDir
+ case 0x1C: // JumpIf
+ case 0x1D: // CallIf
+ // First parameter (condition)
+ parameters.Add(new ScriptParameter(new byte[] { br.ReadByte() }));
+ // Then jump target
+ ProcessRelativeJumpLinear(br, parameters);
+ break;
+
+ case 0x5E: // Movement
+ parameters.Add(new ScriptParameter(BitConverter.GetBytes(br.ReadUInt16())));
+ ProcessRelativeJumpLinear(br, parameters);
+ break;
+
+ case 0x1CF:
+ case 0x1D0:
+ case 0x1D1: {
+ byte parameter1 = br.ReadByte();
+ parameters.Add(new ScriptParameter(new byte[] { parameter1 }));
+ if (parameter1 == 0x2) {
+ parameters.Add(new ScriptParameter(br.ReadBytes(2))); //Read additional u16 if first param read is 2
+ }
}
- }
- break;
- case 0x2C4: {
- byte parameter1 = dataReader.ReadByte();
- parameterList.Add(new byte[] { parameter1 });
- if (parameter1 == 0 || parameter1 == 1) {
- parameterList.Add(dataReader.ReadBytes(2));
+ break;
+ case 0x21D: {
+ ushort parameter1 = br.ReadUInt16();
+ parameters.Add(new ScriptParameter(BitConverter.GetBytes(parameter1)));
+
+ switch (parameter1) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ case 4:
+ case 5:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ case 6:
+ break;
+ }
}
- }
- break;
- case 0x2C5: {
+ break;
+ case 0x235: {
+ short parameter1 = br.ReadInt16();
+ parameters.Add(new ScriptParameter(BitConverter.GetBytes(parameter1)));
+
+ switch (parameter1) {
+ case 0x1:
+ case 0x3:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ case 0x4:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ case 0x0:
+ case 0x6:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case 0x23E: {
+ short parameter1 = br.ReadInt16();
+ parameters.Add(new ScriptParameter(BitConverter.GetBytes(parameter1)));
+
+ switch (parameter1) {
+ case 0x1:
+ case 0x3:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ case 0x5:
+ case 0x6:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case 0x2C4: {
+ byte parameter1 = br.ReadByte();
+ parameters.Add(new ScriptParameter(new byte[] { parameter1 }));
+ if (parameter1 == 0 || parameter1 == 1) {
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ }
+ }
+ break;
+ case 0x2C5: {
+ if (RomInfo.gameVersion == GameVersions.Platinum) {
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ } else {
+ goto default;
+ }
+ }
+ break;
+ case 0x2C6:
+ case 0x2C9:
+ case 0x2CA:
+ case 0x2CD:
if (RomInfo.gameVersion == GameVersions.Platinum) {
- parameterList.Add(dataReader.ReadBytes(2));
- parameterList.Add(dataReader.ReadBytes(2));
+ break;
} else {
goto default;
}
- }
- break;
- case 0x2C6:
- case 0x2C9:
- case 0x2CA:
- case 0x2CD:
- if (RomInfo.gameVersion == GameVersions.Platinum) {
+ case 0x2CF:
+ if (RomInfo.gameVersion == GameVersions.Platinum) {
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ } else {
+ goto default;
+ }
+
break;
- } else {
- goto default;
- }
- case 0x2CF:
- if (RomInfo.gameVersion == GameVersions.Platinum) {
- parameterList.Add(dataReader.ReadBytes(2));
- parameterList.Add(dataReader.ReadBytes(2));
- } else {
- goto default;
- }
+ default:
+ // Standard command handling
+ if (RomInfo.ScriptCommandParametersDict.TryGetValue(id, out byte[] paramSizes)) {
+ foreach (int size in paramSizes) {
+ parameters.Add(new ScriptParameter(br.ReadBytes(size)));
+ }
+ }
+ break;
+ }
+ break;
+ case GameFamilies.HGSS:
+ switch (id) {
+ case 0x16: //Jump
+ case 0x1A: //Call
+ ProcessRelativeJumpLinear(br, parameters);
+ break;
+
+ case 0x17: //JumpIfObjID
+ case 0x18: //JumpIfBgID
+ case 0x19: //JumpIfPlayerDir
+ case 0x1C: //JumpIf
+ case 0x1D: //CallIf
+ parameters.Add(new ScriptParameter(new byte[] { br.ReadByte() })); //in the case of JumpIf and CallIf, the first param is a comparisonOperator
+ ProcessRelativeJumpLinear(br, parameters);
+ break;
+
+ case 0x5E: // Movement
+ parameters.Add(new ScriptParameter(BitConverter.GetBytes(br.ReadUInt16()))); //in the case of Movement, the first param is an overworld ID
+ ProcessRelativeJumpLinear(br, parameters);
+ break;
+
+ case 0x190:
+ case 0x191:
+ case 0x192: {
+ byte parameter1 = br.ReadByte();
+ parameters.Add(new ScriptParameter(new byte[] { parameter1 }));
+ if (parameter1 == 0x2) {
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ }
+ }
+ break;
+
+ case 0x1D1: // Number of parameters differ depending on the first parameter value
+ {
+ short parameter1 = br.ReadInt16();
+ parameters.Add(new ScriptParameter(BitConverter.GetBytes(parameter1)));
+ switch (parameter1) {
+ case 0x0:
+ case 0x1:
+ case 0x2:
+ case 0x3:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ case 0x4:
+ case 0x5:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ case 0x6:
+ break;
+ case 0x7:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+
+ case 0x1E9: // Number of parameters differ depending on the first parameter value
+ {
+ short parameter1 = br.ReadInt16();
+ parameters.Add(new ScriptParameter(BitConverter.GetBytes(parameter1)));
+ switch (parameter1) {
+ case 0x0:
+ break;
+ case 0x1:
+ case 0x2:
+ case 0x3:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ case 0x4:
+ break;
+ case 0x5:
+ case 0x6:
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ parameters.Add(new ScriptParameter(br.ReadBytes(2)));
+ break;
+ case 0x7:
+ case 0x8:
+ break;
+ default:
+ break;
+ }
+ }
break;
- default:
- addParametersToList(ref parameterList, id, dataReader);
- break;
- }
+
+ default:
+ // For standard commands, read parameters based on definition
+ if (RomInfo.ScriptCommandParametersDict.TryGetValue(id, out byte[] paramSizes)) {
+ foreach (int size in paramSizes) {
+ parameters.Add(new ScriptParameter(br.ReadBytes(size)));
+ }
+ }
+ break;
+ }
break;
- case GameFamilies.HGSS:
- switch (id) {
- case 0x16: //Jump
- case 0x1A: //Call
- ProcessRelativeJump(dataReader, ref parameterList, ref functionOffsets);
- break;
- case 0x17: //JumpIfObjID
- case 0x18: //JumpIfBgID
- case 0x19: //JumpIfPlayerDir
- case 0x1C: //JumpIf
- case 0x1D: //CallIf
- parameterList.Add(new byte[] { dataReader.ReadByte() }); //in the case of JumpIf and CallIf, the first param is a comparisonOperator
- ProcessRelativeJump(dataReader, ref parameterList, ref functionOffsets);
- break;
- case 0x5E: // Movement
- parameterList.Add(BitConverter.GetBytes(dataReader.ReadUInt16())); //in the case of Movement, the first param is an overworld ID
- ProcessRelativeJump(dataReader, ref parameterList, ref actionOffsets);
- break;
- case 0x190:
- case 0x191:
- case 0x192: {
- byte parameter1 = dataReader.ReadByte();
- parameterList.Add(new byte[] { parameter1 });
- if (parameter1 == 0x2) {
- parameterList.Add(dataReader.ReadBytes(2));
- }
- }
- break;
- case 0x1D1: // Number of parameters differ depending on the first parameter value
- {
- short parameter1 = dataReader.ReadInt16();
- parameterList.Add(BitConverter.GetBytes(parameter1));
- switch (parameter1) {
- case 0x0:
- case 0x1:
- case 0x2:
- case 0x3:
- parameterList.Add(dataReader.ReadBytes(2));
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- case 0x4:
- case 0x5:
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- case 0x6:
- break;
- case 0x7:
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- default:
- break;
- }
- }
- break;
- case 0x1E9: // Number of parameters differ depending on the first parameter value
- {
- short parameter1 = dataReader.ReadInt16();
- parameterList.Add(BitConverter.GetBytes(parameter1));
- switch (parameter1) {
- case 0x0:
- break;
- case 0x1:
- case 0x2:
- case 0x3:
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- case 0x4:
- break;
- case 0x5:
- case 0x6:
- parameterList.Add(dataReader.ReadBytes(2));
- parameterList.Add(dataReader.ReadBytes(2));
- break;
- case 0x7:
- case 0x8:
- break;
- default:
- break;
- }
- }
- break;
- default:
- addParametersToList(ref parameterList, id, dataReader);
- break;
- }
-
- break;
- }
-
- return new ScriptCommand(id, parameterList);
- }
-
- private void ProcessRelativeJump(BinaryReader dataReader, ref List parameterList, ref List offsetsList) {
- int relativeOffset = dataReader.ReadInt32();
- int offsetFromScriptFileStart = (int)(relativeOffset + dataReader.BaseStream.Position);
-
- if (!offsetsList.Contains(offsetFromScriptFileStart)) {
- offsetsList.Add(offsetFromScriptFileStart);
- }
-
- int functionNumber = offsetsList.IndexOf(offsetFromScriptFileStart);
- if (functionNumber < 0) {
- throw new InvalidOperationException();
- }
-
- parameterList.Add(BitConverter.GetBytes(functionNumber + 1));
- }
-
- private void addParametersToList(ref List parameterList, ushort id, BinaryReader dataReader) {
- Console.WriteLine("Loaded command id: " + id.ToString("X4"));
- try {
- foreach (int bytesToRead in RomInfo.ScriptCommandParametersDict[id]) {
- parameterList.Add(dataReader.ReadBytes(bytesToRead));
}
- } catch (NullReferenceException) {
- MessageBox.Show("Script command " + id + "can't be handled for now." +
- Environment.NewLine + "Reference offset 0x" + dataReader.BaseStream.Position.ToString("X"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- parameterList = null;
- return;
- } catch {
- MessageBox.Show("Error: ID Read - " + id +
- Environment.NewLine + "Reference offset 0x" + dataReader.BaseStream.Position.ToString("X"), "Unrecognized script command", MessageBoxButtons.OK, MessageBoxIcon.Error);
- parameterList = null;
- return;
- }
- }
- private void AddReference(ref List references, ushort commandID, List parameterList, int pos, ScriptCommandContainer cont) {
- if (ScriptDatabase.commandsWithRelativeJump.TryGetValue(commandID, out int parameterWithRelativeJump)) {
- uint invokedID = BitConverter.ToUInt32(parameterList[parameterWithRelativeJump], 0); // Jump, Call
-
- if (commandID == 0x005E)
- references.Add(new ScriptReference(cont.containerType, cont.manualUserID, ContainerTypes.Action, invokedID, pos - 4));
- else {
- references.Add(new ScriptReference(cont.containerType, cont.manualUserID, ContainerTypes.Function, invokedID, pos - 4));
- }
- }
- }
-
- private List ReadCommandsFromLines(List linelist, ContainerTypes containerType, Func, int, ushort?, bool> endConditions) {
- List<(int linenum, string text)> lineSource = new List<(int linenum, string text)>();
-
- for (int l = 0; l < linelist.Count; l++) {
- string cur = linelist[l];
- if (!string.IsNullOrWhiteSpace(cur)) {
- lineSource.Add((l, cur));
- }
- }
-
- List ls = new List();
- int i = 0;
-
- try {
- uint scriptNumber = 0;
-
- while (i < lineSource.Count) {
- if (scriptNumber == 0) {
- int positionOfScriptNumber;
- int positionOfScriptKeyword = lineSource[i].text.IndexOf(containerType.ToString(), StringComparison.InvariantCultureIgnoreCase);
-
- if (positionOfScriptKeyword > 0) {
- MessageBox.Show("Unrecognized container keyword: \"" + lineSource[i] + '"', "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return null;
- } else if (positionOfScriptKeyword < 0) {
- i++;
- continue;
- } else {
- if ((positionOfScriptNumber = lineSource[i].text.IndexOfFirstNumber()) < positionOfScriptKeyword) {
- MessageBox.Show("Unspecified Script/Function label.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return null;
- }
- }
-
- scriptNumber = uint.Parse(lineSource[i++].text.Substring(positionOfScriptNumber).Split()[0].Replace(":", ""));
- }
-
- if (lineSource[i].text.IndexOf("UseScript", StringComparison.InvariantCultureIgnoreCase) >= 0) {
- int useScriptNumber = short.Parse(lineSource[i].text.Substring(1 + lineSource[i].text.IndexOf('#')));
- ls.Add(new ScriptCommandContainer(scriptNumber, containerType, useScriptNumber));
- i++;
- } else {
- /* Read script commands */
- List cmdList = new List();
- ScriptCommand lastRead;
-
- do {
- lastRead = new ScriptCommand(lineSource[i].text, lineSource[i].linenum + 1);
- if (lastRead.id is null) {
- return null;
- }
-
- cmdList.Add(lastRead);
- }
- while (!endConditions(lineSource, i++, lastRead.id));
-
- ls.Add(new ScriptCommandContainer(scriptNumber, containerType, commandList: cmdList));
- }
-
- scriptNumber = 0;
- }
- } catch (ArgumentOutOfRangeException) {
- MessageBox.Show($"Unexpectedly reached end of lines.\n\n" +
- $"Last line index: {lineSource[i].linenum}.\n" +
- $"Managed to parse {ls.Count} Command Containers.", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return new ScriptCommand(id, parameters);
+ } catch (Exception ex) {
+ Console.WriteLine($"Error reading command at offset {br.BaseStream.Position}: {ex.Message}");
return null;
}
-
- return ls;
}
- private List ReadActionsFromLines(List linelist) {
- List<(int linenum, string text)> lineSource = new List<(int linenum, string text)>();
+ private void ProcessRelativeJumpLinear(BinaryReader br, List parameters) {
+ // Read the relative offset
+ int relativeOffset = br.ReadInt32();
- for (int l = 0; l < linelist.Count; l++) {
- string cur = linelist[l];
- if (!string.IsNullOrWhiteSpace(cur)) {
- lineSource.Add((l, cur));
- }
+ // Calculate absolute target
+ int targetOffset = (int)(relativeOffset + br.BaseStream.Position);
+
+ // Add to label map if not already there
+ if (!OffsetToLabelMap.ContainsKey(targetOffset)) {
+ string labelName = $"label_0x{targetOffset:X}";
+ OffsetToLabelMap[targetOffset] = labelName;
}
- List ls = new List();
- int i = 0;
+ // Create jump parameter
+ string targetLabel = OffsetToLabelMap[targetOffset];
+ ScriptParameter jumpParam = new ScriptParameter(relativeOffset, targetLabel) {
+ Type = ScriptParameter.ParameterType.RelativeJump
+ };
+ parameters.Add(jumpParam);
+ }
- try {
- uint actionNumber = 0;
+ // Convert to text - outputs commands in the order they appear in the binary
+ public string ToText() {
+ StringBuilder sb = new StringBuilder();
- while (i < lineSource.Count) {
- if (actionNumber == 0) {
- int positionOfActionNumber;
- int positionOfActionKeyword = lineSource[i].text.IndexOf(ContainerTypes.Action.ToString(), StringComparison.InvariantCultureIgnoreCase);
-
- if (positionOfActionKeyword > 0) {
- MessageBox.Show("Unrecognized container keyword: \"" + lineSource[i] + '"', "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return null;
- } else if (positionOfActionKeyword < 0) {
- i++;
- continue;
- } else {
- if ((positionOfActionNumber = lineSource[i].text.IndexOfFirstNumber()) < positionOfActionKeyword) {
- MessageBox.Show("Unspecified Action label.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return null;
- }
- }
-
- actionNumber = uint.Parse(lineSource[i].text.Substring(positionOfActionNumber).Split()[0].Replace(":", ""));
- i++;
- }
-
- List cmdList = new List();
- /* Read script actions */
- do {
- ScriptAction toAdd = new ScriptAction(lineSource[i].text, lineSource[i].linenum + 1);
- if (toAdd.id is null) {
- return null;
- }
-
- cmdList.Add(toAdd);
- }
- while (!lineSource[i++].text.IgnoreCaseEquals(RomInfo.ScriptActionNamesDict[0x00FE]));
-
- ls.Add(new ScriptActionContainer(actionNumber, commands: cmdList));
- actionNumber = 0;
+ foreach (var cmdPos in CommandSequence) {
+ // If this command needs a label, output it
+ if (!string.IsNullOrEmpty(cmdPos.Label)) {
+ sb.AppendLine($"\n{cmdPos.Label}:");
}
- } catch (ArgumentOutOfRangeException) {
- MessageBox.Show($"Unexpectedly reached end of lines.\n\n" +
- $"Last line index: {i}.\n" +
- $"Managed to parse {ls.Count} Command Containers.", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return null;
+
+ // Output the command (indented if not an entry point)
+ string indent = "\t";
+ sb.AppendLine($"{indent}{cmdPos.Command.name}");
}
- return ls;
+ return sb.ToString();
}
public override byte[] ToByteArray() {
MemoryStream newData = new MemoryStream();
using (BinaryWriter writer = new BinaryWriter(newData)) {
- List scriptOffsets = new List(); //uint OFFSET, int Function/Script/Action ID
- List functionOffsets = new List();
- List actionOffsets = new List();
+ // First, find all entry points and their positions in the command sequence
+ var entryPoints = CommandSequence
+ .Where(c => c.IsEntryPoint)
+ .OrderBy(c => c.EntryPointIndex)
+ .ToList();
- List refList = new List();
+ // Allocate space for header
+ long headerStart = writer.BaseStream.Position;
+ writer.BaseStream.Position += entryPoints.Count * 4;
+ writer.Write((ushort)0xFD13); // End of header marker
- /* Allocate enough space for script pointers, which we do not know yet */
- try {
- writer.BaseStream.Position += allScripts.Count * 0x4;
- writer.Write((ushort)0xFD13); // Signal the end of header section
- List useScriptCallers = new List();
+ // Keep track of command offsets in the new file
+ Dictionary oldOffsetToNewOffset = new Dictionary();
- /* Write scripts */
- foreach (ScriptCommandContainer currentScript in allScripts) {
- if (currentScript.usedScriptID == -1) {
- scriptOffsets.Add(new ContainerReference() {
- ID = currentScript.manualUserID,
- offsetInFile = (uint)writer.BaseStream.Position
- }
- );
+ // Write all commands sequentially
+ foreach (var cmdPos in CommandSequence) {
+ // Record the position of this command
+ oldOffsetToNewOffset[cmdPos.Offset] = writer.BaseStream.Position;
- foreach (ScriptCommand currentCmd in currentScript.commands) {
- writer.Write((ushort)currentCmd.id);
- //System.Diagnostics.Debug.Write(BitConverter.ToString(BitConverter.GetBytes(commandID)) + " ");
+ // Write the command
+ writer.Write((ushort)cmdPos.Command.id);
- List parameterList = currentCmd.cmdParams;
- foreach (byte[] b in parameterList) {
- writer.Write(b);
- //System.Diagnostics.Debug.WriteLine(BitConverter.ToString(parameterList[k]) + " ");
+ // Write parameters, handling jumps specially
+ foreach (var param in cmdPos.Command.Parameters) {
+ if (param.Type == ScriptParameter.ParameterType.RelativeJump) {
+ // For jump targets, we need to recalculate the relative offset
+ // based on the new positions of commands
+
+ // Find the target offset in the original file
+ int targetOffset = -1;
+ foreach (var kvp in OffsetToLabelMap) {
+ if (kvp.Value == param.TargetLabel) {
+ targetOffset = kvp.Key;
+ break;
}
-
- /* If command calls a function/movement, store reference position */
- AddReference(ref refList, (ushort)currentCmd.id, parameterList, (int)writer.BaseStream.Position, currentScript);
- }
- } else {
- useScriptCallers.Add(currentScript);
- }
- }
-
- int scriptsCount = scriptOffsets.Count;
- foreach (ScriptCommandContainer caller in useScriptCallers) {
- for (int i = 0; i < scriptsCount; i++) {
- ContainerReference scriptReference = scriptOffsets[i];
-
- if (scriptReference.ID == caller.usedScriptID) {
- scriptOffsets.Add(new ContainerReference() {
- ID = caller.manualUserID,
- offsetInFile = scriptReference.offsetInFile
- }); // If script has UseScript, copy offset
- }
- }
- }
-
- /* Write functions */
- foreach (ScriptCommandContainer currentFunction in allFunctions) {
- if (currentFunction.usedScriptID == -1) {
- functionOffsets.Add(new ContainerReference() {
- ID = currentFunction.manualUserID,
- offsetInFile = (uint)writer.BaseStream.Position
- }
- );
-
- foreach (ScriptCommand currentCmd in currentFunction.commands) {
- writer.Write((ushort)currentCmd.id);
- //System.Diagnostics.Debug.Write(BitConverter.ToString(BitConverter.GetBytes(commandID)) + " ");
-
- List parameterList = currentCmd.cmdParams;
- foreach (byte[] b in parameterList) {
- writer.Write(b);
- //System.Diagnostics.Debug.Write(BitConverter.ToString(parameterList[k]) + " ");
- }
-
- /* If command calls a function/movement, store reference position */
-
- AddReference(ref refList, (ushort)currentCmd.id, parameterList, (int)writer.BaseStream.Position, currentFunction);
- }
- } else {
- int functionUsescript = currentFunction.usedScriptID - 1;
- if (functionUsescript >= scriptOffsets.Count) {
- MessageBox.Show($"Function #{currentFunction.manualUserID} refers to Script {currentFunction.usedScriptID}, which does not exist.\n" +
- $"This Script File can't be saved.", "Can't resolve UseScript reference", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return null;
}
- functionOffsets.Add(new ContainerReference() {
- ID = currentFunction.manualUserID,
- offsetInFile = scriptOffsets.Find(x => x.ID == currentFunction.usedScriptID).offsetInFile
- });
- }
- }
-
- // Movements must be halfword-aligned
- if (writer.BaseStream.Position % 2 == 1) { //Check if the writer's head is on an odd byte
- writer.Write((byte)0x00); //Add padding
- }
-
- /* Write movements */
- foreach (ScriptActionContainer currentAction in allActions) {
- actionOffsets.Add(new ContainerReference() {
- ID = currentAction.manualUserID,
- offsetInFile = (uint)writer.BaseStream.Position
- });
-
- foreach (ScriptAction currentCmd in currentAction.commands) {
- writer.Write((ushort)currentCmd.id);
- writer.Write((ushort)currentCmd.repetitionCount);
- }
- }
-
- /* Write script offsets to header */
- writer.BaseStream.Position = 0x0;
-
- scriptOffsets = scriptOffsets.OrderBy(x => x.ID).ToList(); //Write script offsets to header in the correct order
- for (int i = 0; i < scriptOffsets.Count; i++) {
- writer.Write(scriptOffsets[i].offsetInFile - (uint)writer.BaseStream.Position - 0x4);
- }
-
- SortedSet undeclaredFuncs = new SortedSet();
- SortedSet undeclaredActions = new SortedSet();
-
- SortedSet uninvokedFuncs = new SortedSet(allFunctions.Select(x => x.manualUserID).ToArray());
- SortedSet unreferencedActions = new SortedSet(allActions.Select(x => x.manualUserID).ToArray());
-
- //refList = refList.OrderBy(x => x.invokedID).ToList(); //Sorting is not necessary, after all...
-
- for (int i = 0; i < refList.Count; i++) {
- writer.BaseStream.Position = refList[i].invokedAt; //place seek head on parameter that is supposed to store the jump address
- ContainerReference result;
-
- if (refList[i].typeOfInvoked is ContainerTypes.Action) { //isApplyMovement
- result = actionOffsets.Find(entry => entry.ID == refList[i].invokedID);
-
- if (result.Equals(default(ContainerReference))) {
- undeclaredActions.Add(refList[i].invokedID);
- } else {
- int relativeOffset = (int)(result.offsetInFile - refList[i].invokedAt - 4);
+ if (targetOffset != -1 && oldOffsetToNewOffset.TryGetValue(targetOffset, out long newTargetOffset)) {
+ // Calculate new relative offset
+ int relativeOffset = (int)(newTargetOffset - (writer.BaseStream.Position + 4));
writer.Write(relativeOffset);
- unreferencedActions.Remove(refList[i].invokedID);
+ } else {
+ // Fallback - write original offset
+ writer.Write(param.TargetOffset);
}
} else {
- result = functionOffsets.Find(entry => entry.ID == refList[i].invokedID);
-
- if (result.Equals(default(ContainerReference))) {
- undeclaredFuncs.Add(refList[i].invokedID);
- } else {
- int relativeOffset = (int)(result.offsetInFile - refList[i].invokedAt - 4);
- writer.Write(relativeOffset);
-
- if (FunctionIsInvoked(refList, uninvokedFuncs, refList[i].invokedID, 0)) {
- uninvokedFuncs.Remove(refList[i].invokedID);
- }
-
- //if (refList[i].callerType != containerTypes.Function ||
- // (refList[i].callerType == refList[i].invokedType && refList[i].callerID == refList[i].invokedID) ||
- // !uninvokedFuncs.Contains(refList[i].callerID)) { //remove reference if caller is a script, or if caller calls itself, or if caller is a function that's been invoked already
- // uninvokedFuncs.Remove(refList[i].invokedID);
- //}
- }
+ // Regular parameter
+ writer.Write(param.RawData);
}
}
+ }
- //Error check
- string errorMsg = "";
- if (undeclaredFuncs.Count > 0) {
- string[] errorFunctionsUndeclared = undeclaredFuncs.ToArray().Select(x => x.ToString()).ToArray();
- errorMsg += "These Functions have been invoked but not declared: " + Environment.NewLine + string.Join(separator: ",", errorFunctionsUndeclared);
- errorMsg += Environment.NewLine;
+ // Update header with entry point offsets
+ writer.BaseStream.Position = headerStart;
+ foreach (var entryPoint in entryPoints) {
+ if (oldOffsetToNewOffset.TryGetValue(entryPoint.Offset, out long newOffset)) {
+ uint relativeOffset = (uint)(newOffset - (headerStart + 4));
+ writer.Write(relativeOffset);
}
-
- if (undeclaredActions.Count > 0) {
- string[] errorActionsUndeclared = undeclaredActions.ToArray().Select(x => x.ToString()).ToArray();
- errorMsg += "These Actions have been referenced but not declared: " + Environment.NewLine + string.Join(separator: ",", errorActionsUndeclared);
- errorMsg += Environment.NewLine;
- }
-
- if (!string.IsNullOrEmpty(errorMsg)) {
- MessageBox.Show(errorMsg + Environment.NewLine + "This Script File has not been overwritten since it can not be saved.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
- errorMsg = "";
- return null;
- }
-
- if (uninvokedFuncs.Count > 0) {
- string[] orphanedFunctions = uninvokedFuncs.ToArray().Select(x => x.ToString()).ToArray();
- errorMsg += "Unused Function IDs detected: " + Environment.NewLine + string.Join(", ", orphanedFunctions);
- errorMsg += Environment.NewLine;
- errorMsg += "\nIn order for a Function to be saved, it must be invoked by a Script or by another used Function.";
- errorMsg += Environment.NewLine;
- errorMsg += Environment.NewLine;
- }
-
- if (unreferencedActions.Count > 0) {
- string[] orphanedActions = unreferencedActions.ToArray().Select(x => x.ToString()).ToArray();
- errorMsg += "Unused Action IDs detected: " + Environment.NewLine + string.Join(", ", orphanedActions);
- errorMsg += Environment.NewLine;
- errorMsg += "\nIn order for an Action to be saved, it must be called by a Script or by a used Function.";
- errorMsg += Environment.NewLine;
- errorMsg += Environment.NewLine;
- }
-
- if (!string.IsNullOrEmpty(errorMsg)) {
- MessageBox.Show(errorMsg + Environment.NewLine + "Remember that every unused Function or Action is always lost upon reloading the Script File.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- errorMsg = "";
- }
- } catch (NullReferenceException nre) {
- Console.WriteLine(nre);
- return null;
}
}
return newData.ToArray();
}
- private bool FunctionIsInvoked(List refList, SortedSet uninvokedFuncsSet, uint funcID, int callCount = 0, uint? excludedCaller = null) {
- if (callCount >= 30) {
- MessageBox.Show("Something went very wrong saving this Script File!" +
- "\nIt is recommended that you backup its code somewhere, to avoid losing progress.",
- "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return false;
- }
-
- Console.WriteLine("Checking calls of function " + funcID + (excludedCaller == null ? "" : " excluding Function " + excludedCaller + " as the caller."));
-
- if (!uninvokedFuncsSet.Contains(funcID)) {
- Console.WriteLine("Function " + funcID + " has already been invoked before. Nothing to check.");
- return true; //Abort
- }
-
- if (refList is null || refList.Count <= 0) {
- return false;
- }
-
- //Find the first instance of funcID being called, excluding calls coming from an excludedCaller
- //if excludedCaller is null, there's nothing to exclude: a normal search is performed.
- ScriptReference sr = refList.Find(x => x.invokedID == funcID && (excludedCaller == null || x.callerID != excludedCaller));
-
- if (sr is null) {
- Console.WriteLine("No reference found!!!");
- return false;
- }
-
- if (sr.typeOfCaller is ContainerTypes.Script) {
- Console.WriteLine("Function " + funcID + " is directly called by Script " + sr.callerID);
- return true;
- }
-
- if (sr.typeOfCaller is ContainerTypes.Function) {
- if (FunctionIsInvoked(refList, uninvokedFuncsSet, sr.callerID, ++callCount, excludedCaller: sr.invokedID)) { //check if caller function is invoked as well
- Console.WriteLine("Function " + funcID + " is called by Function " + sr.callerID);
- return true;
- }
- }
-
- Console.WriteLine("Function " + funcID + " is unused");
- return false;
- }
-
public bool SaveToFileDefaultDir(int IDtoReplace, bool showSuccessMessage = true) {
return SaveToFileDefaultDir(RomInfo.DirNames.scripts, IDtoReplace, showSuccessMessage);
}
diff --git a/DS_Map/ROMFiles/ScriptLabeledSection.cs b/DS_Map/ROMFiles/ScriptLabeledSection.cs
new file mode 100644
index 0000000..3336f3b
--- /dev/null
+++ b/DS_Map/ROMFiles/ScriptLabeledSection.cs
@@ -0,0 +1,21 @@
+// Create this as a new file: ScriptLabeledSection.cs
+using System;
+using System.Collections.Generic;
+
+namespace DSPRE.ROMFiles {
+ public class ScriptLabeledSection {
+ public string LabelName { get; set; }
+ public List Commands { get; set; }
+ public uint OffsetInFile { get; set; }
+ public bool IsReferenced { get; set; } = false;
+
+ public ScriptLabeledSection(string labelName, List commands = null) {
+ LabelName = labelName;
+ Commands = commands ?? new List();
+ }
+
+ public override string ToString() {
+ return LabelName;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DS_Map/ROMFiles/ScriptParameter.cs b/DS_Map/ROMFiles/ScriptParameter.cs
new file mode 100644
index 0000000..d6dd6ee
--- /dev/null
+++ b/DS_Map/ROMFiles/ScriptParameter.cs
@@ -0,0 +1,45 @@
+using System;
+
+public class ScriptParameter {
+ public enum ParameterType {
+ Integer,
+ RelativeJump,
+ Byte,
+ Variable
+ }
+
+ public ParameterType Type { get; set; } = ParameterType.Integer;
+ public byte[] RawData { get; set; }
+ public string TargetLabel { get; set; } // For RelativeJump type
+ public int TargetOffset { get; set; } // For RelativeJump type
+
+ // Constructor for regular parameters
+ public ScriptParameter(byte[] data) {
+ Type = ParameterType.Integer;
+ RawData = data;
+ }
+
+ // Constructor for relative jumps
+ public ScriptParameter(int targetOffset, string targetLabel) {
+ Type = ParameterType.RelativeJump;
+ TargetOffset = targetOffset;
+ TargetLabel = targetLabel;
+ // Store raw bytes only for display purposes
+ RawData = BitConverter.GetBytes(targetOffset);
+ }
+
+ // Get display representation
+ public string GetFormattedValue() {
+ if (Type == ParameterType.RelativeJump && !string.IsNullOrEmpty(TargetLabel)) {
+ return TargetLabel;
+ }
+
+ // Default formatting for other types
+ if (RawData.Length == 0) return "";
+ if (RawData.Length == 1) return RawData[0].ToString("X2");
+ if (RawData.Length == 2) return BitConverter.ToUInt16(RawData, 0).ToString("X4");
+ if (RawData.Length == 4) return BitConverter.ToUInt32(RawData, 0).ToString("X8");
+
+ return BitConverter.ToString(RawData);
+ }
+}
\ No newline at end of file