diff --git a/DS_Map/DSPRE.csproj b/DS_Map/DSPRE.csproj
index c991e02..dc0ef6e 100644
--- a/DS_Map/DSPRE.csproj
+++ b/DS_Map/DSPRE.csproj
@@ -95,6 +95,19 @@
+
+
+ UserControl
+
+
+ LevelScriptEditor.cs
+
+
+ UserControl
+
+
+ ScriptEditor.cs
+
Form
@@ -107,6 +120,7 @@
EvolutionsEditor.cs
+
@@ -164,12 +178,28 @@
Component
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Form
@@ -281,6 +311,12 @@
+
+ LevelScriptEditor.cs
+
+
+ ScriptEditor.cs
+
EventFileImport.cs
diff --git a/DS_Map/EditorPanels.cs b/DS_Map/EditorPanels.cs
new file mode 100644
index 0000000..c61106c
--- /dev/null
+++ b/DS_Map/EditorPanels.cs
@@ -0,0 +1,20 @@
+using System.Windows.Forms;
+using DSPRE.Editors;
+
+namespace DSPRE {
+ public static class EditorPanels {
+ public static MainProgram MainProgram;
+
+ public static void Initialize(MainProgram mainProgram) {
+ MainProgram = mainProgram;
+ }
+
+ public static ScriptEditor scriptEditor { get { return MainProgram.scriptEditor; } }
+ public static LevelScriptEditor levelScriptEditor { get { return MainProgram.levelScriptEditor; } }
+ public static TabControl mainTabControl { get { return MainProgram.mainTabControl; } }
+
+ public static TabPage scriptEditorTabPage { get { return MainProgram.tabPageScriptEditor; } }
+ public static TabPage levelScriptEditorTabPage { get { return MainProgram.tabPageLevelScriptEditor; } }
+
+ }
+}
diff --git a/DS_Map/Editors/LevelScriptEditor.Designer.cs b/DS_Map/Editors/LevelScriptEditor.Designer.cs
new file mode 100644
index 0000000..e17cade
--- /dev/null
+++ b/DS_Map/Editors/LevelScriptEditor.Designer.cs
@@ -0,0 +1,458 @@
+using System.ComponentModel;
+
+namespace DSPRE.Editors {
+ partial class LevelScriptEditor {
+ ///
+ /// Required designer variable.
+ ///
+ private IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.buttonSave = new System.Windows.Forms.Button();
+ this.buttonExport = new System.Windows.Forms.Button();
+ this.radioButtonVariableValue = new System.Windows.Forms.RadioButton();
+ this.radioButtonMapChange = new System.Windows.Forms.RadioButton();
+ this.radioButtonScreenReset = new System.Windows.Forms.RadioButton();
+ this.radioButtonLoadGame = new System.Windows.Forms.RadioButton();
+ this.textBoxScriptID = new System.Windows.Forms.TextBox();
+ this.textBoxVariableName = new System.Windows.Forms.TextBox();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.groupBoxVariable = new System.Windows.Forms.GroupBox();
+ this.groupBoxValue = new System.Windows.Forms.GroupBox();
+ this.textBoxVariableValue = new System.Windows.Forms.TextBox();
+ this.checkBoxPadding = new System.Windows.Forms.CheckBox();
+ this.buttonAdd = new System.Windows.Forms.Button();
+ this.buttonRemove = new System.Windows.Forms.Button();
+ this.radioButtonDecimal = new System.Windows.Forms.RadioButton();
+ this.radioButtonHex = new System.Windows.Forms.RadioButton();
+ this.radioButtonAuto = new System.Windows.Forms.RadioButton();
+ this.selectScriptFileComboBox = new System.Windows.Forms.ComboBox();
+ this.listBoxTriggers = new DSPRE.ListBox2();
+ this.buttonOpenHeaderScript = new System.Windows.Forms.Button();
+ this.buttonOpenSelectedScript = new System.Windows.Forms.Button();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.buttonLocate = new System.Windows.Forms.Button();
+ this.groupBox4 = new System.Windows.Forms.GroupBox();
+ this.buttonImport = new System.Windows.Forms.Button();
+ this.groupBox5 = new System.Windows.Forms.GroupBox();
+ this.groupBox6 = new System.Windows.Forms.GroupBox();
+ this.groupBox7 = new System.Windows.Forms.GroupBox();
+ this.groupBox1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
+ this.groupBoxVariable.SuspendLayout();
+ this.groupBoxValue.SuspendLayout();
+ this.groupBox3.SuspendLayout();
+ this.groupBox4.SuspendLayout();
+ this.groupBox5.SuspendLayout();
+ this.groupBox6.SuspendLayout();
+ this.groupBox7.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // buttonSave
+ //
+ this.buttonSave.Location = new System.Drawing.Point(70, 19);
+ this.buttonSave.Name = "buttonSave";
+ this.buttonSave.Size = new System.Drawing.Size(53, 23);
+ this.buttonSave.TabIndex = 5;
+ this.buttonSave.Text = "Save";
+ this.buttonSave.UseVisualStyleBackColor = true;
+ this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
+ //
+ // buttonExport
+ //
+ this.buttonExport.Location = new System.Drawing.Point(129, 19);
+ this.buttonExport.Name = "buttonExport";
+ this.buttonExport.Size = new System.Drawing.Size(51, 23);
+ this.buttonExport.TabIndex = 6;
+ this.buttonExport.Text = "Export";
+ this.buttonExport.UseVisualStyleBackColor = true;
+ this.buttonExport.Click += new System.EventHandler(this.buttonExport_Click);
+ //
+ // radioButtonVariableValue
+ //
+ this.radioButtonVariableValue.AutoSize = true;
+ this.radioButtonVariableValue.Checked = true;
+ this.radioButtonVariableValue.Location = new System.Drawing.Point(6, 19);
+ this.radioButtonVariableValue.Name = "radioButtonVariableValue";
+ this.radioButtonVariableValue.Size = new System.Drawing.Size(107, 17);
+ this.radioButtonVariableValue.TabIndex = 12;
+ this.radioButtonVariableValue.TabStop = true;
+ this.radioButtonVariableValue.Text = "Variable == value";
+ this.radioButtonVariableValue.UseVisualStyleBackColor = true;
+ this.radioButtonVariableValue.CheckedChanged += new System.EventHandler(this.radioButtonVariableValue_CheckedChanged);
+ //
+ // radioButtonMapChange
+ //
+ this.radioButtonMapChange.AutoSize = true;
+ this.radioButtonMapChange.Location = new System.Drawing.Point(119, 19);
+ this.radioButtonMapChange.Name = "radioButtonMapChange";
+ this.radioButtonMapChange.Size = new System.Drawing.Size(86, 17);
+ this.radioButtonMapChange.TabIndex = 13;
+ this.radioButtonMapChange.Text = "Player enters";
+ this.radioButtonMapChange.UseVisualStyleBackColor = true;
+ this.radioButtonMapChange.CheckedChanged += new System.EventHandler(this.radioButtonMapChange_CheckedChanged);
+ //
+ // radioButtonScreenReset
+ //
+ this.radioButtonScreenReset.AutoSize = true;
+ this.radioButtonScreenReset.Location = new System.Drawing.Point(211, 19);
+ this.radioButtonScreenReset.Name = "radioButtonScreenReset";
+ this.radioButtonScreenReset.Size = new System.Drawing.Size(88, 17);
+ this.radioButtonScreenReset.TabIndex = 14;
+ this.radioButtonScreenReset.Text = "Screen fades";
+ this.radioButtonScreenReset.UseVisualStyleBackColor = true;
+ this.radioButtonScreenReset.CheckedChanged += new System.EventHandler(this.radioButtonScreenReset_CheckedChanged);
+ //
+ // radioButtonLoadGame
+ //
+ this.radioButtonLoadGame.AutoSize = true;
+ this.radioButtonLoadGame.Location = new System.Drawing.Point(305, 19);
+ this.radioButtonLoadGame.Name = "radioButtonLoadGame";
+ this.radioButtonLoadGame.Size = new System.Drawing.Size(81, 17);
+ this.radioButtonLoadGame.TabIndex = 15;
+ this.radioButtonLoadGame.Text = "Game loads";
+ this.radioButtonLoadGame.UseVisualStyleBackColor = true;
+ this.radioButtonLoadGame.CheckedChanged += new System.EventHandler(this.radioButtonLoadGame_CheckedChanged);
+ //
+ // textBoxScriptID
+ //
+ this.textBoxScriptID.Location = new System.Drawing.Point(6, 19);
+ this.textBoxScriptID.Name = "textBoxScriptID";
+ this.textBoxScriptID.Size = new System.Drawing.Size(116, 20);
+ this.textBoxScriptID.TabIndex = 16;
+ this.textBoxScriptID.TextChanged += new System.EventHandler(this.textBoxScriptID_TextChanged);
+ //
+ // textBoxVariableName
+ //
+ this.textBoxVariableName.Location = new System.Drawing.Point(6, 19);
+ this.textBoxVariableName.Name = "textBoxVariableName";
+ this.textBoxVariableName.Size = new System.Drawing.Size(116, 20);
+ this.textBoxVariableName.TabIndex = 17;
+ this.textBoxVariableName.TextChanged += new System.EventHandler(this.textBoxVariableName_TextChanged);
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.radioButtonVariableValue);
+ this.groupBox1.Controls.Add(this.radioButtonMapChange);
+ this.groupBox1.Controls.Add(this.radioButtonScreenReset);
+ this.groupBox1.Controls.Add(this.radioButtonLoadGame);
+ this.groupBox1.Location = new System.Drawing.Point(3, 366);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(397, 48);
+ this.groupBox1.TabIndex = 11;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "When this happens in the map:";
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.Add(this.textBoxScriptID);
+ this.groupBox2.Location = new System.Drawing.Point(3, 420);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(128, 48);
+ this.groupBox2.TabIndex = 12;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Text = "Run this script ID";
+ //
+ // groupBoxVariable
+ //
+ this.groupBoxVariable.Controls.Add(this.textBoxVariableName);
+ this.groupBoxVariable.Location = new System.Drawing.Point(137, 420);
+ this.groupBoxVariable.Name = "groupBoxVariable";
+ this.groupBoxVariable.Size = new System.Drawing.Size(128, 48);
+ this.groupBoxVariable.TabIndex = 13;
+ this.groupBoxVariable.TabStop = false;
+ this.groupBoxVariable.Text = "when this variable ==";
+ //
+ // groupBoxValue
+ //
+ this.groupBoxValue.Controls.Add(this.textBoxVariableValue);
+ this.groupBoxValue.Location = new System.Drawing.Point(271, 420);
+ this.groupBoxValue.Name = "groupBoxValue";
+ this.groupBoxValue.Size = new System.Drawing.Size(129, 48);
+ this.groupBoxValue.TabIndex = 13;
+ this.groupBoxValue.TabStop = false;
+ this.groupBoxValue.Text = "this value";
+ //
+ // textBoxVariableValue
+ //
+ this.textBoxVariableValue.Location = new System.Drawing.Point(6, 19);
+ this.textBoxVariableValue.Name = "textBoxVariableValue";
+ this.textBoxVariableValue.Size = new System.Drawing.Size(117, 20);
+ this.textBoxVariableValue.TabIndex = 18;
+ this.textBoxVariableValue.TextChanged += new System.EventHandler(this.textBoxVariableValue_TextChanged);
+ //
+ // checkBoxPadding
+ //
+ this.checkBoxPadding.AutoSize = true;
+ this.checkBoxPadding.Location = new System.Drawing.Point(186, 23);
+ this.checkBoxPadding.Name = "checkBoxPadding";
+ this.checkBoxPadding.Size = new System.Drawing.Size(141, 17);
+ this.checkBoxPadding.TabIndex = 7;
+ this.checkBoxPadding.Text = "Word-alignment padding";
+ this.checkBoxPadding.UseVisualStyleBackColor = true;
+ //
+ // buttonAdd
+ //
+ this.buttonAdd.Location = new System.Drawing.Point(6, 19);
+ this.buttonAdd.Name = "buttonAdd";
+ this.buttonAdd.Size = new System.Drawing.Size(75, 23);
+ this.buttonAdd.TabIndex = 19;
+ this.buttonAdd.Text = "Add";
+ this.buttonAdd.UseVisualStyleBackColor = true;
+ this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
+ //
+ // buttonRemove
+ //
+ this.buttonRemove.Location = new System.Drawing.Point(87, 19);
+ this.buttonRemove.Name = "buttonRemove";
+ this.buttonRemove.Size = new System.Drawing.Size(75, 23);
+ this.buttonRemove.TabIndex = 20;
+ this.buttonRemove.Text = "Remove";
+ this.buttonRemove.UseVisualStyleBackColor = true;
+ this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
+ //
+ // radioButtonDecimal
+ //
+ this.radioButtonDecimal.AutoSize = true;
+ this.radioButtonDecimal.Location = new System.Drawing.Point(109, 19);
+ this.radioButtonDecimal.Name = "radioButtonDecimal";
+ this.radioButtonDecimal.Size = new System.Drawing.Size(63, 17);
+ this.radioButtonDecimal.TabIndex = 10;
+ this.radioButtonDecimal.Text = "Decimal";
+ this.radioButtonDecimal.UseVisualStyleBackColor = true;
+ this.radioButtonDecimal.CheckedChanged += new System.EventHandler(this.radioButtonDecimal_CheckedChanged);
+ //
+ // radioButtonHex
+ //
+ this.radioButtonHex.AutoSize = true;
+ this.radioButtonHex.Location = new System.Drawing.Point(59, 19);
+ this.radioButtonHex.Name = "radioButtonHex";
+ this.radioButtonHex.Size = new System.Drawing.Size(44, 17);
+ this.radioButtonHex.TabIndex = 9;
+ this.radioButtonHex.Text = "Hex";
+ this.radioButtonHex.UseVisualStyleBackColor = true;
+ this.radioButtonHex.CheckedChanged += new System.EventHandler(this.radioButtonHex_CheckedChanged);
+ //
+ // radioButtonAuto
+ //
+ this.radioButtonAuto.AutoSize = true;
+ this.radioButtonAuto.Checked = true;
+ this.radioButtonAuto.Location = new System.Drawing.Point(6, 19);
+ this.radioButtonAuto.Name = "radioButtonAuto";
+ this.radioButtonAuto.Size = new System.Drawing.Size(47, 17);
+ this.radioButtonAuto.TabIndex = 8;
+ this.radioButtonAuto.TabStop = true;
+ this.radioButtonAuto.Text = "Auto";
+ this.radioButtonAuto.UseVisualStyleBackColor = true;
+ this.radioButtonAuto.CheckedChanged += new System.EventHandler(this.radioButtonAuto_CheckedChanged);
+ //
+ // selectScriptFileComboBox
+ //
+ this.selectScriptFileComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.selectScriptFileComboBox.FormattingEnabled = true;
+ this.selectScriptFileComboBox.Location = new System.Drawing.Point(6, 19);
+ this.selectScriptFileComboBox.Name = "selectScriptFileComboBox";
+ this.selectScriptFileComboBox.Size = new System.Drawing.Size(152, 21);
+ this.selectScriptFileComboBox.TabIndex = 1;
+ this.selectScriptFileComboBox.SelectedIndexChanged += new System.EventHandler(this.selectScriptFileComboBox_SelectedIndexChanged);
+ //
+ // listBoxTriggers
+ //
+ this.listBoxTriggers.FormattingEnabled = true;
+ this.listBoxTriggers.Location = new System.Drawing.Point(3, 226);
+ this.listBoxTriggers.Name = "listBoxTriggers";
+ this.listBoxTriggers.Size = new System.Drawing.Size(397, 134);
+ this.listBoxTriggers.TabIndex = 11;
+ this.listBoxTriggers.SelectedValueChanged += new System.EventHandler(this.listBoxTriggers_SelectedValueChanged);
+ //
+ // buttonOpenHeaderScript
+ //
+ this.buttonOpenHeaderScript.Location = new System.Drawing.Point(6, 19);
+ this.buttonOpenHeaderScript.Name = "buttonOpenHeaderScript";
+ this.buttonOpenHeaderScript.Size = new System.Drawing.Size(88, 23);
+ this.buttonOpenHeaderScript.TabIndex = 2;
+ this.buttonOpenHeaderScript.Text = "Header Script";
+ this.buttonOpenHeaderScript.UseVisualStyleBackColor = true;
+ this.buttonOpenHeaderScript.Click += new System.EventHandler(this.buttonOpenHeaderScript_Click);
+ //
+ // buttonOpenSelectedScript
+ //
+ this.buttonOpenSelectedScript.Location = new System.Drawing.Point(100, 19);
+ this.buttonOpenSelectedScript.Name = "buttonOpenSelectedScript";
+ this.buttonOpenSelectedScript.Size = new System.Drawing.Size(94, 23);
+ this.buttonOpenSelectedScript.TabIndex = 3;
+ this.buttonOpenSelectedScript.Text = "Selected Script";
+ this.buttonOpenSelectedScript.UseVisualStyleBackColor = true;
+ this.buttonOpenSelectedScript.Click += new System.EventHandler(this.buttonOpenSelectedScript_Click);
+ //
+ // groupBox3
+ //
+ this.groupBox3.Controls.Add(this.buttonLocate);
+ this.groupBox3.Controls.Add(this.buttonOpenSelectedScript);
+ this.groupBox3.Controls.Add(this.buttonOpenHeaderScript);
+ this.groupBox3.Location = new System.Drawing.Point(3, 61);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.Size = new System.Drawing.Size(263, 52);
+ this.groupBox3.TabIndex = 18;
+ this.groupBox3.TabStop = false;
+ this.groupBox3.Text = "Open";
+ //
+ // buttonLocate
+ //
+ this.buttonLocate.Location = new System.Drawing.Point(200, 19);
+ this.buttonLocate.Name = "buttonLocate";
+ this.buttonLocate.Size = new System.Drawing.Size(56, 23);
+ this.buttonLocate.TabIndex = 3;
+ this.buttonLocate.Text = "Locate";
+ this.buttonLocate.UseVisualStyleBackColor = true;
+ this.buttonLocate.Click += new System.EventHandler(this.buttonLocate_Click);
+ //
+ // groupBox4
+ //
+ this.groupBox4.Controls.Add(this.buttonImport);
+ this.groupBox4.Controls.Add(this.buttonSave);
+ this.groupBox4.Controls.Add(this.buttonExport);
+ this.groupBox4.Controls.Add(this.checkBoxPadding);
+ this.groupBox4.Location = new System.Drawing.Point(3, 119);
+ this.groupBox4.Name = "groupBox4";
+ this.groupBox4.Size = new System.Drawing.Size(329, 53);
+ this.groupBox4.TabIndex = 20;
+ this.groupBox4.TabStop = false;
+ this.groupBox4.Text = "File";
+ //
+ // buttonImport
+ //
+ this.buttonImport.Location = new System.Drawing.Point(6, 19);
+ this.buttonImport.Name = "buttonImport";
+ this.buttonImport.Size = new System.Drawing.Size(58, 23);
+ this.buttonImport.TabIndex = 4;
+ this.buttonImport.Text = "Import";
+ this.buttonImport.UseVisualStyleBackColor = true;
+ this.buttonImport.Click += new System.EventHandler(this.buttonImport_Click);
+ //
+ // groupBox5
+ //
+ this.groupBox5.Controls.Add(this.buttonRemove);
+ this.groupBox5.Controls.Add(this.buttonAdd);
+ this.groupBox5.Location = new System.Drawing.Point(231, 474);
+ this.groupBox5.Name = "groupBox5";
+ this.groupBox5.Size = new System.Drawing.Size(169, 52);
+ this.groupBox5.TabIndex = 21;
+ this.groupBox5.TabStop = false;
+ this.groupBox5.Text = "Trigger";
+ //
+ // groupBox6
+ //
+ this.groupBox6.Controls.Add(this.radioButtonAuto);
+ this.groupBox6.Controls.Add(this.radioButtonDecimal);
+ this.groupBox6.Controls.Add(this.radioButtonHex);
+ this.groupBox6.Location = new System.Drawing.Point(3, 178);
+ this.groupBox6.Name = "groupBox6";
+ this.groupBox6.Size = new System.Drawing.Size(178, 42);
+ this.groupBox6.TabIndex = 22;
+ this.groupBox6.TabStop = false;
+ this.groupBox6.Text = "Number Format";
+ //
+ // groupBox7
+ //
+ this.groupBox7.Controls.Add(this.selectScriptFileComboBox);
+ this.groupBox7.Location = new System.Drawing.Point(3, 3);
+ this.groupBox7.Name = "groupBox7";
+ this.groupBox7.Size = new System.Drawing.Size(164, 52);
+ this.groupBox7.TabIndex = 23;
+ this.groupBox7.TabStop = false;
+ this.groupBox7.Text = "Script File";
+ //
+ // LevelScriptEditor
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.SystemColors.Control;
+ this.Controls.Add(this.groupBox7);
+ this.Controls.Add(this.groupBox6);
+ this.Controls.Add(this.groupBox5);
+ this.Controls.Add(this.groupBox4);
+ this.Controls.Add(this.groupBox3);
+ this.Controls.Add(this.groupBoxValue);
+ this.Controls.Add(this.groupBoxVariable);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.groupBox1);
+ this.Controls.Add(this.listBoxTriggers);
+ this.Location = new System.Drawing.Point(15, 15);
+ this.Name = "LevelScriptEditor";
+ this.Size = new System.Drawing.Size(408, 622);
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.groupBox2.ResumeLayout(false);
+ this.groupBox2.PerformLayout();
+ this.groupBoxVariable.ResumeLayout(false);
+ this.groupBoxVariable.PerformLayout();
+ this.groupBoxValue.ResumeLayout(false);
+ this.groupBoxValue.PerformLayout();
+ this.groupBox3.ResumeLayout(false);
+ this.groupBox4.ResumeLayout(false);
+ this.groupBox4.PerformLayout();
+ this.groupBox5.ResumeLayout(false);
+ this.groupBox6.ResumeLayout(false);
+ this.groupBox6.PerformLayout();
+ this.groupBox7.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ private System.Windows.Forms.Button buttonImport;
+ private System.Windows.Forms.GroupBox groupBox4;
+ private System.Windows.Forms.GroupBox groupBox5;
+
+ private System.Windows.Forms.Button buttonOpenSelectedScript;
+ private System.Windows.Forms.GroupBox groupBox3;
+
+ public System.Windows.Forms.ComboBox selectScriptFileComboBox;
+
+ #endregion
+ private System.Windows.Forms.Button buttonSave;
+ private DSPRE.ListBox2 listBoxTriggers;
+ private System.Windows.Forms.Button buttonExport;
+ private System.Windows.Forms.RadioButton radioButtonVariableValue;
+ private System.Windows.Forms.RadioButton radioButtonMapChange;
+ private System.Windows.Forms.RadioButton radioButtonScreenReset;
+ private System.Windows.Forms.RadioButton radioButtonLoadGame;
+ private System.Windows.Forms.TextBox textBoxScriptID;
+ private System.Windows.Forms.TextBox textBoxVariableName;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.GroupBox groupBoxVariable;
+ private System.Windows.Forms.GroupBox groupBoxValue;
+ private System.Windows.Forms.TextBox textBoxVariableValue;
+ private System.Windows.Forms.CheckBox checkBoxPadding;
+ private System.Windows.Forms.Button buttonAdd;
+ private System.Windows.Forms.Button buttonRemove;
+ private System.Windows.Forms.RadioButton radioButtonDecimal;
+ private System.Windows.Forms.RadioButton radioButtonHex;
+ private System.Windows.Forms.RadioButton radioButtonAuto;
+ private System.Windows.Forms.Button buttonOpenHeaderScript;
+ private System.Windows.Forms.GroupBox groupBox6;
+ private System.Windows.Forms.GroupBox groupBox7;
+ private System.Windows.Forms.Button buttonLocate;
+ }
+}
+
diff --git a/DS_Map/Editors/LevelScriptEditor.cs b/DS_Map/Editors/LevelScriptEditor.cs
new file mode 100644
index 0000000..0c8c424
--- /dev/null
+++ b/DS_Map/Editors/LevelScriptEditor.cs
@@ -0,0 +1,387 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Windows.Forms;
+using DSPRE.ROMFiles;
+
+namespace DSPRE.Editors {
+ public partial class LevelScriptEditor : UserControl {
+ public bool levelScriptEditorIsReady { get; set; } = false;
+ LevelScriptFile _levelScriptFile;
+ MainProgram _parent;
+
+ public LevelScriptEditor() {
+ InitializeComponent();
+
+ }
+
+ public void SetUpLevelScriptEditor(MainProgram parent, bool force = false) {
+ if (levelScriptEditorIsReady && !force) return;
+ levelScriptEditorIsReady = true;
+ this._parent = parent;
+ DSUtils.TryUnpackNarcs(new List { RomInfo.DirNames.scripts }); //12 = scripts Narc Dir
+ populate_selectScriptFileComboBox();
+ }
+
+ public void OpenLevelScriptEditor(MainProgram parent, int levelScriptID) {
+
+ SetUpLevelScriptEditor(parent);
+
+ selectScriptFileComboBox.SelectedIndex = levelScriptID;
+ EditorPanels.mainTabControl.SelectedTab = EditorPanels.levelScriptEditorTabPage;
+ }
+
+ private void populate_selectScriptFileComboBox(int selectedIndex = 0) {
+ selectScriptFileComboBox.Items.Clear();
+ int scriptCount = Filesystem.GetScriptCount();
+ for (int i = 0; i < scriptCount; i++) {
+ // ScriptFile currentScriptFile = new ScriptFile(i, true, true);
+ // selectScriptFileComboBox.Items.Add(currentScriptFile);
+ selectScriptFileComboBox.Items.Add($"Script File {i}");
+ }
+
+ selectScriptFileComboBox.SelectedIndex = selectedIndex;
+ }
+
+ void disableButtons() {
+ listBoxTriggers.DataSource = null;
+
+ textBoxScriptID.Clear();
+ textBoxVariableName.Clear();
+ textBoxVariableValue.Clear();
+
+ radioButtonVariableValue.Checked = false;
+ radioButtonMapChange.Checked = false;
+ radioButtonScreenReset.Checked = false;
+ radioButtonLoadGame.Checked = false;
+
+ textBoxScriptID.Enabled = false;
+ textBoxVariableName.Enabled = false;
+ textBoxVariableValue.Enabled = false;
+
+ radioButtonVariableValue.Enabled = false;
+ radioButtonMapChange.Enabled = false;
+ radioButtonScreenReset.Enabled = false;
+ radioButtonLoadGame.Enabled = false;
+
+ radioButtonAuto.Enabled = false;
+ radioButtonHex.Enabled = false;
+ radioButtonDecimal.Enabled = false;
+
+ buttonImport.Enabled = false;
+ buttonSave.Enabled = false;
+ buttonExport.Enabled = false;
+ checkBoxPadding.Enabled = false;
+
+ buttonAdd.Enabled = false;
+ buttonRemove.Enabled = false;
+ }
+
+ void enableButtons() {
+ // textBoxScriptID.Enabled = true;
+ // textBoxVariableName.Enabled = true;
+ // textBoxVariableValue.Enabled = true;
+
+ radioButtonVariableValue.Enabled = true;
+ radioButtonMapChange.Enabled = true;
+ radioButtonScreenReset.Enabled = true;
+ radioButtonLoadGame.Enabled = true;
+
+ radioButtonAuto.Enabled = true;
+ radioButtonHex.Enabled = true;
+ radioButtonDecimal.Enabled = true;
+
+ buttonImport.Enabled = true;
+ buttonSave.Enabled = true;
+ buttonExport.Enabled = true;
+ checkBoxPadding.Enabled = true;
+ }
+
+ void buttonAdd_logic() {
+ buttonAdd.Enabled = false;
+
+ if (radioButtonVariableValue.Checked) {
+ if (!string.IsNullOrEmpty(textBoxScriptID.Text) && !string.IsNullOrEmpty(textBoxVariableName.Text) && !string.IsNullOrEmpty(textBoxVariableValue.Text)) {
+ buttonAdd.Enabled = true;
+ }
+ }
+ else if (radioButtonMapChange.Checked || radioButtonScreenReset.Checked || radioButtonLoadGame.Checked) {
+ if (!string.IsNullOrEmpty(textBoxScriptID.Text)) {
+ buttonAdd.Enabled = true;
+ }
+ }
+ }
+
+ private void selectScriptFileComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+ if (selectScriptFileComboBox.SelectedIndex == -1) {
+ buttonOpenSelectedScript.Enabled = false;
+ buttonOpenHeaderScript.Enabled = false;
+ buttonLocate.Enabled = false;
+ }
+ else {
+ buttonOpenSelectedScript.Enabled = true;
+ buttonOpenHeaderScript.Enabled = true;
+ buttonLocate.Enabled = true;
+ }
+
+ disableButtons();
+
+ try {
+ _levelScriptFile = new LevelScriptFile(selectScriptFileComboBox.SelectedIndex);
+
+ listBoxTriggers.DataSource = _levelScriptFile.bufferSet;
+ if (listBoxTriggers.Items.Count > 0) listBoxTriggers.SelectedIndex = 0;
+
+ enableButtons();
+ }
+ catch (InvalidDataException ex) { //not a level script
+ disableButtons();
+ Console.WriteLine(ex.Message);
+ }
+ }
+
+ void listBoxTriggers_SelectedValueChanged(object sender, EventArgs e) {
+ if (listBoxTriggers.SelectedItem == null) {
+ buttonRemove.Enabled = false;
+ return;
+ }
+
+ if (listBoxTriggers.SelectedItem is MapScreenLoadTrigger mapScreenLoadTrigger) {
+ if (mapScreenLoadTrigger.triggerType == LevelScriptTrigger.LOADGAME) {
+ radioButtonLoadGame.Checked = true;
+ }
+ else if (mapScreenLoadTrigger.triggerType == LevelScriptTrigger.MAPCHANGE) {
+ radioButtonMapChange.Checked = true;
+ }
+ else if (mapScreenLoadTrigger.triggerType == LevelScriptTrigger.SCREENRESET) {
+ radioButtonScreenReset.Checked = true;
+ }
+ }
+ else if (listBoxTriggers.SelectedItem is VariableValueTrigger variableValueTrigger) {
+ if (variableValueTrigger.triggerType == LevelScriptTrigger.VARIABLEVALUE) {
+ radioButtonVariableValue.Checked = true;
+ }
+ }
+
+ handleAutoFormat();
+ handleHexFormat();
+ handleDecimalFormat();
+
+ textBoxScriptID.Enabled = true;
+ buttonRemove.Enabled = true;
+ }
+
+ private void buttonAdd_Click(object sender, EventArgs e) {
+ // try {
+ if (_levelScriptFile == null) {
+ _levelScriptFile = new LevelScriptFile();
+ }
+
+ int convertBase = 10; //decimal
+ if (radioButtonHex.Checked) {
+ convertBase = 16; //hex
+ }
+
+ if (radioButtonVariableValue.Checked) {
+ int scriptID = Convert.ToInt16(textBoxScriptID.Text, convertBase);
+ int variableName = Convert.ToInt16(textBoxVariableName.Text, convertBase);
+ int variableValue = Convert.ToInt16(textBoxVariableValue.Text, convertBase);
+ VariableValueTrigger variableValueTrigger = new VariableValueTrigger(scriptID, variableName, variableValue);
+ _levelScriptFile.bufferSet.Add(variableValueTrigger);
+ }
+ else {
+ int scriptID = Convert.ToInt16(textBoxScriptID.Text, convertBase);
+ if (radioButtonMapChange.Checked) {
+ MapScreenLoadTrigger mapScreenLoadTrigger = new MapScreenLoadTrigger(LevelScriptTrigger.MAPCHANGE, scriptID);
+ _levelScriptFile.bufferSet.Add(mapScreenLoadTrigger);
+ }
+ else if (radioButtonScreenReset.Checked) {
+ MapScreenLoadTrigger mapScreenLoadTrigger = new MapScreenLoadTrigger(LevelScriptTrigger.SCREENRESET, scriptID);
+ _levelScriptFile.bufferSet.Add(mapScreenLoadTrigger);
+ }
+ else if (radioButtonLoadGame.Checked) {
+ MapScreenLoadTrigger mapScreenLoadTrigger = new MapScreenLoadTrigger(LevelScriptTrigger.LOADGAME, scriptID);
+ _levelScriptFile.bufferSet.Add(mapScreenLoadTrigger);
+ }
+ }
+
+ textBoxScriptID.Clear();
+ textBoxVariableName.Clear();
+ textBoxVariableValue.Clear();
+ // }
+ // catch (Exception exception) {
+ // MessageBox.Show(exception.Message);
+ // }
+ }
+
+ private void buttonRemove_Click(object sender, EventArgs e) {
+ _levelScriptFile.bufferSet.RemoveAt(listBoxTriggers.SelectedIndex);
+ }
+
+ private void buttonOpenHeaderScript_Click(object sender, EventArgs e) {
+ EditorPanels.scriptEditor.OpenScriptEditor(this._parent, (int)EditorPanels.MainProgram.scriptFileUpDown.Value);
+ }
+
+ private void buttonOpenSelectedScript_Click(object sender, EventArgs e) {
+ EditorPanels.scriptEditor.OpenScriptEditor(this._parent, (int)EditorPanels.levelScriptEditor.selectScriptFileComboBox.SelectedIndex);
+ }
+
+ void buttonLocate_Click(object sender, EventArgs e) {
+ if (_levelScriptFile == null) return;
+ string path = Filesystem.GetScriptPath(_levelScriptFile.ID);
+ Helpers.ExplorerSelect(path);
+ }
+
+ void buttonImport_Click(object sender, EventArgs e) {
+ OpenFileDialog ofd = new OpenFileDialog();
+ if (ofd.ShowDialog() == DialogResult.OK) {
+ try {
+ LevelScriptFile importedFile = new LevelScriptFile();
+ importedFile.parse_file(ofd.FileName);
+ _levelScriptFile.bufferSet.Clear();
+ foreach (LevelScriptTrigger trigger in importedFile.bufferSet) {
+ _levelScriptFile.bufferSet.Add(trigger);
+ }
+ }
+ catch (InvalidDataException ex) {
+ MessageBox.Show(ex.Message, ex.GetType().ToString());
+ }
+ }
+ }
+
+ private void buttonSave_Click(object sender, EventArgs e) {
+ string path = Filesystem.GetScriptPath(_levelScriptFile.ID);
+ saveFile(path);
+ }
+
+ private void buttonExport_Click(object sender, EventArgs e) {
+ SaveFileDialog sfd = new SaveFileDialog();
+ try {
+ sfd.InitialDirectory = Path.GetDirectoryName(sfd.FileName);
+ sfd.FileName = Path.GetFileName(sfd.FileName);
+ }
+ catch (Exception ex) {
+ sfd.InitialDirectory = Path.GetDirectoryName(Environment.SpecialFolder.UserProfile.ToString());
+ sfd.FileName = Path.GetFileName(sfd.FileName);
+ }
+
+ if (sfd.ShowDialog() == DialogResult.OK) {
+ saveFile(sfd.FileName);
+ }
+ }
+
+ void saveFile(string path) {
+ try {
+ long bytes_written = _levelScriptFile.write_file(path);
+ if (bytes_written <= 4) {
+ MessageBox.Show("Empty level script file was correctly saved.", "Success!");
+ }
+ else {
+ MessageBox.Show("File was correctly saved.", "Success!");
+ }
+ }
+ catch (Exception ex) {
+ MessageBox.Show(ex.Message, ex.GetType().ToString());
+ }
+ }
+
+ private void handleAutoFormat() {
+ if (!radioButtonAuto.Checked) return;
+
+ textBoxScriptID.Clear();
+ textBoxVariableName.Clear();
+ textBoxVariableValue.Clear();
+
+ if (listBoxTriggers.SelectedItem is MapScreenLoadTrigger mapScreenLoadTrigger) {
+ textBoxScriptID.Text = mapScreenLoadTrigger.scriptTriggered.ToString();
+ }
+ else if (listBoxTriggers.SelectedItem is VariableValueTrigger variableValueTrigger) {
+ textBoxScriptID.Text = variableValueTrigger.scriptTriggered.ToString();
+ textBoxVariableName.Text = "" + variableValueTrigger.variableToWatch.ToString("D");
+ textBoxVariableValue.Text = "" + variableValueTrigger.expectedValue.ToString("D");
+ }
+ }
+
+ private void handleHexFormat() {
+ if (!radioButtonHex.Checked) return;
+
+ textBoxScriptID.Clear();
+ textBoxVariableName.Clear();
+ textBoxVariableValue.Clear();
+
+ if (listBoxTriggers.SelectedItem is MapScreenLoadTrigger mapScreenLoadTrigger) {
+ textBoxScriptID.Text = mapScreenLoadTrigger.scriptTriggered.ToString();
+ }
+ else if (listBoxTriggers.SelectedItem is VariableValueTrigger variableValueTrigger) {
+ textBoxScriptID.Text = variableValueTrigger.scriptTriggered.ToString();
+ textBoxVariableName.Text = "0x" + variableValueTrigger.variableToWatch.ToString("X");
+ textBoxVariableValue.Text = "0x" + variableValueTrigger.expectedValue.ToString("X");
+ }
+ }
+
+ private void handleDecimalFormat() {
+ if (!radioButtonDecimal.Checked) return;
+
+ textBoxScriptID.Clear();
+ textBoxVariableName.Clear();
+ textBoxVariableValue.Clear();
+
+ if (listBoxTriggers.SelectedItem is MapScreenLoadTrigger mapScreenLoadTrigger) {
+ textBoxScriptID.Text = mapScreenLoadTrigger.scriptTriggered.ToString();
+ }
+ else if (listBoxTriggers.SelectedItem is VariableValueTrigger variableValueTrigger) {
+ textBoxScriptID.Text = variableValueTrigger.scriptTriggered.ToString();
+ textBoxVariableName.Text = "" + variableValueTrigger.variableToWatch.ToString("D");
+ textBoxVariableValue.Text = "" + variableValueTrigger.expectedValue.ToString("D");
+ }
+ }
+
+ private void radioButtonAuto_CheckedChanged(object sender, EventArgs e) {
+ handleAutoFormat();
+ }
+
+ private void radioButtonHex_CheckedChanged(object sender, EventArgs e) {
+ handleHexFormat();
+ }
+
+ private void radioButtonDecimal_CheckedChanged(object sender, EventArgs e) {
+ handleDecimalFormat();
+ }
+
+ private void radioButtonVariableValue_CheckedChanged(object sender, EventArgs e) {
+ textBoxVariableName.Enabled = true;
+ textBoxVariableValue.Enabled = true;
+ buttonAdd_logic();
+ }
+
+ private void radioButtonMapChange_CheckedChanged(object sender, EventArgs e) {
+ textBoxVariableName.Enabled = false;
+ textBoxVariableValue.Enabled = false;
+ buttonAdd_logic();
+ }
+
+ private void radioButtonScreenReset_CheckedChanged(object sender, EventArgs e) {
+ textBoxVariableName.Enabled = false;
+ textBoxVariableValue.Enabled = false;
+ buttonAdd_logic();
+ }
+
+ private void radioButtonLoadGame_CheckedChanged(object sender, EventArgs e) {
+ textBoxVariableName.Enabled = false;
+ textBoxVariableValue.Enabled = false;
+ buttonAdd_logic();
+ }
+
+ void textBoxScriptID_TextChanged(object sender, EventArgs e) {
+ buttonAdd_logic();
+ }
+
+ void textBoxVariableName_TextChanged(object sender, EventArgs e) {
+ buttonAdd_logic();
+ }
+
+ void textBoxVariableValue_TextChanged(object sender, EventArgs e) {
+ buttonAdd_logic();
+ }
+ }
+}
diff --git a/DS_Map/Editors/LevelScriptEditor.resx b/DS_Map/Editors/LevelScriptEditor.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/DS_Map/Editors/LevelScriptEditor.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/DS_Map/Editors/ScriptEditor.Designer.cs b/DS_Map/Editors/ScriptEditor.Designer.cs
new file mode 100644
index 0000000..9d00b3a
--- /dev/null
+++ b/DS_Map/Editors/ScriptEditor.Designer.cs
@@ -0,0 +1,917 @@
+
+namespace DSPRE.Editors
+{
+ partial class ScriptEditor
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// 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();
+
+ }
+
+ private System.Windows.Forms.CheckBox scrollToBlockStartcheckBox;
+
+ #endregion
+
+ 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;
+ private System.Windows.Forms.Button exportScriptFileButton;
+ private System.Windows.Forms.Button importScriptFileButton;
+ private System.Windows.Forms.GroupBox groupBox8;
+ private System.Windows.Forms.CheckBox searchOnlyCurrentScriptCheckBox;
+ private System.Windows.Forms.CheckBox scriptSearchCaseSensitiveCheckBox;
+ private System.Windows.Forms.TextBox searchInScriptsTextBox;
+ private System.Windows.Forms.Label label31;
+ private System.Windows.Forms.ProgressBar searchProgressBar;
+ private System.Windows.Forms.Label label30;
+ private System.Windows.Forms.Label label29;
+ private System.Windows.Forms.Button searchInScriptsButton;
+ private System.Windows.Forms.ListBox searchInScriptsResultListBox;
+ private System.Windows.Forms.GroupBox groupBox24;
+ private System.Windows.Forms.TabControl ScriptNavigatorTabControl;
+ private System.Windows.Forms.TabPage ScriptsNavTab;
+ private System.Windows.Forms.ListBox scriptsNavListbox;
+ private System.Windows.Forms.TabPage FunctionsNavTab;
+ private System.Windows.Forms.ListBox functionsNavListbox;
+ private System.Windows.Forms.TabPage ActionsNavTab;
+ private System.Windows.Forms.ListBox actionsNavListbox;
+ private System.Windows.Forms.Button openFindScriptEditorButton;
+ private System.Windows.Forms.Button expandScriptTextButton;
+ private System.Windows.Forms.Button compressScriptTextButton;
+ private System.Windows.Forms.CheckBox scriptEditorWordWrapCheckbox;
+ private System.Windows.Forms.CheckBox scriptEditorWhitespacesCheckbox;
+ private System.Windows.Forms.GroupBox groupBox26;
+ private System.Windows.Forms.RadioButton scriptEditorNumberFormatNoPreference;
+ private System.Windows.Forms.RadioButton scriptEditorNumberFormatDecimal;
+ private System.Windows.Forms.RadioButton scriptEditorNumberFormatHex;
+ private System.Windows.Forms.Button viewLevelScriptButton;
+ private System.Windows.Forms.Button locateCurrentScriptFile;
+ }
+}
diff --git a/DS_Map/Editors/ScriptEditor.cs b/DS_Map/Editors/ScriptEditor.cs
new file mode 100644
index 0000000..f13f14a
--- /dev/null
+++ b/DS_Map/Editors/ScriptEditor.cs
@@ -0,0 +1,1047 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.IO;
+using System.Windows.Forms;
+using DSPRE.Resources;
+using DSPRE.ROMFiles;
+using ScintillaNET;
+using ScintillaNET.Utils;
+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 bool scriptsDirty = false;
+ private bool functionsDirty = false;
+ private bool actionsDirty = false;
+ private string cmdKeyWords = "";
+ private string secondaryKeyWords = "";
+ private ScriptFile currentScriptFile;
+ MainProgram _parent;
+ ///
+ /// the background color of the text area
+ ///
+ private readonly Color BACK_COLOR = Color.FromArgb(0x2A211C);
+
+ ///
+ /// default text color of the text area
+ ///
+ private readonly Color FORE_COLOR = Color.FromArgb(0xB7B7B7);
+
+ ///
+ /// change this to whatever margin you want the line numbers to show in
+ ///
+ private const int NUMBER_MARGIN = 1;
+
+ ///
+ /// change this to whatever margin you want the bookmarks/breakpoints to show in
+ ///
+ private const int BOOKMARK_MARGIN = 2;
+
+ private const int BOOKMARK_MARKER = 2;
+
+ ///
+ /// change this to whatever margin you want the code folding tree (+/-) to show in
+ ///
+ private const int FOLDING_MARGIN = 3;
+
+ ///
+ /// set this true to show circular buttons for code folding (the [+] and [-] buttons on the margin)
+ ///
+ private const bool CODE_FOLDING_CIRCULAR = true;
+
+ readonly Point initial_importScriptFileButton_location;
+ readonly Point initial_exportScriptFileButton_location;
+ readonly Point initial_addScriptFileButton_location;
+ readonly Point initial_removeScriptFileButton_location;
+ readonly Point initial_viewLevelScript_location;
+
+ readonly Point new_importScriptFileButton_location;
+ readonly Point new_exportScriptFileButton_location;
+ readonly Point new_addScriptFileButton_location;
+ readonly Point new_removeScriptFileButton_location;
+ readonly Point new_viewLevelScript_location;
+
+ public ScriptEditor() {
+ InitializeComponent();
+
+
+ //initially, these buttons are off the canvas so they can be interacted with in the designer
+ //they are then moved as needed
+ initial_importScriptFileButton_location = importScriptFileButton.Location;
+ initial_exportScriptFileButton_location = exportScriptFileButton.Location;
+ initial_addScriptFileButton_location = addScriptFileButton.Location;
+ initial_removeScriptFileButton_location = removeScriptFileButton.Location;
+ initial_viewLevelScript_location = viewLevelScriptButton.Location;
+
+ new_importScriptFileButton_location = new Point(164, 22);
+ new_exportScriptFileButton_location = new Point(239, 22);
+ new_addScriptFileButton_location = new Point(314, 22);
+ new_removeScriptFileButton_location = new Point(314, 49);
+ new_viewLevelScript_location = new Point(326, 37);
+
+ importScriptFileButton.Enabled = false;
+ exportScriptFileButton.Enabled = false;
+ addScriptFileButton.Enabled = false;
+ removeScriptFileButton.Enabled = false;
+ viewLevelScriptButton.Enabled = false;
+ }
+
+ public void SetupScriptEditor(MainProgram parent, bool force = false) {
+ if (scriptEditorIsReady && !force) return;
+ scriptEditorIsReady = true;
+ this._parent = parent;
+ SetupScriptEditorTextAreas();
+
+ /* Extract essential NARCs sub-archives*/
+ Helpers.statusLabelMessage("Setting up Script Editor...");
+ Update();
+
+ DSUtils.TryUnpackNarcs(new List { RomInfo.DirNames.scripts }); //12 = scripts Narc Dir
+
+ populate_selectScriptFileComboBox(0);
+
+ UpdateScriptNumberCheckBox((NumberStyles)Properties.Settings.Default.scriptEditorFormatPreference);
+ Helpers.statusLabelMessage();
+ }
+
+ public void OpenScriptEditor(MainProgram parent, int scriptFileID) {
+ SetupScriptEditor(parent);
+
+ scriptEditorTabControl.SelectedIndex = 0;
+ selectScriptFileComboBox.SelectedIndex = scriptFileID;
+ EditorPanels.mainTabControl.SelectedTab = EditorPanels.scriptEditorTabPage;
+ }
+
+ private void SetupScriptEditorTextAreas() {
+ //PREPARE SCRIPT EDITOR KEYWORDS
+ cmdKeyWords = String.Join(" ", RomInfo.ScriptCommandNamesDict.Values) +
+ " " + String.Join(" ", ScriptDatabase.movementsDictIDName.Values);
+ cmdKeyWords += " " + cmdKeyWords.ToUpper() + " " + cmdKeyWords.ToLower();
+
+ 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();
+
+ // CREATE CONTROLS
+ ScriptTextArea = new Scintilla();
+ scriptSearchManager = new SearchManager(EditorPanels.MainProgram, ScriptTextArea, panelFindScriptTextBox, PanelSearchScripts);
+ 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
+ /*
+ ScriptTextArea.MouseDwellTime = 300;
+ ScriptTextArea.DwellEnd += TextArea_DwellEnd;
+ ScriptTextArea.DwellStart += TextArea_DwellStart;
+
+ FunctionTextArea.MouseDwellTime = 300;
+ FunctionTextArea.DwellEnd += TextArea_DwellEnd;
+ FunctionTextArea.DwellStart += TextArea_DwellStart;
+ */
+ }
+
+ private void populate_selectScriptFileComboBox(int selectedIndex = 0) {
+ selectScriptFileComboBox.Items.Clear();
+ int scriptCount = Filesystem.GetScriptCount();
+ for (int i = 0; i < scriptCount; i++) {
+ // ScriptFile currentScriptFile = new ScriptFile(i, true, true);
+ // selectScriptFileComboBox.Items.Add(currentScriptFile);
+ selectScriptFileComboBox.Items.Add($"Script File {i}");
+ }
+
+ selectScriptFileComboBox.SelectedIndex = selectedIndex;
+ }
+
+ private void InitialViewConfig(Scintilla textArea) {
+ textArea.Dock = DockStyle.Fill;
+ textArea.WrapMode = WrapMode.Word;
+ textArea.IndentationGuides = IndentView.LookBoth;
+ textArea.CaretPeriod = 500;
+ textArea.CaretForeColor = Color.White;
+ textArea.SetSelectionBackColor(true, Color.FromArgb(0x114D9C));
+ textArea.WrapIndentMode = WrapIndentMode.Same;
+ }
+
+ private void InitSyntaxColoring(Scintilla textArea) {
+ // Configure the default style
+ textArea.StyleResetDefault();
+ textArea.Styles[Style.Default].Font = "Consolas";
+ textArea.Styles[Style.Default].Size = 12;
+ textArea.Styles[Style.Default].BackColor = Color.FromArgb(0x212121);
+ textArea.Styles[Style.Default].ForeColor = Color.FromArgb(0xFFFFFF);
+ textArea.StyleClearAll();
+
+ // Configure the lexer styles
+ textArea.Styles[Style.Python.Identifier].ForeColor = Color.FromArgb(0xD0DAE2);
+ textArea.Styles[Style.Python.CommentLine].ForeColor = Color.FromArgb(0x40BF57);
+ textArea.Styles[Style.Python.Number].ForeColor = Color.FromArgb(0xFFFF00);
+ textArea.Styles[Style.Python.String].ForeColor = Color.FromArgb(0xFF00FF);
+ textArea.Styles[Style.Python.Character].ForeColor = Color.FromArgb(0xE95454);
+ textArea.Styles[Style.Python.Operator].ForeColor = Color.FromArgb(0xFFFF00);
+ textArea.Styles[Style.Python.Word].ForeColor = Color.FromArgb(0x48A8EE);
+ textArea.Styles[Style.Python.Word2].ForeColor = Color.FromArgb(0xF98906);
+
+ textArea.Lexer = Lexer.Python;
+
+ textArea.SetKeywords(0, cmdKeyWords);
+ textArea.SetKeywords(1, secondaryKeyWords);
+ }
+
+ private void InitNumberMargin(Scintilla textArea, EventHandler textArea_MarginClick) {
+ textArea.Styles[Style.LineNumber].BackColor = BACK_COLOR;
+ textArea.Styles[Style.LineNumber].ForeColor = FORE_COLOR;
+ textArea.Styles[Style.IndentGuide].ForeColor = FORE_COLOR;
+ textArea.Styles[Style.IndentGuide].BackColor = BACK_COLOR;
+
+ Margin nums = textArea.Margins[NUMBER_MARGIN];
+ nums.Type = MarginType.Number;
+ nums.Sensitive = true;
+ nums.Mask = 0;
+
+ textArea.MarginClick += textArea_MarginClick;
+ }
+
+ private void InitBookmarkMargin(Scintilla textArea) {
+ //TextArea.SetFoldMarginColor(true, IntToColor(BACK_COLOR));
+
+ Margin margin = textArea.Margins[BOOKMARK_MARGIN];
+ margin.Width = 20;
+ margin.Sensitive = true;
+ margin.Type = MarginType.Symbol;
+ margin.Mask = (1 << BOOKMARK_MARKER);
+ //margin.Cursor = MarginCursor.Arrow;
+
+ Marker marker = textArea.Markers[BOOKMARK_MARKER];
+ marker.Symbol = MarkerSymbol.Circle;
+ marker.SetBackColor(Color.FromArgb(0xFF003B));
+ marker.SetForeColor(Color.FromArgb(0x000000));
+ marker.SetAlpha(100);
+ }
+
+ private void InitCodeFolding(Scintilla textArea) {
+ textArea.SetFoldMarginColor(true, BACK_COLOR);
+ textArea.SetFoldMarginHighlightColor(true, BACK_COLOR);
+
+ // Enable code folding
+ textArea.SetProperty("fold", "1");
+ textArea.SetProperty("fold.compact", "1");
+
+ // Configure a margin to display folding symbols
+ textArea.Margins[FOLDING_MARGIN].Type = MarginType.Symbol;
+ textArea.Margins[FOLDING_MARGIN].Mask = Marker.MaskFolders;
+ textArea.Margins[FOLDING_MARGIN].Sensitive = true;
+ textArea.Margins[FOLDING_MARGIN].Width = 20;
+
+ // Set colors for all folding markers
+ for (int i = 25; i <= 31; i++) {
+ textArea.Markers[i].SetForeColor(BACK_COLOR); // styles for [+] and [-]
+ textArea.Markers[i].SetBackColor(FORE_COLOR); // styles for [+] and [-]
+ }
+
+ // Configure folding markers with respective symbols
+ textArea.Markers[Marker.Folder].Symbol = CODE_FOLDING_CIRCULAR ? MarkerSymbol.CirclePlus : MarkerSymbol.BoxPlus;
+ textArea.Markers[Marker.FolderOpen].Symbol = CODE_FOLDING_CIRCULAR ? MarkerSymbol.CircleMinus : MarkerSymbol.BoxMinus;
+ textArea.Markers[Marker.FolderEnd].Symbol = CODE_FOLDING_CIRCULAR ? MarkerSymbol.CirclePlusConnected : MarkerSymbol.BoxPlusConnected;
+ textArea.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner;
+ textArea.Markers[Marker.FolderOpenMid].Symbol = CODE_FOLDING_CIRCULAR ? MarkerSymbol.CircleMinusConnected : MarkerSymbol.BoxMinusConnected;
+ textArea.Markers[Marker.FolderSub].Symbol = MarkerSymbol.VLine;
+ textArea.Markers[Marker.FolderTail].Symbol = MarkerSymbol.LCorner;
+
+ // Enable automatic folding
+ textArea.AutomaticFold = (AutomaticFold.Show|AutomaticFold.Click|AutomaticFold.Change);
+ }
+
+ private void InitHotkeys(Scintilla scintillaTb, SearchManager sm) {
+ // register the hotkeys with the form
+ HotKeyManager.AddHotKey(scintillaTb, sm.OpenSearch, Keys.F, true);
+ HotKeyManager.AddHotKey(scintillaTb, () => Uppercase(scintillaTb), Keys.U, true);
+ HotKeyManager.AddHotKey(scintillaTb, () => Lowercase(scintillaTb), Keys.L, true);
+ HotKeyManager.AddHotKey(scintillaTb, () => ZoomIn(scintillaTb), Keys.Oemplus, true);
+ HotKeyManager.AddHotKey(scintillaTb, () => ZoomOut(scintillaTb), Keys.OemMinus, true);
+ HotKeyManager.AddHotKey(scintillaTb, () => ZoomDefault(scintillaTb), Keys.D0, true);
+ HotKeyManager.AddHotKey(scintillaTb, sm.CloseSearch, Keys.Escape);
+
+ // remove conflicting hotkeys from scintilla
+ scintillaTb.ClearCmdKey(Keys.Control|Keys.F);
+ scintillaTb.ClearCmdKey(Keys.Control|Keys.R);
+ scintillaTb.ClearCmdKey(Keys.Control|Keys.H);
+ scintillaTb.ClearCmdKey(Keys.Control|Keys.L);
+ scintillaTb.ClearCmdKey(Keys.Control|Keys.U);
+ }
+
+ private void Uppercase(Scintilla textArea) {
+ // save the selection
+ int start = textArea.SelectionStart;
+ int end = textArea.SelectionEnd;
+
+ // modify the selected text
+ textArea.ReplaceSelection(textArea.GetTextRange(start, end - start).ToUpper());
+
+ // preserve the original selection
+ textArea.SetSelection(start, end);
+ }
+
+ private void Lowercase(Scintilla textArea) {
+ // save the selection
+ int start = textArea.SelectionStart;
+ int end = textArea.SelectionEnd;
+
+ // modify the selected text
+ textArea.ReplaceSelection(textArea.GetTextRange(start, end - start).ToLower());
+
+ // preserve the original selection
+ textArea.SetSelection(start, end);
+ }
+
+ private void ZoomIn(Scintilla textArea) {
+ textArea.ZoomIn();
+ }
+
+ private void ZoomOut(Scintilla textArea) {
+ textArea.ZoomOut();
+ }
+
+ private void ZoomDefault(Scintilla textArea) {
+ textArea.Zoom = 0;
+ }
+
+ 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;
+
+ Helpers.EnableHandlers();
+ }
+
+ 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" + "*";
+ }
+
+ 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?
+ const uint mask = (1 << BOOKMARK_MARKER);
+ Line line = textArea.Lines[textArea.LineFromPosition(e.Position)];
+ if ((line.MarkerGet()&mask) > 0) {
+ // Remove existing bookmark
+ line.MarkerDelete(BOOKMARK_MARKER);
+ }
+ else {
+ // Add bookmark
+ line.MarkerAdd(BOOKMARK_MARKER);
+ }
+ }
+ }
+
+ private void selectScriptFileComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+ DisplayScript();
+ }
+
+ public void UpdateScriptNumberCheckBox(NumberStyles toSet) {
+ Helpers.DisableHandlers();
+ Properties.Settings.Default.scriptEditorFormatPreference = (int)toSet;
+
+ switch ((NumberStyles)Properties.Settings.Default.scriptEditorFormatPreference) {
+ case NumberStyles.None:
+ scriptEditorNumberFormatNoPreference.Checked = true;
+ break;
+ case NumberStyles.HexNumber:
+ scriptEditorNumberFormatHex.Checked = true;
+ break;
+ case NumberStyles.Integer:
+ scriptEditorNumberFormatDecimal.Checked = true;
+ break;
+ }
+
+ Console.WriteLine("changed style to " + Properties.Settings.Default.scriptEditorFormatPreference);
+ Helpers.EnableHandlers();
+ }
+
+ private void UpdateScriptNumberFormat(NumberStyles numberStyle) {
+ if (Helpers.HandlersEnabled) {
+ NumberStyles old = (NumberStyles)Properties.Settings.Default.scriptEditorFormatPreference; //Local Backup
+ Properties.Settings.Default.scriptEditorFormatPreference = (int)numberStyle;
+
+ if (!DisplayScript()) {
+ UpdateScriptNumberCheckBox(old); //Restore old checkbox status! Script couldn't be redrawn
+ }
+ }
+ }
+
+ private void UpdateScriptNumberFormatNoPref(object sender, EventArgs e) {
+ UpdateScriptNumberFormat(NumberStyles.None);
+ }
+
+ private void UpdateScriptNumberFormatDec(object sender, EventArgs e) {
+ UpdateScriptNumberFormat(NumberStyles.Integer);
+ }
+
+ private void UpdateScriptNumberFormatHex(object sender, EventArgs e) {
+ UpdateScriptNumberFormat(NumberStyles.HexNumber);
+ }
+
+ private bool DisplayScript() {
+ Console.WriteLine("Script Reload has been requested");
+
+ /* clear controls */
+ if (Helpers.HandlersDisabled || selectScriptFileComboBox.SelectedItem == null) {
+ return false;
+ }
+
+ 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;
+ }
+ }
+
+ Helpers.DisableHandlers();
+
+ ScriptFile lastScriptFile = currentScriptFile;
+ // currentScriptFile = (ScriptFile)selectScriptFileComboBox.SelectedItem;
+ currentScriptFile = new ScriptFile(selectScriptFileComboBox.SelectedIndex); // Load script file
+
+ 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;
+ }
+
+ if (typeChanged) {
+ if (currentScriptFile.isLevelScript) {
+ importScriptFileButton.Location = initial_importScriptFileButton_location;
+ exportScriptFileButton.Location = initial_exportScriptFileButton_location;
+ addScriptFileButton.Location = initial_addScriptFileButton_location;
+ removeScriptFileButton.Location = initial_removeScriptFileButton_location;
+
+ viewLevelScriptButton.Location = new_viewLevelScript_location;
+
+ importScriptFileButton.Enabled = false;
+ exportScriptFileButton.Enabled = false;
+ addScriptFileButton.Enabled = false;
+ removeScriptFileButton.Enabled = false;
+
+ viewLevelScriptButton.Enabled = true;
+ }
+ else {
+ importScriptFileButton.Location = new_importScriptFileButton_location;
+ exportScriptFileButton.Location = new_exportScriptFileButton_location;
+ addScriptFileButton.Location = new_addScriptFileButton_location;
+ removeScriptFileButton.Location = new_removeScriptFileButton_location;
+
+ viewLevelScriptButton.Location = initial_viewLevelScript_location;
+
+ importScriptFileButton.Enabled = true;
+ exportScriptFileButton.Enabled = true;
+ addScriptFileButton.Enabled = true;
+ removeScriptFileButton.Enabled = true;
+
+ viewLevelScriptButton.Enabled = false;
+ }
+ }
+
+ 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);
+ }
+
+ ScriptEditorSetClean();
+
+ Helpers.statusLabelMessage();
+ Helpers.EnableHandlers();
+
+ 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 = "";
+ }
+ }
+
+ 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;
+ }
+
+ textArea.AppendText(buffer + Environment.NewLine);
+ buffer = "";
+ }
+ }
+
+ private void scriptEditorZoomInButton_Click(object sender, EventArgs e) {
+ ZoomIn(currentScintillaEditor);
+ }
+
+ private void scriptEditorZoomOutButton_Click(object sender, EventArgs e) {
+ ZoomOut(currentScintillaEditor);
+ }
+
+ 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;
+ }
+ }
+
+ private void removeScriptFileButton_Click(object sender, EventArgs e) {
+ DialogResult d = MessageBox.Show("Are you sure you want to delete the last Script File?", "Confirm deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
+ if (d.Equals(DialogResult.Yes)) {
+ /* Delete script file */
+ string path = Filesystem.GetScriptPath(selectScriptFileComboBox.Items.Count - 1);
+ File.Delete(path);
+
+ /* Check if currently selected file is the last one, and in that case select the one before it */
+ int lastIndex = selectScriptFileComboBox.Items.Count - 1;
+ if (selectScriptFileComboBox.SelectedIndex == lastIndex) {
+ selectScriptFileComboBox.SelectedIndex--;
+ }
+
+ /* Remove item from ComboBox */
+ selectScriptFileComboBox.Items.RemoveAt(lastIndex);
+ }
+ }
+
+ private void addScriptFileButton_Click(object sender, EventArgs e) {
+ /* 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
+ );
+
+ //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;
+ }
+ }
+
+ private void saveScriptFileButton_Click(object sender, EventArgs e) {
+ /* Create new ScriptFile object using the values in the script editor */
+ int fileID = currentScriptFile.fileID;
+
+ ScriptFile userEdited = new ScriptFile(
+ scriptLines: ScriptTextArea.Lines.ToStringsList(trim: true),
+ functionLines: FunctionTextArea.Lines.ToStringsList(trim: true),
+ actionLines: ActionTextArea.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
+ if (userEdited.SaveToFileDefaultDir(fileID)) {
+ currentScriptFile = userEdited;
+ ScriptEditorSetClean();
+ }
+ }
+
+ private void exportScriptFileButton_Click(object sender, EventArgs e) {
+ currentScriptFile.SaveToFileExplorePath(currentScriptFile.ToString(), blindmode: true);
+ }
+
+ private void importScriptFileButton_Click(object sender, EventArgs e) {
+ /* Prompt user to select .scr or .bin file */
+ OpenFileDialog of = new OpenFileDialog {
+ Filter = "Script File (*.scr, *.bin)|*.scr;*.bin"
+ };
+ if (of.ShowDialog(this) != DialogResult.OK) {
+ return;
+ }
+
+ /* Update scriptFile object in memory */
+ int i = selectScriptFileComboBox.SelectedIndex;
+ string path = Filesystem.GetScriptPath(i);
+ File.Copy(of.FileName, path, true);
+
+ populate_selectScriptFileComboBox(i);
+
+ /* Refresh controls */
+ selectScriptFileComboBox_SelectedIndexChanged(null, null);
+
+ /* Display success message */
+ MessageBox.Show("Scripts imported successfully!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+
+ private void viewLevelScriptButton_Click(object sender, EventArgs e) {
+ EditorPanels.levelScriptEditor.OpenLevelScriptEditor(this._parent, selectScriptFileComboBox.SelectedIndex);
+ }
+
+ private void locateCurrentScriptFile_Click(object sender, EventArgs e) {
+ string path = Filesystem.GetScriptPath(selectScriptFileComboBox.SelectedIndex);
+ Helpers.ExplorerSelect(path);
+ }
+
+ private void findNext(SearchManager searchManager) {
+ searchManager.Find(true, false);
+ scrollResultToTop(searchManager);
+ }
+
+ private void findPrev(SearchManager searchManager) {
+ searchManager.Find(false, false);
+ scrollResultToTop(searchManager);
+ }
+
+ private void findCurrent(SearchManager searchManager) {
+ searchManager.Find(true, true);
+ scrollResultToTop(searchManager);
+ }
+
+ private void TxtFindKeyDown(SearchManager searchManager, KeyEventArgs e) {
+ if (HotKeyManager.IsHotkey(e, Keys.Enter)) {
+ findNext(searchManager);
+ }
+
+ if (HotKeyManager.IsHotkey(e, Keys.Enter, true) || HotKeyManager.IsHotkey(e, Keys.Enter, false, true)) {
+ findPrev(searchManager);
+ }
+ }
+
+ private void BtnNextFindScript_Click(object sender, EventArgs e) {
+ findNext(scriptSearchManager);
+ }
+
+ private void BtnPrevFindScript_Click(object sender, EventArgs e) {
+ findPrev(scriptSearchManager);
+ }
+
+ private void panelFindScriptTextBox_TextChanged(object sender, EventArgs e) {
+ findCurrent(scriptSearchManager);
+ }
+
+ private void scriptTxtFind_KeyDown(object sender, KeyEventArgs e) {
+ TxtFindKeyDown(scriptSearchManager, e);
+ }
+
+ private void BtnCloseFindScript_Click(object sender, EventArgs e) {
+ 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) {
+ if (listBox.SelectedIndex < 0) {
+ return;
+ }
+
+ scriptEditorTabControl.SelectedTab = tabPage;
+ int commandNumber = listBox.SelectedIndex + 1;
+ string CommandBlockOpen = $"{containerType} {commandNumber}:";
+ searchManager.Find(true, false, CommandBlockOpen);
+
+ scrollResultToTop(searchManager);
+ }
+
+ private void scriptsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
+ NavigatorGoTo((ListBox)sender, scriptsTabPage, scriptSearchManager, ScriptFile.ContainerTypes.Script);
+ }
+
+ private void functionsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
+ NavigatorGoTo((ListBox)sender, functionsTabPage, functionSearchManager, ScriptFile.ContainerTypes.Function);
+ }
+
+ private void actionsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
+ NavigatorGoTo((ListBox)sender, actionsTabPage, actionSearchManager, ScriptFile.ContainerTypes.Action);
+ }
+
+ private void openFindScriptEditorButton_Click(object sender, EventArgs e) {
+ currentSearchManager.OpenSearch();
+ }
+
+ private void ScriptEditorExpandButton_Click(object sender, EventArgs e) {
+ currentScintillaEditor.FoldAll(FoldAction.Expand);
+ }
+
+ private void ScriptEditorCollapseButton_Click(object sender, EventArgs e) {
+ currentScintillaEditor.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) {
+ if (e.KeyCode == Keys.Enter) {
+ searchInScriptsButton_Click(null, null);
+ }
+ }
+
+ public List getScriptsToSearch() {
+ List scriptsToSearch = new List();
+
+ if (searchOnlyCurrentScriptCheckBox.Checked) {
+ this.UIThread(() => {
+ searchProgressBar.Maximum = 1;
+ });
+ int i = selectScriptFileComboBox.SelectedIndex;
+ ScriptFile scriptFile = new ScriptFile(i);
+ Console.WriteLine("Attempting to load script " + scriptFile.fileID);
+ scriptsToSearch.Add(scriptFile);
+ this.UIThread(() => {
+ searchProgressBar.IncrementNoAnimation();
+ });
+ }
+ else {
+ this.UIThread(() => {
+ searchProgressBar.Maximum = selectScriptFileComboBox.Items.Count;
+ });
+ for (int i = 0; i < selectScriptFileComboBox.Items.Count; i++) {
+ ScriptFile scriptFile = new ScriptFile(i);
+ Console.WriteLine("Attempting to load script " + scriptFile.fileID);
+ scriptsToSearch.Add(scriptFile);
+ this.UIThread(() => {
+ searchProgressBar.IncrementNoAnimation();
+ });
+ }
+ }
+
+ return scriptsToSearch;
+ }
+
+ private void searchInScriptsButton_Click(object sender, EventArgs e) {
+ if (searchInScriptsTextBox.Text == "") {
+ return;
+ }
+
+ BackgroundWorker bw = new BackgroundWorker();
+ bw.DoWork += (_sender, args) => {
+ this.UIThread(() => {
+ searchInScriptsResultListBox.Items.Clear();
+ searchProgressBar.Value = 0;
+ });
+
+ 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;
+
+ 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);
+ results.AddRange(scriptResults);
+ results.AddRange(functionResults);
+ // results.AddRange(actionResults);
+ }
+
+ this.UIThread(() => {
+ searchInScriptsResultListBox.Items.AddRange(results.ToArray());
+ searchProgressBar.Value = 0;
+ });
+ };
+
+ bw.RunWorkerAsync();
+ }
+
+ private List SearchInScripts(ScriptFile scriptFile, List commandContainers, 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;
+ }
+
+ private void searchInScriptsResultListBox_KeyDown(object sender, KeyEventArgs e) {
+ if (e.KeyCode == Keys.Enter) {
+ goToSearchResult();
+ }
+ }
+
+ private void searchInScripts_GoToEntryResult(object sender, MouseEventArgs e) {
+ goToSearchResult();
+ }
+
+ private void goToSearchResult() {
+ if (searchInScriptsResultListBox.SelectedItem == null) return;
+
+ ScriptEditorSearchResult searchResult = (ScriptEditorSearchResult)searchInScriptsResultListBox.SelectedItem;
+ ScriptFile scriptFile = searchResult.scriptFile;
+ ScriptFile.ContainerTypes containerType = searchResult.containerType;
+
+ 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);
+ }
+ }
+
+ private void displaySearchResult(TabPage tabPage, SearchManager searchManager, ScriptEditorSearchResult searchResult) {
+ if (scriptEditorTabControl.SelectedTab != tabPage) {
+ scriptEditorTabControl.SelectedTab = tabPage;
+ }
+
+ searchManager.Find(true, false, searchResult.CommandBlockOpen);
+ int blockStart = searchManager.textAreaScintilla.CurrentLine - ScriptEditorSearchResult.ResultsPadding;
+
+ searchManager.Find(true, false, searchResult.scriptCommand.name);
+ int resultStart = searchManager.textAreaScintilla.CurrentLine - ScriptEditorSearchResult.ResultsPadding;
+
+ if (scrollToBlockStartcheckBox.Checked) {
+ searchManager.textAreaScintilla.FirstVisibleLine = blockStart;
+ }
+ else {
+ searchManager.textAreaScintilla.FirstVisibleLine = resultStart;
+ }
+ }
+ }
+
+ public class ScriptEditorSearchResult {
+ public readonly ScriptFile scriptFile;
+ public readonly ScriptFile.ContainerTypes containerType;
+ public readonly int commandNumber;
+ public readonly ScriptCommand scriptCommand;
+
+ public const int ResultsPadding = 1;
+
+ public ScriptEditorSearchResult(ScriptFile scriptFile, ScriptFile.ContainerTypes containerType, int commandNumber, ScriptCommand scriptCommand) {
+ this.scriptFile = scriptFile;
+ this.containerType = containerType;
+ this.commandNumber = commandNumber;
+ this.scriptCommand = scriptCommand;
+ }
+
+ public string CommandBlockOpen { get { return $"{containerType} {commandNumber}:"; } }
+
+ public override string ToString() {
+ return $"File {scriptFile.fileID} - {CommandBlockOpen} {scriptCommand.name}";
+ }
+ }
+}
diff --git a/DS_Map/Editors/ScriptEditor.resx b/DS_Map/Editors/ScriptEditor.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/DS_Map/Editors/ScriptEditor.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/DS_Map/ExtensionMethods.cs b/DS_Map/ExtensionMethods.cs
new file mode 100644
index 0000000..b306b5a
--- /dev/null
+++ b/DS_Map/ExtensionMethods.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Windows.Forms;
+
+namespace DSPRE {
+ public static class ExtensionMethods {
+ ///
+ /// Increment the progress bar value, without using Windows Aero animation
+ ///
+ public static void IncrementNoAnimation(this ProgressBar pb, int amount = 1) {
+ pb.Value += amount;
+ if (pb.Value != pb.Maximum) pb.Value++;
+ pb.Value--;
+ }
+
+ //https://stackoverflow.com/a/10939890
+ ///
+ /// Sets the progress bar value, without using Windows Aero animation
+ ///
+ public static void SetProgressNoAnimation(this ProgressBar pb, int value) {
+ // Don't redraw if nothing is changing.
+ if (value == pb.Value)
+ return;
+
+ // To get around this animation, we need to move the progress bar backwards.
+ if (value == pb.Maximum) {
+ // Special case (can't set value > Maximum).
+ pb.Value = value; // Set the value
+ pb.Value = value - 1; // Move it backwards
+ }
+ else {
+ pb.Value = value + 1; // Move past
+ }
+
+ pb.Value = value; // Move to correct value
+ }
+
+ /*
+ searchInScriptsButton.BeginInvoke(new Action(() => {
+ }));
+
+ BackgroundWorker bw = new BackgroundWorker();
+ bw.DoWork += (_sender, args) => {
+ this.UIThread(() => {
+ });
+ };
+
+ //easier to set up
+ searchInScriptsButton.BeginInvoke(new Action(() => {
+ searchProgressBar.Value += 1;
+ }));
+
+ //smoother if you put the control updates in the UIThread
+ //same as BeginInvoke if you put the entire logic in UIThread
+ BackgroundWorker bw = new BackgroundWorker();
+ bw.DoWork += (_sender, args) => {
+ this.UIThread(() => {
+ searchProgressBar.Value += 1;
+ });
+ };
+ bw.RunWorkerAsync();
+ */
+ public static void UIThread(this Control control, Action code) {
+ if (control.InvokeRequired) {
+ control.BeginInvoke(code);
+ return;
+ }
+
+ code.Invoke();
+ }
+ }
+}
diff --git a/DS_Map/Extensions.cs b/DS_Map/Extensions.cs
index ee71c01..76d1a9c 100644
--- a/DS_Map/Extensions.cs
+++ b/DS_Map/Extensions.cs
@@ -7,6 +7,8 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
+using System.ComponentModel;
+using Tao.Platform.Windows;
namespace DSPRE {
public static class Extensions {
@@ -142,4 +144,33 @@ namespace DSPRE {
}
public static Bitmap Resize(this Bitmap source, float factor) => source.Resize((int)(source.Width * factor), (int)(source.Height * factor));
}
+
+ public class ListBox2 : ListBox {
+ public new void RefreshItem(int index) {
+ base.RefreshItem(index);
+ }
+ }
+
+ public class SimpleOpenGlControl2 : SimpleOpenGlControl {
+ private bool designMode;
+
+ public SimpleOpenGlControl2() : base() {
+ designMode = LicenseManager.UsageMode == LicenseUsageMode.Designtime;
+ }
+
+ public new bool DesignMode { get { return designMode; } }
+
+ protected override void OnPaint(PaintEventArgs e) {
+ //if the control is allowed to paint in design mode, a message box prevents working with it
+ //"No device or rendering context available!"
+ if (DesignMode) {
+ e.Graphics.Clear(this.BackColor);
+ if (this.BackgroundImage != null)
+ e.Graphics.DrawImage(this.BackgroundImage, this.ClientRectangle, 0, 0, this.BackgroundImage.Width, this.BackgroundImage.Height, GraphicsUnit.Pixel);
+ e.Graphics.Flush();
+ return;
+ };
+ base.OnPaint(e);
+ }
+ }
}
diff --git a/DS_Map/Helpers.cs b/DS_Map/Helpers.cs
index f6d2aa0..13fa6d0 100644
--- a/DS_Map/Helpers.cs
+++ b/DS_Map/Helpers.cs
@@ -47,11 +47,11 @@ namespace DSPRE {
}
public static void DisableHandlers() {
- Helpers.DisableHandlers();
+ disableHandlers = true;
}
public static void EnableHandlers() {
- Helpers.EnableHandlers();
+ disableHandlers = false;
}
public static void statusLabelMessage(string msg = "Ready") {
diff --git a/DS_Map/Main Window.Designer.cs b/DS_Map/Main Window.Designer.cs
index c684a6a..746d63e 100644
--- a/DS_Map/Main Window.Designer.cs
+++ b/DS_Map/Main Window.Designer.cs
@@ -30,22 +30,22 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainProgram));
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle41 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle42 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle45 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle46 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle47 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle48 = new System.Windows.Forms.DataGridViewCellStyle();
this.mainTabControl = new System.Windows.Forms.TabControl();
this.headerEditorTabPage = new System.Windows.Forms.TabPage();
this.removeLastHeaderBTN = new System.Windows.Forms.Button();
@@ -508,66 +508,6 @@
this.exportEventFileButton = new System.Windows.Forms.Button();
this.importEventFileButton = new System.Windows.Forms.Button();
this.saveEventsButton = new System.Windows.Forms.Button();
- this.scriptEditorTabPage = new System.Windows.Forms.TabPage();
- this.locateCurrentScriptFile = new System.Windows.Forms.Button();
- this.clearCurrentLevelScriptButton = new System.Windows.Forms.Button();
- 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.scriptEditorWhitespacesCheckbox = new System.Windows.Forms.CheckBox();
- this.scriptEditorWordWrapCheckbox = new System.Windows.Forms.CheckBox();
- this.compressScriptTextButton = new System.Windows.Forms.Button();
- this.expandScriptTextButton = new System.Windows.Forms.Button();
- this.openSearchScriptEditorButton = new System.Windows.Forms.Button();
- this.groupBox24 = new System.Windows.Forms.GroupBox();
- this.SyncNavigatorCB = new System.Windows.Forms.CheckBox();
- 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.groupBox8 = new System.Windows.Forms.GroupBox();
- this.searchOnlyCurrentScriptCheckBox = 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.searchInScriptsButton = new System.Windows.Forms.Button();
- this.searchInScriptsResultListBox = new System.Windows.Forms.ListBox();
- this.importScriptFileButton = new System.Windows.Forms.Button();
- this.exportScriptFileButton = new System.Windows.Forms.Button();
- this.saveScriptFileButton = new System.Windows.Forms.Button();
- this.removeScriptFileButton = new System.Windows.Forms.Button();
- this.addScriptFileButton = new System.Windows.Forms.Button();
- this.scriptEditorTabControl = new System.Windows.Forms.TabControl();
- this.scriptsTabPage = new System.Windows.Forms.TabPage();
- this.PanelSearchScripts = new System.Windows.Forms.Panel();
- this.BtnNextSearchScript = new System.Windows.Forms.Button();
- this.BtnPrevSearchScript = new System.Windows.Forms.Button();
- this.BtnCloseSearchScript = new System.Windows.Forms.Button();
- this.panelSearchScriptTextBox = 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.BtnNextSearchFunc = new System.Windows.Forms.Button();
- this.BtnPrevSearchFunc = new System.Windows.Forms.Button();
- this.BtnCloseSearchFunc = new System.Windows.Forms.Button();
- this.panelSearchFunctionTextBox = 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.BtnNextSearchActions = new System.Windows.Forms.Button();
- this.BtnPrevSearchActions = new System.Windows.Forms.Button();
- this.BtnCloseSearchActions = new System.Windows.Forms.Button();
- this.panelSearchActionTextBox = new System.Windows.Forms.TextBox();
- this.scintillaActionsPanel = new System.Windows.Forms.Panel();
- this.label5 = new System.Windows.Forms.Label();
- this.selectScriptFileComboBox = new System.Windows.Forms.ComboBox();
this.textEditorTabPage = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label6 = new System.Windows.Forms.Label();
@@ -834,6 +774,8 @@
this.locationNameConditionalMusicLBL = new System.Windows.Forms.Label();
this.headerConditionalMusicComboBox = new System.Windows.Forms.ComboBox();
this.conditionalMusicTableListBox = new System.Windows.Forms.ListBox();
+ this.tabPageScriptEditor = new System.Windows.Forms.TabPage();
+ this.tabPageLevelScriptEditor = new System.Windows.Forms.TabPage();
this.mainTabImageList = new System.Windows.Forms.ImageList(this.components);
this.gameIcon = new System.Windows.Forms.PictureBox();
this.languageLabel = new System.Windows.Forms.Label();
@@ -906,6 +848,8 @@
this.separator_afterMiscButtons = new System.Windows.Forms.ToolStripSeparator();
this.versionLabel = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
+ this.scriptEditor = new DSPRE.Editors.ScriptEditor();
+ this.levelScriptEditor = new DSPRE.Editors.LevelScriptEditor();
this.mainTabControl.SuspendLayout();
this.headerEditorTabPage.SuspendLayout();
this.worldmapCoordsGroupBox.SuspendLayout();
@@ -1061,21 +1005,6 @@
((System.ComponentModel.ISupportInitialize)(this.rightClickPicture)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.wheelClickPicture)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.LeftClickPicture)).BeginInit();
- this.scriptEditorTabPage.SuspendLayout();
- this.groupBox26.SuspendLayout();
- this.groupBox24.SuspendLayout();
- this.ScriptNavigatorTabControl.SuspendLayout();
- this.ScriptsNavTab.SuspendLayout();
- this.FunctionsNavTab.SuspendLayout();
- this.ActionsNavTab.SuspendLayout();
- this.groupBox8.SuspendLayout();
- this.scriptEditorTabControl.SuspendLayout();
- this.scriptsTabPage.SuspendLayout();
- this.PanelSearchScripts.SuspendLayout();
- this.functionsTabPage.SuspendLayout();
- this.PanelSearchFunctions.SuspendLayout();
- this.actionsTabPage.SuspendLayout();
- this.PanelSearchActions.SuspendLayout();
this.textEditorTabPage.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.LineNumbersFormatgroupBox.SuspendLayout();
@@ -1152,6 +1081,8 @@
this.conditionalMusicGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.musicIDconditionalMusicUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.flagConditionalMusicUpDown)).BeginInit();
+ this.tabPageScriptEditor.SuspendLayout();
+ this.tabPageLevelScriptEditor.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gameIcon)).BeginInit();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
@@ -1166,11 +1097,12 @@
this.mainTabControl.Controls.Add(this.mapEditorTabPage);
this.mainTabControl.Controls.Add(this.nsbtxEditorTabPage);
this.mainTabControl.Controls.Add(this.eventEditorTabPage);
- this.mainTabControl.Controls.Add(this.scriptEditorTabPage);
this.mainTabControl.Controls.Add(this.textEditorTabPage);
this.mainTabControl.Controls.Add(this.cameraEditorTabPage);
this.mainTabControl.Controls.Add(this.trainerEditorTabPage);
this.mainTabControl.Controls.Add(this.tableEditorTabPage);
+ this.mainTabControl.Controls.Add(this.tabPageScriptEditor);
+ this.mainTabControl.Controls.Add(this.tabPageLevelScriptEditor);
this.mainTabControl.ImageList = this.mainTabImageList;
this.mainTabControl.Location = new System.Drawing.Point(11, 72);
this.mainTabControl.Name = "mainTabControl";
@@ -2827,40 +2759,40 @@
this.headersGridView.AllowUserToResizeColumns = false;
this.headersGridView.AllowUserToResizeRows = false;
this.headersGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
- dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.Info;
- dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.headersGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
+ dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle33.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ dataGridViewCellStyle33.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ dataGridViewCellStyle33.ForeColor = System.Drawing.SystemColors.Info;
+ dataGridViewCellStyle33.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle33.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle33.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.headersGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle33;
this.headersGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
- dataGridViewCellStyle2.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
- dataGridViewCellStyle2.Format = "D4";
- dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
- this.headersGridView.DefaultCellStyle = dataGridViewCellStyle2;
+ dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle34.BackColor = System.Drawing.SystemColors.Window;
+ dataGridViewCellStyle34.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ dataGridViewCellStyle34.ForeColor = System.Drawing.SystemColors.ControlText;
+ dataGridViewCellStyle34.Format = "D4";
+ dataGridViewCellStyle34.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle34.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle34.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
+ this.headersGridView.DefaultCellStyle = dataGridViewCellStyle34;
this.headersGridView.Location = new System.Drawing.Point(0, 0);
this.headersGridView.MultiSelect = false;
this.headersGridView.Name = "headersGridView";
- dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
- dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.headersGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
+ dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle35.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle35.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
+ dataGridViewCellStyle35.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle35.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle35.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle35.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.headersGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle35;
this.headersGridView.RowHeadersWidth = 50;
this.headersGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
- dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle4.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.headersGridView.RowsDefaultCellStyle = dataGridViewCellStyle4;
+ dataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle36.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.headersGridView.RowsDefaultCellStyle = dataGridViewCellStyle36;
this.headersGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.headersGridView.RowTemplate.Height = 18;
this.headersGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
@@ -2889,43 +2821,43 @@
this.heightsGridView.AllowUserToDeleteRows = false;
this.heightsGridView.AllowUserToResizeColumns = false;
this.heightsGridView.AllowUserToResizeRows = false;
- dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.heightsGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5;
+ dataGridViewCellStyle37.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ this.heightsGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle37;
this.heightsGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
- dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
- dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.heightsGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6;
+ dataGridViewCellStyle38.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle38.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle38.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
+ dataGridViewCellStyle38.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle38.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle38.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle38.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.heightsGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle38;
this.heightsGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window;
- dataGridViewCellStyle7.Font = new System.Drawing.Font("Tahoma", 8.25F);
- dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText;
- dataGridViewCellStyle7.Format = "D2";
- dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
- this.heightsGridView.DefaultCellStyle = dataGridViewCellStyle7;
+ dataGridViewCellStyle39.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle39.BackColor = System.Drawing.SystemColors.Window;
+ dataGridViewCellStyle39.Font = new System.Drawing.Font("Tahoma", 8.25F);
+ dataGridViewCellStyle39.ForeColor = System.Drawing.SystemColors.ControlText;
+ dataGridViewCellStyle39.Format = "D2";
+ dataGridViewCellStyle39.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle39.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle39.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
+ this.heightsGridView.DefaultCellStyle = dataGridViewCellStyle39;
this.heightsGridView.Location = new System.Drawing.Point(0, 0);
this.heightsGridView.MultiSelect = false;
this.heightsGridView.Name = "heightsGridView";
- dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
- dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.heightsGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle8;
+ dataGridViewCellStyle40.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle40.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle40.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
+ dataGridViewCellStyle40.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle40.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle40.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle40.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.heightsGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle40;
this.heightsGridView.RowHeadersWidth = 50;
this.heightsGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
- dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle9.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.heightsGridView.RowsDefaultCellStyle = dataGridViewCellStyle9;
+ dataGridViewCellStyle41.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle41.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.heightsGridView.RowsDefaultCellStyle = dataGridViewCellStyle41;
this.heightsGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.heightsGridView.RowTemplate.Height = 18;
this.heightsGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
@@ -2952,43 +2884,43 @@
this.mapFilesGridView.AllowUserToDeleteRows = false;
this.mapFilesGridView.AllowUserToResizeColumns = false;
this.mapFilesGridView.AllowUserToResizeRows = false;
- dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.mapFilesGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10;
+ dataGridViewCellStyle42.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ this.mapFilesGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle42;
this.mapFilesGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
- dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
- dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.mapFilesGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;
+ dataGridViewCellStyle43.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle43.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle43.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
+ dataGridViewCellStyle43.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle43.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle43.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle43.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.mapFilesGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle43;
this.mapFilesGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Window;
- dataGridViewCellStyle12.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.ControlText;
- dataGridViewCellStyle12.Format = "D4";
- dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
- this.mapFilesGridView.DefaultCellStyle = dataGridViewCellStyle12;
+ dataGridViewCellStyle44.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle44.BackColor = System.Drawing.SystemColors.Window;
+ dataGridViewCellStyle44.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ dataGridViewCellStyle44.ForeColor = System.Drawing.SystemColors.ControlText;
+ dataGridViewCellStyle44.Format = "D4";
+ dataGridViewCellStyle44.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle44.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle44.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
+ this.mapFilesGridView.DefaultCellStyle = dataGridViewCellStyle44;
this.mapFilesGridView.Location = new System.Drawing.Point(0, 0);
this.mapFilesGridView.MultiSelect = false;
this.mapFilesGridView.Name = "mapFilesGridView";
- dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
- dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.mapFilesGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle13;
+ dataGridViewCellStyle45.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle45.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle45.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
+ dataGridViewCellStyle45.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle45.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle45.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle45.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.mapFilesGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle45;
this.mapFilesGridView.RowHeadersWidth = 50;
this.mapFilesGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
- dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle14.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.mapFilesGridView.RowsDefaultCellStyle = dataGridViewCellStyle14;
+ dataGridViewCellStyle46.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle46.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.mapFilesGridView.RowsDefaultCellStyle = dataGridViewCellStyle46;
this.mapFilesGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.mapFilesGridView.RowTemplate.Height = 18;
this.mapFilesGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
@@ -7010,758 +6942,6 @@
this.saveEventsButton.UseVisualStyleBackColor = true;
this.saveEventsButton.Click += new System.EventHandler(this.saveEventsButton_Click);
//
- // scriptEditorTabPage
- //
- this.scriptEditorTabPage.Controls.Add(this.locateCurrentScriptFile);
- this.scriptEditorTabPage.Controls.Add(this.clearCurrentLevelScriptButton);
- this.scriptEditorTabPage.Controls.Add(this.groupBox26);
- this.scriptEditorTabPage.Controls.Add(this.scriptEditorWhitespacesCheckbox);
- this.scriptEditorTabPage.Controls.Add(this.scriptEditorWordWrapCheckbox);
- this.scriptEditorTabPage.Controls.Add(this.compressScriptTextButton);
- this.scriptEditorTabPage.Controls.Add(this.expandScriptTextButton);
- this.scriptEditorTabPage.Controls.Add(this.openSearchScriptEditorButton);
- this.scriptEditorTabPage.Controls.Add(this.groupBox24);
- this.scriptEditorTabPage.Controls.Add(this.groupBox8);
- this.scriptEditorTabPage.Controls.Add(this.importScriptFileButton);
- this.scriptEditorTabPage.Controls.Add(this.exportScriptFileButton);
- this.scriptEditorTabPage.Controls.Add(this.saveScriptFileButton);
- this.scriptEditorTabPage.Controls.Add(this.removeScriptFileButton);
- this.scriptEditorTabPage.Controls.Add(this.addScriptFileButton);
- this.scriptEditorTabPage.Controls.Add(this.scriptEditorTabControl);
- this.scriptEditorTabPage.Controls.Add(this.label5);
- this.scriptEditorTabPage.Controls.Add(this.selectScriptFileComboBox);
- this.scriptEditorTabPage.ImageIndex = 5;
- this.scriptEditorTabPage.Location = new System.Drawing.Point(4, 23);
- this.scriptEditorTabPage.Name = "scriptEditorTabPage";
- this.scriptEditorTabPage.Padding = new System.Windows.Forms.Padding(3);
- this.scriptEditorTabPage.Size = new System.Drawing.Size(1185, 633);
- this.scriptEditorTabPage.TabIndex = 4;
- this.scriptEditorTabPage.Text = "Script Editor";
- this.scriptEditorTabPage.UseVisualStyleBackColor = true;
- //
- // locateCurrentScriptFile
- //
- this.locateCurrentScriptFile.Image = global::DSPRE.Properties.Resources.open_file;
- this.locateCurrentScriptFile.Location = new System.Drawing.Point(429, 29);
- this.locateCurrentScriptFile.Name = "locateCurrentScriptFile";
- this.locateCurrentScriptFile.Size = new System.Drawing.Size(42, 40);
- this.locateCurrentScriptFile.TabIndex = 63;
- this.locateCurrentScriptFile.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.locateCurrentScriptFile.UseVisualStyleBackColor = true;
- this.locateCurrentScriptFile.Click += new System.EventHandler(this.locateCurrentScriptFile_Click);
- //
- // clearCurrentLevelScriptButton
- //
- this.clearCurrentLevelScriptButton.Image = global::DSPRE.Properties.Resources.destroyLevelScript;
- this.clearCurrentLevelScriptButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.clearCurrentLevelScriptButton.Location = new System.Drawing.Point(320, 22);
- this.clearCurrentLevelScriptButton.Name = "clearCurrentLevelScriptButton";
- this.clearCurrentLevelScriptButton.Size = new System.Drawing.Size(106, 52);
- this.clearCurrentLevelScriptButton.TabIndex = 19;
- this.clearCurrentLevelScriptButton.Text = "&Clear This\r\nLevel Script";
- this.clearCurrentLevelScriptButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.clearCurrentLevelScriptButton.UseVisualStyleBackColor = true;
- this.clearCurrentLevelScriptButton.Visible = false;
- this.clearCurrentLevelScriptButton.Click += new System.EventHandler(this.clearCurrentLevelScriptButton_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(693, 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 = 36;
- 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 = 35;
- 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 = 34;
- this.scriptEditorNumberFormatHex.Text = "Hex";
- this.scriptEditorNumberFormatHex.UseVisualStyleBackColor = true;
- this.scriptEditorNumberFormatHex.CheckedChanged += new System.EventHandler(this.UpdateScriptNumberFormatHex);
- //
- // scriptEditorWhitespacesCheckbox
- //
- this.scriptEditorWhitespacesCheckbox.Appearance = System.Windows.Forms.Appearance.Button;
- this.scriptEditorWhitespacesCheckbox.AutoSize = true;
- this.scriptEditorWhitespacesCheckbox.Location = new System.Drawing.Point(987, 12);
- this.scriptEditorWhitespacesCheckbox.Name = "scriptEditorWhitespacesCheckbox";
- this.scriptEditorWhitespacesCheckbox.Size = new System.Drawing.Size(79, 23);
- this.scriptEditorWhitespacesCheckbox.TabIndex = 46;
- this.scriptEditorWhitespacesCheckbox.Text = "Whitespaces";
- this.scriptEditorWhitespacesCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- this.scriptEditorWhitespacesCheckbox.UseVisualStyleBackColor = true;
- this.scriptEditorWhitespacesCheckbox.CheckedChanged += new System.EventHandler(this.viewWhiteSpacesButton_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(913, 12);
- this.scriptEditorWordWrapCheckbox.Name = "scriptEditorWordWrapCheckbox";
- this.scriptEditorWordWrapCheckbox.Size = new System.Drawing.Size(72, 23);
- this.scriptEditorWordWrapCheckbox.TabIndex = 43;
- 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);
- //
- // compressScriptTextButton
- //
- this.compressScriptTextButton.Image = global::DSPRE.Properties.Resources.compressArrow;
- this.compressScriptTextButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.compressScriptTextButton.Location = new System.Drawing.Point(1141, 11);
- this.compressScriptTextButton.Name = "compressScriptTextButton";
- this.compressScriptTextButton.Size = new System.Drawing.Size(24, 24);
- this.compressScriptTextButton.TabIndex = 49;
- this.compressScriptTextButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.compressScriptTextButton.UseVisualStyleBackColor = true;
- this.compressScriptTextButton.Click += new System.EventHandler(this.ScriptEditorCollapseButton_Click);
- //
- // expandScriptTextButton
- //
- this.expandScriptTextButton.Image = global::DSPRE.Properties.Resources.expandArrow;
- this.expandScriptTextButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.expandScriptTextButton.Location = new System.Drawing.Point(1113, 11);
- this.expandScriptTextButton.Name = "expandScriptTextButton";
- this.expandScriptTextButton.Size = new System.Drawing.Size(24, 24);
- this.expandScriptTextButton.TabIndex = 48;
- this.expandScriptTextButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.expandScriptTextButton.UseVisualStyleBackColor = true;
- this.expandScriptTextButton.Click += new System.EventHandler(this.ScriptEditorExpandButton_Click);
- //
- // openSearchScriptEditorButton
- //
- this.openSearchScriptEditorButton.Image = global::DSPRE.Properties.Resources.SearchMiniIcon;
- this.openSearchScriptEditorButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.openSearchScriptEditorButton.Location = new System.Drawing.Point(1085, 11);
- this.openSearchScriptEditorButton.Name = "openSearchScriptEditorButton";
- this.openSearchScriptEditorButton.Size = new System.Drawing.Size(24, 24);
- this.openSearchScriptEditorButton.TabIndex = 47;
- this.openSearchScriptEditorButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.openSearchScriptEditorButton.UseVisualStyleBackColor = true;
- this.openSearchScriptEditorButton.Click += new System.EventHandler(this.openSearchScriptEditorButton_Click);
- //
- // groupBox24
- //
- this.groupBox24.Controls.Add(this.SyncNavigatorCB);
- this.groupBox24.Controls.Add(this.ScriptNavigatorTabControl);
- this.groupBox24.Location = new System.Drawing.Point(9, 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";
- //
- // SyncNavigatorCB
- //
- this.SyncNavigatorCB.Appearance = System.Windows.Forms.Appearance.Button;
- this.SyncNavigatorCB.AutoSize = true;
- this.SyncNavigatorCB.Checked = true;
- this.SyncNavigatorCB.CheckState = System.Windows.Forms.CheckState.Checked;
- this.SyncNavigatorCB.Location = new System.Drawing.Point(417, 11);
- this.SyncNavigatorCB.Name = "SyncNavigatorCB";
- this.SyncNavigatorCB.Size = new System.Drawing.Size(41, 23);
- this.SyncNavigatorCB.TabIndex = 43;
- this.SyncNavigatorCB.Text = "Sync";
- this.SyncNavigatorCB.UseVisualStyleBackColor = true;
- //
- // 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 = 18;
- //
- // 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 = 18;
- 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 = 19;
- 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 = 19;
- this.actionsNavListbox.SelectedIndexChanged += new System.EventHandler(this.actionsNavListbox_SelectedIndexChanged);
- //
- // groupBox8
- //
- this.groupBox8.Controls.Add(this.searchOnlyCurrentScriptCheckBox);
- 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.searchInScriptsButton);
- this.groupBox8.Controls.Add(this.searchInScriptsResultListBox);
- this.groupBox8.Location = new System.Drawing.Point(8, 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:";
- //
- // searchOnlyCurrentScriptCheckBox
- //
- this.searchOnlyCurrentScriptCheckBox.AutoSize = true;
- this.searchOnlyCurrentScriptCheckBox.Location = new System.Drawing.Point(281, 48);
- this.searchOnlyCurrentScriptCheckBox.Name = "searchOnlyCurrentScriptCheckBox";
- this.searchOnlyCurrentScriptCheckBox.Size = new System.Drawing.Size(84, 17);
- this.searchOnlyCurrentScriptCheckBox.TabIndex = 41;
- this.searchOnlyCurrentScriptCheckBox.Text = "Only Current";
- this.searchOnlyCurrentScriptCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- this.searchOnlyCurrentScriptCheckBox.UseVisualStyleBackColor = true;
- //
- // scriptSearchCaseSensitiveCheckBox
- //
- this.scriptSearchCaseSensitiveCheckBox.AutoSize = true;
- this.scriptSearchCaseSensitiveCheckBox.Location = new System.Drawing.Point(281, 26);
- this.scriptSearchCaseSensitiveCheckBox.Name = "scriptSearchCaseSensitiveCheckBox";
- this.scriptSearchCaseSensitiveCheckBox.Size = new System.Drawing.Size(83, 17);
- this.scriptSearchCaseSensitiveCheckBox.TabIndex = 39;
- this.scriptSearchCaseSensitiveCheckBox.Text = "Match Case";
- this.scriptSearchCaseSensitiveCheckBox.UseVisualStyleBackColor = true;
- //
- // searchInScriptsTextBox
- //
- this.searchInScriptsTextBox.Location = new System.Drawing.Point(11, 35);
- this.searchInScriptsTextBox.Name = "searchInScriptsTextBox";
- this.searchInScriptsTextBox.Size = new System.Drawing.Size(255, 20);
- this.searchInScriptsTextBox.TabIndex = 38;
- this.searchInScriptsTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.searchInScriptsTextBox_KeyDown);
- //
- // label31
- //
- this.label31.AutoSize = true;
- this.label31.Location = new System.Drawing.Point(7, 248);
- 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(9, 264);
- this.searchProgressBar.Name = "searchProgressBar";
- this.searchProgressBar.Size = new System.Drawing.Size(453, 23);
- this.searchProgressBar.TabIndex = 36;
- //
- // label30
- //
- this.label30.AutoSize = true;
- this.label30.Location = new System.Drawing.Point(7, 63);
- 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(8, 18);
- this.label29.Name = "label29";
- this.label29.Size = new System.Drawing.Size(77, 13);
- this.label29.TabIndex = 33;
- this.label29.Text = "Line to search:";
- //
- // searchInScriptsButton
- //
- this.searchInScriptsButton.Image = global::DSPRE.Properties.Resources.SearchMiniIcon;
- this.searchInScriptsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.searchInScriptsButton.Location = new System.Drawing.Point(371, 26);
- this.searchInScriptsButton.Name = "searchInScriptsButton";
- this.searchInScriptsButton.Size = new System.Drawing.Size(91, 36);
- this.searchInScriptsButton.TabIndex = 32;
- this.searchInScriptsButton.Text = "Search";
- this.searchInScriptsButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.searchInScriptsButton.UseVisualStyleBackColor = true;
- this.searchInScriptsButton.Click += new System.EventHandler(this.searchInScriptsButton_Click);
- //
- // searchInScriptsResultListBox
- //
- this.searchInScriptsResultListBox.Location = new System.Drawing.Point(10, 79);
- this.searchInScriptsResultListBox.Name = "searchInScriptsResultListBox";
- this.searchInScriptsResultListBox.Size = new System.Drawing.Size(452, 160);
- 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);
- //
- // importScriptFileButton
- //
- this.importScriptFileButton.Image = global::DSPRE.Properties.Resources.importArrow;
- this.importScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.importScriptFileButton.Location = new System.Drawing.Point(170, 22);
- this.importScriptFileButton.Name = "importScriptFileButton";
- this.importScriptFileButton.Size = new System.Drawing.Size(70, 52);
- this.importScriptFileButton.TabIndex = 16;
- 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);
- //
- // exportScriptFileButton
- //
- this.exportScriptFileButton.Image = global::DSPRE.Properties.Resources.exportArrow;
- this.exportScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.exportScriptFileButton.Location = new System.Drawing.Point(245, 22);
- this.exportScriptFileButton.Name = "exportScriptFileButton";
- this.exportScriptFileButton.Size = new System.Drawing.Size(70, 52);
- this.exportScriptFileButton.TabIndex = 15;
- 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);
- //
- // saveScriptFileButton
- //
- this.saveScriptFileButton.Image = global::DSPRE.Properties.Resources.saveButton;
- this.saveScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.saveScriptFileButton.Location = new System.Drawing.Point(12, 50);
- this.saveScriptFileButton.Name = "saveScriptFileButton";
- this.saveScriptFileButton.Size = new System.Drawing.Size(154, 23);
- this.saveScriptFileButton.TabIndex = 14;
- this.saveScriptFileButton.Text = "&Save Current File";
- this.saveScriptFileButton.UseVisualStyleBackColor = true;
- this.saveScriptFileButton.Click += new System.EventHandler(this.saveScriptFileButton_Click);
- //
- // removeScriptFileButton
- //
- this.removeScriptFileButton.Image = global::DSPRE.Properties.Resources.deleteIcon;
- this.removeScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.removeScriptFileButton.Location = new System.Drawing.Point(320, 49);
- this.removeScriptFileButton.Name = "removeScriptFileButton";
- this.removeScriptFileButton.Size = new System.Drawing.Size(106, 25);
- this.removeScriptFileButton.TabIndex = 13;
- 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);
- //
- // addScriptFileButton
- //
- this.addScriptFileButton.Image = global::DSPRE.Properties.Resources.addIcon;
- this.addScriptFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.addScriptFileButton.Location = new System.Drawing.Point(320, 22);
- this.addScriptFileButton.Name = "addScriptFileButton";
- this.addScriptFileButton.Size = new System.Drawing.Size(106, 25);
- this.addScriptFileButton.TabIndex = 10;
- 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);
- //
- // 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(487, 22);
- this.scriptEditorTabControl.Name = "scriptEditorTabControl";
- this.scriptEditorTabControl.SelectedIndex = 0;
- this.scriptEditorTabControl.Size = new System.Drawing.Size(692, 591);
- this.scriptEditorTabControl.TabIndex = 5;
- 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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.PanelSearchScripts.BackColor = System.Drawing.Color.White;
- this.PanelSearchScripts.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.PanelSearchScripts.Controls.Add(this.BtnNextSearchScript);
- this.PanelSearchScripts.Controls.Add(this.BtnPrevSearchScript);
- this.PanelSearchScripts.Controls.Add(this.BtnCloseSearchScript);
- this.PanelSearchScripts.Controls.Add(this.panelSearchScriptTextBox);
- 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;
- //
- // BtnNextSearchScript
- //
- this.BtnNextSearchScript.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.BtnNextSearchScript.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnNextSearchScript.ForeColor = System.Drawing.Color.White;
- this.BtnNextSearchScript.Image = global::DSPRE.Properties.Resources.arrowdown;
- this.BtnNextSearchScript.Location = new System.Drawing.Point(233, 4);
- this.BtnNextSearchScript.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnNextSearchScript.Name = "BtnNextSearchScript";
- this.BtnNextSearchScript.Size = new System.Drawing.Size(25, 30);
- this.BtnNextSearchScript.TabIndex = 9;
- this.BtnNextSearchScript.Tag = "Find next (Enter)";
- this.BtnNextSearchScript.UseVisualStyleBackColor = true;
- this.BtnNextSearchScript.Click += new System.EventHandler(this.BtnNextSearchScript_Click);
- //
- // BtnPrevSearchScript
- //
- this.BtnPrevSearchScript.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.BtnPrevSearchScript.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnPrevSearchScript.ForeColor = System.Drawing.Color.White;
- this.BtnPrevSearchScript.Image = global::DSPRE.Properties.Resources.arrowup;
- this.BtnPrevSearchScript.Location = new System.Drawing.Point(205, 4);
- this.BtnPrevSearchScript.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnPrevSearchScript.Name = "BtnPrevSearchScript";
- this.BtnPrevSearchScript.Size = new System.Drawing.Size(25, 30);
- this.BtnPrevSearchScript.TabIndex = 8;
- this.BtnPrevSearchScript.Tag = "Find previous (Shift+Enter)";
- this.BtnPrevSearchScript.UseVisualStyleBackColor = true;
- this.BtnPrevSearchScript.Click += new System.EventHandler(this.BtnPrevSearchScript_Click);
- //
- // BtnCloseSearchScript
- //
- this.BtnCloseSearchScript.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.BtnCloseSearchScript.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnCloseSearchScript.ForeColor = System.Drawing.Color.White;
- this.BtnCloseSearchScript.Image = global::DSPRE.Properties.Resources.Cross;
- this.BtnCloseSearchScript.Location = new System.Drawing.Point(261, 4);
- this.BtnCloseSearchScript.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnCloseSearchScript.Name = "BtnCloseSearchScript";
- this.BtnCloseSearchScript.Size = new System.Drawing.Size(25, 30);
- this.BtnCloseSearchScript.TabIndex = 7;
- this.BtnCloseSearchScript.Tag = "Close (Esc)";
- this.BtnCloseSearchScript.UseVisualStyleBackColor = true;
- this.BtnCloseSearchScript.Click += new System.EventHandler(this.BtnCloseSearchScript_Click);
- //
- // panelSearchScriptTextBox
- //
- this.panelSearchScriptTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.panelSearchScriptTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.panelSearchScriptTextBox.Font = new System.Drawing.Font("Segoe UI", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.panelSearchScriptTextBox.Location = new System.Drawing.Point(10, 6);
- this.panelSearchScriptTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.panelSearchScriptTextBox.Name = "panelSearchScriptTextBox";
- this.panelSearchScriptTextBox.Size = new System.Drawing.Size(189, 25);
- this.panelSearchScriptTextBox.TabIndex = 6;
- this.panelSearchScriptTextBox.TextChanged += new System.EventHandler(this.panelSearchScriptTextBox_TextChanged);
- this.panelSearchScriptTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.scriptTxtSearch_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 = 13;
- //
- // 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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.PanelSearchFunctions.BackColor = System.Drawing.Color.White;
- this.PanelSearchFunctions.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.PanelSearchFunctions.Controls.Add(this.BtnNextSearchFunc);
- this.PanelSearchFunctions.Controls.Add(this.BtnPrevSearchFunc);
- this.PanelSearchFunctions.Controls.Add(this.BtnCloseSearchFunc);
- this.PanelSearchFunctions.Controls.Add(this.panelSearchFunctionTextBox);
- 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;
- //
- // BtnNextSearchFunc
- //
- this.BtnNextSearchFunc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.BtnNextSearchFunc.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnNextSearchFunc.ForeColor = System.Drawing.Color.White;
- this.BtnNextSearchFunc.Image = global::DSPRE.Properties.Resources.arrowdown;
- this.BtnNextSearchFunc.Location = new System.Drawing.Point(233, 4);
- this.BtnNextSearchFunc.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnNextSearchFunc.Name = "BtnNextSearchFunc";
- this.BtnNextSearchFunc.Size = new System.Drawing.Size(25, 30);
- this.BtnNextSearchFunc.TabIndex = 9;
- this.BtnNextSearchFunc.Tag = "Find next (Enter)";
- this.BtnNextSearchFunc.UseVisualStyleBackColor = true;
- this.BtnNextSearchFunc.Click += new System.EventHandler(this.BtnNextSearchFunc_Click);
- //
- // BtnPrevSearchFunc
- //
- this.BtnPrevSearchFunc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.BtnPrevSearchFunc.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnPrevSearchFunc.ForeColor = System.Drawing.Color.White;
- this.BtnPrevSearchFunc.Image = global::DSPRE.Properties.Resources.arrowup;
- this.BtnPrevSearchFunc.Location = new System.Drawing.Point(205, 4);
- this.BtnPrevSearchFunc.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnPrevSearchFunc.Name = "BtnPrevSearchFunc";
- this.BtnPrevSearchFunc.Size = new System.Drawing.Size(25, 30);
- this.BtnPrevSearchFunc.TabIndex = 8;
- this.BtnPrevSearchFunc.Tag = "Find previous (Shift+Enter)";
- this.BtnPrevSearchFunc.UseVisualStyleBackColor = true;
- this.BtnPrevSearchFunc.Click += new System.EventHandler(this.BtnPrevSearchFunc_Click);
- //
- // BtnCloseSearchFunc
- //
- this.BtnCloseSearchFunc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.BtnCloseSearchFunc.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnCloseSearchFunc.ForeColor = System.Drawing.Color.White;
- this.BtnCloseSearchFunc.Image = global::DSPRE.Properties.Resources.Cross;
- this.BtnCloseSearchFunc.Location = new System.Drawing.Point(261, 4);
- this.BtnCloseSearchFunc.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnCloseSearchFunc.Name = "BtnCloseSearchFunc";
- this.BtnCloseSearchFunc.Size = new System.Drawing.Size(25, 30);
- this.BtnCloseSearchFunc.TabIndex = 7;
- this.BtnCloseSearchFunc.Tag = "Close (Esc)";
- this.BtnCloseSearchFunc.UseVisualStyleBackColor = true;
- this.BtnCloseSearchFunc.Click += new System.EventHandler(this.BtnCloseSearchFunc_Click);
- //
- // panelSearchFunctionTextBox
- //
- this.panelSearchFunctionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.panelSearchFunctionTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.panelSearchFunctionTextBox.Font = new System.Drawing.Font("Segoe UI", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.panelSearchFunctionTextBox.Location = new System.Drawing.Point(10, 6);
- this.panelSearchFunctionTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.panelSearchFunctionTextBox.Name = "panelSearchFunctionTextBox";
- this.panelSearchFunctionTextBox.Size = new System.Drawing.Size(189, 25);
- this.panelSearchFunctionTextBox.TabIndex = 6;
- this.panelSearchFunctionTextBox.TextChanged += new System.EventHandler(this.panelSearchFunctionTextBox_TextChanged);
- this.panelSearchFunctionTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.functionTxtSearch_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 = 15;
- //
- // 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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.PanelSearchActions.BackColor = System.Drawing.Color.White;
- this.PanelSearchActions.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.PanelSearchActions.Controls.Add(this.BtnNextSearchActions);
- this.PanelSearchActions.Controls.Add(this.BtnPrevSearchActions);
- this.PanelSearchActions.Controls.Add(this.BtnCloseSearchActions);
- this.PanelSearchActions.Controls.Add(this.panelSearchActionTextBox);
- 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;
- //
- // BtnNextSearchActions
- //
- this.BtnNextSearchActions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.BtnNextSearchActions.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnNextSearchActions.ForeColor = System.Drawing.Color.White;
- this.BtnNextSearchActions.Image = global::DSPRE.Properties.Resources.arrowdown;
- this.BtnNextSearchActions.Location = new System.Drawing.Point(233, 4);
- this.BtnNextSearchActions.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnNextSearchActions.Name = "BtnNextSearchActions";
- this.BtnNextSearchActions.Size = new System.Drawing.Size(25, 30);
- this.BtnNextSearchActions.TabIndex = 9;
- this.BtnNextSearchActions.Tag = "Find next (Enter)";
- this.BtnNextSearchActions.UseVisualStyleBackColor = true;
- this.BtnNextSearchActions.Click += new System.EventHandler(this.BtnNextSearchActions_Click);
- //
- // BtnPrevSearchActions
- //
- this.BtnPrevSearchActions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.BtnPrevSearchActions.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnPrevSearchActions.ForeColor = System.Drawing.Color.White;
- this.BtnPrevSearchActions.Image = global::DSPRE.Properties.Resources.arrowup;
- this.BtnPrevSearchActions.Location = new System.Drawing.Point(205, 4);
- this.BtnPrevSearchActions.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnPrevSearchActions.Name = "BtnPrevSearchActions";
- this.BtnPrevSearchActions.Size = new System.Drawing.Size(25, 30);
- this.BtnPrevSearchActions.TabIndex = 8;
- this.BtnPrevSearchActions.Tag = "Find previous (Shift+Enter)";
- this.BtnPrevSearchActions.UseVisualStyleBackColor = true;
- this.BtnPrevSearchActions.Click += new System.EventHandler(this.BtnPrevSearchActions_Click);
- //
- // BtnCloseSearchActions
- //
- this.BtnCloseSearchActions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.BtnCloseSearchActions.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.BtnCloseSearchActions.ForeColor = System.Drawing.Color.White;
- this.BtnCloseSearchActions.Image = global::DSPRE.Properties.Resources.Cross;
- this.BtnCloseSearchActions.Location = new System.Drawing.Point(261, 4);
- this.BtnCloseSearchActions.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.BtnCloseSearchActions.Name = "BtnCloseSearchActions";
- this.BtnCloseSearchActions.Size = new System.Drawing.Size(25, 30);
- this.BtnCloseSearchActions.TabIndex = 7;
- this.BtnCloseSearchActions.Tag = "Close (Esc)";
- this.BtnCloseSearchActions.UseVisualStyleBackColor = true;
- this.BtnCloseSearchActions.Click += new System.EventHandler(this.BtnCloseSearchActions_Click);
- //
- // panelSearchActionTextBox
- //
- this.panelSearchActionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.panelSearchActionTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.panelSearchActionTextBox.Font = new System.Drawing.Font("Segoe UI", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.panelSearchActionTextBox.Location = new System.Drawing.Point(10, 6);
- this.panelSearchActionTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.panelSearchActionTextBox.Name = "panelSearchActionTextBox";
- this.panelSearchActionTextBox.Size = new System.Drawing.Size(189, 25);
- this.panelSearchActionTextBox.TabIndex = 6;
- this.panelSearchActionTextBox.TextChanged += new System.EventHandler(this.panelSearchActionTextBox_TextChanged);
- this.panelSearchActionTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.actiontTxtSearch_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 = 15;
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(11, 8);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(53, 13);
- this.label5.TabIndex = 1;
- this.label5.Text = "Script File";
- //
- // selectScriptFileComboBox
- //
- this.selectScriptFileComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.selectScriptFileComboBox.FormattingEnabled = true;
- this.selectScriptFileComboBox.Location = new System.Drawing.Point(13, 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);
- //
// textEditorTabPage
//
this.textEditorTabPage.Controls.Add(this.tableLayoutPanel1);
@@ -8147,8 +7327,8 @@
this.textEditorDataGridView.Location = new System.Drawing.Point(12, 77);
this.textEditorDataGridView.Name = "textEditorDataGridView";
this.textEditorDataGridView.RowHeadersWidth = 68;
- dataGridViewCellStyle15.Font = new System.Drawing.Font("Consolas", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.textEditorDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle15;
+ dataGridViewCellStyle47.Font = new System.Drawing.Font("Consolas", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.textEditorDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle47;
this.textEditorDataGridView.Size = new System.Drawing.Size(873, 500);
this.textEditorDataGridView.TabIndex = 24;
this.textEditorDataGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.textEditorDataGridView_CellValueChanged);
@@ -8251,9 +7431,9 @@
this.cameraEditorDataGridView.CausesValidation = false;
this.cameraEditorDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised;
this.cameraEditorDataGridView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
- dataGridViewCellStyle16.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.cameraEditorDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle16;
+ dataGridViewCellStyle48.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ dataGridViewCellStyle48.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.cameraEditorDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle48;
this.cameraEditorDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.cameraEditorDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.DistanceGVCol,
@@ -10868,6 +10048,29 @@
this.conditionalMusicTableListBox.TabIndex = 0;
this.conditionalMusicTableListBox.SelectedIndexChanged += new System.EventHandler(this.conditionalMusicTableListBox_SelectedIndexChanged);
//
+ // tabPageScriptEditor
+ //
+ this.tabPageScriptEditor.Controls.Add(this.scriptEditor);
+ this.tabPageScriptEditor.ImageIndex = 5;
+ this.tabPageScriptEditor.Location = new System.Drawing.Point(4, 23);
+ this.tabPageScriptEditor.Name = "tabPageScriptEditor";
+ this.tabPageScriptEditor.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPageScriptEditor.Size = new System.Drawing.Size(1185, 633);
+ this.tabPageScriptEditor.TabIndex = 10;
+ this.tabPageScriptEditor.Text = "Script Editor New";
+ this.tabPageScriptEditor.UseVisualStyleBackColor = true;
+ //
+ // tabPageLevelScriptEditor
+ //
+ this.tabPageLevelScriptEditor.Controls.Add(this.levelScriptEditor);
+ this.tabPageLevelScriptEditor.Location = new System.Drawing.Point(4, 23);
+ this.tabPageLevelScriptEditor.Name = "tabPageLevelScriptEditor";
+ this.tabPageLevelScriptEditor.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPageLevelScriptEditor.Size = new System.Drawing.Size(1185, 633);
+ this.tabPageLevelScriptEditor.TabIndex = 11;
+ this.tabPageLevelScriptEditor.Text = "Level Script Editor";
+ this.tabPageLevelScriptEditor.UseVisualStyleBackColor = true;
+ //
// mainTabImageList
//
this.mainTabImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("mainTabImageList.ImageStream")));
@@ -11241,16 +10444,16 @@
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.statusLabel,
this.toolStripProgressBar});
- this.statusStrip1.Location = new System.Drawing.Point(0, 737);
+ this.statusStrip1.Location = new System.Drawing.Point(0, 739);
this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.Size = new System.Drawing.Size(1214, 24);
+ this.statusStrip1.Size = new System.Drawing.Size(1214, 22);
this.statusStrip1.TabIndex = 13;
this.statusStrip1.Text = "statusStrip1";
//
// statusLabel
//
this.statusLabel.Name = "statusLabel";
- this.statusLabel.Size = new System.Drawing.Size(39, 19);
+ this.statusLabel.Size = new System.Drawing.Size(39, 17);
this.statusLabel.Text = "Ready";
//
// toolStripProgressBar
@@ -11600,6 +10803,23 @@
this.versionLabel.Text = "ROM:";
this.versionLabel.Visible = false;
//
+ // scriptEditor
+ //
+ this.scriptEditor.Location = new System.Drawing.Point(2, 3);
+ this.scriptEditor.Name = "scriptEditor";
+ this.scriptEditor.scriptEditorIsReady = false;
+ this.scriptEditor.Size = new System.Drawing.Size(1177, 735);
+ this.scriptEditor.TabIndex = 0;
+ //
+ // levelScriptEditor
+ //
+ this.levelScriptEditor.BackColor = System.Drawing.SystemColors.Control;
+ this.levelScriptEditor.levelScriptEditorIsReady = false;
+ this.levelScriptEditor.Location = new System.Drawing.Point(6, 8);
+ this.levelScriptEditor.Name = "levelScriptEditor";
+ this.levelScriptEditor.Size = new System.Drawing.Size(408, 622);
+ this.levelScriptEditor.TabIndex = 0;
+ //
// MainProgram
//
this.AllowDrop = true;
@@ -11819,28 +11039,6 @@
((System.ComponentModel.ISupportInitialize)(this.rightClickPicture)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.wheelClickPicture)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.LeftClickPicture)).EndInit();
- this.scriptEditorTabPage.ResumeLayout(false);
- this.scriptEditorTabPage.PerformLayout();
- this.groupBox26.ResumeLayout(false);
- this.groupBox26.PerformLayout();
- this.groupBox24.ResumeLayout(false);
- this.groupBox24.PerformLayout();
- this.ScriptNavigatorTabControl.ResumeLayout(false);
- this.ScriptsNavTab.ResumeLayout(false);
- this.FunctionsNavTab.ResumeLayout(false);
- this.ActionsNavTab.ResumeLayout(false);
- this.groupBox8.ResumeLayout(false);
- this.groupBox8.PerformLayout();
- 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.textEditorTabPage.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
@@ -11936,6 +11134,8 @@
this.conditionalMusicGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.musicIDconditionalMusicUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.flagConditionalMusicUpDown)).EndInit();
+ this.tabPageScriptEditor.ResumeLayout(false);
+ this.tabPageLevelScriptEditor.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gameIcon)).EndInit();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
@@ -11949,7 +11149,6 @@
}
#endregion
- private System.Windows.Forms.TabControl mainTabControl;
private System.Windows.Forms.TabPage matrixEditorTabPage;
private System.Windows.Forms.PictureBox gameIcon;
private System.Windows.Forms.Label languageLabel;
@@ -12062,7 +11261,6 @@
private System.Windows.Forms.ComboBox selectEventComboBox;
private System.Windows.Forms.Label signScriptNumberLabel;
private System.Windows.Forms.NumericUpDown spawnableScriptUpDown;
- private System.Windows.Forms.TabPage scriptEditorTabPage;
private System.Windows.Forms.TabPage textEditorTabPage;
private System.Windows.Forms.ListBox warpsListBox;
private System.Windows.Forms.ListBox triggersListBox;
@@ -12107,17 +11305,6 @@
private System.Windows.Forms.NumericUpDown triggerScriptUpDown;
private System.Windows.Forms.Label label28;
private System.Windows.Forms.NumericUpDown triggerVariableWatchedUpDown;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.ComboBox selectScriptFileComboBox;
- private System.Windows.Forms.TabControl scriptEditorTabControl;
- private System.Windows.Forms.TabPage scriptsTabPage;
- private System.Windows.Forms.TabPage functionsTabPage;
- private System.Windows.Forms.TabPage actionsTabPage;
- private System.Windows.Forms.Button addScriptFileButton;
- private System.Windows.Forms.Button saveScriptFileButton;
- private System.Windows.Forms.Button removeScriptFileButton;
- private System.Windows.Forms.Button importScriptFileButton;
- private System.Windows.Forms.Button exportScriptFileButton;
private System.Windows.Forms.Button removeEventFileButton;
private System.Windows.Forms.Button addEventFileButton;
private System.Windows.Forms.Button removeMatrixButton;
@@ -12141,13 +11328,6 @@
private System.Windows.Forms.CheckBox caseSensitiveTextSearchCheckbox;
private System.Windows.Forms.ProgressBar textSearchProgressBar;
private System.Windows.Forms.Label label8;
- private System.Windows.Forms.ListBox searchInScriptsResultListBox;
- private System.Windows.Forms.GroupBox groupBox8;
- private System.Windows.Forms.Label label29;
- private System.Windows.Forms.Button searchInScriptsButton;
- private System.Windows.Forms.Label label30;
- private System.Windows.Forms.Label label31;
- private System.Windows.Forms.ProgressBar searchProgressBar;
private System.Windows.Forms.ToolStripButton wildEditorButton;
private System.Windows.Forms.TabPage nsbtxEditorTabPage;
private System.Windows.Forms.GroupBox areaDataGroupBox;
@@ -12185,7 +11365,6 @@
private System.Windows.Forms.Button addMapFileButton;
private System.Windows.Forms.Label replaceTextLabel;
private System.Windows.Forms.TextBox replaceMessageTextBox;
- private System.Windows.Forms.TextBox searchInScriptsTextBox;
private System.Windows.Forms.TabPage headerEditorTabPage;
private System.Windows.Forms.GroupBox groupBox10;
private System.Windows.Forms.Button openMessageFileButton;
@@ -12226,7 +11405,6 @@
private System.Windows.Forms.Label levelScriptLabel;
private System.Windows.Forms.Button openScriptButton;
private System.Windows.Forms.Label scriptLabel;
- private System.Windows.Forms.NumericUpDown scriptFileUpDown;
private System.Windows.Forms.ListBox headerListBox;
private System.Windows.Forms.Button saveHeaderButton;
private System.Windows.Forms.GroupBox groupBox4;
@@ -12384,7 +11562,6 @@
private System.Windows.Forms.Button resetColorTableButton;
private System.Windows.Forms.Button duplicateBuildingButton;
private System.Windows.Forms.Button replaceMapBinButton;
- private System.Windows.Forms.CheckBox scriptSearchCaseSensitiveCheckBox;
private System.Windows.Forms.GroupBox worldmapCoordsGroupBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.NumericUpDown worldmapYCoordUpDown;
@@ -12451,8 +11628,6 @@
private System.Windows.Forms.ToolStripButton nsbmdAddTexButton;
private System.Windows.Forms.ToolStripSeparator separator_afterMiscButtons;
private System.Windows.Forms.CheckBox embedTexturesInMapModelCheckBox;
- private System.Windows.Forms.CheckBox searchOnlyCurrentScriptCheckBox;
- private System.Windows.Forms.Button clearCurrentLevelScriptButton;
private System.Windows.Forms.GroupBox bldRoundGroupbox;
private System.Windows.Forms.RadioButton bldRoundDecmil;
private System.Windows.Forms.RadioButton bldRoundMil;
@@ -12478,15 +11653,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn ZDispGVCol;
private System.Windows.Forms.DataGridViewButtonColumn ExportBTN;
private System.Windows.Forms.DataGridViewButtonColumn ImportBTN;
- private System.Windows.Forms.GroupBox groupBox24;
- private System.Windows.Forms.TabControl ScriptNavigatorTabControl;
- private System.Windows.Forms.TabPage ScriptsNavTab;
- private System.Windows.Forms.ListBox scriptsNavListbox;
- private System.Windows.Forms.TabPage FunctionsNavTab;
- private System.Windows.Forms.ListBox functionsNavListbox;
- private System.Windows.Forms.TabPage ActionsNavTab;
- private System.Windows.Forms.ListBox actionsNavListbox;
- private System.Windows.Forms.CheckBox SyncNavigatorCB;
private System.Windows.Forms.Button removeLastHeaderBTN;
private System.Windows.Forms.Button addHeaderBTN;
private System.Windows.Forms.NumericUpDown cameraUpDown;
@@ -12675,34 +11841,7 @@
private System.Windows.Forms.NumericUpDown tbEditorTrClassFramePreviewUpDown;
private System.Windows.Forms.PictureBox tbEditorPokeminiPictureBox;
private System.Windows.Forms.ToolStripMenuItem openFolderToolStripMenuItem;
- private System.Windows.Forms.Panel PanelSearchScripts;
- private System.Windows.Forms.Button BtnNextSearchScript;
- private System.Windows.Forms.Button BtnPrevSearchScript;
- private System.Windows.Forms.Button BtnCloseSearchScript;
- private System.Windows.Forms.TextBox panelSearchScriptTextBox;
- private System.Windows.Forms.Panel scintillaScriptsPanel;
- private System.Windows.Forms.Panel PanelSearchFunctions;
- private System.Windows.Forms.Button BtnNextSearchFunc;
- private System.Windows.Forms.Button BtnPrevSearchFunc;
- private System.Windows.Forms.Button BtnCloseSearchFunc;
- private System.Windows.Forms.TextBox panelSearchFunctionTextBox;
- private System.Windows.Forms.Panel scintillaFunctionsPanel;
- private System.Windows.Forms.Panel PanelSearchActions;
- private System.Windows.Forms.Button BtnNextSearchActions;
- private System.Windows.Forms.Button BtnPrevSearchActions;
- private System.Windows.Forms.Button BtnCloseSearchActions;
- private System.Windows.Forms.TextBox panelSearchActionTextBox;
- private System.Windows.Forms.Panel scintillaActionsPanel;
- private System.Windows.Forms.CheckBox scriptEditorWhitespacesCheckbox;
- private System.Windows.Forms.CheckBox scriptEditorWordWrapCheckbox;
- private System.Windows.Forms.Button openSearchScriptEditorButton;
- private System.Windows.Forms.Button compressScriptTextButton;
- private System.Windows.Forms.Button expandScriptTextButton;
private System.Windows.Forms.Button itemsSelectorHelpBtn;
- private System.Windows.Forms.GroupBox groupBox26;
- private System.Windows.Forms.RadioButton scriptEditorNumberFormatNoPreference;
- private System.Windows.Forms.RadioButton scriptEditorNumberFormatDecimal;
- private System.Windows.Forms.RadioButton scriptEditorNumberFormatHex;
private System.Windows.Forms.Button deleteTrainerButton;
private System.Windows.Forms.Label label67;
private System.Windows.Forms.ToolStripMenuItem NarcUtilityToolStripMenuItem;
@@ -12747,7 +11886,6 @@
private System.Windows.Forms.Button locateCurrentNsbtx;
private System.Windows.Forms.Button locateCurrentAreaData;
private System.Windows.Forms.Button locateCurrentEvFile;
- private System.Windows.Forms.Button locateCurrentScriptFile;
private System.Windows.Forms.Button locateCurrentTextArchive;
private System.Windows.Forms.GroupBox groupBox31;
private System.Windows.Forms.Label label75;
diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs
index b1b7abc..dd4434b 100644
--- a/DS_Map/Main Window.cs
+++ b/DS_Map/Main Window.cs
@@ -25,11 +25,15 @@ using static DSPRE.ROMFiles.Event;
using NSMBe4.NSBMD;
using static DSPRE.ROMFiles.SpeciesFile;
using System.Reflection;
+using System.ComponentModel;
+using DSPRE.Editors;
namespace DSPRE {
public partial class MainProgram : Form {
public MainProgram() {
InitializeComponent();
+ EditorPanels.Initialize(this);
+ Helpers.Initialize(this);
SetMenuLayout(Properties.Settings.Default.menuLayout); //Read user settings for menu layout
Text = "DS Pokémon Rom Editor Reloaded " + GetDSPREVersion() + " (Nømura, AdAstra/LD3005, Mixone)";
}
@@ -216,14 +220,14 @@ namespace DSPRE {
DSUtils.TryUnpackNarcs(new List { DirNames.scripts }); //12 = scripts Narc Dir
- selectScriptFileComboBox.Items.Clear();
+ EditorPanels.scriptEditor.selectScriptFileComboBox.Items.Clear();
int scriptCount = Directory.GetFiles(RomInfo.gameDirs[DirNames.scripts].unpackedDir).Length;
for (int i = 0; i < scriptCount; i++) {
- selectScriptFileComboBox.Items.Add("Script File " + i);
+ EditorPanels.scriptEditor.selectScriptFileComboBox.Items.Add("Script File " + i);
}
- UpdateScriptNumberCheckBox((NumberStyles)Properties.Settings.Default.scriptEditorFormatPreference);
- selectScriptFileComboBox.SelectedIndex = 0;
+ EditorPanels.scriptEditor.UpdateScriptNumberCheckBox((NumberStyles)Properties.Settings.Default.scriptEditorFormatPreference);
+ EditorPanels.scriptEditor.selectScriptFileComboBox.SelectedIndex = 0;
Helpers.statusLabelMessage();
}
private void SetupTextEditor() {
@@ -531,6 +535,7 @@ namespace DSPRE {
SetupROMLanguage(openRom.FileName);
/* Set ROM gameVersion and language */
romInfo = new RomInfo(gameCode, openRom.FileName, useSuffix: true);
+ Helpers.romInfo = new RomInfo(gameCode, openRom.FileName, useSuffix: true);
if (string.IsNullOrWhiteSpace(RomInfo.romID) || string.IsNullOrWhiteSpace(RomInfo.fileName)) {
return;
@@ -584,7 +589,7 @@ namespace DSPRE {
Update();
for (int i = 0; i < 128; i++) {
if (DSUtils.OverlayIsCompressed(i)) {
- DSUtils.DecompressOverlay(i);
+ //DSUtils.DecompressOverlay(i);
}
}
ReadROMInitData();
@@ -786,7 +791,6 @@ namespace DSPRE {
SetupMapEditor();
SetupNSBTXEditor();
SetupEventEditor();
- SetupScriptEditorTextAreas();
SetupScriptEditor();
SetupTextEditor();
SetupTrainerEditor();
@@ -852,12 +856,6 @@ namespace DSPRE {
SetupEventEditor();
eventEditorIsReady = true;
}
- } else if (mainTabControl.SelectedTab == scriptEditorTabPage) {
- if (!scriptEditorIsReady) {
- SetupScriptEditorTextAreas();
- SetupScriptEditor();
- scriptEditorIsReady = true;
- }
} else if (mainTabControl.SelectedTab == textEditorTabPage) {
if (!textEditorIsReady) {
SetupTextEditor();
@@ -883,6 +881,14 @@ namespace DSPRE {
}
}
+ private void tabPageScriptEditor_Enter(object sender, EventArgs e) {
+ scriptEditor.SetupScriptEditor(this);
+ }
+
+ private void tabPageLevelScriptEditor_Enter(object sender, EventArgs e) {
+ levelScriptEditor.SetUpLevelScriptEditor(this);
+ }
+
private void spawnEditorToolStripButton_Click(object sender, EventArgs e) {
if (!matrixEditorIsReady) {
SetupMatrixEditor();
@@ -1375,6 +1381,15 @@ namespace DSPRE {
}
currentHeader.matrixID = (ushort)matrixUpDown.Value;
}
+
+ private void openScriptButton_Click(object sender, EventArgs e) {
+ EditorPanels.scriptEditor.OpenScriptEditor(this, (int)scriptFileUpDown.Value);
+ }
+
+ private void openLevelScriptButton_Click(object sender, EventArgs e) {
+ EditorPanels.levelScriptEditor.OpenLevelScriptEditor(this, (int)levelScriptUpDown.Value);
+ }
+
private void musicDayComboBox_SelectedIndexChanged(object sender, EventArgs e) {
if (Helpers.HandlersDisabled) {
return;
@@ -5367,7 +5382,7 @@ namespace DSPRE {
} else {
ScriptFile itemScript = new ScriptFile(RomInfo.itemScriptFileNumber);
owItemComboBox.Items.Clear();
- foreach (CommandContainer cont in itemScript.allScripts) {
+ foreach (ScriptCommandContainer cont in itemScript.allScripts) {
if (cont.commands.Count > 4) {
continue;
}
@@ -6706,967 +6721,6 @@ namespace DSPRE {
#endregion
#endregion
- #region Script Editor
- #region Variables
- //private static Mutex tooltipMutex = new Mutex();
- //private ScriptTooltip customTooltip;
-
- private bool scriptsDirty = false;
- private bool functionsDirty = false;
- private bool actionsDirty = false;
-
- private string cmdKeyWords = "";
- private string secondaryKeyWords = "";
- private ScriptFile currentScriptFile;
- #endregion
- #region Helper Methods
- private ScintillaNET.Scintilla ScriptTextArea;
- private ScintillaNET.Scintilla FunctionTextArea;
- private ScintillaNET.Scintilla ActionTextArea;
-
- private SearchManager scriptSearchManager;
- private SearchManager functionSearchManager;
- private SearchManager actionSearchManager;
-
- private Scintilla currentScintillaEditor;
- private SearchManager currentSearchManager;
- 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;
-
- Helpers.EnableHandlers();
- }
- 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;
- }
- }
- private void SetupScriptEditorTextAreas() {
- //PREPARE SCRIPT EDITOR KEYWORDS
- cmdKeyWords = String.Join(" ", ScriptCommandNamesDict.Values) +
- " " + String.Join(" ", ScriptDatabase.movementsDictIDName.Values);
- cmdKeyWords += " " + cmdKeyWords.ToUpper() + " " + cmdKeyWords.ToLower();
-
- 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() +
- " " + EventType.Overworld +
- " " + Overworld.MovementCodeKW;
- secondaryKeyWords += " " + secondaryKeyWords.ToUpper() + " " + secondaryKeyWords.ToLower();
-
-
- // CREATE CONTROLS
- ScriptTextArea = new ScintillaNET.Scintilla();
- scriptSearchManager = new SearchManager(this, ScriptTextArea, panelSearchScriptTextBox, PanelSearchScripts);
- scintillaScriptsPanel.Controls.Clear();
- scintillaScriptsPanel.Controls.Add(ScriptTextArea);
-
- FunctionTextArea = new ScintillaNET.Scintilla();
- functionSearchManager = new SearchManager(this, FunctionTextArea, panelSearchFunctionTextBox, PanelSearchFunctions);
- scintillaFunctionsPanel.Controls.Clear();
- scintillaFunctionsPanel.Controls.Add(FunctionTextArea);
-
- ActionTextArea = new ScintillaNET.Scintilla();
- actionSearchManager = new SearchManager(this, ActionTextArea, panelSearchActionTextBox, PanelSearchActions);
- scintillaActionsPanel.Controls.Clear();
- scintillaActionsPanel.Controls.Add(ActionTextArea);
-
- currentScintillaEditor = ScriptTextArea;
- currentSearchManager = scriptSearchManager;
-
- // BASIC CONFIG
- ScriptTextArea.TextChanged += (this.OnTextChangedScript);
- FunctionTextArea.TextChanged += (this.OnTextChangedFunction);
- ActionTextArea.TextChanged += (this.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
- /*
- ScriptTextArea.MouseDwellTime = 300;
- ScriptTextArea.DwellEnd += TextArea_DwellEnd;
- ScriptTextArea.DwellStart += TextArea_DwellStart;
-
- FunctionTextArea.MouseDwellTime = 300;
- FunctionTextArea.DwellEnd += TextArea_DwellEnd;
- FunctionTextArea.DwellStart += TextArea_DwellStart;
- */
- }
-
- /*
- private void TextArea_DwellStart(object sender, DwellEventArgs e) {
- TextArea_DwellEnd(sender, e);
- Scintilla ctr = sender as Scintilla;
- string hoveredWord = ctr.GetWordFromPosition(e.Position);
- ushort cmdID;
-
- string commandName = "";
- if (RomInfo.ScriptCommandNamesReverseDict.TryGetValue(hoveredWord, out cmdID)) {
- commandName = hoveredWord;
- } else {
- if (!ushort.TryParse(hoveredWord, NumberStyles.HexNumber, new CultureInfo("en-US"), out cmdID)) {
- return;
- }
- }
- string tip = "";
-
- tooltipMutex.WaitOne();
- tip += cmdID.ToString("X4") + ": " + commandName + "(";
- byte[] parameters = ScriptCommandParametersDict[cmdID];
- for (int i = 0; i < parameters.Length; i++) {
- if (parameters[i] == 0) {
- break;
- } else if (parameters[i] == 1) {
- tip += "byte";
- } else {
- tip += "uint" + 8 * parameters[i];
- }
- if (i != parameters.Length - 1) {
- tip += ", ";
- }
- }
- tip += ")";
- tip += Environment.NewLine + "Command descriptions aren't available yet.";
-
- Point globalCtrCoords = ctr.PointToScreen(ctr.Location);
- Point incrementedCoords = new Point(globalCtrCoords.X + e.X, globalCtrCoords.Y + e.Y);
-
- customTooltip = new ScriptTooltip(cmdKeyWords, tip);
- customTooltip.Visible = false;
- customTooltip.Show();
-
- int newy = incrementedCoords.Y - customTooltip.Size.Height - 5;
- customTooltip.Location = new Point(incrementedCoords.X, newy);
- customTooltip.BringToFront();
- customTooltip.Visible = true;
- Thread t = new Thread(() => {
- customTooltip.Invoke((MethodInvoker)delegate {
- customTooltip.ctrl.Visible = true;
- customTooltip.FadeIn(16, 9);
- customTooltip.WriteText(4);
- });
- });
- t.Start();
- tooltipMutex.ReleaseMutex();
- }
- private void TextArea_DwellEnd(object sender, DwellEventArgs e) {
- if (customTooltip != null && !customTooltip.IsDisposed) {
- tooltipMutex.WaitOne();
- Thread t = new Thread(() => {
- customTooltip.Invoke((MethodInvoker)delegate {
- customTooltip.FadeOut(16, 9);
- customTooltip.Close();
- customTooltip.Dispose();
- });
-
- });
- t.Start();
- tooltipMutex.ReleaseMutex();
- }
- }
- */
-
- private void InitNumberMargin(Scintilla textArea, EventHandler textArea_MarginClick) {
- textArea.Styles[Style.LineNumber].BackColor = BACK_COLOR;
- textArea.Styles[Style.LineNumber].ForeColor = FORE_COLOR;
- textArea.Styles[Style.IndentGuide].ForeColor = FORE_COLOR;
- textArea.Styles[Style.IndentGuide].BackColor = BACK_COLOR;
-
- var nums = textArea.Margins[NUMBER_MARGIN];
- nums.Type = MarginType.Number;
- nums.Sensitive = true;
- nums.Mask = 0;
-
- textArea.MarginClick += textArea_MarginClick;
- }
-
- private void InitHotkeys(Scintilla scintillaTb, SearchManager sm) {
- // register the hotkeys with the form
- HotKeyManager.AddHotKey(scintillaTb, sm.OpenSearch, Keys.F, true);
- HotKeyManager.AddHotKey(scintillaTb, () => Uppercase(scintillaTb), Keys.U, true);
- HotKeyManager.AddHotKey(scintillaTb, () => Lowercase(scintillaTb), Keys.L, true);
- HotKeyManager.AddHotKey(scintillaTb, () => ZoomIn(scintillaTb), Keys.Oemplus, true);
- HotKeyManager.AddHotKey(scintillaTb, () => ZoomOut(scintillaTb), Keys.OemMinus, true);
- HotKeyManager.AddHotKey(scintillaTb, () => ZoomDefault(scintillaTb), Keys.D0, true);
- HotKeyManager.AddHotKey(scintillaTb, sm.CloseSearch, Keys.Escape);
-
- // remove conflicting hotkeys from scintilla
- scintillaTb.ClearCmdKey(Keys.Control | Keys.F);
- scintillaTb.ClearCmdKey(Keys.Control | Keys.R);
- scintillaTb.ClearCmdKey(Keys.Control | Keys.H);
- scintillaTb.ClearCmdKey(Keys.Control | Keys.L);
- scintillaTb.ClearCmdKey(Keys.Control | Keys.U);
- }
-
- private void InitSyntaxColoring(Scintilla textArea) {
-
- // Configure the default style
- textArea.StyleResetDefault();
- textArea.Styles[Style.Default].Font = "Consolas";
- textArea.Styles[Style.Default].Size = 12;
- textArea.Styles[Style.Default].BackColor = Color.FromArgb(0x212121);
- textArea.Styles[Style.Default].ForeColor = Color.FromArgb(0xFFFFFF);
- textArea.StyleClearAll();
-
- // Configure the lexer styles
- textArea.Styles[Style.Python.Identifier].ForeColor = Color.FromArgb(0xD0DAE2);
- textArea.Styles[Style.Python.CommentLine].ForeColor = Color.FromArgb(0x40BF57);
- textArea.Styles[Style.Python.Number].ForeColor = Color.FromArgb(0xFFFF00);
- textArea.Styles[Style.Python.String].ForeColor = Color.FromArgb(0xFF00FF);
- textArea.Styles[Style.Python.Character].ForeColor = Color.FromArgb(0xE95454);
- textArea.Styles[Style.Python.Operator].ForeColor = Color.FromArgb(0xFFFF00);
- textArea.Styles[Style.Python.Word].ForeColor = Color.FromArgb(0x48A8EE);
- textArea.Styles[Style.Python.Word2].ForeColor = Color.FromArgb(0xF98906);
-
- textArea.Lexer = Lexer.Python;
-
- textArea.SetKeywords(0, cmdKeyWords);
- textArea.SetKeywords(1, secondaryKeyWords);
- }
- private void openSearchScriptEditorButton_Click(object sender, EventArgs e) {
- currentSearchManager.OpenSearch();
- }
-
- 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" + "*";
- }
-
-
- #region Numbers, Bookmarks, Code Folding
-
- ///
- /// the background color of the text area
- ///
- private readonly Color BACK_COLOR = Color.FromArgb(0x2A211C);
-
- ///
- /// default text color of the text area
- ///
- private readonly Color FORE_COLOR = Color.FromArgb(0xB7B7B7);
-
- ///
- /// change this to whatever margin you want the line numbers to show in
- ///
- private const int NUMBER_MARGIN = 1;
-
- ///
- /// change this to whatever margin you want the bookmarks/breakpoints to show in
- ///
- private const int BOOKMARK_MARGIN = 2;
- private const int BOOKMARK_MARKER = 2;
-
- ///
- /// change this to whatever margin you want the code folding tree (+/-) to show in
- ///
- private const int FOLDING_MARGIN = 3;
-
- ///
- /// set this true to show circular buttons for code folding (the [+] and [-] buttons on the margin)
- ///
- private const bool CODEFOLDING_CIRCULAR = true;
-
-
- private void InitialViewConfig(Scintilla textArea) {
- textArea.Dock = DockStyle.Fill;
- textArea.WrapMode = ScintillaNET.WrapMode.Word;
- textArea.IndentationGuides = IndentView.LookBoth;
- textArea.CaretPeriod = 500;
- textArea.CaretForeColor = Color.White;
- textArea.SetSelectionBackColor(true, Color.FromArgb(0x114D9C));
- textArea.WrapIndentMode = WrapIndentMode.Same;
- }
-
- private void InitBookmarkMargin(Scintilla textArea) {
-
- var margin = textArea.Margins[BOOKMARK_MARGIN];
- margin.Width = 20;
- margin.Sensitive = true;
- margin.Type = MarginType.Symbol;
- margin.Mask = (1 << BOOKMARK_MARKER);
-
- var marker = textArea.Markers[BOOKMARK_MARKER];
- marker.Symbol = MarkerSymbol.Circle;
- marker.SetBackColor(Color.FromArgb(0xFF003B));
- marker.SetForeColor(Color.FromArgb(0x000000));
- marker.SetAlpha(100);
- }
-
- private void InitCodeFolding(Scintilla textArea) {
- textArea.SetFoldMarginColor(true, BACK_COLOR);
- textArea.SetFoldMarginHighlightColor(true, BACK_COLOR);
-
- // Enable code folding
- textArea.SetProperty("fold", "1");
- textArea.SetProperty("fold.compact", "1");
-
- // Configure a margin to display folding symbols
- textArea.Margins[FOLDING_MARGIN].Type = MarginType.Symbol;
- textArea.Margins[FOLDING_MARGIN].Mask = Marker.MaskFolders;
- textArea.Margins[FOLDING_MARGIN].Sensitive = true;
- textArea.Margins[FOLDING_MARGIN].Width = 20;
-
- // Set colors for all folding markers
- for (int i = 25; i <= 31; i++) {
- textArea.Markers[i].SetForeColor(BACK_COLOR); // styles for [+] and [-]
- textArea.Markers[i].SetBackColor(FORE_COLOR); // styles for [+] and [-]
- }
-
- // Configure folding markers with respective symbols
- textArea.Markers[Marker.Folder].Symbol = CODEFOLDING_CIRCULAR ? MarkerSymbol.CirclePlus : MarkerSymbol.BoxPlus;
- textArea.Markers[Marker.FolderOpen].Symbol = CODEFOLDING_CIRCULAR ? MarkerSymbol.CircleMinus : MarkerSymbol.BoxMinus;
- textArea.Markers[Marker.FolderEnd].Symbol = CODEFOLDING_CIRCULAR ? MarkerSymbol.CirclePlusConnected : MarkerSymbol.BoxPlusConnected;
- textArea.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner;
- textArea.Markers[Marker.FolderOpenMid].Symbol = CODEFOLDING_CIRCULAR ? MarkerSymbol.CircleMinusConnected : MarkerSymbol.BoxMinusConnected;
- textArea.Markers[Marker.FolderSub].Symbol = MarkerSymbol.VLine;
- textArea.Markers[Marker.FolderTail].Symbol = MarkerSymbol.LCorner;
-
- // Enable automatic folding
- textArea.AutomaticFold = (AutomaticFold.Show | AutomaticFold.Click | AutomaticFold.Change);
- }
-
- 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?
- const uint mask = (1 << BOOKMARK_MARKER);
- var line = textArea.Lines[textArea.LineFromPosition(e.Position)];
- if ((line.MarkerGet() & mask) > 0) {
- // Remove existing bookmark
- line.MarkerDelete(BOOKMARK_MARKER);
- } else {
- // Add bookmark
- line.MarkerAdd(BOOKMARK_MARKER);
- }
- }
- }
-
- #endregion
-
- #region Main Menu Commands
-
- private void scriptEditorWordWrapCheckbox_CheckedChanged(object sender, EventArgs e) {
- ScriptTextArea.WrapMode = scriptEditorWordWrapCheckbox.Checked ? ScintillaNET.WrapMode.Word : ScintillaNET.WrapMode.None;
- FunctionTextArea.WrapMode = scriptEditorWordWrapCheckbox.Checked ? ScintillaNET.WrapMode.Word : ScintillaNET.WrapMode.None;
- ActionTextArea.WrapMode = scriptEditorWordWrapCheckbox.Checked ? ScintillaNET.WrapMode.Word : ScintillaNET.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 scriptEditorZoomInButton_Click(object sender, EventArgs e) {
- ZoomIn(currentScintillaEditor);
- }
-
- private void scriptEditorZoomOutButton_Click(object sender, EventArgs e) {
- ZoomOut(currentScintillaEditor);
- }
-
- private void scriptEditorZoomResetButton_Click(object sender, EventArgs e) {
- ZoomDefault(currentScintillaEditor);
- }
-
- private void ScriptEditorCollapseButton_Click(object sender, EventArgs e) {
- currentScintillaEditor.FoldAll(FoldAction.Contract);
- }
-
- private void ScriptEditorExpandButton_Click(object sender, EventArgs e) {
- currentScintillaEditor.FoldAll(FoldAction.Expand);
- }
-
-
- #endregion
-
- #region Uppercase / Lowercase
-
- private void Lowercase(Scintilla textArea) {
-
- // save the selection
- int start = textArea.SelectionStart;
- int end = textArea.SelectionEnd;
-
- // modify the selected text
- textArea.ReplaceSelection(textArea.GetTextRange(start, end - start).ToLower());
-
- // preserve the original selection
- textArea.SetSelection(start, end);
- }
-
- private void Uppercase(Scintilla textArea) {
- // save the selection
- int start = textArea.SelectionStart;
- int end = textArea.SelectionEnd;
-
- // modify the selected text
- textArea.ReplaceSelection(textArea.GetTextRange(start, end - start).ToUpper());
-
- // preserve the original selection
- textArea.SetSelection(start, end);
- }
-
- #endregion
-
- #region Indent / Outdent
-
- private void GenerateKeystrokes(string keys, Scintilla textArea) {
- //Example
- //GenerateKeystrokes("+{TAB}");
- HotKeyManager.Enable = false;
- textArea.Focus();
- SendKeys.Send(keys);
- HotKeyManager.Enable = true;
- }
-
- #endregion
-
- #region Zoom
-
- private void ZoomIn(Scintilla textArea) {
- textArea.ZoomIn();
- }
-
- private void ZoomOut(Scintilla textArea) {
- textArea.ZoomOut();
- }
-
- private void ZoomDefault(Scintilla textArea) {
- textArea.Zoom = 0;
- }
- #endregion
-
- #region Quick Search Bar
- private void BtnPrevSearchScript_Click(object sender, EventArgs e) {
- scriptSearchManager.Find(false, false);
- }
-
- private void BtnNextSearchScript_Click(object sender, EventArgs e) {
- scriptSearchManager.Find(true, false);
- }
-
- private void BtnPrevSearchFunc_Click(object sender, EventArgs e) {
- functionSearchManager.Find(false, false);
- }
-
- private void BtnNextSearchFunc_Click(object sender, EventArgs e) {
- functionSearchManager.Find(true, false);
- }
-
- private void BtnPrevSearchActions_Click(object sender, EventArgs e) {
- actionSearchManager.Find(false, false);
- }
-
- private void BtnNextSearchActions_Click(object sender, EventArgs e) {
- actionSearchManager.Find(true, false);
- }
-
- private void BtnCloseSearchScript_Click(object sender, EventArgs e) {
- scriptSearchManager.CloseSearch();
- }
-
- private void BtnCloseSearchFunc_Click(object sender, EventArgs e) {
- functionSearchManager.CloseSearch();
- }
-
- private void BtnCloseSearchActions_Click(object sender, EventArgs e) {
- actionSearchManager.CloseSearch();
- }
-
- private void scriptTxtSearch_KeyDown(object sender, KeyEventArgs e) {
- TxtSearchKeyDown(scriptSearchManager, e);
- }
- private void functionTxtSearch_KeyDown(object sender, KeyEventArgs e) {
- TxtSearchKeyDown(functionSearchManager, e);
- }
- private void actiontTxtSearch_KeyDown(object sender, KeyEventArgs e) {
- TxtSearchKeyDown(actionSearchManager, e);
- }
-
- private void TxtSearchKeyDown(SearchManager sm, KeyEventArgs e) {
- if (HotKeyManager.IsHotkey(e, Keys.Enter)) {
- sm.Find(true, false);
- }
- if (HotKeyManager.IsHotkey(e, Keys.Enter, true) || HotKeyManager.IsHotkey(e, Keys.Enter, false, true)) {
- sm.Find(false, false);
- }
- }
-
- private void panelSearchScriptTextBox_TextChanged(object sender, EventArgs e) {
- scriptSearchManager.Find(true, true);
- }
- private void panelSearchFunctionTextBox_TextChanged(object sender, EventArgs e) {
- functionSearchManager.Find(true, true);
- }
- private void panelSearchActionTextBox_TextChanged(object sender, EventArgs e) {
- actionSearchManager.Find(true, true);
- }
-
- #endregion
- private void addScriptFileButton_Click(object sender, EventArgs e) {
- /* Add new event file to event folder */
- string scriptFilePath = RomInfo.gameDirs[DirNames.scripts].unpackedDir + "\\" + selectScriptFileComboBox.Items.Count.ToString("D4");
- File.WriteAllBytes(scriptFilePath, new ScriptFile(0).ToByteArray());
-
- /* Update ComboBox and select new file */
- selectScriptFileComboBox.Items.Add("Script File " + selectScriptFileComboBox.Items.Count);
- selectScriptFileComboBox.SelectedIndex = selectScriptFileComboBox.Items.Count - 1;
- }
- private void exportScriptFileButton_Click(object sender, EventArgs e) {
- string suggestion = "Script File ";
- if (currentScriptFile.isLevelScript) {
- suggestion = "Level " + suggestion;
- }
- currentScriptFile.SaveToFileExplorePath(suggestion + selectScriptFileComboBox.SelectedIndex, blindmode: true);
- }
- private void saveScriptFileButton_Click(object sender, EventArgs e) {
- /* Create new ScriptFile object */
- int idToAssign = selectScriptFileComboBox.SelectedIndex;
-
- ScriptFile userEdited = new ScriptFile(
- scriptLines: ScriptTextArea.Lines.ToStringsList(trim: true),
- functionLines: FunctionTextArea.Lines.ToStringsList(trim: true),
- actionLines: ActionTextArea.Lines.ToStringsList(trim: true),
- selectScriptFileComboBox.SelectedIndex
- );
-
- /* Write new scripts to file */
- if (userEdited.fileID == null) {
- MessageBox.Show("This " + typeof(ScriptFile).Name + " couldn't be saved, due to a processing error.", "Can't save", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- } else if (userEdited.fileID == int.MaxValue) {
- MessageBox.Show("This " + typeof(ScriptFile).Name + " is couldn't be saved since it's empty.", "Can't save", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- } else { //check if ScriptFile instance was created succesfully
- if (userEdited.SaveToFileDefaultDir(selectScriptFileComboBox.SelectedIndex)) {
- currentScriptFile = userEdited;
- ScriptEditorSetClean();
- }
- }
- }
- private void clearCurrentLevelScriptButton_Click(object sender, EventArgs e) {
- string path = RomInfo.gameDirs[DirNames.scripts].unpackedDir + "\\" + selectScriptFileComboBox.SelectedIndex.ToString("D4");
- File.WriteAllBytes(path, new byte[4]);
- MessageBox.Show("Level script correctly cleared.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- private void importScriptFileButton_Click(object sender, EventArgs e) {
- /* Prompt user to select .scr or .bin file */
- OpenFileDialog of = new OpenFileDialog {
- Filter = "Script File (*.scr, *.bin)|*.scr;*.bin"
- };
- if (of.ShowDialog(this) != DialogResult.OK) {
- return;
- }
-
- /* Update scriptFile object in memory */
- string path = RomInfo.gameDirs[DirNames.scripts].unpackedDir + "\\" + selectScriptFileComboBox.SelectedIndex.ToString("D4");
- File.Copy(of.FileName, path, true);
-
- /* Refresh controls */
- selectScriptFileComboBox_SelectedIndexChanged(null, null);
-
- /* Display success message */
- MessageBox.Show("Scripts imported successfully!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- private void openScriptButton_Click(object sender, EventArgs e) {
- if (!scriptEditorIsReady) {
- SetupScriptEditorTextAreas();
- SetupScriptEditor();
- scriptEditorIsReady = true;
- }
-
- scriptEditorTabControl.SelectedIndex = 0;
- selectScriptFileComboBox.SelectedIndex = (int)scriptFileUpDown.Value;
- mainTabControl.SelectedTab = scriptEditorTabPage;
- }
- private void openLevelScriptButton_Click(object sender, EventArgs e) {
- if (!scriptEditorIsReady) {
- SetupScriptEditorTextAreas();
- SetupScriptEditor();
- scriptEditorIsReady = true;
- }
-
- selectScriptFileComboBox.SelectedIndex = (int)levelScriptUpDown.Value;
- mainTabControl.SelectedTab = scriptEditorTabPage;
- }
- private void removeScriptFileButton_Click(object sender, EventArgs e) {
- DialogResult d = MessageBox.Show("Are you sure you want to delete the last Script File?", "Confirm deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
- if (d.Equals(DialogResult.Yes)) {
- /* Delete script file */
- File.Delete(RomInfo.gameDirs[DirNames.scripts].unpackedDir + "\\" + (selectScriptFileComboBox.Items.Count - 1).ToString("D4"));
-
- /* Check if currently selected file is the last one, and in that case select the one before it */
- int lastIndex = selectScriptFileComboBox.Items.Count - 1;
- if (selectScriptFileComboBox.SelectedIndex == lastIndex) {
- selectScriptFileComboBox.SelectedIndex--;
- }
-
- /* Remove item from ComboBox */
- selectScriptFileComboBox.Items.RemoveAt(lastIndex);
- }
- }
- private void searchInScriptsButton_Click(object sender, EventArgs e) {
- if (searchInScriptsTextBox.Text == "") {
- return;
- }
-
- int firstArchive;
- int lastArchive;
-
- if (searchOnlyCurrentScriptCheckBox.Checked) {
- firstArchive = selectScriptFileComboBox.SelectedIndex;
- lastArchive = firstArchive + 1;
- } else {
- firstArchive = 0;
- lastArchive = romInfo.GetScriptCount();
- }
-
- searchInScriptsResultListBox.Items.Clear();
- string searchString = searchInScriptsTextBox.Text;
- searchProgressBar.Maximum = selectScriptFileComboBox.Items.Count;
-
- List results = new List();
-
- string scriptKw = ScriptFile.containerTypes.Script.ToString();
- string functionKw = ScriptFile.containerTypes.Function.ToString();
-
- for (int i = firstArchive; i < lastArchive; i++) {
- try {
- Console.WriteLine("Attempting to load script " + i);
- ScriptFile file = new ScriptFile(i, readActions: false);
-
- if (scriptSearchCaseSensitiveCheckBox.Checked) {
- results.AddRange(SearchInScripts(i, file.allScripts, scriptKw, (string s) => s.Contains(searchString)));
- results.AddRange(SearchInScripts(i, file.allFunctions, functionKw, (string s) => s.Contains(searchString)));
- } else {
- results.AddRange(SearchInScripts(i, file.allScripts, scriptKw, (string s) => s.IndexOf(searchString, StringComparison.InvariantCultureIgnoreCase) >= 0));
- results.AddRange(SearchInScripts(i, file.allFunctions, functionKw, (string s) => s.IndexOf(searchString, StringComparison.InvariantCultureIgnoreCase) >= 0));
- }
- } catch { }
- searchProgressBar.Value = i;
- }
-
- searchProgressBar.Value = 0;
- searchInScriptsResultListBox.Items.AddRange(results.ToArray());
- }
- private List SearchInScripts(int fileID, List cmdList, string entryType, Func criteria) {
- List results = new List();
-
- for (int j = 0; j < cmdList.Count; j++) {
- if (cmdList[j].commands is null) {
- continue;
- }
- foreach (ScriptCommand cur in cmdList[j].commands) {
- if (criteria(cur.name)) {
- results.Add($"File {fileID} - {entryType} {j + 1}: {cur.name}{Environment.NewLine}");
- }
- }
- }
- return results;
- }
- private void searchInScripts_GoToEntryResult(object sender, MouseEventArgs e) {
- if (searchInScriptsResultListBox.SelectedIndex < 0) {
- return;
- }
-
- string[] split = searchInScriptsResultListBox.SelectedItem.ToString().Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- selectScriptFileComboBox.SelectedIndex = int.Parse(split[1]);
- string cmdNameAndParams = String.Join(" ", split.Skip(5).Take(split.Length - 5));
-
- if (split[3].StartsWith(ScriptFile.containerTypes.Script.ToString())) {
- if (scriptEditorTabControl.SelectedTab != scriptsTabPage) {
- scriptEditorTabControl.SelectedTab = scriptsTabPage;
- }
- scriptSearchManager.Find(true, false, ScriptFile.containerTypes.Script.ToString() + " " + split[4].Replace(":", ""));
- scriptSearchManager.Find(true, false, cmdNameAndParams);
- } else if (split[3].StartsWith(ScriptFile.containerTypes.Function.ToString())) {
- if (scriptEditorTabControl.SelectedTab != functionsTabPage) {
- scriptEditorTabControl.SelectedTab = functionsTabPage;
- }
- functionSearchManager.Find(true, false, ScriptFile.containerTypes.Function.ToString() + " " + split[4].Replace(":", ""));
- functionSearchManager.Find(true, false, cmdNameAndParams);
- } else if (split[3].StartsWith(ScriptFile.containerTypes.Action.ToString())) {
- if (scriptEditorTabControl.SelectedTab != actionsTabPage) {
- scriptEditorTabControl.SelectedTab = actionsTabPage;
- }
- actionSearchManager.Find(true, false, ScriptFile.containerTypes.Action.ToString() + " " + split[4].Replace(":", ""));
- actionSearchManager.Find(true, false, cmdNameAndParams);
- }
- }
- private void searchInScriptsResultListBox_KeyDown(object sender, KeyEventArgs e) {
- if (e.KeyCode == Keys.Enter) {
- searchInScripts_GoToEntryResult(null, null);
- }
- }
- private void searchInScriptsTextBox_KeyDown(object sender, KeyEventArgs e) {
- if (e.KeyCode == Keys.Enter) {
- searchInScriptsButton_Click(null, null);
- }
- }
- private void selectScriptFileComboBox_SelectedIndexChanged(object sender, EventArgs e) {
- ReloadScript();
- }
-
- private bool ReloadScript() {
- Console.WriteLine("Script Reload has been requested");
- /* clear controls */
- if (Helpers.HandlersDisabled || selectScriptFileComboBox.SelectedIndex < 0) {
- return false;
- }
-
- 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.SelectedIndex = (int)currentScriptFile.fileID;
- Helpers.EnableHandlers();
- return false;
- }
- }
- currentScriptFile = new ScriptFile(selectScriptFileComboBox.SelectedIndex); // Load script file
-
- ScriptTextArea.ClearAll();
- FunctionTextArea.ClearAll();
- ActionTextArea.ClearAll();
-
- scriptsNavListbox.Items.Clear();
- functionsNavListbox.Items.Clear();
- actionsNavListbox.Items.Clear();
-
- if (currentScriptFile.isLevelScript) {
- ScriptTextArea.Text += "LevelScript files are currently not supported.\nYou can use AdAstra's Level Scripts Editor.";
- addScriptFileButton.Visible = false;
- removeScriptFileButton.Visible = false;
-
- clearCurrentLevelScriptButton.Visible = true;
- } else {
- Helpers.DisableHandlers();
- addScriptFileButton.Visible = true;
- removeScriptFileButton.Visible = true;
-
- clearCurrentLevelScriptButton.Visible = false;
-
- string buffer = "";
-
- /* Add scripts */
- for (int i = 0; i < currentScriptFile.allScripts.Count; i++) {
- CommandContainer currentScript = currentScriptFile.allScripts[i];
-
- /* Write header */
- string header = ScriptFile.containerTypes.Script.ToString() + " " + (i + 1);
- buffer += header + ':' + Environment.NewLine;
- scriptsNavListbox.Items.Add(header);
-
- /* If current script is identical to another, print UseScript instead of commands */
- if (currentScript.usedScript < 0) {
- for (int j = 0; j < currentScript.commands.Count; j++) {
- if (!ScriptDatabase.endCodes.Contains(currentScript.commands[j].id)) {
- buffer += '\t';
- }
- buffer += currentScript.commands[j].name + Environment.NewLine;
- }
- } else {
- buffer += '\t' + "UseScript_#" + currentScript.usedScript + Environment.NewLine;
- }
-
- ScriptTextArea.AppendText(buffer + Environment.NewLine);
- buffer = "";
- }
-
-
- /* Add functions */
- for (int i = 0; i < currentScriptFile.allFunctions.Count; i++) {
- CommandContainer currentFunction = currentScriptFile.allFunctions[i];
-
- /* Write Heaader */
- string header = ScriptFile.containerTypes.Function.ToString() + " " + (i + 1);
- buffer += header + ':' + Environment.NewLine;
- functionsNavListbox.Items.Add(header);
-
- /* If current function is identical to a script, print UseScript instead of commands */
- if (currentFunction.usedScript < 0) {
- for (int j = 0; j < currentFunction.commands.Count; j++) {
- if (!ScriptDatabase.endCodes.Contains(currentFunction.commands[j].id)) {
- buffer += '\t';
- }
- buffer += currentFunction.commands[j].name + Environment.NewLine;
- }
- } else {
- buffer += '\t' + "UseScript_#" + currentFunction.usedScript + Environment.NewLine;
- }
-
- FunctionTextArea.AppendText(buffer + Environment.NewLine);
- buffer = "";
- }
-
- /* Add movements */
- for (int i = 0; i < currentScriptFile.allActions.Count; i++) {
- ActionContainer currentAction = currentScriptFile.allActions[i];
-
- string header = ScriptFile.containerTypes.Action.ToString() + " " + (i + 1);
- buffer += header + ':' + Environment.NewLine;
- actionsNavListbox.Items.Add(header);
-
- for (int j = 0; j < currentAction.actionCommandsList.Count; j++) {
- if (currentAction.actionCommandsList[j].id != 0x00FE) {
- buffer += '\t';
- }
- buffer += currentAction.actionCommandsList[j].name + Environment.NewLine;
- }
-
- ActionTextArea.AppendText(buffer + Environment.NewLine);
- buffer = "";
- }
- }
-
- ScriptEditorSetClean();
- Helpers.statusLabelMessage();
- Helpers.EnableHandlers();
- return true;
- }
-
- private void UpdateScriptNumberFormatDec(object sender, EventArgs e) {
- if (Helpers.HandlersEnabled && scriptEditorNumberFormatDecimal.Checked) {
- NumberStyles old = (NumberStyles)Properties.Settings.Default.scriptEditorFormatPreference; //Local Backup
- Properties.Settings.Default.scriptEditorFormatPreference = (int)NumberStyles.Integer;
-
-
- if (!ReloadScript()) {
- UpdateScriptNumberCheckBox(old); //Restore old checkbox status! Script couldn't be redrawn
- }
- }
- }
- private void UpdateScriptNumberFormatHex(object sender, EventArgs e) {
- if (Helpers.HandlersEnabled && scriptEditorNumberFormatHex.Checked) {
- NumberStyles old = (NumberStyles)Properties.Settings.Default.scriptEditorFormatPreference; //Local Backup
- Properties.Settings.Default.scriptEditorFormatPreference = (int)NumberStyles.HexNumber;
-
- if (!ReloadScript()) {
- UpdateScriptNumberCheckBox(old); //Restore old checkbox status! Script couldn't be redrawn
- }
- }
- }
- private void UpdateScriptNumberFormatNoPref(object sender, EventArgs e) {
- if (Helpers.HandlersEnabled && scriptEditorNumberFormatNoPreference.Checked) {
- NumberStyles old = (NumberStyles)Properties.Settings.Default.scriptEditorFormatPreference; //Local Backup
- Properties.Settings.Default.scriptEditorFormatPreference = (int)NumberStyles.None;
-
- if (!ReloadScript()) {
- UpdateScriptNumberCheckBox(old); //Restore old checkbox status! Script couldn't be redrawn
- }
- }
- }
-
- private void UpdateScriptNumberCheckBox(NumberStyles toSet) {
-
- Helpers.DisableHandlers();
- Properties.Settings.Default.scriptEditorFormatPreference = (int)toSet;
-
- switch ((NumberStyles)Properties.Settings.Default.scriptEditorFormatPreference) {
- case NumberStyles.None:
- scriptEditorNumberFormatNoPreference.Checked = true;
- break;
- case NumberStyles.HexNumber:
- scriptEditorNumberFormatHex.Checked = true;
- break;
- case NumberStyles.Integer:
- scriptEditorNumberFormatDecimal.Checked = true;
- break;
- }
- Console.WriteLine("changed style to " + Properties.Settings.Default.scriptEditorFormatPreference);
- Helpers.EnableHandlers();
- }
-
- private void scriptsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
- NavigatorGoTo((ListBox)sender, 0, scriptSearchManager, ScriptFile.containerTypes.Script.ToString());
- }
-
- private void functionsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
- NavigatorGoTo((ListBox)sender, 1, functionSearchManager, ScriptFile.containerTypes.Function.ToString());
- }
-
- private void actionsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
- NavigatorGoTo((ListBox)sender, 2, actionSearchManager, ScriptFile.containerTypes.Action.ToString());
- }
-
- private void NavigatorGoTo(ListBox currentLB, int indexToSwitchTo, SearchManager entrusted, string keyword) {
- if (currentLB.SelectedIndex < 0) {
- return;
- }
-
- if (scriptEditorTabControl.SelectedIndex != indexToSwitchTo) {
- scriptEditorTabControl.SelectedIndex = indexToSwitchTo;
- }
-
- entrusted.Find(true, false, keyword + ' ' + (currentLB.SelectedIndex + 1) + ':');
- }
- #endregion
- #endregion
-
#region Text Editor
#region Variables
@@ -10581,7 +9635,7 @@ namespace DSPRE {
ExplorerSelect(Path.Combine(gameDirs[DirNames.eventFiles].unpackedDir, selectEventComboBox.SelectedIndex.ToString("D4")));
}
private void locateCurrentScriptFile_Click(object sender, EventArgs e) {
- ExplorerSelect(Path.Combine(gameDirs[DirNames.scripts].unpackedDir, selectScriptFileComboBox.SelectedIndex.ToString("D4")));
+ ExplorerSelect(Path.Combine(gameDirs[DirNames.scripts].unpackedDir, EditorPanels.scriptEditor.selectScriptFileComboBox.SelectedIndex.ToString("D4")));
}
private void locateCurrentTextArchive_Click(object sender, EventArgs e) {
ExplorerSelect(Path.Combine(gameDirs[DirNames.textArchives].unpackedDir, selectTextFileComboBox.SelectedIndex.ToString("D4")));
diff --git a/DS_Map/Main Window.resx b/DS_Map/Main Window.resx
index 9b3572c..b263bbb 100644
--- a/DS_Map/Main Window.resx
+++ b/DS_Map/Main Window.resx
@@ -117,6 +117,96 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 239, 17
+
+
+
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
+ LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
+ ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM
+ EgAAAk1TRnQBSQFMAgEBCgEAAegBGwHoARsBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+ AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
+ AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
+ AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
+ AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
+ AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM
+ AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA
+ ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz
+ AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ
+ AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM
+ AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA
+ AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA
+ AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ
+ AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/
+ AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA
+ AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm
+ ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ
+ Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz
+ AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA
+ AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM
+ AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM
+ ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM
+ Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA
+ AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM
+ AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ
+ AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz
+ AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm
+ AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw
+ AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/xMABLwEAAS8KwAGvAIA
+ BOkBvAMABOkBvCoAASYBHgQAArwBAATpBAAE6QG8KgABJgEeAgABJgEeAQABvAEAAukBvAIABLwBAALp
+ AbwtAAG8ASYBHgMAAukBvAEABAsCvALpAbwsAAEmAR4CAAG8AgAC6QG8AgsBvAEAAgsBvALpAbwmAAO8
+ AgABJgEeAgABvAMAAukBvAILArwCCwEAAukBvCUAAc0BCgEAAbwBAAEmAR4BAAHsAwABvAEAAukBvAUL
+ AgAC6QG8JQABzQEKAQACvAEmAR4BAAESArwBAAG8AQAC6QG8AgsCvAMAAukBvCQAAc0BCgMAAbwBAAEm
+ AR4GAALpAbwBAAILA7wBAALpAbwkAAHNAQoBEgHsAQABEgG8CAAC6QG8AgADCwIAAukBvCQAAc0BCgES
+ AgABEgG8CAAC6QO8BAABvALpAbwjAAHNAQoBAAG8AwABvAgABOkBvAMABOkBvAEAAbwhAAHNAQoBAAG8
+ AwAB7AG8BwAE6QQABOkBGwExAZkhAAFlGwADMT0AARsBMQEbKQAB7AESAe8FAAH0EQAKEhgAAvMC6wHv
+ AewB6wHzBQAB6gH0BQAC8gH0BgADEgZKAxIUAAHzAfEBvALsAQcBvAEHAewB6wEHBAABDgESAe0EAAHw
+ ASIBKQHrAfMFAAESAkoGbgJKARIDAAEPBwABDwUAAQ8BAAG8AfcB7QGSAe8BvAEHAfAB9AHyAesB6gQA
+ AQ4BbQHtAwABBwEjAisBKgHrAfMDAAESAUoBbgFKBm4BSgFuAUoBEgEAAQ8J7wEPAwAB7wIAAW0C9wHw
+ AbwB8wLyAvQB7QHrAQcDAAEHARUB6gPtASkBKwElAR8BJQEqAesB9AIAARIBSgFuAUoGkwFKAW4BSgES
+ AgAB7wEBAR8G7wMAAu8CAAG8Ae8B8QH0AfYB8gLwAfQB9gHvAewBbQMAAfQBEAHrAUoBMAEDASUBFwH5
+ AiABJQEqAeoCAAESAUoBkwFuBkkBbgGTAUoBEgIAAe8CAQEfBe8BAAIPAu8CAAHyAe8C9gH3AW0B6wHy
+ AfQB9gHzAesB7AEHAgAB9AEQAXMBRQEkASAB+QEXAfkBIAEfASABMQEiAfQBAAESAZMBbgFJBmwBSQFu
+ AZMBEgIAAe8BAQEfBu8DAALvAwAB7wHzAbwBkgHwAfcB9gH3Ae0BBwHrAewB7wMAAfIBEQFFAR8CIAH5
+ ARcB+QEgAR8BMQEiAfQBAAESAZMBSQJsBHECbAFJAZMBEgEAAQ8J7wEPAwAB7wMAAQcB8AFEASUBGgKS
+ AfIC8wH0ARIB6wHyAgAB8gFDAewBRQEfASAB+QEXASYBMQE3ATABFAIAAUkBbgFsAXEBlwRxAZcBcQFs
+ AW4BEgIAAQ8HAAEPBQABDwIAAfQBbQEsASUB6wH0AvEC7wHyAusBvAIAAfMBbQHrAUUBHwIgAfkBMQFR
+ Am0B8wIAAUkCbAGXAnEClwJxAZcCbAFJAgABFQEPARUDAAEVAQ8BFQgAARwBLAErAeoBBwG8Au8B9AK8
+ AfMCbQMAAfABEwFFAR8BJAIrAVEBvAUAAUkBbAJxBpcCcQFsAUkBAAEVAfcBBwH3ARUBAAEVAfcBBwH3
+ ARUGAAHvAisBSwHvAQcBvAHxBAcB9AGLAeoDAAHwAREBSwEkASMBAwFKAfAHAAFsAXEDlwJ4A5cBcQFs
+ AgABDwEHAQABBwEPAQABDwEHAQABBwEPBQAB7wErASwBRQK8AQcB7wEHAbwB8AEZAtsBbAEHAwAB8AEj
+ AisBDgHwAfEIAAFJAXEClwF4BZcBcQFJAgABFQH3AQcB9wEVAQABFQH3AQcB9wEVBQABEgEsAUUB8gHz
+ Ae8B8gHxAbsC2gGzAosB8wQAAfABIwE3ATEBDgsAAUkBcQKXAXgDlwFxAUkEAAEVAQ8BFQMAARUBDwEV
+ BwABEgG8AgABBwGzAdQBswJsAe8IAAHvAg4B8wwAAWwBcQSXAXEBbBkAAQcCEgG8HQAEcRcAAfQL8wH0
+ EwAN8xMAAQcL7wEHAgAPEAEAAQcNswEHBwAEQwcAAe8BAAG7BrMBuwIAAe8CAAEQBjgBEAbTARABAAGz
+ DQABswUAAkME8AJDBQAB7wEAAbMGAAGzAgAB7wIAARACOAMAATgBEALTAgAC0wEQAQABsw0AAbMEAAFD
+ CPABQwQAAe8BAAGtAQABlwJWAZcBAAGzAgAB7wIAARADOAEAAjgBEAHTAQAC0wEAAdMBEAEAAbMBAAFW
+ CVABVgEAAbMDAAFDA/ABkgJDAZID8AFDAwAB7wEAAa0BAARWAQABswH0AQAB7wIAARACOAIAAjgBEAHT
+ AQAC0wEAAdMBEAEAAbMBAAtWAQABswMAAUMB8AGSARIBQwHwAZIBQwESAZIB8AFDAwAB7wEAAa0BAARW
+ AQABswH0AQAB7wIAARADOAEAAjgBEALTAgAC0wEQAQABswEAC1YBAAGzAgABQwHwARICYwFDAQAB8AFD
+ AmMBEgHwAUMCAAHvAQABrQEABHgBAAGzAfQBAAHvAgABEAY4ARAG0wEQAQABswEAC1YBAAGzAgABQwES
+ BEcCQwRHARIBQwIAAe8BAAGtBgABswHzAQAB7wIADxABAAGzAQALVgEAAbMCAAFDDEcBQwIAAe8BAAG7
+ Aq0EswG7AfMBAAHvAgABEAZHARAGAAEQAQABswEAC1YBAAGzAgABQwxHAUMCAAHvAQAB8wP0AfMB9AQA
+ Ae8CAAEQAkcCAAJHARAGAAEQAQABswEAC1YBAAGzAwABQwJHApQGRwFDAwAB7wEAAXQCMgEsAXQBAAG8
+ AvcBAAHvAgABEAFHAQACRwEAAUcBEAYAARABAAGzAQABVgl4AVYBAAGzAwABQwFHBJQFRwFDAwAB7wEA
+ ASwDwwFTAQAB9wIAAfMB8AIAARABRwEAAkcBAAFHARAGAAEQAQABswEAC3gBAAGzBAABQwSUBEcBQwQA
+ Ae8BAAF0AywBdAEAAfcBAAHzAfADAAEQAkcCAAJHARAGAAEQAQABswEAC3gBAAGzBQACQwGUA0cCQwUA
+ Ae8IAAHzAfAEAAEQBkcBEAYAARABAAGzDQABswcABEMHAAEHCO8BBwUADxABAAEJDbMBCREAAUIBTQE+
+ BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/wEAAv8CwwQAAf8BgQKDBAAB/wEAAYcBgwQA
+ Af8BMAGMASMEAAH/AeEBiAEDBAAB/wHBAYEBAwQAAfEBgwGAASMEAAHhAQ4BgAFjBAAB4AEAAYAB4wQA
+ AcABgQGIASMEAAHAAX8BjAFjBAABxAF/AYMBwwQAAYQBfwGDAYIEAAGEAT8BhwGABAABjAF/Af8B+AQA
+ A/8B+AQAAf8BjwG/Af8B4AEHAv8B+AEHAo8BwAEDAv8BwAEHAY8BBwHAAQMBgAE8AYABBwGOAQMBgAEB
+ AQABGAGAAQMBgAEBAYABAQIAAYABAwGAAQEBgAEBAgABgAEBAYABAAGAAQECAAHAAQEBwAEAAYABAQEA
+ ARgBwAEAAcABAQGAAQEBgAE8AcABAAHAAQEBgAEBAY4BPwHAAQAB4AEPAYABAQEEAR8BgAEAAeABHwHA
+ AQMBJAGfAgAB4AE/AcABAwEEAR8BAAEBAeAB/wHgAQcBjgE/AZgBDwHwAf8B8AEPAv8B+AF/Av8B/AE/
+ Av8BgAEDAv8BgAEDAv8BgAEDAQABAQEAAQEB/AE/AaABGwEAAQEBfwH9AfABDwGvAdsBAAExAX8B/QHg
+ AQcBqAFbAQABSQFAAQUBwAEDAagBSwEAAUkBQAEFAcABAwGoAUsBAAExAUABBQGBAQEBqAFLAQABAQFA
+ AQUBgAEBAa8BywEAAQEBQAEFAYABAQGgAQsBAAH9AUABBQGAAQEBoAF7ARgBxQFAAQUBwAEDAaABiwEk
+ Ae0BQAEFAcABAwGgAbMBJAHNAUABBQHgAQcBoAGnARgB7QFAAQUB8AEPAb8BzwEAAf0BfwH9AfwBPwGA
+ AR8BAAEBAQABAQL/Cw==
+
+
@@ -946,96 +1036,6 @@
p3S+M+m1V1me9QgCUQNXX2YRT1sYHBiEP3wHVbp3PF3cB40GbrzN86xHENrScf1NDsl8FaI4jODMHOgS
SOacfYAmbr5XeNYjGH7yDReXv+JeNIUhUYwFpmZjDz+nMLf5B3b2rcZ5tju4ntjtFw4T54j+v2g/t9NH
9AiCIPwGJelqUAd/T3AAAAAASUVORK5CYII=
-
-
-
- 239, 17
-
-
-
- AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
- LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
- ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM
- EgAAAk1TRnQBSQFMAgEBCgEAAbABGwGwARsBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
- AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
- AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
- AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
- AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
- AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM
- AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA
- ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz
- AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ
- AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM
- AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA
- AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA
- AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ
- AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/
- AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA
- AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm
- ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ
- Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz
- AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA
- AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM
- AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM
- ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM
- Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA
- AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM
- AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ
- AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz
- AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm
- AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw
- AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/xMABLwEAAS8KwAGvAIA
- BOkBvAMABOkBvCoAASYBHgQAArwBAATpBAAE6QG8KgABJgEeAgABJgEeAQABvAEAAukBvAIABLwBAALp
- AbwtAAG8ASYBHgMAAukBvAEABAsCvALpAbwsAAEmAR4CAAG8AgAC6QG8AgsBvAEAAgsBvALpAbwmAAO8
- AgABJgEeAgABvAMAAukBvAILArwCCwEAAukBvCUAAc0BCgEAAbwBAAEmAR4BAAHsAwABvAEAAukBvAUL
- AgAC6QG8JQABzQEKAQACvAEmAR4BAAESArwBAAG8AQAC6QG8AgsCvAMAAukBvCQAAc0BCgMAAbwBAAEm
- AR4GAALpAbwBAAILA7wBAALpAbwkAAHNAQoBEgHsAQABEgG8CAAC6QG8AgADCwIAAukBvCQAAc0BCgES
- AgABEgG8CAAC6QO8BAABvALpAbwjAAHNAQoBAAG8AwABvAgABOkBvAMABOkBvAEAAbwhAAHNAQoBAAG8
- AwAB7AG8BwAE6QQABOkBGwExAZkhAAFlGwADMT0AARsBMQEbKQAB7AESAe8FAAH0EQAKEhgAAvMC6wHv
- AewB6wHzBQAB6gH0BQAC8gH0BgADEgZKAxIUAAHzAfEBvALsAQcBvAEHAewB6wEHBAABDgESAe0EAAHw
- ASIBKQHrAfMFAAESAkoGbgJKARIDAAEPBwABDwUAAQ8BAAG8AfcB7QGSAe8BvAEHAfAB9AHyAesB6gQA
- AQ4BbQHtAwABBwEjAisBKgHrAfMDAAESAUoBbgFKBm4BSgFuAUoBEgEAAQ8J7wEPAwAB7wIAAW0C9wHw
- AbwB8wLyAvQB7QHrAQcDAAEHARUB6gPtASkBKwElAR8BJQEqAesB9AIAARIBSgFuAUoGkwFKAW4BSgES
- AgAB7wEBAR8G7wMAAu8CAAG8Ae8B8QH0AfYB8gLwAfQB9gHvAewBbQMAAfQBEAHrAUoBMAEDASUBFwH5
- AiABJQEqAeoCAAESAUoBkwFuBkkBbgGTAUoBEgIAAe8CAQEfBe8BAAIPAu8CAAHyAe8C9gH3AW0B6wHy
- AfQB9gHzAesB7AEHAgAB9AEQAXMBRQEkASAB+QEXAfkBIAEfASABMQEiAfQBAAESAZMBbgFJBmwBSQFu
- AZMBEgIAAe8BAQEfBu8DAALvAwAB7wHzAbwBkgHwAfcB9gH3Ae0BBwHrAewB7wMAAfIBEQFFAR8CIAH5
- ARcB+QEgAR8BMQEiAfQBAAESAZMBSQJsBHECbAFJAZMBEgEAAQ8J7wEPAwAB7wMAAQcB8AFEASUBGgKS
- AfIC8wH0ARIB6wHyAgAB8gFDAewBRQEfASAB+QEXASYBMQE3ATABFAIAAUkBbgFsAXEBlwRxAZcBcQFs
- AW4BEgIAAQ8HAAEPBQABDwIAAfQBbQEsASUB6wH0AvEC7wHyAusBvAIAAfMBbQHrAUUBHwIgAfkBMQFR
- Am0B8wIAAUkCbAGXAnEClwJxAZcCbAFJAgABFQEPARUDAAEVAQ8BFQgAARwBLAErAeoBBwG8Au8B9AK8
- AfMCbQMAAfABEwFFAR8BJAIrAVEBvAUAAUkBbAJxBpcCcQFsAUkBAAEVAfcBBwH3ARUBAAEVAfcBBwH3
- ARUGAAHvAisBSwHvAQcBvAHxBAcB9AGLAeoDAAHwAREBSwEkASMBAwFKAfAHAAFsAXEDlwJ4A5cBcQFs
- AgABDwEHAQABBwEPAQABDwEHAQABBwEPBQAB7wErASwBRQK8AQcB7wEHAbwB8AEZAtsBbAEHAwAB8AEj
- AisBDgHwAfEIAAFJAXEClwF4BZcBcQFJAgABFQH3AQcB9wEVAQABFQH3AQcB9wEVBQABEgEsAUUB8gHz
- Ae8B8gHxAbsC2gGzAosB8wQAAfABIwE3ATEBDgsAAUkBcQKXAXgDlwFxAUkEAAEVAQ8BFQMAARUBDwEV
- BwABEgG8AgABBwGzAdQBswJsAe8IAAHvAg4B8wwAAWwBcQSXAXEBbBkAAQcCEgG8HQAEcRcAAfQL8wH0
- EwAN8xMAAQcL7wEHAgAPEAEAAQcNswEHBwAEQwcAAe8BAAG7BrMBuwIAAe8CAAEQBjgBEAbTARABAAGz
- DQABswUAAkME8AJDBQAB7wEAAbMGAAGzAgAB7wIAARACOAMAATgBEALTAgAC0wEQAQABsw0AAbMEAAFD
- CPABQwQAAe8BAAGtAQABlwJWAZcBAAGzAgAB7wIAARADOAEAAjgBEAHTAQAC0wEAAdMBEAEAAbMBAAFW
- CVABVgEAAbMDAAFDA/ABkgJDAZID8AFDAwAB7wEAAa0BAARWAQABswH0AQAB7wIAARACOAIAAjgBEAHT
- AQAC0wEAAdMBEAEAAbMBAAtWAQABswMAAUMB8AGSARIBQwHwAZIBQwESAZIB8AFDAwAB7wEAAa0BAARW
- AQABswH0AQAB7wIAARADOAEAAjgBEALTAgAC0wEQAQABswEAC1YBAAGzAgABQwHwARICYwFDAQAB8AFD
- AmMBEgHwAUMCAAHvAQABrQEABHgBAAGzAfQBAAHvAgABEAY4ARAG0wEQAQABswEAC1YBAAGzAgABQwES
- BEcCQwRHARIBQwIAAe8BAAGtBgABswHzAQAB7wIADxABAAGzAQALVgEAAbMCAAFDDEcBQwIAAe8BAAG7
- Aq0EswG7AfMBAAHvAgABEAZHARAGAAEQAQABswEAC1YBAAGzAgABQwxHAUMCAAHvAQAB8wP0AfMB9AQA
- Ae8CAAEQAkcCAAJHARAGAAEQAQABswEAC1YBAAGzAwABQwJHApQGRwFDAwAB7wEAAXQCMgEsAXQBAAG8
- AvcBAAHvAgABEAFHAQACRwEAAUcBEAYAARABAAGzAQABVgl4AVYBAAGzAwABQwFHBJQFRwFDAwAB7wEA
- ASwDwwFTAQAB9wIAAfMB8AIAARABRwEAAkcBAAFHARAGAAEQAQABswEAC3gBAAGzBAABQwSUBEcBQwQA
- Ae8BAAF0AywBdAEAAfcBAAHzAfADAAEQAkcCAAJHARAGAAEQAQABswEAC3gBAAGzBQACQwGUA0cCQwUA
- Ae8IAAHzAfAEAAEQBkcBEAYAARABAAGzDQABswcABEMHAAEHCO8BBwUADxABAAEJDbMBCREAAUIBTQE+
- BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/wEAAv8CwwQAAf8BgQKDBAAB/wEAAYcBgwQA
- Af8BMAGMASMEAAH/AeEBiAEDBAAB/wHBAYEBAwQAAfEBgwGAASMEAAHhAQ4BgAFjBAAB4AEAAYAB4wQA
- AcABgQGIASMEAAHAAX8BjAFjBAABxAF/AYMBwwQAAYQBfwGDAYIEAAGEAT8BhwGABAABjAF/Af8B+AQA
- A/8B+AQAAf8BjwG/Af8B4AEHAv8B+AEHAo8BwAEDAv8BwAEHAY8BBwHAAQMBgAE8AYABBwGOAQMBgAEB
- AQABGAGAAQMBgAEBAYABAQIAAYABAwGAAQEBgAEBAgABgAEBAYABAAGAAQECAAHAAQEBwAEAAYABAQEA
- ARgBwAEAAcABAQGAAQEBgAE8AcABAAHAAQEBgAEBAY4BPwHAAQAB4AEPAYABAQEEAR8BgAEAAeABHwHA
- AQMBJAGfAgAB4AE/AcABAwEEAR8BAAEBAeAB/wHgAQcBjgE/AZgBDwHwAf8B8AEPAv8B+AF/Av8B/AE/
- Av8BgAEDAv8BgAEDAv8BgAEDAQABAQEAAQEB/AE/AaABGwEAAQEBfwH9AfABDwGvAdsBAAExAX8B/QHg
- AQcBqAFbAQABSQFAAQUBwAEDAagBSwEAAUkBQAEFAcABAwGoAUsBAAExAUABBQGBAQEBqAFLAQABAQFA
- AQUBgAEBAa8BywEAAQEBQAEFAYABAQGgAQsBAAH9AUABBQGAAQEBoAF7ARgBxQFAAQUBwAEDAaABiwEk
- Ae0BQAEFAcABAwGgAbMBJAHNAUABBQHgAQcBoAGnARgB7QFAAQUB8AEPAb8BzwEAAf0BfwH9AfwBPwGA
- AR8BAAEBAQABAQL/Cw==
@@ -1047,6 +1047,9 @@
386, 19
+
+ 533, 20
+
62
diff --git a/DS_Map/ROMFiles/HeadbuttEncounter.cs b/DS_Map/ROMFiles/HeadbuttEncounter.cs
new file mode 100644
index 0000000..7398a19
--- /dev/null
+++ b/DS_Map/ROMFiles/HeadbuttEncounter.cs
@@ -0,0 +1,27 @@
+using System.IO;
+
+namespace DSPRE.ROMFiles {
+ public class HeadbuttEncounter {
+ public ushort pokemonID;
+ public byte minLevel;
+ public byte maxLevel;
+
+ public HeadbuttEncounter() {
+ maxLevel = 0;
+ minLevel = 0;
+ pokemonID = 0;
+ }
+
+ public HeadbuttEncounter(BinaryReader br) {
+ this.pokemonID = br.ReadUInt16();
+ this.minLevel = br.ReadByte();
+ this.maxLevel = br.ReadByte();
+ }
+
+ public override string ToString() {
+ string[] pokemonNames = RomInfo.GetPokemonNames();
+ string pokemon = pokemonNames[pokemonID];
+ return $"{pokemonID,4} {pokemon,10}: {minLevel,3} - {maxLevel,3}";
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/HeadbuttEncounterFile.cs b/DS_Map/ROMFiles/HeadbuttEncounterFile.cs
new file mode 100644
index 0000000..7c7d6c7
--- /dev/null
+++ b/DS_Map/ROMFiles/HeadbuttEncounterFile.cs
@@ -0,0 +1,136 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+
+namespace DSPRE.ROMFiles {
+ //https://hirotdk.neocities.org/FileSpecs.html#Headbutt
+ public class HeadbuttEncounterFile {
+ public ushort ID;
+
+ //get encounter tables, 12 normal pokemon definitions, 6 special pokemon definitions, 4 bytes per definition
+ const int normalEncountersCount = 12;
+ const int specialEncountersCount = 6;
+
+ public byte normalTreeGroupsCount;
+ public byte specialTreeGroupsCount;
+ public List normalEncounters;
+ public List specialEncounters;
+ public BindingList normalTreeGroups;
+ public BindingList specialTreeGroups;
+
+ public HeadbuttEncounterFile(ushort id) {
+ this.ID = id;
+ string path = Filesystem.GetHeadbuttPath(id);
+ parse_file(path);
+ }
+
+ public HeadbuttEncounterFile(string path) {
+ parse_file(path);
+ }
+
+ public void parse_file(string path) {
+ FileStream fs = new FileStream(path, FileMode.Open);
+ using (BinaryReader br = new BinaryReader(fs)) {
+ //get the number of tree group definitions
+ normalTreeGroupsCount = br.ReadByte();
+ br.ReadByte(); //padding
+ specialTreeGroupsCount = br.ReadByte();
+ br.ReadByte(); //padding
+
+ normalEncounters = new List();
+ specialEncounters = new List();
+
+ normalTreeGroups = new BindingList();
+ specialTreeGroups = new BindingList();
+
+ //if there are no trees defined in either section, there are no encounters or trees defined
+ bool hasTrees = normalTreeGroupsCount > 0 || specialTreeGroupsCount > 0;
+ if (!hasTrees) {
+ for (int i = 0; i < normalEncountersCount; i++) {
+ normalEncounters.Add(new HeadbuttEncounter());
+ }
+
+ for (int i = 0; i < specialEncountersCount; i++) {
+ specialEncounters.Add(new HeadbuttEncounter());
+ }
+
+ return;
+ }
+
+ for (int i = 0; i < normalEncountersCount; i++) {
+ normalEncounters.Add(new HeadbuttEncounter(br));
+ }
+
+ for (int i = 0; i < specialEncountersCount; i++) {
+ specialEncounters.Add(new HeadbuttEncounter(br));
+ }
+
+ //tree groups have 6 sets of xy global coordinates x treeGroupsCount
+ //coordinates need to be converted to matrix and local coordinates to be useful
+ for (int i = 0; i < normalTreeGroupsCount; i++) {
+ normalTreeGroups.Add(new HeadbuttTreeGroup(br));
+ }
+
+ for (int i = 0; i < specialTreeGroupsCount; i++) {
+ specialTreeGroups.Add(new HeadbuttTreeGroup(br));
+ }
+ }
+ }
+
+ public byte[] ToByteArray() {
+ MemoryStream newData = new MemoryStream();
+ using (BinaryWriter writer = new BinaryWriter(newData)) {
+ writer.Write((byte)normalTreeGroups.Count);
+ writer.Write((byte)0);
+ writer.Write((byte)specialTreeGroups.Count);
+ writer.Write((byte)0);
+
+ foreach (HeadbuttEncounter encounter in normalEncounters) {
+ writer.Write((UInt16)encounter.pokemonID);
+ writer.Write((byte)encounter.minLevel);
+ writer.Write((byte)encounter.maxLevel);
+ }
+
+ foreach (HeadbuttEncounter encounter in specialEncounters) {
+ writer.Write((UInt16)encounter.pokemonID);
+ writer.Write((byte)encounter.minLevel);
+ writer.Write((byte)encounter.maxLevel);
+ }
+
+ foreach (var treeGroup in normalTreeGroups) {
+ foreach (var tree in treeGroup.trees) {
+ writer.Write((UInt16)tree.globalX);
+ writer.Write((UInt16)tree.globalY);
+ }
+ }
+
+ foreach (var treeGroup in specialTreeGroups) {
+ foreach (var tree in treeGroup.trees) {
+ writer.Write((UInt16)tree.globalX);
+ writer.Write((UInt16)tree.globalY);
+ }
+ }
+ }
+
+ return newData.ToArray();
+ }
+
+ public bool SaveToFile() {
+ string path = Filesystem.GetHeadbuttPath(ID);
+ return SaveToFile(path);
+ }
+
+ public bool SaveToFile(int id) {
+ string path = Filesystem.GetHeadbuttPath(id);
+ return SaveToFile(path);
+ }
+
+
+ public bool SaveToFile(string path, bool showSuccessMessage = true) {
+ byte[] romFileToByteArray = ToByteArray();
+ File.WriteAllBytes(path, romFileToByteArray);
+ return true;
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/HeadbuttEncounterMap.cs b/DS_Map/ROMFiles/HeadbuttEncounterMap.cs
new file mode 100644
index 0000000..7738473
--- /dev/null
+++ b/DS_Map/ROMFiles/HeadbuttEncounterMap.cs
@@ -0,0 +1,36 @@
+namespace DSPRE.ROMFiles {
+ //This class is in case a MapHeader uses the same MapFile more than once
+ //ToString is the matrix x,y and mapID
+ class HeadbuttEncounterMap {
+ public readonly int mapID;
+ public readonly int x;
+ public readonly int y;
+
+ public HeadbuttEncounterMap(int mapID, int x, int y) {
+ this.mapID = mapID;
+ this.x = x;
+ this.y = y;
+ }
+
+ public override string ToString() {
+ return $"{mapID} - {x},{y}";
+ }
+
+ public override bool Equals(object obj) {
+ // If the passed object is null
+ if (obj == null) {
+ return false;
+ }
+
+ if (obj is HeadbuttEncounterMap) {
+ return this.ToString() == ((HeadbuttEncounterMap)obj).ToString();
+ }
+
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return this.x.GetHashCode() ^ y.GetHashCode() ^ mapID.GetHashCode();
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/HeadbuttTree.cs b/DS_Map/ROMFiles/HeadbuttTree.cs
new file mode 100644
index 0000000..224d0da
--- /dev/null
+++ b/DS_Map/ROMFiles/HeadbuttTree.cs
@@ -0,0 +1,103 @@
+using System.IO;
+
+namespace DSPRE.ROMFiles {
+ public class HeadbuttTree {
+ public bool picked = false;
+
+ private ushort _globalX;
+ private ushort _globalY;
+ private ushort _matrixX;
+ private ushort _matrixY;
+ private ushort _mapX;
+ private ushort _mapY;
+
+ public bool unused { get { return globalX == ushort.MaxValue && globalY == ushort.MaxValue; } }
+
+ public enum Types {
+ Normal,
+ Special,
+ }
+
+ public HeadbuttTree(BinaryReader br) {
+ this.globalX = br.ReadUInt16();
+ this.globalY = br.ReadUInt16();
+ }
+
+ public HeadbuttTree(ushort globalX = ushort.MaxValue, ushort globalY = ushort.MaxValue) {
+ this.globalX = globalX;
+ this.globalY = globalY;
+ }
+
+ public HeadbuttTree(HeadbuttTree original) {
+ this.globalX = original.globalX;
+ this.globalY = original.globalY;
+ }
+
+ public ushort globalX {
+ get { return _globalX; }
+ set {
+ _globalX = value;
+ _matrixX = (ushort)(_globalX / MapFile.mapSize);
+ _mapX = (ushort)(_globalX % MapFile.mapSize);
+ }
+ }
+
+ public ushort globalY {
+ get { return _globalY; }
+ set {
+ _globalY = value;
+ _matrixY = (ushort)(_globalY / MapFile.mapSize);
+ _mapY = (ushort)(_globalY % MapFile.mapSize);
+ }
+ }
+
+ public ushort matrixX {
+ get {
+ return _matrixX;
+ }
+ set {
+ _matrixX = value;
+ _globalX = (ushort)(_matrixX * MapFile.mapSize + _mapX);
+ _mapX = (ushort)(_globalX % MapFile.mapSize);
+ }
+ }
+
+ public ushort matrixY {
+ get {
+ return _matrixY;
+ }
+ set {
+ _matrixY = value;
+ _globalY = (ushort)(_matrixY * MapFile.mapSize + _mapY);
+ _mapY = (ushort)(_globalY % MapFile.mapSize);
+ }
+ }
+
+ public ushort mapX {
+ get {
+ return _mapX;
+ }
+ set {
+ _mapX = value;
+ _globalX = (ushort)(_matrixX * MapFile.mapSize + _mapX);
+ _matrixX = (ushort)(_globalX / MapFile.mapSize);
+ }
+ }
+
+ public ushort mapY {
+ get {
+ return _mapY;
+ }
+ set {
+ _mapY = value;
+ _globalY = (ushort)(_matrixY * MapFile.mapSize + _mapY);
+ _matrixY = (ushort)(_globalY / MapFile.mapSize);
+ }
+ }
+
+ public override string ToString() {
+ string suffix = unused ? "unused" : $"globalX: {globalX}, globalY: {globalY}";
+ return $"{nameof(HeadbuttTree)} - {suffix}";
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/HeadbuttTreeGroup.cs b/DS_Map/ROMFiles/HeadbuttTreeGroup.cs
new file mode 100644
index 0000000..f012e70
--- /dev/null
+++ b/DS_Map/ROMFiles/HeadbuttTreeGroup.cs
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using System.IO;
+
+namespace DSPRE.ROMFiles {
+ public class HeadbuttTreeGroup {
+ const int treeCount = 6; //number of trees in each tree group
+
+ public List trees = new List();
+
+ public HeadbuttTreeGroup(BinaryReader br) {
+ for (int j = 0; j < treeCount; j++) {
+ trees.Add(new HeadbuttTree(br));
+ }
+ }
+
+ public HeadbuttTreeGroup() {
+ for (int j = 0; j < treeCount; j++) {
+ trees.Add(new HeadbuttTree());
+ }
+ }
+
+ public HeadbuttTreeGroup(HeadbuttTreeGroup original) {
+ foreach (HeadbuttTree headbuttTree in original.trees) {
+ trees.Add(new HeadbuttTree(headbuttTree));
+ }
+ }
+
+ public override string ToString() {
+ return $"{nameof(HeadbuttTreeGroup)}";
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/LevelScriptFile.cs b/DS_Map/ROMFiles/LevelScriptFile.cs
new file mode 100644
index 0000000..bb208bf
--- /dev/null
+++ b/DS_Map/ROMFiles/LevelScriptFile.cs
@@ -0,0 +1,139 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+
+namespace DSPRE.ROMFiles {
+ public class LevelScriptFile {
+ public int ID;
+ public BindingList bufferSet = new BindingList();
+
+ public LevelScriptFile() { }
+
+ public LevelScriptFile(int id) {
+ this.ID = id;
+ string path1 = Filesystem.scripts;
+ string path = Path.Combine(path1, this.ID.ToString("D4"));
+ parse_file(path);
+ }
+
+ public void parse_file(string path) {
+ FileStream fs = new FileStream(path, FileMode.Open);
+ using (BinaryReader br = new BinaryReader(fs)) {
+ bool hasConditionalStructure = false;
+
+ //conditionalStructureOffset is used to ensure the structure of the file is correct
+ int conditionalStructureOffset = -1;
+
+ while (true) {
+ //first byte is the script type
+ //if not a valid script type, break loop
+ byte triggerType = br.ReadByte();
+ if (!LevelScriptTrigger.IsValidTriggerType(triggerType)) break;
+
+ //subtract triggerType length from conditionalStructureOffset
+ if (hasConditionalStructure) conditionalStructureOffset -= sizeof(byte);
+
+ //if trigger type is a variable value, that doesn't immediately mean we're processing that trigger
+ //the trigger data is processed last if it is there
+ if (triggerType == LevelScriptTrigger.VARIABLEVALUE) {
+ hasConditionalStructure = true;
+ conditionalStructureOffset = (int)br.ReadUInt32();
+ continue;
+ }
+
+ //map screen load trigger doesn't have a value or variable
+ uint scriptToTrigger = br.ReadUInt32();
+ bufferSet.Add(new MapScreenLoadTrigger(triggerType, (int)scriptToTrigger));
+
+ //subtract scriptToTrigger length from conditionalStructureOffset
+ if (hasConditionalStructure) conditionalStructureOffset -= sizeof(UInt32);
+ }
+
+ //the earliest position a trigger can be
+ const int SMALLEST_TRIGGER_SIZE = 5;
+
+ //if triggerType is invalid
+ //and next uint16 == 0
+ //and the file stream length is shorter than the earliest position a trigger can be
+ if (br.BaseStream.Position == 1 && br.ReadUInt16() == 0 && fs.Length < SMALLEST_TRIGGER_SIZE) {
+ return;
+ throw new InvalidDataException("This level script does nothing."); // "Interesting..."
+ }
+
+ //br.BaseStream.Position == 3
+ //triggerType is valid,
+ //stream position is earlier than the first possible trigger, or
+ //there is no start script condition specified
+ if (br.BaseStream.Position < SMALLEST_TRIGGER_SIZE) {
+ throw new InvalidDataException("Parser failure: The input file you attempted to load is either malformed or not a Level Script file.");
+ }
+
+ //there are no instances of a variable value trigger
+ if (!hasConditionalStructure) {
+ return;
+ }
+
+ //if there's a variable value trigger but the offset is incorrect, the file is corrupt
+ if (conditionalStructureOffset != 1) {
+ throw new InvalidDataException($"Field error: The Level Script file you attempted to load is broken. {conditionalStructureOffset}");
+ }
+
+ //get the variable value trigger parts
+ while (true) {
+ //there are no variables below 1
+ int variableID = br.ReadUInt16();
+ if (variableID <= 0) break;
+
+ int varExpectedValue = br.ReadUInt16();
+ int scriptToTrigger = br.ReadUInt16();
+ bufferSet.Add(new VariableValueTrigger(scriptToTrigger, variableID, varExpectedValue));
+ }
+ }
+ }
+
+ public long write_file(string path, bool word_alignment_padding = false) {
+ FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write);
+ using (BinaryWriter bw = new BinaryWriter(fs)) {
+ HashSet mapScreenLoadTriggers = new HashSet();
+ HashSet variableValueTriggers = new HashSet();
+
+ foreach (LevelScriptTrigger item in bufferSet) {
+ if (item is VariableValueTrigger variableValueTrigger) {
+ variableValueTriggers.Add(variableValueTrigger);
+ }
+ else if (item is MapScreenLoadTrigger mapScreenLoadTrigger) {
+ mapScreenLoadTriggers.Add(mapScreenLoadTrigger);
+ }
+ }
+
+ foreach (MapScreenLoadTrigger item in mapScreenLoadTriggers) {
+ bw.Write((byte)item.triggerType);
+ bw.Write((UInt32)item.scriptTriggered);
+ }
+
+ if (variableValueTriggers.Count > 0) {
+ bw.Write((byte)LevelScriptTrigger.VARIABLEVALUE);
+ bw.Write((UInt32)1);
+ bw.Write((byte)0);
+ foreach (VariableValueTrigger item in variableValueTriggers) {
+ bw.Write((UInt16)item.variableToWatch);
+ bw.Write((UInt16)item.expectedValue);
+ bw.Write((UInt16)item.scriptTriggered);
+ }
+ }
+
+ bw.Write((UInt16)0);
+
+ if (word_alignment_padding) {
+ long missing_bytes = bw.BaseStream.Position % 4;
+ for (int i = 0; i < 4 - missing_bytes; i++) {
+ bw.Write((byte)0);
+ }
+ }
+
+ return bw.BaseStream.Position;
+ }
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/LevelScriptTrigger.cs b/DS_Map/ROMFiles/LevelScriptTrigger.cs
new file mode 100644
index 0000000..eaae9b7
--- /dev/null
+++ b/DS_Map/ROMFiles/LevelScriptTrigger.cs
@@ -0,0 +1,31 @@
+using System;
+
+namespace DSPRE.ROMFiles {
+ public class LevelScriptTrigger {
+ public const int VARIABLEVALUE = 1;
+ public const int MAPCHANGE = 2;
+ public const int SCREENRESET = 3;
+ public const int LOADGAME = 4;
+
+ private static int[] _triggerTypes;
+ public int triggerType { get; set; }
+ public int scriptTriggered { get; set; }
+
+ public LevelScriptTrigger(int triggerType, int scriptTriggered) {
+ this.triggerType = triggerType;
+ this.scriptTriggered = scriptTriggered;
+ }
+
+ public static bool IsValidTriggerType(byte triggerType) {
+ if (_triggerTypes == null) {
+ _triggerTypes = new[] { VARIABLEVALUE, MAPCHANGE, SCREENRESET, LOADGAME };
+ }
+
+ return Array.IndexOf(_triggerTypes, triggerType) != -1;
+ }
+
+ public override string ToString() {
+ return "Starts Script " + scriptTriggered;
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/MapScreenLoadTrigger.cs b/DS_Map/ROMFiles/MapScreenLoadTrigger.cs
new file mode 100644
index 0000000..69543a7
--- /dev/null
+++ b/DS_Map/ROMFiles/MapScreenLoadTrigger.cs
@@ -0,0 +1,35 @@
+namespace DSPRE.ROMFiles {
+ public class MapScreenLoadTrigger : LevelScriptTrigger {
+ public MapScreenLoadTrigger(int type, int scriptTriggered) : base(type, scriptTriggered) { }
+
+ public override string ToString() {
+ switch (triggerType) {
+ case LevelScriptTrigger.MAPCHANGE:
+ return base.ToString() + " upon entering the LS map.";
+ case LevelScriptTrigger.SCREENRESET:
+ return base.ToString() + " when a fadescreen happens in the LS map.";
+ case LevelScriptTrigger.LOADGAME:
+ return base.ToString() + " when the game resumes in the LS map.";
+ default:
+ return base.ToString() + " under unknown circumstances.";
+ }
+ }
+
+ public override bool Equals(object obj) {
+ // If the passed object is null
+ if (obj == null) {
+ return false;
+ }
+
+ if (obj is MapScreenLoadTrigger) {
+ return this.ToString() == ((MapScreenLoadTrigger)obj).ToString();
+ }
+
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return this.triggerType.GetHashCode() ^ scriptTriggered.GetHashCode();
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/SafariZoneEncounter.cs b/DS_Map/ROMFiles/SafariZoneEncounter.cs
new file mode 100644
index 0000000..52df80b
--- /dev/null
+++ b/DS_Map/ROMFiles/SafariZoneEncounter.cs
@@ -0,0 +1,35 @@
+using System;
+using System.IO;
+
+namespace DSPRE.ROMFiles
+{
+ public class SafariZoneEncounter
+ {
+ public ushort pokemonID;
+ public byte level;
+ public SafariZoneEncounter() {
+ level = 1;
+ pokemonID = 0;
+ }
+
+ public SafariZoneEncounter(BinaryReader br) {
+ readEncounter(br);
+ }
+
+ public void readEncounter(BinaryReader br) {
+ this.pokemonID = br.ReadUInt16();
+ this.level = br.ReadByte();
+ }
+
+ public void writeEncounter(BinaryWriter bw) {
+ bw.Write((UInt16)pokemonID);
+ bw.Write((byte)level);
+ }
+
+ public override string ToString() {
+ string[] pokemonNames = RomInfo.GetPokemonNames();
+ string pokemon = pokemonNames[pokemonID];
+ return $"{pokemonID,4} {pokemon,10}: {level,3}";
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/SafariZoneEncounterFile.cs b/DS_Map/ROMFiles/SafariZoneEncounterFile.cs
new file mode 100644
index 0000000..5e3ddd2
--- /dev/null
+++ b/DS_Map/ROMFiles/SafariZoneEncounterFile.cs
@@ -0,0 +1,101 @@
+using System.Collections.Generic;
+using System.IO;
+
+namespace DSPRE.ROMFiles {
+ public class SafariZoneEncounterFile {
+ public static Dictionary Names = new Dictionary() {
+ {0, "Plains"},
+ {1, "Meadow"},
+ {2, "Savannah"},
+ {3, "Peak"},
+ {4, "Rocky Beach"},
+ {5, "Wetland"},
+ {6, "Forest"},
+ {7, "Swamp"},
+ {8, "Marshland"},
+ {9, "Wasteland"},
+ {10, "Mountain"},
+ {11, "Desert"},
+ };
+
+ public int ID;
+
+ public SafariZoneEncounterGroup grassEncounterGroup = new SafariZoneEncounterGroup();
+ public SafariZoneEncounterGroup surfEncounterGroup = new SafariZoneEncounterGroup();
+ public SafariZoneEncounterGroup oldRodEncounterGroup = new SafariZoneEncounterGroup();
+ public SafariZoneEncounterGroup goodRodEncounterGroup = new SafariZoneEncounterGroup();
+ public SafariZoneEncounterGroup superRodEncounterGroup = new SafariZoneEncounterGroup();
+
+ public SafariZoneEncounterFile(int id) {
+ this.ID = id;
+ string path = Filesystem.GetSafariZonePath(id);
+ parse_file(path);
+ }
+
+ public SafariZoneEncounterFile(string path) {
+ parse_file(path);
+ }
+
+ public void parse_file(string path) {
+ FileStream fs = new FileStream(path, FileMode.Open);
+ using (BinaryReader br = new BinaryReader(fs)) {
+ if (br.BaseStream.Length < 5) return;
+ //#1 Section - Object Arrangement Allocation
+ grassEncounterGroup.readObjectSlots(br);
+ surfEncounterGroup.readObjectSlots(br);
+ oldRodEncounterGroup.readObjectSlots(br);
+ goodRodEncounterGroup.readObjectSlots(br);
+ superRodEncounterGroup.readObjectSlots(br);
+
+ br.ReadByte();
+ br.ReadByte();
+ br.ReadByte();
+
+ grassEncounterGroup.readGroup(br);
+ surfEncounterGroup.readGroup(br);
+ oldRodEncounterGroup.readGroup(br);
+ goodRodEncounterGroup.readGroup(br);
+ superRodEncounterGroup.readGroup(br);
+ }
+ }
+
+ public byte[] ToByteArray() {
+ MemoryStream newData = new MemoryStream();
+ using (BinaryWriter bw = new BinaryWriter(newData)) {
+ grassEncounterGroup.writeObjectSlots(bw);
+ surfEncounterGroup.writeObjectSlots(bw);
+ oldRodEncounterGroup.writeObjectSlots(bw);
+ goodRodEncounterGroup.writeObjectSlots(bw);
+ superRodEncounterGroup.writeObjectSlots(bw);
+
+ bw.Write((byte)0);
+ bw.Write((byte)0);
+ bw.Write((byte)0);
+
+ grassEncounterGroup.writeGroup(bw);
+ surfEncounterGroup.writeGroup(bw);
+ oldRodEncounterGroup.writeGroup(bw);
+ goodRodEncounterGroup.writeGroup(bw);
+ superRodEncounterGroup.writeGroup(bw);
+ }
+ return newData.ToArray();
+ }
+
+ public bool SaveToFile() {
+ string path = Filesystem.GetSafariZonePath(ID);
+ return SaveToFile(path);
+ }
+
+ public bool SaveToFile(int id) {
+ string path = Filesystem.GetSafariZonePath(id);
+ return SaveToFile(path);
+ }
+
+
+ public bool SaveToFile(string path, bool showSuccessMessage = true) {
+ byte[] romFileToByteArray = ToByteArray();
+ File.WriteAllBytes(path, romFileToByteArray);
+ return true;
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/SafariZoneEncounterGroup.cs b/DS_Map/ROMFiles/SafariZoneEncounterGroup.cs
new file mode 100644
index 0000000..f94be89
--- /dev/null
+++ b/DS_Map/ROMFiles/SafariZoneEncounterGroup.cs
@@ -0,0 +1,108 @@
+using System.ComponentModel;
+using System.IO;
+
+namespace DSPRE.ROMFiles
+{
+ public class SafariZoneEncounterGroup
+ {
+ private const int EncounterSlots = 10;
+
+ public byte ObjectSlots;
+ public BindingList MorningEncounters = new BindingList();
+ public BindingList DayEncounters = new BindingList();
+ public BindingList NightEncounters = new BindingList();
+ public BindingList MorningEncountersObject = new BindingList();
+ public BindingList DayEncountersObject = new BindingList();
+ public BindingList NightEncountersObject = new BindingList();
+ public BindingList ObjectRequirements = new BindingList();
+ public BindingList OptionalObjectRequirements = new BindingList();
+
+ public void readObjectSlots(BinaryReader br) {
+ ObjectSlots = br.ReadByte();
+ }
+
+ public void writeObjectSlots(BinaryWriter bw) {
+ bw.Write((byte)ObjectSlots);
+ }
+
+ public void readGroup(BinaryReader br) {
+ //#2 Section - Tall Grass Encounters
+ for (int i = 0; i < EncounterSlots; i++) {
+ MorningEncounters.Add(new SafariZoneEncounter(br));
+ br.ReadByte();
+ }
+
+ for (int i = 0; i < EncounterSlots; i++) {
+ DayEncounters.Add(new SafariZoneEncounter(br));
+ br.ReadByte();
+ }
+
+ for (int i = 0; i < EncounterSlots; i++) {
+ NightEncounters.Add(new SafariZoneEncounter(br));
+ br.ReadByte();
+ }
+
+ //#3 Section - Tall Grass Encounters (Object Arrangement)
+ for (int i = 0; i < ObjectSlots; i++) {
+ MorningEncountersObject.Add(new SafariZoneEncounter(br));
+ br.ReadByte();
+ }
+
+ for (int i = 0; i < ObjectSlots; i++) {
+ DayEncountersObject.Add(new SafariZoneEncounter(br));
+ br.ReadByte();
+ }
+
+ for (int i = 0; i < ObjectSlots; i++) {
+ NightEncountersObject.Add(new SafariZoneEncounter(br));
+ br.ReadByte();
+ }
+
+ //#4 Section - Object Arrangement Requirements (Tall Grass)
+ for (int i = 0; i < ObjectSlots; i++) {
+ ObjectRequirements.Add(new SafariZoneObjectRequirement(br));
+ OptionalObjectRequirements.Add(new SafariZoneObjectRequirement(br));
+ }
+ }
+
+ public void writeGroup(BinaryWriter bw) {
+ //#2 Section - Tall Grass Encounters
+ for (int i = 0; i < MorningEncounters.Count; i++) {
+ MorningEncounters[i].writeEncounter(bw);
+ bw.Write((byte)0);
+ }
+
+ for (int i = 0; i < EncounterSlots; i++) {
+ DayEncounters[i].writeEncounter(bw);
+ bw.Write((byte)0);
+ }
+
+ for (int i = 0; i < EncounterSlots; i++) {
+ NightEncounters[i].writeEncounter(bw);
+ bw.Write((byte)0);
+ }
+
+ //#3 Section - Tall Grass Encounters (Object Arrangement)
+ for (int i = 0; i < ObjectSlots; i++) {
+ MorningEncountersObject[i].writeEncounter(bw);
+ bw.Write((byte)0);
+ }
+
+ for (int i = 0; i < ObjectSlots; i++) {
+ DayEncountersObject[i].writeEncounter(bw);
+ bw.Write((byte)0);
+ }
+
+ for (int i = 0; i < ObjectSlots; i++) {
+ NightEncountersObject[i].writeEncounter(bw);
+ bw.Write((byte)0);
+ }
+
+ //#4 Section - Object Arrangement Requirements (Tall Grass)
+ for (int i = 0; i < ObjectSlots; i++) {
+ ObjectRequirements[i].writeRequirement(bw);
+ OptionalObjectRequirements[i].writeRequirement(bw);
+ }
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/SafariZoneObjectRequirement.cs b/DS_Map/ROMFiles/SafariZoneObjectRequirement.cs
new file mode 100644
index 0000000..8fbaf65
--- /dev/null
+++ b/DS_Map/ROMFiles/SafariZoneObjectRequirement.cs
@@ -0,0 +1,40 @@
+using System.Collections.Generic;
+using System.IO;
+
+namespace DSPRE.ROMFiles {
+ public class SafariZoneObjectRequirement {
+ public static Dictionary ObjectTypes = new Dictionary() {
+ { 0, "No Requirement" },
+ { 1, "Plains" },
+ { 2, "Forest" },
+ { 3, "Peak" },
+ { 4, "Waterside" },
+ };
+
+ public byte typeID;
+ public byte quantity;
+
+ public SafariZoneObjectRequirement(byte typeID = 0, byte quantity = 0) {
+ this.typeID = typeID;
+ this.quantity = quantity;
+ }
+
+ public SafariZoneObjectRequirement(BinaryReader br) {
+ readRequirement(br);
+ }
+
+ public void readRequirement(BinaryReader br) {
+ typeID = br.ReadByte();
+ quantity = br.ReadByte();
+ }
+
+ public void writeRequirement(BinaryWriter bw) {
+ bw.Write((byte)typeID);
+ bw.Write((byte)quantity);
+ }
+
+ public override string ToString() {
+ return $"{typeID} {ObjectTypes[typeID]}: {quantity}";
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/ScriptActionContainer.cs b/DS_Map/ROMFiles/ScriptActionContainer.cs
new file mode 100644
index 0000000..a004d56
--- /dev/null
+++ b/DS_Map/ROMFiles/ScriptActionContainer.cs
@@ -0,0 +1,13 @@
+using System.Collections.Generic;
+
+namespace DSPRE.ROMFiles {
+ public class ScriptActionContainer {
+ public List commands;
+ public uint manualUserID;
+
+ public ScriptActionContainer(uint actionNumber, List commands = null) {
+ manualUserID = actionNumber;
+ this.commands = commands;
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/ScriptCommand.cs b/DS_Map/ROMFiles/ScriptCommand.cs
index 8472bb2..ddb7e68 100644
--- a/DS_Map/ROMFiles/ScriptCommand.cs
+++ b/DS_Map/ROMFiles/ScriptCommand.cs
@@ -4,41 +4,25 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows.Forms;
-using static DSPRE.ROMFiles.Event;
-using static DSPRE.ROMFiles.ScriptFile;
namespace DSPRE.ROMFiles {
- public enum ParamTypeEnum { INTEGER, VARIABLE, FLEX, OW_ID, OW_MOVEMENT_TYPE, OW_DIRECTION, FUNCTION_ID, ACTION_ID, CMD_NUMBER };
- public class CommandContainer {
- public List commands;
- public uint manualUserID;
- public int usedScript; //useScript ID referenced by this Script/Function
- public containerTypes containerType;
- internal static readonly string functionStart;
-
- #region Constructors (2)
- public CommandContainer(uint scriptNumber, containerTypes containerType, int useScript = -1, List commandList = null) {
- manualUserID = scriptNumber;
- this.usedScript = useScript;
- this.containerType = containerType;
- commands = commandList;
- }
- public CommandContainer(uint newID, CommandContainer toCopy) {
- manualUserID = newID;
- usedScript = toCopy.usedScript;
- containerType = toCopy.containerType;
- commands = new List(toCopy.commands); //command parameters need to be copied recursively
- }
- #endregion
- }
public class ScriptCommand {
- #region Fields (4)
+ enum ParamTypeEnum {
+ INTEGER,
+ VARIABLE,
+ FLEX,
+ OW_ID,
+ OW_MOVEMENT_TYPE,
+ OW_DIRECTION,
+ FUNCTION_ID,
+ ACTION_ID,
+ CMD_NUMBER
+ };
+
public ushort? id;
public List cmdParams;
public string name;
- #endregion
- #region Constructors (2)
public ScriptCommand(ushort id, List parametersList) {
if (parametersList is null) {
this.id = null;
@@ -50,20 +34,20 @@ namespace DSPRE.ROMFiles {
}
switch (id) {
- case 0x0016: // Jump
- case 0x001A: // Call
+ case 0x0016: // Jump
+ case 0x001A: // Call
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.FUNCTION_ID)}";
break;
- case 0x0017: // JumpIfObjID
- case 0x0018: // JumpIfEventID
+ case 0x0017: // JumpIfObjID
+ case 0x0018: // JumpIfEventID
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1])}";
break;
- case 0x0019: // JumpIfPlayerDir
+ case 0x0019: // JumpIfPlayerDir
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_DIRECTION)} {FormatNumber(parametersList[1], ParamTypeEnum.ACTION_ID)}";
break;
- case 0x001C: // JumpIf
- case 0x001D: // CallIf
- {
+ case 0x001C: // JumpIf
+ case 0x001D: // CallIf
+ {
string number = FormatNumber(parametersList[1], ParamTypeEnum.FUNCTION_ID);
if (RomInfo.ScriptComparisonOperatorsDict.TryGetValue(parametersList[0][0], out string v)) {
@@ -71,131 +55,150 @@ namespace DSPRE.ROMFiles {
} else {
name += $" {parametersList[0][0]} {number}";
}
+
break;
}
- case 0x005E: // Movement
+ case 0x005E: // Movement
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.ACTION_ID)}";
break;
- case 0x006A: // GetOverworldPosition
+ case 0x006A: // GetOverworldPosition
name += FormatCmd_Overworld_TwoParams(parametersList);
break;
- case 0x0062: // Lock
- case 0x0063: // Release
- case 0x0064: // AddOW
- case 0x0065: // RemoveOW
+ case 0x0062: // Lock
+ case 0x0063: // Release
+ case 0x0064: // AddOW
+ case 0x0065: // RemoveOW
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)}";
break;
- case 0x006D: // SetOverworldMovement
+ case 0x006D: // SetOverworldMovement
name += FormatCmd_Overworld_Move(parametersList);
break;
- case 0x00B0: // Warp [HGSS]
+ case 0x00B0: // Warp [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Warp(parametersList);
} else {
goto default;
}
+
break;
- case 0x0152: // SetOverworldDefaultPosition [HGSS]
+ case 0x0152: // SetOverworldDefaultPosition [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_TwoParams(parametersList);
} else {
goto default;
}
+
break;
- case 0x0153: // SetOverworldPosition [HGSS]
+ case 0x0153: // SetOverworldPosition [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_3Coords_Dir(parametersList);
} else {
goto default;
}
+
break;
- case 0x0154: // SetOverworldDefaultMovement [HGSS]
+ case 0x0154: // SetOverworldDefaultMovement [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_Move(parametersList);
} else {
goto default;
}
+
break;
- case 0x0155: // SetOverworldDefaultDirection [DPPt]
+ case 0x0155: // SetOverworldDefaultDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_Dir(parametersList);
} else {
goto default;
}
+
break;
- case 0x0158: // SetOverworldDirection [DPPt]
+ case 0x0158: // SetOverworldDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_Dir(parametersList);
} else {
goto default;
}
+
break;
- case 0x00BE: // Warp [DPPt]
+ case 0x00BE: // Warp [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Warp(parametersList);
} else {
goto default;
}
+
break;
- case 0x0186: // SetOverworldDefaultPosition [DPPt]
+ case 0x0186: // SetOverworldDefaultPosition [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_TwoParams(parametersList);
} else {
goto default;
}
+
break;
- case 0x0187: // SetOverworldPosition [DPPt]
+ case 0x0187: // SetOverworldPosition [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_3Coords_Dir(parametersList);
} else {
goto default;
}
+
break;
- case 0x0188: // SetOverworldDefaultMovement [DPPt]
+ case 0x0188: // SetOverworldDefaultMovement [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_Move(parametersList);
} else {
goto default;
}
+
break;
- case 0x0189: // SetOverworldDefaultDirection [DPPt]
+ case 0x0189: // SetOverworldDefaultDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_Dir(parametersList);
} else {
goto default;
}
+
break;
- case 0x018C: // SetOverworldDirection [DPPt]
+ case 0x018C: // SetOverworldDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_Dir(parametersList);
} else {
goto default;
}
+
break;
default:
for (int i = 0; i < parametersList.Count; i++) {
name += $" {FormatNumber(parametersList[i])}";
}
- break;
+ break;
}
+
this.id = id;
this.cmdParams = parametersList;
}
+
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_Overworld_TwoParams(List parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[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_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_Dir(List parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.OW_DIRECTION)}";
}
@@ -212,7 +215,6 @@ namespace DSPRE.ROMFiles {
} else {
try {
id = ushort.Parse(nameParts[0].PurgeSpecial(ScriptFile.specialChars), nameParts[0].GetNumberStyle());
- //id = ushort.Parse(nameParts[0].Substring(nameParts[0].("_")+1), Properties.Settings.Default.scriptEditorFormatPreference, CultureInfo.InvariantCulture);
} catch {
string details;
if (wholeLine.Contains(':') && wholeLine.ContainsNumber()) {
@@ -223,7 +225,7 @@ namespace DSPRE.ROMFiles {
}
MessageBox.Show("This Script file could not be saved." +
- $"\nParser failed to interpret line {lineNumber}: \"{wholeLine}\".\n\n{details}", "Parser error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ $"\nParser failed to interpret line {lineNumber}: \"{wholeLine}\".\n\n{details}", "Parser error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
@@ -235,7 +237,7 @@ namespace DSPRE.ROMFiles {
int paramLength = 0;
int paramsProcessed = 0;
- if (parametersSizeArr.First() == 0xFF) {
+ if (parametersSizeArr.First() == 0xFF) {
int firstParamValue = int.Parse(nameParts[1].PurgeSpecial(ScriptFile.specialChars), nameParts[1].GetNumberStyle());
byte firstParamSize = parametersSizeArr[1];
@@ -262,7 +264,7 @@ namespace DSPRE.ROMFiles {
// 5, 3, (2, 2, 2) => this will be the parameters subarray
// 6, 1, 2
// },
- byte[] subParametersSize = parametersSizeArr.SubArray(i + 2, paramLength++);
+ byte[] subParametersSize = parametersSizeArr.SubArray(i + 2, paramLength++);
//Create a slightly bigger temp array
byte[] temp = new byte[1 + subParametersSize.Length];
@@ -271,26 +273,28 @@ namespace DSPRE.ROMFiles {
temp[0] = firstParamSize;
//Then copy the whole subarray of parameter sizes
- Array.Copy(subParametersSize, 0, temp, 1, temp.Length-1);
+ Array.Copy(subParametersSize, 0, temp, 1, temp.Length - 1);
//Replace the original parametersSizeArr with the new array
parametersSizeArr = temp;
found = true;
break;
}
+
i += 2 + paramLength;
optionsCount++;
}
+
if (!found) {
MessageBox.Show($"Command {nameParts[0]} is a special Script Command.\n" +
- $"The value of the first parameter must be a number in the range [0 - {optionsCount}].\n\n" +
- $"Line {lineNumber}: {wholeLine}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ $"The value of the first parameter must be a number in the range [0 - {optionsCount}].\n\n" +
+ $"Line {lineNumber}: {wholeLine}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = null;
return;
}
} else if (parametersSizeArr.Length == 1 && parametersSizeArr.First() == 0) {
paramLength = 0;
- } else {
+ } else {
paramLength = parametersSizeArr.Length;
}
@@ -304,7 +308,7 @@ namespace DSPRE.ROMFiles {
/* Convert strings of parameters to the correct datatypes */
NumberStyles numStyle = nameParts[i + 1].GetNumberStyle();
nameParts[i + 1] = nameParts[i + 1].PurgeSpecial(ScriptFile.specialChars);
-
+
int result = 0;
try {
@@ -312,9 +316,9 @@ namespace DSPRE.ROMFiles {
} catch {
if (string.IsNullOrWhiteSpace(nameParts[i + 1])) {
MessageBox.Show($"You must specify an Overworld ID, Script, Function or Action number.\n\n" +
- $"Line {lineNumber}: {wholeLine}", "Unspecified identifier", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ $"Line {lineNumber}: {wholeLine}", "Unspecified identifier", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = null;
- } else {
+ } else {
var first = ScriptDatabase.specialOverworlds.FirstOrDefault(x => x.Value.IgnoreCaseEquals(nameParts[i + 1]));
if (string.IsNullOrWhiteSpace(first.Value)) {
@@ -322,7 +326,7 @@ namespace DSPRE.ROMFiles {
if (string.IsNullOrWhiteSpace(res.Value)) {
MessageBox.Show($"Argument {nameParts[i + 1]} couldn't be parsed as a valid Condition, Overworld ID, Direction ID, Script, Function or Action number.\n\n" +
- $"Line {lineNumber}: {wholeLine}", "Invalid identifier", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ $"Line {lineNumber}: {wholeLine}", "Invalid identifier", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = null;
} else {
result = res.Key;
@@ -343,14 +347,12 @@ namespace DSPRE.ROMFiles {
}
} else {
MessageBox.Show($"Wrong number of parameters for command {nameParts[0]} at line {lineNumber}.\n" +
- $"Received: {nameParts.Length - 1}\n" +
- $"Expected: {paramLength}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ $"Received: {nameParts.Length - 1}\n" +
+ $"Expected: {paramLength}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = null;
}
}
- #endregion
- #region Utilities
private string FormatNumber(byte[] par, ParamTypeEnum paramType = ParamTypeEnum.INTEGER) {
//number acquisition
uint num;
@@ -365,8 +367,10 @@ namespace DSPRE.ROMFiles {
} else {
throw new InvalidOperationException();
}
+
return FormatNumber(num, paramType);
}
+
private string FormatNumber(uint num, ParamTypeEnum paramType = ParamTypeEnum.INTEGER) {
//differentiate depending on param type
string formatOverride;
@@ -387,36 +391,37 @@ namespace DSPRE.ROMFiles {
return "CMD_" + prefix + num.ToString(formatOverride + '3');
case ParamTypeEnum.FUNCTION_ID:
- return containerTypes.Function.ToString() + "#" + num;
+ return ScriptFile.ContainerTypes.Function.ToString() + "#" + num;
case ParamTypeEnum.ACTION_ID:
- return containerTypes.Action.ToString() + "#" + num;
+ return ScriptFile.ContainerTypes.Action.ToString() + "#" + num;
case ParamTypeEnum.OW_MOVEMENT_TYPE:
if (num < 4000) {
outp += "Move.";
}
+
goto default;
- case ParamTypeEnum.OW_ID:
- {
+ case ParamTypeEnum.OW_ID: {
if (ScriptDatabase.specialOverworlds.TryGetValue((ushort)num, out string output)) {
return output;
} else {
if (num < 4000) {
- outp += $"{EventType.Overworld}.";
+ outp += $"{Event.EventType.Overworld}.";
}
+
goto default;
}
}
- case ParamTypeEnum.OW_DIRECTION:
- {
+ case ParamTypeEnum.OW_DIRECTION: {
if (ScriptDatabase.overworldDirections.TryGetValue((byte)num, out string output)) {
return output;
} else {
if (num < 4000) {
outp += $"Direction.";
}
+
goto default;
}
}
@@ -427,15 +432,16 @@ namespace DSPRE.ROMFiles {
prefix = "0x";
}
}
+
outp += prefix + num.ToString(formatOverride);
break;
}
-
+
return outp;
}
+
public override string ToString() {
return name + " (" + ((ushort)id).ToString("X") + ")";
}
- #endregion
}
}
diff --git a/DS_Map/ROMFiles/ScriptCommandContainer.cs b/DS_Map/ROMFiles/ScriptCommandContainer.cs
new file mode 100644
index 0000000..e374cea
--- /dev/null
+++ b/DS_Map/ROMFiles/ScriptCommandContainer.cs
@@ -0,0 +1,25 @@
+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/ScriptFile.cs b/DS_Map/ROMFiles/ScriptFile.cs
index 864abdc..4e6f223 100644
--- a/DS_Map/ROMFiles/ScriptFile.cs
+++ b/DS_Map/ROMFiles/ScriptFile.cs
@@ -1,67 +1,64 @@
using DSPRE.Resources;
-using ScintillaNET;
using System;
using System.Collections.Generic;
-using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows.Forms;
-using static DSPRE.ROMFiles.ScriptFile;
-using static DSPRE.RomInfo;
namespace DSPRE.ROMFiles {
///
/// Class to store script file data in Pokémon NDS games
///
public class ScriptFile : RomFile {
- #region Constants
//this enum doesn't really make much sense now but it will, once scripts can be called and jumped to
- public enum containerTypes { Function, Action, Script };
+ public enum ContainerTypes {
+ Function,
+ Action,
+ Script
+ };
public struct ContainerReference {
public uint ID;
public uint offsetInFile;
}
- #endregion
-
- #region Fields (3)
- public List allScripts = new List();
- public List allFunctions = new List();
- public List allActions = new List();
- public int? fileID = null;
+ 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 static readonly char[] specialChars = { 'x', 'X', '#', '.', '_' };
- #endregion
+ public bool hasNoScripts { get { return fileID == int.MaxValue; } }
- #region Constructors (1)
+ 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();
- using (BinaryReader scrReader = new BinaryReader(fs)) {
+ 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
try {
while (true) {
- uint checker = scrReader.ReadUInt16();
- scrReader.BaseStream.Position -= 0x2;
- uint value = scrReader.ReadUInt32();
+ uint checker = br.ReadUInt16();
+ br.BaseStream.Position -= 0x2;
+ uint value = br.ReadUInt32();
if (value == 0 && scriptOffsets.Count == 0) {
isLevelScript = true;
break;
- } else if (checker == 0xFD13) {
- scrReader.BaseStream.Position -= 0x4;
+ }
+
+ if (checker == 0xFD13) {
+ br.BaseStream.Position -= 0x4;
isLevelScript = false;
break;
- } else {
- int offsetFromStart = (int)(value + scrReader.BaseStream.Position); // Don't change order of addition
- scriptOffsets.Add(offsetFromStart);
}
+
+ int offsetFromStart = (int)(value + br.BaseStream.Position); // Don't change order of addition
+ scriptOffsets.Add(offsetFromStart);
}
} catch (EndOfStreamException) {
if (!isLevelScript) {
@@ -78,12 +75,12 @@ namespace DSPRE.ROMFiles {
int index = scriptOffsets.FindIndex(x => x == scriptOffsets[(int)current]); // Check for UseScript
if (index == current) {
- scrReader.BaseStream.Position = scriptOffsets[(int)current];
+ br.BaseStream.Position = scriptOffsets[(int)current];
List cmdList = new List();
bool endScript = new bool();
while (!endScript) {
- ScriptCommand cmd = ReadCommand(scrReader, ref functionOffsets, ref movementOffsets);
+ ScriptCommand cmd = ReadCommand(br, ref functionOffsets, ref movementOffsets);
if (cmd.cmdParams is null) {
return;
}
@@ -94,23 +91,24 @@ namespace DSPRE.ROMFiles {
endScript = true;
}
}
- allScripts.Add(new CommandContainer(current + 1, containerTypes.Script, commandList: cmdList));
+
+ allScripts.Add(new ScriptCommandContainer(current + 1, ContainerTypes.Script, commandList: cmdList));
} else {
- allScripts.Add(new CommandContainer(current + 1, containerTypes.Script, useScript: index + 1));
+ allScripts.Add(new ScriptCommandContainer(current + 1, ContainerTypes.Script, usedScriptID: index + 1));
}
}
/* Read functions */
if (readFunctions) {
for (uint current = 0; current < functionOffsets.Count; current++) {
- scrReader.BaseStream.Position = functionOffsets[(int)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(scrReader, ref functionOffsets, ref movementOffsets);
+ ScriptCommand command = ReadCommand(br, ref functionOffsets, ref movementOffsets);
if (command.cmdParams is null) {
return;
}
@@ -120,9 +118,10 @@ namespace DSPRE.ROMFiles {
endFunction = true;
}
}
- allFunctions.Add(new CommandContainer(current + 1, containerTypes.Function, commandList: cmdList));
+
+ allFunctions.Add(new ScriptCommandContainer(current + 1, ContainerTypes.Function, commandList: cmdList));
} else {
- allFunctions.Add(new CommandContainer(current + 1, containerTypes.Function, useScript: posInList + 1));
+ allFunctions.Add(new ScriptCommandContainer(current + 1, ContainerTypes.Function, usedScriptID: posInList + 1));
}
}
}
@@ -130,53 +129,65 @@ namespace DSPRE.ROMFiles {
if (readActions) {
/* Read movements */
for (uint current = 0; current < movementOffsets.Count; current++) {
- scrReader.BaseStream.Position = movementOffsets[(int)current];
+ br.BaseStream.Position = movementOffsets[(int)current];
List cmdList = new List();
bool endMovement = new bool();
while (!endMovement) {
- ushort id = scrReader.ReadUInt16();
+ ushort id = br.ReadUInt16();
if (id == 0xFE) {
endMovement = true;
cmdList.Add(new ScriptAction(id, 0));
} else {
- cmdList.Add(new ScriptAction(id, scrReader.ReadUInt16()));
+ cmdList.Add(new ScriptAction(id, br.ReadUInt16()));
}
}
- allActions.Add(new ActionContainer(current + 1, actionCommandsList: cmdList));
+
+ allActions.Add(new ScriptActionContainer(current + 1, commands: cmdList));
}
}
}
}
- public ScriptFile(int fileID, bool readFunctions = true, bool readActions = true) :
- this(new FileStream(RomInfo.gameDirs[DirNames.scripts].unpackedDir + "\\" + fileID.ToString("D4"), FileMode.Open), readFunctions, readActions) {
+ public ScriptFile(int fileID, bool readFunctions = true, bool readActions = true) : this(getFileStream(fileID), readFunctions, readActions) {
this.fileID = fileID;
}
- public ScriptFile(List scripts, List functions, List movements, int fileID = -1) {
+
+ static FileStream getFileStream(int fileID) {
+ string path = Filesystem.GetScriptPath(fileID);
+ return new FileStream(path, FileMode.OpenOrCreate);
+ }
+
+ public override string ToString() {
+ string prefix = isLevelScript ? "Level " : "";
+ 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
+ || 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);
+ 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
+ allScripts = ReadCommandsFromLines(scriptLines.ToList(), ContainerTypes.Script, scriptEndCondition); //Jump + whitespace
if (allScripts is null) {
return;
}
@@ -187,7 +198,7 @@ namespace DSPRE.ROMFiles {
}
if (functionLines != null) {
- allFunctions = ReadCommandsFromLines(functionLines.ToList(), containerTypes.Function, functionEndCondition); //Jump + whitespace
+ allFunctions = ReadCommandsFromLines(functionLines.ToList(), ContainerTypes.Function, functionEndCondition); //Jump + whitespace
if (allFunctions is null) {
return;
}
@@ -202,17 +213,15 @@ namespace DSPRE.ROMFiles {
this.fileID = fileID;
}
- #endregion
- #region Methods (1)
private ScriptCommand ReadCommand(BinaryReader dataReader, ref List functionOffsets, ref List actionOffsets) {
ushort id = dataReader.ReadUInt16();
List parameterList = new List();
/* How to read parameters for different commands for DPPt*/
switch (RomInfo.gameFamily) {
- case GameFamilies.DP:
- case GameFamilies.Plat:
+ case RomInfo.GameFamilies.DP:
+ case RomInfo.GameFamilies.Plat:
switch (id) {
case 0x16: //Jump
case 0x1A: //Call
@@ -223,15 +232,15 @@ namespace DSPRE.ROMFiles {
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
+ //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
case 0x2A1: // Movement2
- //in the case of Movement, the first param is an overworld ID
+ //in the case of Movement, the first param is an overworld ID
parameterList.Add(BitConverter.GetBytes(dataReader.ReadUInt16()));
ProcessRelativeJump(dataReader, ref parameterList, ref actionOffsets);
break;
@@ -318,7 +327,7 @@ namespace DSPRE.ROMFiles {
}
break;
case 0x2C5: {
- if (RomInfo.gameVersion == GameVersions.Platinum) {
+ if (RomInfo.gameVersion == RomInfo.GameVersions.Platinum) {
parameterList.Add(dataReader.ReadBytes(2));
parameterList.Add(dataReader.ReadBytes(2));
} else {
@@ -330,25 +339,27 @@ namespace DSPRE.ROMFiles {
case 0x2C9:
case 0x2CA:
case 0x2CD:
- if (RomInfo.gameVersion == GameVersions.Platinum) {
+ if (RomInfo.gameVersion == RomInfo.GameVersions.Platinum) {
break;
} else {
goto default;
}
case 0x2CF:
- if (RomInfo.gameVersion == GameVersions.Platinum) {
+ if (RomInfo.gameVersion == RomInfo.GameVersions.Platinum) {
parameterList.Add(dataReader.ReadBytes(2));
parameterList.Add(dataReader.ReadBytes(2));
} else {
goto default;
}
+
break;
default:
addParametersToList(ref parameterList, id, dataReader);
break;
}
+
break;
- case GameFamilies.HGSS:
+ case RomInfo.GameFamilies.HGSS:
switch (id) {
case 0x16: //Jump
case 0x1A: //Call
@@ -377,7 +388,7 @@ namespace DSPRE.ROMFiles {
}
break;
case 0x1D1: // Number of parameters differ depending on the first parameter value
- {
+ {
short parameter1 = dataReader.ReadInt16();
parameterList.Add(BitConverter.GetBytes(parameter1));
switch (parameter1) {
@@ -403,7 +414,7 @@ namespace DSPRE.ROMFiles {
}
break;
case 0x1E9: // Number of parameters differ depending on the first parameter value
- {
+ {
short parameter1 = dataReader.ReadInt16();
parameterList.Add(BitConverter.GetBytes(parameter1));
switch (parameter1) {
@@ -433,8 +444,10 @@ namespace DSPRE.ROMFiles {
addParametersToList(ref parameterList, id, dataReader);
break;
}
+
break;
}
+
return new ScriptCommand(id, parameterList);
}
@@ -462,28 +475,30 @@ namespace DSPRE.ROMFiles {
}
} 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);
+ 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);
+ 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, CommandContainer cont) {
+
+ 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
+ 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));
+ 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));
+ 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) {
+
+ 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++) {
@@ -493,7 +508,7 @@ namespace DSPRE.ROMFiles {
}
}
- List ls = new List();
+ List ls = new List();
int i = 0;
try {
@@ -516,12 +531,13 @@ namespace DSPRE.ROMFiles {
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 CommandContainer(scriptNumber, containerType, useScriptNumber));
+ ls.Add(new ScriptCommandContainer(scriptNumber, containerType, useScriptNumber));
i++;
} else {
/* Read script commands */
@@ -535,23 +551,25 @@ namespace DSPRE.ROMFiles {
}
cmdList.Add(lastRead);
- } while (!endConditions(lineSource, i++, lastRead.id));
+ }
+ while (!endConditions(lineSource, i++, lastRead.id));
- ls.Add(new CommandContainer(scriptNumber, containerType, commandList: cmdList));
+ 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);
+ $"Last line index: {lineSource[i].linenum}.\n" +
+ $"Managed to parse {ls.Count} Command Containers.", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
return ls;
}
- private List ReadActionsFromLines(List linelist) {
+ private List ReadActionsFromLines(List linelist) {
List<(int linenum, string text)> lineSource = new List<(int linenum, string text)>();
for (int l = 0; l < linelist.Count; l++) {
@@ -561,7 +579,7 @@ namespace DSPRE.ROMFiles {
}
}
- List ls = new List();
+ List ls = new List();
int i = 0;
try {
@@ -570,7 +588,7 @@ namespace DSPRE.ROMFiles {
while (i < lineSource.Count) {
if (actionNumber == 0) {
int positionOfActionNumber;
- int positionOfActionKeyword = lineSource[i].text.IndexOf(containerTypes.Action.ToString(), StringComparison.InvariantCultureIgnoreCase);
+ 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);
@@ -584,6 +602,7 @@ namespace DSPRE.ROMFiles {
return null;
}
}
+
actionNumber = uint.Parse(lineSource[i].text.Substring(positionOfActionNumber).Split()[0].Replace(":", ""));
i++;
}
@@ -597,23 +616,22 @@ namespace DSPRE.ROMFiles {
}
cmdList.Add(toAdd);
+ }
+ while (!lineSource[i++].text.IgnoreCaseEquals(RomInfo.ScriptActionNamesDict[0x00FE]));
- } while (!lineSource[i++].text.IgnoreCaseEquals(RomInfo.ScriptActionNamesDict[0x00FE]));
-
- ls.Add(new ActionContainer(actionNumber, actionCommandsList: cmdList));
+ ls.Add(new ScriptActionContainer(actionNumber, commands: cmdList));
actionNumber = 0;
}
} 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);
+ $"Last line index: {i}.\n" +
+ $"Managed to parse {ls.Count} Command Containers.", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
return ls;
}
- #region Output
public override byte[] ToByteArray() {
MemoryStream newData = new MemoryStream();
using (BinaryWriter writer = new BinaryWriter(newData)) {
@@ -627,11 +645,11 @@ namespace DSPRE.ROMFiles {
try {
writer.BaseStream.Position += allScripts.Count * 0x4;
writer.Write((ushort)0xFD13); // Signal the end of header section
- List useScriptCallers = new List();
+ List useScriptCallers = new List();
/* Write scripts */
- foreach (CommandContainer currentScript in allScripts) {
- if (currentScript.usedScript == -1) {
+ foreach (ScriptCommandContainer currentScript in allScripts) {
+ if (currentScript.usedScriptID == -1) {
scriptOffsets.Add(new ContainerReference() {
ID = currentScript.manualUserID,
offsetInFile = (uint)writer.BaseStream.Position
@@ -657,22 +675,22 @@ namespace DSPRE.ROMFiles {
}
int scriptsCount = scriptOffsets.Count;
- foreach (CommandContainer caller in useScriptCallers) {
+ foreach (ScriptCommandContainer caller in useScriptCallers) {
for (int i = 0; i < scriptsCount; i++) {
ContainerReference scriptReference = scriptOffsets[i];
- if (scriptReference.ID == caller.usedScript) {
+ if (scriptReference.ID == caller.usedScriptID) {
scriptOffsets.Add(new ContainerReference() {
ID = caller.manualUserID,
offsetInFile = scriptReference.offsetInFile
- });// If script has UseScript, copy offset
+ }); // If script has UseScript, copy offset
}
}
}
/* Write functions */
- foreach (CommandContainer currentFunction in allFunctions) {
- if (currentFunction.usedScript == -1) {
+ foreach (ScriptCommandContainer currentFunction in allFunctions) {
+ if (currentFunction.usedScriptID == -1) {
functionOffsets.Add(new ContainerReference() {
ID = currentFunction.manualUserID,
offsetInFile = (uint)writer.BaseStream.Position
@@ -694,20 +712,16 @@ namespace DSPRE.ROMFiles {
AddReference(ref refList, (ushort)currentCmd.id, parameterList, (int)writer.BaseStream.Position, currentFunction);
}
} else {
- int functionUsescript = currentFunction.usedScript - 1;
-
- //Find script with same ID as the function's referenced UseScript
- int scriptUsedByFunction = scriptOffsets.FindIndex(ind => ind.ID == currentFunction.usedScript);
-
- if (functionUsescript >= scriptOffsets.Count || scriptUsedByFunction < 0) {
- MessageBox.Show($"Function #{currentFunction.manualUserID} refers to Script {currentFunction.usedScript}, which does not exist.\n" +
- $"This Script File can't be saved.", "Can't resolve UseScript reference", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ 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[scriptUsedByFunction].offsetInFile
+ offsetInFile = scriptOffsets[currentFunction.usedScriptID - 1].offsetInFile
});
}
}
@@ -718,13 +732,13 @@ namespace DSPRE.ROMFiles {
}
/* Write movements */
- foreach (ActionContainer currentAction in allActions) {
+ foreach (ScriptActionContainer currentAction in allActions) {
actionOffsets.Add(new ContainerReference() {
ID = currentAction.manualUserID,
offsetInFile = (uint)writer.BaseStream.Position
});
- foreach (ScriptAction currentCmd in currentAction.actionCommandsList) {
+ foreach (ScriptAction currentCmd in currentAction.commands) {
writer.Write((ushort)currentCmd.id);
writer.Write((ushort)currentCmd.repetitionCount);
}
@@ -738,7 +752,6 @@ namespace DSPRE.ROMFiles {
writer.Write(scriptOffsets[i].offsetInFile - (uint)writer.BaseStream.Position - 0x4);
}
-
SortedSet undeclaredFuncs = new SortedSet();
SortedSet undeclaredActions = new SortedSet();
@@ -751,7 +764,7 @@ namespace DSPRE.ROMFiles {
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
+ if (refList[i].typeOfInvoked is ContainerTypes.Action) { //isApplyMovement
result = actionOffsets.Find(entry => entry.ID == refList[i].invokedID);
if (result.Equals(default(ContainerReference))) {
@@ -770,12 +783,10 @@ namespace DSPRE.ROMFiles {
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
@@ -792,11 +803,13 @@ namespace DSPRE.ROMFiles {
errorMsg += "These Functions have been invoked but not declared: " + Environment.NewLine + string.Join(separator: ",", errorFunctionsUndeclared);
errorMsg += Environment.NewLine;
}
+
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 = "";
@@ -811,6 +824,7 @@ namespace DSPRE.ROMFiles {
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);
@@ -819,6 +833,7 @@ namespace DSPRE.ROMFiles {
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 = "";
@@ -835,8 +850,8 @@ namespace DSPRE.ROMFiles {
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);
+ "\nIt is recommended that you backup its code somewhere, to avoid losing progress.",
+ "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
@@ -860,12 +875,12 @@ namespace DSPRE.ROMFiles {
return false;
}
- if (sr.typeOfCaller is containerTypes.Script) {
+ 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 (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;
@@ -877,8 +892,9 @@ namespace DSPRE.ROMFiles {
}
public bool SaveToFileDefaultDir(int IDtoReplace, bool showSuccessMessage = true) {
- return SaveToFileDefaultDir(DirNames.scripts, IDtoReplace, showSuccessMessage);
+ return SaveToFileDefaultDir(RomInfo.DirNames.scripts, IDtoReplace, showSuccessMessage);
}
+
public void SaveToFileExplorePath(string suggestedFileName, bool blindmode) {
SaveFileDialog sf = new SaveFileDialog {
Filter = "Gen IV Script File (*.scr)|*.scr"
@@ -893,7 +909,8 @@ namespace DSPRE.ROMFiles {
}
if (blindmode) {
- File.Copy(RomInfo.gameDirs[DirNames.scripts].unpackedDir + "\\" + ((int)fileID).ToString("D4"), sf.FileName, overwrite: true);
+ string path = Filesystem.GetScriptPath(fileID);
+ File.Copy(path, sf.FileName, overwrite: true);
string msg = "";
if (!isLevelScript) {
@@ -905,28 +922,5 @@ namespace DSPRE.ROMFiles {
this.SaveToFile(sf.FileName, showSuccessMessage: true);
}
}
- #endregion
- #endregion
}
-
- internal class ScriptReference {
- public containerTypes typeOfCaller { get; private set; }
- public uint callerID { get; private set; }
- public containerTypes typeOfInvoked { get; private set; }
- public uint invokedID { get; private set; }
- public int invokedAt { get; private set; }
-
- public ScriptReference(containerTypes typeOfCaller, uint callerID, containerTypes invokedType, uint invokedID, int invokedAt) {
- this.typeOfCaller = typeOfCaller;
- this.callerID = callerID;
- this.typeOfInvoked = invokedType;
- this.invokedID = invokedID;
-
- this.invokedAt = invokedAt;
- }
-
- public override string ToString() {
- return typeOfCaller + " " + callerID + " invokes " + typeOfInvoked + " " + invokedID + " at " + invokedAt;
- }
- }
-}
\ No newline at end of file
+}
diff --git a/DS_Map/ROMFiles/ScriptReference.cs b/DS_Map/ROMFiles/ScriptReference.cs
new file mode 100644
index 0000000..4b5eec1
--- /dev/null
+++ b/DS_Map/ROMFiles/ScriptReference.cs
@@ -0,0 +1,22 @@
+namespace DSPRE.ROMFiles {
+ internal class ScriptReference {
+ public ScriptFile.ContainerTypes typeOfCaller { get; private set; }
+ public uint callerID { get; private set; }
+ public ScriptFile.ContainerTypes typeOfInvoked { get; private set; }
+ public uint invokedID { get; private set; }
+ public int invokedAt { get; private set; }
+
+ public ScriptReference(ScriptFile.ContainerTypes typeOfCaller, uint callerID, ScriptFile.ContainerTypes invokedType, uint invokedID, int invokedAt) {
+ this.typeOfCaller = typeOfCaller;
+ this.callerID = callerID;
+ this.typeOfInvoked = invokedType;
+ this.invokedID = invokedID;
+
+ this.invokedAt = invokedAt;
+ }
+
+ public override string ToString() {
+ return typeOfCaller + " " + callerID + " invokes " + typeOfInvoked + " " + invokedID + " at " + invokedAt;
+ }
+ }
+}
diff --git a/DS_Map/ROMFiles/VariableValueTrigger.cs b/DS_Map/ROMFiles/VariableValueTrigger.cs
new file mode 100644
index 0000000..1c03c73
--- /dev/null
+++ b/DS_Map/ROMFiles/VariableValueTrigger.cs
@@ -0,0 +1,32 @@
+namespace DSPRE.ROMFiles {
+ public class VariableValueTrigger : LevelScriptTrigger {
+ public int variableToWatch { get; set; }
+ public int expectedValue { get; set; }
+
+ public VariableValueTrigger(int scriptIDtoTrigger, int variableToWatch, int expectedValue) : base(VARIABLEVALUE, scriptIDtoTrigger) {
+ this.variableToWatch = variableToWatch;
+ this.expectedValue = expectedValue;
+ }
+
+ public override string ToString() {
+ return base.ToString() + " when Var " + variableToWatch + " == " + expectedValue;
+ }
+
+ public override bool Equals(object obj) {
+ // If the passed object is null
+ if (obj == null) {
+ return false;
+ }
+
+ if (!(obj is VariableValueTrigger)) {
+ return false;
+ }
+
+ return this.ToString() == ((VariableValueTrigger)obj).ToString();
+ }
+
+ public override int GetHashCode() {
+ return this.triggerType.GetHashCode() ^ variableToWatch.GetHashCode() ^ expectedValue.GetHashCode();
+ }
+ }
+}
diff --git a/DS_Map/ROMToolboxDialog.cs b/DS_Map/ROMToolboxDialog.cs
index d5b9b18..98f86ba 100644
--- a/DS_Map/ROMToolboxDialog.cs
+++ b/DS_Map/ROMToolboxDialog.cs
@@ -461,8 +461,7 @@ namespace DSPRE {
private void ApplyItemStandardizeButton_Click(object sender, EventArgs e) {
DialogResult d = MessageBox.Show("This process will apply the following changes:\n\n" +
- "- Item scripts will be rearranged to follow the natural, ascending index order.\n\n" +
- "- Any unsaved change to the current Event File will be discarded.\n\n",
+ "- Item scripts will be rearranged to follow the natural, ascending index order.\n\n",
"Confirm to proceed", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (d == DialogResult.Yes) {
@@ -478,59 +477,35 @@ namespace DSPRE {
ScriptFile itemScriptFile = new ScriptFile(RomInfo.itemScriptFileNumber);
// Create map for: script no. -> vanilla item
- int[] vanillaItemsArray = new int[itemScriptFile.allScripts.Count - 1];
+ int[] vanillaItemsArray = new int[itemScriptFile.allScripts.Count];
for (int i = 0; i < itemScriptFile.allScripts.Count - 1; i++) {
vanillaItemsArray[i] = BitConverter.ToInt16(itemScriptFile.allScripts[i].commands[0].cmdParams[1], 0);
- };
+ }
// Parse all event files and fix instances of ground items according to the new order
- int cnt = RomInfo.GetEventFileCount();
- (int min, int max) itemScriptRange = (7000, 8000);
-
- for (int i = 0; i < cnt; i++) {
- bool dirty = false;
-
+ for (int i = 0; i < Filesystem.GetEventFileCount(); i++) {
EventFile eventFile = new EventFile(i);
for (int j = 0; j < eventFile.overworlds.Count; j++) {
// If ow is marked as an item, or in the rare case it is not but script no. falls within item script range:
bool isItem = eventFile.overworlds[j].type == (ushort)Overworld.OwType.ITEM
- || (eventFile.overworlds[j].scriptNumber >= itemScriptRange.min
- && eventFile.overworlds[j].scriptNumber <= itemScriptRange.max);
+ || (eventFile.overworlds[j].scriptNumber >= 7000
+ && eventFile.overworlds[j].scriptNumber <= 8000);
if (isItem) {
- int itemScriptID = eventFile.overworlds[j].scriptNumber - (itemScriptRange.min - 1);
- eventFile.overworlds[j].scriptNumber = (ushort)(itemScriptRange.min + vanillaItemsArray[itemScriptID - 1]);
- dirty = true;
+ int itemScriptID = eventFile.overworlds[j].scriptNumber - 6999;
+ eventFile.overworlds[j].scriptNumber = (ushort)(7000 + vanillaItemsArray[itemScriptID - 1]);
}
}
// Save event file
- if (dirty) {
- eventFile.SaveToFileDefaultDir(i, showSuccessMessage: false);
- }
- };
-
- //Distortion world - turnback cave Griseous Orb fix
- if (gameFamily.Equals(GameFamilies.Plat)) {
- string ow9path = DSUtils.GetOverlayPath(9);
- int ow9offs = 0x8E20 + 10;
-
- int itemScriptID;
-
- using (DSUtils.EasyReader ewr = new DSUtils.EasyReader(ow9path, ow9offs)) {
- itemScriptID = ewr.ReadUInt16() - (itemScriptRange.min - 1);
- }
-
- using (DSUtils.EasyWriter ewr = new DSUtils.EasyWriter(ow9path, ow9offs)) {
- ewr.Write((ushort)(itemScriptRange.min + vanillaItemsArray[itemScriptID - 1]));
- }
+ eventFile.SaveToFileDefaultDir(i, showSuccessMessage: false);
}
// Sort scripts in the Script File according to item indices
int itemCount = new TextArchive(RomInfo.itemNamesTextNumber).messages.Count;
- CommandContainer executeGive = new CommandContainer((uint)itemCount + 1, itemScriptFile.allScripts[itemScriptFile.allScripts.Count - 1]);
+ ScriptCommandContainer executeGive = new ScriptCommandContainer((uint)itemCount, itemScriptFile.allScripts[itemScriptFile.allScripts.Count - 1]);
itemScriptFile.allScripts.Clear();
@@ -542,11 +517,11 @@ namespace DSPRE {
new ScriptCommand("Jump Function_#1")
};
- itemScriptFile.allScripts.Add(new CommandContainer((ushort)(i + 1), ScriptFile.containerTypes.Script, commandList: cmdList));
+ itemScriptFile.allScripts.Add(new ScriptCommandContainer((ushort)(i + 1), ScriptFile.ContainerTypes.Script, commandList: cmdList));
}
itemScriptFile.allScripts.Add(executeGive);
- itemScriptFile.allFunctions[0].usedScript = itemCount + 1;
+ 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/Resources/ScriptDatabase.cs b/DS_Map/Resources/ScriptDatabase.cs
index a70e808..a402edc 100644
--- a/DS_Map/Resources/ScriptDatabase.cs
+++ b/DS_Map/Resources/ScriptDatabase.cs
@@ -156,6 +156,10 @@ namespace DSPRE.Resources {
[0x00FE] = "End"
};
+ public static HashSet movementEndCodes = new HashSet() {
+ 0x00FE,
+ };
+
public static Dictionary DPPtScrCmdNames = new Dictionary() {
[0x0000] = "Nop",
[0x0001] = "Dummy",