Added the levelscript editor

Co-authored-by: Cuddlyogre <cuddlyogre@users.noreply.github.com>
This commit is contained in:
Miguel Terol Espino
2024-03-03 17:35:34 +01:00
committed by Mixone-FinallyHere
parent 0408e2ba44
commit 5bfbde28e9
34 changed files with 4643 additions and 2347 deletions

View File

@@ -95,6 +95,19 @@
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Compile Include="EditorPanels.cs" />
<Compile Include="Editors\LevelScriptEditor.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Editors\LevelScriptEditor.Designer.cs">
<DependentUpon>LevelScriptEditor.cs</DependentUpon>
</Compile>
<Compile Include="Editors\ScriptEditor.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Editors\ScriptEditor.Designer.cs">
<DependentUpon>ScriptEditor.cs</DependentUpon>
</Compile>
<Compile Include="EventFileImport.cs">
<SubType>Form</SubType>
</Compile>
@@ -107,6 +120,7 @@
<Compile Include="EvolutionsEditor.designer.cs">
<DependentUpon>EvolutionsEditor.cs</DependentUpon>
</Compile>
<Compile Include="ExtensionMethods.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="Filesystem.cs" />
<Compile Include="GameCamera.cs" />
@@ -164,12 +178,28 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="ROMFiles\EvolutionFile.cs" />
<Compile Include="ROMFiles\HeadbuttEncounter.cs" />
<Compile Include="ROMFiles\HeadbuttEncounterFile.cs" />
<Compile Include="ROMFiles\HeadbuttEncounterMap.cs" />
<Compile Include="ROMFiles\HeadbuttTree.cs" />
<Compile Include="ROMFiles\HeadbuttTreeGroup.cs" />
<Compile Include="ROMFiles\LearnsetData.cs" />
<Compile Include="ROMFiles\LevelScriptFile.cs" />
<Compile Include="ROMFiles\LevelScriptTrigger.cs" />
<Compile Include="ROMFiles\MapScreenLoadTrigger.cs" />
<Compile Include="ROMFiles\PokemonPersonalData.cs" />
<Compile Include="ROMFiles\RomFile.cs" />
<Compile Include="ROMFiles\SafariZoneEncounter.cs" />
<Compile Include="ROMFiles\SafariZoneEncounterFile.cs" />
<Compile Include="ROMFiles\SafariZoneEncounterGroup.cs" />
<Compile Include="ROMFiles\SafariZoneObjectRequirement.cs" />
<Compile Include="ROMFiles\ScriptAction.cs" />
<Compile Include="ROMFiles\ScriptActionContainer.cs" />
<Compile Include="ROMFiles\ScriptCommandContainer.cs" />
<Compile Include="ROMFiles\ScriptReference.cs" />
<Compile Include="ROMFiles\SpeciesFile.cs" />
<Compile Include="ROMFiles\TrainerFile.cs" />
<Compile Include="ROMFiles\VariableValueTrigger.cs" />
<Compile Include="ROMToolboxDialog.cs">
<SubType>Form</SubType>
</Compile>
@@ -281,6 +311,12 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\writeText.Designer.cs" />
<EmbeddedResource Include="Editors\LevelScriptEditor.resx">
<DependentUpon>LevelScriptEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Editors\ScriptEditor.resx">
<DependentUpon>ScriptEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="EventFileImport.resx">
<DependentUpon>EventFileImport.cs</DependentUpon>
</EmbeddedResource>

20
DS_Map/EditorPanels.cs Normal file
View File

@@ -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; } }
}
}

View File

@@ -0,0 +1,458 @@
using System.ComponentModel;
namespace DSPRE.Editors {
partial class LevelScriptEditor {
/// <summary>
/// Required designer variable.
/// </summary>
private IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@@ -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> { 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();
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

917
DS_Map/Editors/ScriptEditor.Designer.cs generated Normal file
View File

@@ -0,0 +1,917 @@

namespace DSPRE.Editors
{
partial class ScriptEditor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,71 @@
using System;
using System.Windows.Forms;
namespace DSPRE {
public static class ExtensionMethods {
/// <summary>
/// Increment the progress bar value, without using Windows Aero animation
/// </summary>
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
/// <summary>
/// Sets the progress bar value, without using Windows Aero animation
/// </summary>
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();
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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") {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -117,6 +117,96 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="mainTabImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>239, 17</value>
</metadata>
<data name="mainTabImageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2lu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QL/Cw==
</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="worldmapCoordsPasteButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@@ -946,96 +1036,6 @@
p3S+M+m1V1me9QgCUQNXX2YRT1sYHBiEP3wHVbp3PF3cB40GbrzN86xHENrScf1NDsl8FaI4jODMHOgS
SOacfYAmbr5XeNYjGH7yDReXv+JeNIUhUYwFpmZjDz+nMLf5B3b2rcZ5tju4ntjtFw4T54j+v2g/t9NH
9AiCIPwGJelqUAd/T3AAAAAASUVORK5CYII=
</value>
</data>
<metadata name="mainTabImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>239, 17</value>
</metadata>
<data name="mainTabImageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM
EgAAAk1TRnQBSQFMAgEBCgEAAbABGwGwARsBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHW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MBwwQAAYQBfwGDAYIEAAGEAT8BhwGABAABjAF/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==
</value>
</data>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
@@ -1047,6 +1047,9 @@
<metadata name="mainToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>386, 19</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>533, 20</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>62</value>
</metadata>

View File

@@ -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}";
}
}
}

View File

@@ -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<HeadbuttEncounter> normalEncounters;
public List<HeadbuttEncounter> specialEncounters;
public BindingList<HeadbuttTreeGroup> normalTreeGroups;
public BindingList<HeadbuttTreeGroup> 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<HeadbuttEncounter>();
specialEncounters = new List<HeadbuttEncounter>();
normalTreeGroups = new BindingList<HeadbuttTreeGroup>();
specialTreeGroups = new BindingList<HeadbuttTreeGroup>();
//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;
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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}";
}
}
}

View File

@@ -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<HeadbuttTree> trees = new List<HeadbuttTree>();
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)}";
}
}
}

View File

@@ -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<LevelScriptTrigger> bufferSet = new BindingList<LevelScriptTrigger>();
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<MapScreenLoadTrigger> mapScreenLoadTriggers = new HashSet<MapScreenLoadTrigger>();
HashSet<VariableValueTrigger> variableValueTriggers = new HashSet<VariableValueTrigger>();
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;
}
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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}";
}
}
}

View File

@@ -0,0 +1,101 @@
using System.Collections.Generic;
using System.IO;
namespace DSPRE.ROMFiles {
public class SafariZoneEncounterFile {
public static Dictionary<int, string> Names = new Dictionary<int, string>() {
{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;
}
}
}

View File

@@ -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<SafariZoneEncounter> MorningEncounters = new BindingList<SafariZoneEncounter>();
public BindingList<SafariZoneEncounter> DayEncounters = new BindingList<SafariZoneEncounter>();
public BindingList<SafariZoneEncounter> NightEncounters = new BindingList<SafariZoneEncounter>();
public BindingList<SafariZoneEncounter> MorningEncountersObject = new BindingList<SafariZoneEncounter>();
public BindingList<SafariZoneEncounter> DayEncountersObject = new BindingList<SafariZoneEncounter>();
public BindingList<SafariZoneEncounter> NightEncountersObject = new BindingList<SafariZoneEncounter>();
public BindingList<SafariZoneObjectRequirement> ObjectRequirements = new BindingList<SafariZoneObjectRequirement>();
public BindingList<SafariZoneObjectRequirement> OptionalObjectRequirements = new BindingList<SafariZoneObjectRequirement>();
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);
}
}
}
}

View File

@@ -0,0 +1,40 @@
using System.Collections.Generic;
using System.IO;
namespace DSPRE.ROMFiles {
public class SafariZoneObjectRequirement {
public static Dictionary<int, string> ObjectTypes = new Dictionary<int, string>() {
{ 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}";
}
}
}

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
namespace DSPRE.ROMFiles {
public class ScriptActionContainer {
public List<ScriptAction> commands;
public uint manualUserID;
public ScriptActionContainer(uint actionNumber, List<ScriptAction> commands = null) {
manualUserID = actionNumber;
this.commands = commands;
}
}
}

View File

@@ -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<ScriptCommand> 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<ScriptCommand> 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<ScriptCommand>(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<byte[]> cmdParams;
public string name;
#endregion
#region Constructors (2)
public ScriptCommand(ushort id, List<byte[]> 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<byte[]> 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<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2])}";
}
private string FormatCmd_Overworld_Move(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.OW_MOVEMENT_TYPE)}";
}
private string FormatCmd_Overworld_3Coords_Dir(List<byte[]> 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<byte[]> 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
}
}

View File

@@ -0,0 +1,25 @@
using System.Collections.Generic;
namespace DSPRE.ROMFiles {
public class ScriptCommandContainer {
public List<ScriptCommand> 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<ScriptCommand> 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<ScriptCommand>(toCopy.commands); //command parameters need to be copied recursively
}
}
}

View File

@@ -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 {
/// <summary>
/// Class to store script file data in Pokémon NDS games
/// </summary>
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<CommandContainer> allScripts = new List<CommandContainer>();
public List<CommandContainer> allFunctions = new List<CommandContainer>();
public List<ActionContainer> allActions = new List<ActionContainer>();
public int? fileID = null;
public List<ScriptCommandContainer> allScripts = new List<ScriptCommandContainer>();
public List<ScriptCommandContainer> allFunctions = new List<ScriptCommandContainer>();
public List<ScriptActionContainer> allActions = new List<ScriptActionContainer>();
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<int> scriptOffsets = new List<int>();
List<int> functionOffsets = new List<int>();
List<int> movementOffsets = new List<int>();
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<ScriptCommand> cmdList = new List<ScriptCommand>();
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<ScriptCommand> cmdList = new List<ScriptCommand>();
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<ScriptAction> cmdList = new List<ScriptAction>();
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<CommandContainer> scripts, List<CommandContainer> functions, List<ActionContainer> 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<ScriptCommandContainer> scripts, List<ScriptCommandContainer> functions, List<ScriptActionContainer> movements, int fileID = -1) {
allScripts = scripts;
allFunctions = functions;
allActions = movements;
isLevelScript = false;
}
public ScriptFile(IEnumerable<string> scriptLines, IEnumerable<string> functionLines, IEnumerable<string> 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<int> functionOffsets, ref List<int> actionOffsets) {
ushort id = dataReader.ReadUInt16();
List<byte[]> parameterList = new List<byte[]>();
/* 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<ScriptReference> references, ushort commandID, List<byte[]> parameterList, int pos, CommandContainer cont) {
private void AddReference(ref List<ScriptReference> references, ushort commandID, List<byte[]> 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<CommandContainer> ReadCommandsFromLines(List<string> linelist, containerTypes containerType, Func<List<(int linenum, string text)>, int, ushort?, bool> endConditions) {
private List<ScriptCommandContainer> ReadCommandsFromLines(List<string> linelist, ContainerTypes containerType, Func<List<(int linenum, string text)>, 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<CommandContainer> ls = new List<CommandContainer>();
List<ScriptCommandContainer> ls = new List<ScriptCommandContainer>();
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<ActionContainer> ReadActionsFromLines(List<string> linelist) {
private List<ScriptActionContainer> ReadActionsFromLines(List<string> 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<ActionContainer> ls = new List<ActionContainer>();
List<ScriptActionContainer> ls = new List<ScriptActionContainer>();
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<CommandContainer> useScriptCallers = new List<CommandContainer>();
List<ScriptCommandContainer> useScriptCallers = new List<ScriptCommandContainer>();
/* 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<uint> undeclaredFuncs = new SortedSet<uint>();
SortedSet<uint> undeclaredActions = new SortedSet<uint>();
@@ -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<ScriptReference> refList, SortedSet<uint> 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;
}
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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);

View File

@@ -156,6 +156,10 @@ namespace DSPRE.Resources {
[0x00FE] = "End"
};
public static HashSet<ushort?> movementEndCodes = new HashSet<ushort?>() {
0x00FE,
};
public static Dictionary<ushort, string> DPPtScrCmdNames = new Dictionary<ushort, string>() {
[0x0000] = "Nop",
[0x0001] = "Dummy",