diff --git a/DS_Map/DSPRE.csproj b/DS_Map/DSPRE.csproj index dc0ef6e..63ac31d 100644 --- a/DS_Map/DSPRE.csproj +++ b/DS_Map/DSPRE.csproj @@ -96,12 +96,48 @@ + + UserControl + + + EncountersEditor.cs + + + UserControl + + + HeadbuttEncounterEditor.cs + + + UserControl + + + HeadbuttEncounterEditorTab.cs + UserControl LevelScriptEditor.cs + + UserControl + + + SafariZoneEditor.cs + + + UserControl + + + SafariZoneEncounterEditorTab.cs + + + UserControl + + + SafariZoneEncounterGroupEditor.cs + UserControl @@ -311,9 +347,27 @@ + + EncountersEditor.cs + + + HeadbuttEncounterEditor.cs + + + HeadbuttEncounterEditorTab.cs + LevelScriptEditor.cs + + SafariZoneEditor.cs + + + SafariZoneEncounterEditorTab.cs + + + SafariZoneEncounterGroupEditor.cs + ScriptEditor.cs diff --git a/DS_Map/DSUtils.cs b/DS_Map/DSUtils.cs index 3313457..b001237 100644 --- a/DS_Map/DSUtils.cs +++ b/DS_Map/DSUtils.cs @@ -431,23 +431,28 @@ namespace DSPRE { return b; } - public static void TryUnpackNarcs(List IDs) { + public static void TryUnpackNarcs(List IDs) { Parallel.ForEach(IDs, id => { - if (gameDirs.TryGetValue(id, out (string packedPath, string unpackedPath) paths)) { - DirectoryInfo di = new DirectoryInfo(paths.unpackedPath); - - if (!di.Exists || di.GetFiles().Length == 0) { - Narc opened = Narc.Open(paths.packedPath); - - if (opened is null) { - throw new NullReferenceException(); - } - - opened.ExtractToFolder(paths.unpackedPath); - } + if (!RomInfo.gameDirs.TryGetValue(id, out (string packedPath, string unpackedPath) paths)) { + return; } + + DirectoryInfo di = new DirectoryInfo(paths.unpackedPath); + + if (di.Exists && di.GetFiles().Length != 0) { + return; + } + + Narc opened = Narc.Open(paths.packedPath); + + if (opened is null) { + throw new NullReferenceException(); + } + + opened.ExtractToFolder(paths.unpackedPath); }); } + public static void ForceUnpackNarcs(List IDs) { Parallel.ForEach(IDs, id => { if (gameDirs.TryGetValue(id, out (string packedPath, string unpackedPath) paths)) { diff --git a/DS_Map/Editors/EncountersEditor.Designer.cs b/DS_Map/Editors/EncountersEditor.Designer.cs new file mode 100644 index 0000000..842c2ff --- /dev/null +++ b/DS_Map/Editors/EncountersEditor.Designer.cs @@ -0,0 +1,115 @@ + +namespace DSPRE.Editors +{ + partial class EncountersEditor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tabControl = new System.Windows.Forms.TabControl(); + this.tabPageHeadbuttEditor = new System.Windows.Forms.TabPage(); + this.headbuttEncounterEditor = new DSPRE.Editors.HeadbuttEncounterEditor(); + this.tabPageSafariZoneEditor = new System.Windows.Forms.TabPage(); + this.safariZoneEditor = new DSPRE.Editors.SafariZoneEditor(); + this.tabControl.SuspendLayout(); + this.tabPageHeadbuttEditor.SuspendLayout(); + this.tabPageSafariZoneEditor.SuspendLayout(); + this.SuspendLayout(); + // + // tabControl + // + this.tabControl.Controls.Add(this.tabPageHeadbuttEditor); + this.tabControl.Controls.Add(this.tabPageSafariZoneEditor); + this.tabControl.Location = new System.Drawing.Point(4, 4); + this.tabControl.Name = "tabControl"; + this.tabControl.SelectedIndex = 0; + this.tabControl.Size = new System.Drawing.Size(1103, 654); + this.tabControl.TabIndex = 2; + // + // tabPageHeadbuttEditor + // + this.tabPageHeadbuttEditor.Controls.Add(this.headbuttEncounterEditor); + this.tabPageHeadbuttEditor.Location = new System.Drawing.Point(4, 22); + this.tabPageHeadbuttEditor.Name = "tabPageHeadbuttEditor"; + this.tabPageHeadbuttEditor.Padding = new System.Windows.Forms.Padding(3); + this.tabPageHeadbuttEditor.Size = new System.Drawing.Size(1095, 628); + this.tabPageHeadbuttEditor.TabIndex = 0; + this.tabPageHeadbuttEditor.Text = "Headbutt"; + this.tabPageHeadbuttEditor.UseVisualStyleBackColor = true; + this.tabPageHeadbuttEditor.Enter += new System.EventHandler(this.tabPageHeadbuttEditor_Enter); + // + // headbuttEncounterEditor + // + this.headbuttEncounterEditor.BackColor = System.Drawing.SystemColors.Control; + this.headbuttEncounterEditor.headbuttEncounterEditorIsReady = false; + this.headbuttEncounterEditor.Location = new System.Drawing.Point(6, 6); + this.headbuttEncounterEditor.Name = "headbuttEncounterEditor"; + this.headbuttEncounterEditor.Size = new System.Drawing.Size(1081, 621); + this.headbuttEncounterEditor.TabIndex = 1; + // + // tabPageSafariZoneEditor + // + this.tabPageSafariZoneEditor.Controls.Add(this.safariZoneEditor); + this.tabPageSafariZoneEditor.Location = new System.Drawing.Point(4, 22); + this.tabPageSafariZoneEditor.Name = "tabPageSafariZoneEditor"; + this.tabPageSafariZoneEditor.Padding = new System.Windows.Forms.Padding(3); + this.tabPageSafariZoneEditor.Size = new System.Drawing.Size(1095, 628); + this.tabPageSafariZoneEditor.TabIndex = 1; + this.tabPageSafariZoneEditor.Text = "Safari Zone"; + this.tabPageSafariZoneEditor.UseVisualStyleBackColor = true; + this.tabPageSafariZoneEditor.Enter += new System.EventHandler(this.tabPageSafariZoneEditor_Enter); + // + // safariZoneEditor + // + this.safariZoneEditor.Location = new System.Drawing.Point(6, 6); + this.safariZoneEditor.Name = "safariZoneEditor"; + this.safariZoneEditor.safariZoneEditorIsReady = false; + this.safariZoneEditor.Size = new System.Drawing.Size(996, 341); + this.safariZoneEditor.TabIndex = 1; + // + // EncountersEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tabControl); + this.Name = "EncountersEditor"; + this.Size = new System.Drawing.Size(1111, 664); + this.tabControl.ResumeLayout(false); + this.tabPageHeadbuttEditor.ResumeLayout(false); + this.tabPageSafariZoneEditor.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + public HeadbuttEncounterEditor headbuttEncounterEditor; + private System.Windows.Forms.TabControl tabControl; + private System.Windows.Forms.TabPage tabPageHeadbuttEditor; + private System.Windows.Forms.TabPage tabPageSafariZoneEditor; + public SafariZoneEditor safariZoneEditor; + } +} diff --git a/DS_Map/Editors/EncountersEditor.cs b/DS_Map/Editors/EncountersEditor.cs new file mode 100644 index 0000000..f9bafb4 --- /dev/null +++ b/DS_Map/Editors/EncountersEditor.cs @@ -0,0 +1,27 @@ +using System.Windows.Forms; + +namespace DSPRE.Editors +{ + public partial class EncountersEditor : UserControl + { + public EncountersEditor() + { + InitializeComponent(); + } + + public void SetupEncountersEditor() { + tabPageHeadbuttEditor_Enter(null, null); + } + + private void tabPageHeadbuttEditor_Enter(object sender, System.EventArgs e) + { + headbuttEncounterEditor.SetupHeadbuttEncounterEditor(); + headbuttEncounterEditor.makeCurrent(); + } + + private void tabPageSafariZoneEditor_Enter(object sender, System.EventArgs e) + { + safariZoneEditor.SetupSafariZoneEditor(); + } + } +} diff --git a/DS_Map/Editors/EncountersEditor.resx b/DS_Map/Editors/EncountersEditor.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DS_Map/Editors/EncountersEditor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DS_Map/Editors/HeadbuttEncounterEditor.Designer.cs b/DS_Map/Editors/HeadbuttEncounterEditor.Designer.cs new file mode 100644 index 0000000..b1842db --- /dev/null +++ b/DS_Map/Editors/HeadbuttEncounterEditor.Designer.cs @@ -0,0 +1,459 @@ +using System.ComponentModel; + +namespace DSPRE.Editors { + partial class HeadbuttEncounterEditor { + /// + /// Required designer variable. + /// + private IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.buttonSaveAs = new System.Windows.Forms.Button(); + this.buttonSave = new System.Windows.Forms.Button(); + this.tabControl = new System.Windows.Forms.TabControl(); + this.tabPageNormal = new System.Windows.Forms.TabPage(); + this.headbuttEncounterEditorTabNormal = new DSPRE.Editors.HeadbuttEncounterEditorTab(); + this.tabPageSpecial = new System.Windows.Forms.TabPage(); + this.headbuttEncounterEditorTabSpecial = new DSPRE.Editors.HeadbuttEncounterEditorTab(); + this.mapRenderPanel = new System.Windows.Forms.Panel(); + this.openGlPictureBox = new System.Windows.Forms.PictureBox(); + this.mapScreenshotButton = new System.Windows.Forms.Button(); + this.comboBoxMapHeader = new System.Windows.Forms.ComboBox(); + this.comboBoxMapFile = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.labelLocationName = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.numericUpDownTreeGlobalX = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownTreeGlobalY = new System.Windows.Forms.NumericUpDown(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.numericUpDownTreeMatrixX = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownTreeMatrixY = new System.Windows.Forms.NumericUpDown(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.numericUpDownTreeMapX = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownTreeMapY = new System.Windows.Forms.NumericUpDown(); + this.RightClickLabel = new System.Windows.Forms.Label(); + this.LeftClickLabel = new System.Windows.Forms.Label(); + this.LeftClickPicture = new System.Windows.Forms.PictureBox(); + this.rightClickPicture = new System.Windows.Forms.PictureBox(); + this.buttonImport = new System.Windows.Forms.Button(); + this.tabControl.SuspendLayout(); + this.tabPageNormal.SuspendLayout(); + this.tabPageSpecial.SuspendLayout(); + this.mapRenderPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.openGlPictureBox)).BeginInit(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeGlobalX)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeGlobalY)).BeginInit(); + this.groupBox2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeMatrixX)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeMatrixY)).BeginInit(); + this.groupBox3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeMapX)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeMapY)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.LeftClickPicture)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.rightClickPicture)).BeginInit(); + this.SuspendLayout(); + // + // buttonSaveAs + // + this.buttonSaveAs.Location = new System.Drawing.Point(338, 29); + this.buttonSaveAs.Name = "buttonSaveAs"; + this.buttonSaveAs.Size = new System.Drawing.Size(75, 23); + this.buttonSaveAs.TabIndex = 9; + this.buttonSaveAs.Text = "Save As"; + this.buttonSaveAs.UseVisualStyleBackColor = true; + this.buttonSaveAs.Click += new System.EventHandler(this.buttonSaveAs_Click); + // + // buttonSave + // + this.buttonSave.Location = new System.Drawing.Point(338, 3); + this.buttonSave.Name = "buttonSave"; + this.buttonSave.Size = new System.Drawing.Size(75, 23); + this.buttonSave.TabIndex = 10; + this.buttonSave.Text = "Save"; + this.buttonSave.UseVisualStyleBackColor = true; + this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click); + // + // tabControl + // + this.tabControl.Controls.Add(this.tabPageNormal); + this.tabControl.Controls.Add(this.tabPageSpecial); + this.tabControl.Location = new System.Drawing.Point(3, 71); + this.tabControl.Name = "tabControl"; + this.tabControl.SelectedIndex = 0; + this.tabControl.Size = new System.Drawing.Size(274, 544); + this.tabControl.TabIndex = 21; + // + // tabPageNormal + // + this.tabPageNormal.Controls.Add(this.headbuttEncounterEditorTabNormal); + this.tabPageNormal.Location = new System.Drawing.Point(4, 22); + this.tabPageNormal.Name = "tabPageNormal"; + this.tabPageNormal.Padding = new System.Windows.Forms.Padding(3); + this.tabPageNormal.Size = new System.Drawing.Size(266, 518); + this.tabPageNormal.TabIndex = 0; + this.tabPageNormal.Text = "Normal"; + this.tabPageNormal.UseVisualStyleBackColor = true; + // + // headbuttEncounterEditorTabNormal + // + this.headbuttEncounterEditorTabNormal.Location = new System.Drawing.Point(2, 2); + this.headbuttEncounterEditorTabNormal.Name = "headbuttEncounterEditorTabNormal"; + this.headbuttEncounterEditorTabNormal.Size = new System.Drawing.Size(264, 519); + this.headbuttEncounterEditorTabNormal.TabIndex = 0; + // + // tabPageSpecial + // + this.tabPageSpecial.Controls.Add(this.headbuttEncounterEditorTabSpecial); + this.tabPageSpecial.Location = new System.Drawing.Point(4, 22); + this.tabPageSpecial.Name = "tabPageSpecial"; + this.tabPageSpecial.Padding = new System.Windows.Forms.Padding(3); + this.tabPageSpecial.Size = new System.Drawing.Size(266, 518); + this.tabPageSpecial.TabIndex = 1; + this.tabPageSpecial.Text = "Special"; + this.tabPageSpecial.UseVisualStyleBackColor = true; + // + // headbuttEncounterEditorTabSpecial + // + this.headbuttEncounterEditorTabSpecial.Location = new System.Drawing.Point(2, 2); + this.headbuttEncounterEditorTabSpecial.Name = "headbuttEncounterEditorTabSpecial"; + this.headbuttEncounterEditorTabSpecial.Size = new System.Drawing.Size(402, 518); + this.headbuttEncounterEditorTabSpecial.TabIndex = 0; + // + // mapRenderPanel + // + this.mapRenderPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.mapRenderPanel.Controls.Add(this.openGlPictureBox); + this.mapRenderPanel.Location = new System.Drawing.Point(419, 4); + this.mapRenderPanel.Name = "mapRenderPanel"; + this.mapRenderPanel.Size = new System.Drawing.Size(610, 610); + this.mapRenderPanel.TabIndex = 24; + // + // openGlPictureBox + // + this.openGlPictureBox.BackColor = System.Drawing.Color.White; + this.openGlPictureBox.Location = new System.Drawing.Point(0, 0); + this.openGlPictureBox.Name = "openGlPictureBox"; + this.openGlPictureBox.Size = new System.Drawing.Size(608, 608); + this.openGlPictureBox.TabIndex = 3; + this.openGlPictureBox.TabStop = false; + this.openGlPictureBox.Click += new System.EventHandler(this.openGlPictureBox_Click); + // + // mapScreenshotButton + // + this.mapScreenshotButton.Image = global::DSPRE.Properties.Resources.cameraIcon; + this.mapScreenshotButton.Location = new System.Drawing.Point(1034, 574); + this.mapScreenshotButton.Name = "mapScreenshotButton"; + this.mapScreenshotButton.Size = new System.Drawing.Size(41, 40); + this.mapScreenshotButton.TabIndex = 39; + this.mapScreenshotButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.mapScreenshotButton.UseVisualStyleBackColor = true; + this.mapScreenshotButton.Click += new System.EventHandler(this.mapScreenshotButton_Click); + // + // comboBoxMapHeader + // + this.comboBoxMapHeader.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxMapHeader.FormattingEnabled = true; + this.comboBoxMapHeader.Location = new System.Drawing.Point(54, 4); + this.comboBoxMapHeader.Name = "comboBoxMapHeader"; + this.comboBoxMapHeader.Size = new System.Drawing.Size(278, 21); + this.comboBoxMapHeader.TabIndex = 40; + this.comboBoxMapHeader.SelectedIndexChanged += new System.EventHandler(this.comboBoxMapHeader_SelectedIndexChanged); + // + // comboBoxMapFile + // + this.comboBoxMapFile.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxMapFile.FormattingEnabled = true; + this.comboBoxMapFile.Location = new System.Drawing.Point(54, 31); + this.comboBoxMapFile.Name = "comboBoxMapFile"; + this.comboBoxMapFile.Size = new System.Drawing.Size(278, 21); + this.comboBoxMapFile.TabIndex = 40; + this.comboBoxMapFile.SelectedIndexChanged += new System.EventHandler(this.comboBoxMapFile_SelectedIndexChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(6, 7); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(42, 13); + this.label1.TabIndex = 41; + this.label1.Text = "Header"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(20, 36); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(28, 13); + this.label2.TabIndex = 41; + this.label2.Text = "Map"; + // + // labelLocationName + // + this.labelLocationName.AutoSize = true; + this.labelLocationName.Location = new System.Drawing.Point(51, 55); + this.labelLocationName.Name = "labelLocationName"; + this.labelLocationName.Size = new System.Drawing.Size(35, 13); + this.labelLocationName.TabIndex = 42; + this.labelLocationName.Text = "label3"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.numericUpDownTreeGlobalX); + this.groupBox1.Controls.Add(this.numericUpDownTreeGlobalY); + this.groupBox1.Location = new System.Drawing.Point(279, 452); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(134, 49); + this.groupBox1.TabIndex = 16; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Global"; + // + // numericUpDownTreeGlobalX + // + this.numericUpDownTreeGlobalX.Location = new System.Drawing.Point(6, 19); + this.numericUpDownTreeGlobalX.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.numericUpDownTreeGlobalX.Name = "numericUpDownTreeGlobalX"; + this.numericUpDownTreeGlobalX.Size = new System.Drawing.Size(58, 20); + this.numericUpDownTreeGlobalX.TabIndex = 15; + this.numericUpDownTreeGlobalX.ValueChanged += new System.EventHandler(this.numericUpDownTreeGlobalX_ValueChanged); + // + // numericUpDownTreeGlobalY + // + this.numericUpDownTreeGlobalY.Location = new System.Drawing.Point(70, 19); + this.numericUpDownTreeGlobalY.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.numericUpDownTreeGlobalY.Name = "numericUpDownTreeGlobalY"; + this.numericUpDownTreeGlobalY.Size = new System.Drawing.Size(58, 20); + this.numericUpDownTreeGlobalY.TabIndex = 15; + this.numericUpDownTreeGlobalY.ValueChanged += new System.EventHandler(this.numericUpDownTreeGlobalY_ValueChanged); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.numericUpDownTreeMatrixX); + this.groupBox2.Controls.Add(this.numericUpDownTreeMatrixY); + this.groupBox2.Location = new System.Drawing.Point(279, 507); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(134, 49); + this.groupBox2.TabIndex = 16; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Matrix"; + // + // numericUpDownTreeMatrixX + // + this.numericUpDownTreeMatrixX.Location = new System.Drawing.Point(6, 19); + this.numericUpDownTreeMatrixX.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.numericUpDownTreeMatrixX.Name = "numericUpDownTreeMatrixX"; + this.numericUpDownTreeMatrixX.Size = new System.Drawing.Size(58, 20); + this.numericUpDownTreeMatrixX.TabIndex = 15; + this.numericUpDownTreeMatrixX.ValueChanged += new System.EventHandler(this.numericUpDownTreeMatrixX_ValueChanged); + // + // numericUpDownTreeMatrixY + // + this.numericUpDownTreeMatrixY.Location = new System.Drawing.Point(70, 19); + this.numericUpDownTreeMatrixY.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.numericUpDownTreeMatrixY.Name = "numericUpDownTreeMatrixY"; + this.numericUpDownTreeMatrixY.Size = new System.Drawing.Size(58, 20); + this.numericUpDownTreeMatrixY.TabIndex = 15; + this.numericUpDownTreeMatrixY.ValueChanged += new System.EventHandler(this.numericUpDownTreeMatrixY_ValueChanged); + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.numericUpDownTreeMapX); + this.groupBox3.Controls.Add(this.numericUpDownTreeMapY); + this.groupBox3.Location = new System.Drawing.Point(279, 562); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(134, 49); + this.groupBox3.TabIndex = 16; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Local"; + // + // numericUpDownTreeMapX + // + this.numericUpDownTreeMapX.Location = new System.Drawing.Point(6, 19); + this.numericUpDownTreeMapX.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.numericUpDownTreeMapX.Name = "numericUpDownTreeMapX"; + this.numericUpDownTreeMapX.Size = new System.Drawing.Size(58, 20); + this.numericUpDownTreeMapX.TabIndex = 15; + this.numericUpDownTreeMapX.ValueChanged += new System.EventHandler(this.numericUpDownTreeMapX_ValueChanged); + // + // numericUpDownTreeMapY + // + this.numericUpDownTreeMapY.Location = new System.Drawing.Point(70, 19); + this.numericUpDownTreeMapY.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.numericUpDownTreeMapY.Name = "numericUpDownTreeMapY"; + this.numericUpDownTreeMapY.Size = new System.Drawing.Size(58, 20); + this.numericUpDownTreeMapY.TabIndex = 15; + this.numericUpDownTreeMapY.ValueChanged += new System.EventHandler(this.numericUpDownTreeMapY_ValueChanged); + // + // RightClickLabel + // + this.RightClickLabel.AutoSize = true; + this.RightClickLabel.Location = new System.Drawing.Point(308, 425); + this.RightClickLabel.Name = "RightClickLabel"; + this.RightClickLabel.Size = new System.Drawing.Size(37, 13); + this.RightClickLabel.TabIndex = 66; + this.RightClickLabel.Text = "Select"; + // + // LeftClickLabel + // + this.LeftClickLabel.AutoSize = true; + this.LeftClickLabel.Location = new System.Drawing.Point(352, 425); + this.LeftClickLabel.Name = "LeftClickLabel"; + this.LeftClickLabel.Size = new System.Drawing.Size(34, 13); + this.LeftClickLabel.TabIndex = 63; + this.LeftClickLabel.Text = "Move"; + // + // LeftClickPicture + // + this.LeftClickPicture.Image = global::DSPRE.Properties.Resources.LeftClick; + this.LeftClickPicture.ImageLocation = ""; + this.LeftClickPicture.Location = new System.Drawing.Point(349, 387); + this.LeftClickPicture.Name = "LeftClickPicture"; + this.LeftClickPicture.Size = new System.Drawing.Size(38, 38); + this.LeftClickPicture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.LeftClickPicture.TabIndex = 61; + this.LeftClickPicture.TabStop = false; + // + // rightClickPicture + // + this.rightClickPicture.Image = global::DSPRE.Properties.Resources.RightClick; + this.rightClickPicture.ImageLocation = ""; + this.rightClickPicture.Location = new System.Drawing.Point(307, 387); + this.rightClickPicture.Name = "rightClickPicture"; + this.rightClickPicture.Size = new System.Drawing.Size(38, 38); + this.rightClickPicture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.rightClickPicture.TabIndex = 65; + this.rightClickPicture.TabStop = false; + // + // buttonImport + // + this.buttonImport.Location = new System.Drawing.Point(338, 55); + this.buttonImport.Name = "buttonImport"; + this.buttonImport.Size = new System.Drawing.Size(75, 23); + this.buttonImport.TabIndex = 9; + this.buttonImport.Text = "Import"; + this.buttonImport.UseVisualStyleBackColor = true; + this.buttonImport.Click += new System.EventHandler(this.buttonImport_Click); + // + // HeadbuttEncounterEditor + // + 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.RightClickLabel); + this.Controls.Add(this.LeftClickLabel); + this.Controls.Add(this.LeftClickPicture); + this.Controls.Add(this.rightClickPicture); + this.Controls.Add(this.labelLocationName); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.comboBoxMapFile); + this.Controls.Add(this.comboBoxMapHeader); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.mapRenderPanel); + this.Controls.Add(this.tabControl); + this.Controls.Add(this.mapScreenshotButton); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.buttonImport); + this.Controls.Add(this.buttonSaveAs); + this.Controls.Add(this.buttonSave); + this.Controls.Add(this.groupBox1); + this.Location = new System.Drawing.Point(15, 15); + this.Name = "HeadbuttEncounterEditor"; + this.Size = new System.Drawing.Size(1080, 620); + this.tabControl.ResumeLayout(false); + this.tabPageNormal.ResumeLayout(false); + this.tabPageSpecial.ResumeLayout(false); + this.mapRenderPanel.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.openGlPictureBox)).EndInit(); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeGlobalX)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeGlobalY)).EndInit(); + this.groupBox2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeMatrixX)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeMatrixY)).EndInit(); + this.groupBox3.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeMapX)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTreeMapY)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.LeftClickPicture)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.rightClickPicture)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + private System.Windows.Forms.Button buttonSaveAs; + private System.Windows.Forms.Button buttonSave; + + #endregion + private System.Windows.Forms.TabControl tabControl; + private System.Windows.Forms.TabPage tabPageNormal; + private System.Windows.Forms.TabPage tabPageSpecial; + private HeadbuttEncounterEditorTab headbuttEncounterEditorTabNormal; + private HeadbuttEncounterEditorTab headbuttEncounterEditorTabSpecial; + private System.Windows.Forms.Panel mapRenderPanel; + private System.Windows.Forms.PictureBox openGlPictureBox; + private System.Windows.Forms.Button mapScreenshotButton; + private System.Windows.Forms.ComboBox comboBoxMapHeader; + private System.Windows.Forms.ComboBox comboBoxMapFile; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label labelLocationName; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.NumericUpDown numericUpDownTreeGlobalX; + private System.Windows.Forms.NumericUpDown numericUpDownTreeGlobalY; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.NumericUpDown numericUpDownTreeMatrixX; + private System.Windows.Forms.NumericUpDown numericUpDownTreeMatrixY; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.NumericUpDown numericUpDownTreeMapX; + private System.Windows.Forms.NumericUpDown numericUpDownTreeMapY; + private System.Windows.Forms.Label RightClickLabel; + private System.Windows.Forms.Label LeftClickLabel; + private System.Windows.Forms.PictureBox LeftClickPicture; + private System.Windows.Forms.PictureBox rightClickPicture; + private System.Windows.Forms.Button buttonImport; + } +} + diff --git a/DS_Map/Editors/HeadbuttEncounterEditor.cs b/DS_Map/Editors/HeadbuttEncounterEditor.cs new file mode 100644 index 0000000..e497ee5 --- /dev/null +++ b/DS_Map/Editors/HeadbuttEncounterEditor.cs @@ -0,0 +1,491 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.IO; +using System.Windows.Forms; +using DSPRE.ROMFiles; + +namespace DSPRE.Editors { + public partial class HeadbuttEncounterEditor : UserControl { + public bool headbuttEncounterEditorIsReady { get; set; } = false; + + private ListBox2 listBoxTrees; + private HeadbuttTree headbuttTree; + + private HeaderHGSS mapHeader; + private HeadbuttEncounterFile headbuttEncounterFile; + private HeadbuttEncounterMap headbuttEncounterMap; + private GameMatrix gameMatrix; + private AreaData areaData; + private MapFile mapFile; + private string locationName; + + private int width; + private int height; + static SimpleOpenGlControl2 openGlControl; + + private Pen selectedPen; + private Pen normalPen; + private SolidBrush normalBrush; + private Pen specialPen; + private SolidBrush specialBrush; + + private static float perspective; + private static float ang; + private static float dist; + private static float elev; + + public HeadbuttEncounterEditor() { + InitializeComponent(); + } + + //TODO: refresh headers list if a header is added + public void SetupHeadbuttEncounterEditor(bool force = false) { + if (headbuttEncounterEditorIsReady && !force) return; + headbuttEncounterEditorIsReady = true; + + DSUtils.TryUnpackNarcs(new List() { + RomInfo.DirNames.dynamicHeaders, + RomInfo.DirNames.matrices, + RomInfo.DirNames.textArchives, + RomInfo.DirNames.areaData, + RomInfo.DirNames.headbutt, + RomInfo.DirNames.maps, + RomInfo.DirNames.mapTextures, + RomInfo.DirNames.exteriorBuildingModels, + RomInfo.DirNames.buildingTextures, + }); + + width = openGlPictureBox.Width; + height = openGlPictureBox.Height; + + openGlControl = new SimpleOpenGlControl2(); + openGlControl.InitializeContexts(); + openGlControl.Width = width; + openGlControl.Height = height; + openGlControl.Invalidate(); + openGlControl.MakeCurrent(); + + List headerListBoxNames = Helpers.getHeaderListBoxNames(); + + Color selectedColor = Color.FromArgb(255, Color.White); + selectedPen = new Pen(selectedColor); + + Color normalColor = Color.FromArgb(128, Color.DarkBlue); + normalPen = new Pen(normalColor); + normalBrush = new SolidBrush(normalColor); + + Color specialColor = Color.FromArgb(128, Color.DarkRed); + specialPen = new Pen(specialColor); + specialBrush = new SolidBrush(specialColor); + + Helpers.DisableHandlers(); + + for (int i = 0; i < Filesystem.GetHeadbuttCount(); i++) { + if (i < headerListBoxNames.Count) { + comboBoxMapHeader.Items.Add(headerListBoxNames[i]); + } + else { + i.ToString("D4"); + } + } + + string[] pokemonNames = RomInfo.GetPokemonNames(); + headbuttEncounterEditorTabNormal.comboBoxPokemon.Items.AddRange(pokemonNames); + headbuttEncounterEditorTabNormal.comboBoxPokemon.SelectedIndex = 0; + headbuttEncounterEditorTabNormal.listBoxTrees.SelectedIndexChanged += ListBoxTrees_SelectedIndexChanged; + + headbuttEncounterEditorTabSpecial.comboBoxPokemon.Items.AddRange(pokemonNames); + headbuttEncounterEditorTabSpecial.comboBoxPokemon.SelectedIndex = 0; + headbuttEncounterEditorTabSpecial.listBoxTrees.SelectedIndexChanged += ListBoxTrees_SelectedIndexChanged; + + openGlPictureBox.BringToFront(); + SetCam2DValues(); + + Helpers.EnableHandlers(); + + if (comboBoxMapHeader.Items.Count > 0) { + comboBoxMapHeader.SelectedIndex = 0; + } + } + + public void makeCurrent() { + openGlControl.MakeCurrent(); + } + + private void comboBoxMapHeader_SelectedIndexChanged(object sender, EventArgs e) { + ushort headbuttID = (ushort)comboBoxMapHeader.SelectedIndex; + this.headbuttEncounterFile = new HeadbuttEncounterFile(headbuttID); + setCurrentMap(headbuttEncounterFile); + } + + public void setCurrentMap(HeadbuttEncounterFile headbuttEncounterFile) { + this.mapFile = null; + this.headbuttEncounterMap = null; + + comboBoxMapFile.Items.Clear(); + labelLocationName.Text = ""; + + listBoxTrees = null; + if (headbuttTree != null) headbuttTree.picked = false; + headbuttTree = null; + + headbuttEncounterEditorTabNormal.Reset(); + headbuttEncounterEditorTabSpecial.Reset(); + + numericUpDownTreeGlobalX.Value = 0; + numericUpDownTreeGlobalY.Value = 0; + numericUpDownTreeMatrixX.Value = 0; + numericUpDownTreeMatrixY.Value = 0; + numericUpDownTreeMapX.Value = 0; + numericUpDownTreeMapY.Value = 0; + + RenderBackground(); + + try { + if (headbuttEncounterFile.ID == GameMatrix.EMPTY) return; + this.mapHeader = (HeaderHGSS)MapHeader.GetMapHeader(headbuttEncounterFile.ID); + } + catch (Exception ex) { + //most likely more headbutt files than map headers + //there should be the same amount + Console.WriteLine(ex); + return; + } + + this.gameMatrix = new GameMatrix(mapHeader.matrixID); + this.areaData = new AreaData(mapHeader.areaDataID); + + TextArchive currentTextArchive = new TextArchive(RomInfo.locationNamesTextNumber); + this.locationName = currentTextArchive.messages[mapHeader.locationName]; + labelLocationName.Text = locationName; + + headbuttEncounterEditorTabNormal.SetHeadbuttEncounter(headbuttEncounterFile.normalEncounters, headbuttEncounterFile.normalTreeGroups); + headbuttEncounterEditorTabSpecial.SetHeadbuttEncounter(headbuttEncounterFile.specialEncounters, headbuttEncounterFile.specialTreeGroups); + + List mapHeaderMapsIDsList = new List(); + + if (gameMatrix.hasHeadersSection) { + for (int y = 0; y < gameMatrix.height; y++) { + for (int x = 0; x < gameMatrix.width; x++) { + if (gameMatrix.headers[y, x] == mapHeader.ID) { + int mapID = gameMatrix.maps[y, x]; + if (mapID == GameMatrix.EMPTY) continue; + HeadbuttEncounterMap map = new HeadbuttEncounterMap(mapID, x, y); + if (mapHeaderMapsIDsList.Contains(map)) continue; + mapHeaderMapsIDsList.Add(map); + } + } + } + } + else { + for (int y = 0; y < gameMatrix.height; y++) { + for (int x = 0; x < gameMatrix.width; x++) { + int mapID = gameMatrix.maps[y, x]; + if (mapID == GameMatrix.EMPTY) continue; + HeadbuttEncounterMap map = new HeadbuttEncounterMap(mapID, x, y); + if (mapHeaderMapsIDsList.Contains(map)) continue; + mapHeaderMapsIDsList.Add(map); + } + } + } + + foreach (HeadbuttTreeGroup treeGroup in headbuttEncounterFile.normalTreeGroups) { + foreach (HeadbuttTree tree in treeGroup.trees) { + if (tree.unused) continue; + if (tree.matrixX >= gameMatrix.width || tree.matrixY >= gameMatrix.height) continue; + int x = tree.matrixX; + int y = tree.matrixY; + int mapID = gameMatrix.maps[y, x]; + if (mapID == GameMatrix.EMPTY) continue; + HeadbuttEncounterMap map = new HeadbuttEncounterMap(mapID, x, y); + if (mapHeaderMapsIDsList.Contains(map)) continue; + mapHeaderMapsIDsList.Add(map); + } + } + + foreach (HeadbuttTreeGroup treeGroup in headbuttEncounterFile.specialTreeGroups) { + foreach (HeadbuttTree tree in treeGroup.trees) { + if (tree.unused) continue; + if (tree.matrixX >= gameMatrix.width || tree.matrixY >= gameMatrix.height) continue; + int x = tree.matrixX; + int y = tree.matrixY; + int mapID = gameMatrix.maps[y, x]; + if (mapID == GameMatrix.EMPTY) continue; + HeadbuttEncounterMap map = new HeadbuttEncounterMap(mapID, x, y); + if (mapHeaderMapsIDsList.Contains(map)) continue; + mapHeaderMapsIDsList.Add(map); + } + } + + mapHeaderMapsIDsList.Sort((first, second) => { + int ret = first.mapID.CompareTo(second.mapID); + return ret != 0 ? ret : first.x.CompareTo(second.x); + }); + foreach (HeadbuttEncounterMap map in mapHeaderMapsIDsList) { + comboBoxMapFile.Items.Add(map); + } + + if (comboBoxMapFile.Items.Count > 0) { + comboBoxMapFile.SelectedIndex = 0; + } + } + + private void buttonSave_Click(object sender, EventArgs e) { + if (headbuttEncounterFile == null) return; + headbuttEncounterFile.SaveToFile(); + } + + private void buttonSaveAs_Click(object sender, EventArgs e) { + if (headbuttEncounterFile == null) return; + + 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) return; + + headbuttEncounterFile.SaveToFile(sfd.FileName); + } + + private void buttonImport_Click(object sender, EventArgs e) { + OpenFileDialog ofd = new OpenFileDialog(); + try { + ofd.InitialDirectory = Path.GetDirectoryName(ofd.FileName); + ofd.FileName = Path.GetFileName(ofd.FileName); + } + catch (Exception ex) { + ofd.InitialDirectory = Path.GetDirectoryName(Environment.SpecialFolder.UserProfile.ToString()); + ofd.FileName = Path.GetFileName(ofd.FileName); + } + + if (ofd.ShowDialog() != DialogResult.OK) return; + + this.headbuttEncounterFile = new HeadbuttEncounterFile(ofd.FileName); + headbuttEncounterFile.ID = (ushort)comboBoxMapHeader.SelectedIndex; + setCurrentMap(headbuttEncounterFile); + } + + private void comboBoxMapFile_SelectedIndexChanged(object sender, EventArgs e) { + HeadbuttEncounterMap map = comboBoxMapFile.SelectedItem as HeadbuttEncounterMap; + int mapID = gameMatrix.maps[map.y, map.x]; + this.mapFile = new MapFile(mapID, RomInfo.gameFamily, discardMoveperms: true); + this.headbuttEncounterMap = map; + RenderBackground(); + } + + private Bitmap GetMapBitmap() { + Bitmap bm = RenderMap(); + openGlControl.Invalidate(); + return bm; + } + + private void RenderBackground() { + Bitmap bm = GetMapBitmap(); + + if (headbuttEncounterFile != null) { + using (Graphics g = Graphics.FromImage(bm)) { + g.InterpolationMode = InterpolationMode.NearestNeighbor; + g.PixelOffsetMode = PixelOffsetMode.HighQuality; + MarkTrees(g, headbuttEncounterFile.normalTreeGroups, HeadbuttTree.Types.Normal); + MarkTrees(g, headbuttEncounterFile.specialTreeGroups, HeadbuttTree.Types.Special); + } + } + + openGlPictureBox.BackgroundImage = bm; + } + + private Bitmap RenderMap() { + MapFile currentMapFile = this.mapFile; + + if (currentMapFile == null) { + Bitmap blank = new Bitmap(openGlPictureBox.Width, openGlPictureBox.Height); + using (Graphics g = Graphics.FromImage(blank)) { + g.Clear(Color.Black); + } + + return blank; + } + + Helpers.MW_LoadModelTextures(currentMapFile, areaData.mapTileset); + + bool isInteriorMap = false; + if (RomInfo.gameFamily == RomInfo.GameFamilies.HGSS && areaData.areaType == AreaData.TYPE_INDOOR) { + isInteriorMap = true; + } + + for (int i = 0; i < currentMapFile.buildings.Count; i++) { + Building building = currentMapFile.buildings[i]; + building.LoadModelData(isInteriorMap); // Load building nsbmd + Helpers.MW_LoadModelTextures(building, areaData.buildingsTileset); // Load building textures + } + + Helpers.RenderMap(ref currentMapFile, openGlControl.Width, openGlControl.Height, ang, dist, elev, perspective); + return Helpers.GrabMapScreenshot(width, height); + } + + private void MarkTrees(Graphics g, BindingList treeGroups, HeadbuttTree.Types treeType) { + HeadbuttEncounterMap map = comboBoxMapFile.SelectedItem as HeadbuttEncounterMap; + if (map == null) return; + + foreach (HeadbuttTreeGroup treeGroup in treeGroups) { + foreach (HeadbuttTree tree in treeGroup.trees) { + if (tree.unused) continue; + if (tree.matrixX != map.x || tree.matrixY != map.y) continue; + MarkTree(g, tree, treeType); + } + } + } + + private void MarkTree(Graphics g, HeadbuttTree tree, HeadbuttTree.Types treeType) { + Pen paintPen; + SolidBrush paintBrush; + if (treeType == HeadbuttTree.Types.Normal) { + paintPen = normalPen; + paintBrush = normalBrush; + } + else { + paintPen = specialPen; + paintBrush = specialBrush; + } + + if (tree.picked) { + paintPen = selectedPen; + } + + int tileWidth = openGlControl.Width / MapFile.mapSize; + int tileHeight = openGlControl.Height / MapFile.mapSize; + int tileX = tree.mapX * tileWidth; + int tileY = tree.mapY * tileHeight; + + int padding = 1; + Rectangle rectangle = new Rectangle(tileX + padding, tileY + padding, tileWidth - padding, tileHeight - padding); + g.FillRectangle(paintBrush, rectangle); + g.DrawRectangle(paintPen, rectangle); + } + + private void ListBoxTrees_SelectedIndexChanged(object sender, EventArgs e) { + listBoxTrees = sender as ListBox2; + headbuttTree = listBoxTrees.SelectedItem as HeadbuttTree; + if (headbuttTree == null) return; + numericUpDownTreeGlobalX.Value = headbuttTree.globalX; + numericUpDownTreeGlobalY.Value = headbuttTree.globalY; + numericUpDownTreeMatrixX.Value = headbuttTree.matrixX; + numericUpDownTreeMatrixY.Value = headbuttTree.matrixY; + numericUpDownTreeMapX.Value = headbuttTree.mapX; + numericUpDownTreeMapY.Value = headbuttTree.mapY; + } + + private void openGlPictureBox_Click(object sender, EventArgs e) { + MouseEventArgs mea = (MouseEventArgs)e; + + int tileWidth = openGlControl.Width / MapFile.mapSize; + int tileHeight = openGlControl.Height / MapFile.mapSize; + int mouseX = openGlPictureBox.PointToClient(MousePosition).X / tileWidth; + int mouseY = openGlPictureBox.PointToClient(MousePosition).Y / tileHeight; + + + if (mea.Button == MouseButtons.Left) { + if (this.headbuttEncounterMap != null) { + numericUpDownTreeMatrixX.Value = headbuttEncounterMap.x; + numericUpDownTreeMatrixY.Value = headbuttEncounterMap.y; + numericUpDownTreeMapX.Value = mouseX; + numericUpDownTreeMapY.Value = mouseY; + } + } + else if (mea.Button == MouseButtons.Middle) { + //warp + } + else if (mea.Button == MouseButtons.Right) { + if (headbuttTree != null) headbuttTree.picked = false; + + if (FindTreeFromMap(headbuttEncounterEditorTabNormal.listBoxTreeGroups, headbuttEncounterEditorTabNormal.listBoxTrees, mouseX, mouseY)) { + tabControl.SelectedTab = tabPageNormal; + } + else if (FindTreeFromMap(headbuttEncounterEditorTabSpecial.listBoxTreeGroups, headbuttEncounterEditorTabSpecial.listBoxTrees, mouseX, mouseY)) { + tabControl.SelectedTab = tabPageSpecial; + } + else { + headbuttEncounterEditorTabNormal.listBoxTreeGroups.SelectedItem = null; + headbuttEncounterEditorTabNormal.listBoxTrees.SelectedItem = null; + headbuttEncounterEditorTabSpecial.listBoxTreeGroups.SelectedItem = null; + headbuttEncounterEditorTabSpecial.listBoxTrees.SelectedItem = null; + } + } + + RenderBackground(); + } + + private bool FindTreeFromMap(ListBox2 listBoxTreeGroups, ListBox2 listBoxTrees, int x, int y) { + foreach (HeadbuttTreeGroup headbuttTreeGroup in listBoxTreeGroups.Items) { + foreach (HeadbuttTree tree in headbuttTreeGroup.trees) { + if (tree.mapX != x || tree.mapY != y) continue; + listBoxTreeGroups.SelectedItem = headbuttTreeGroup; + listBoxTrees.SelectedItem = tree; + tree.picked = true; + return true; + } + } + + return false; + } + + private void numericUpDownTreeGlobalX_ValueChanged(object sender, EventArgs e) { + if (headbuttTree == null) return; + headbuttTree.globalX = (ushort)((NumericUpDown)sender).Value; + listBoxTrees.RefreshItem(listBoxTrees.SelectedIndex); + } + + private void numericUpDownTreeGlobalY_ValueChanged(object sender, EventArgs e) { + if (headbuttTree == null) return; + headbuttTree.globalY = (ushort)((NumericUpDown)sender).Value; + listBoxTrees.RefreshItem(listBoxTrees.SelectedIndex); + } + + private void numericUpDownTreeMatrixX_ValueChanged(object sender, EventArgs e) { + if (headbuttTree == null) return; + headbuttTree.matrixX = (ushort)((NumericUpDown)sender).Value; + listBoxTrees.RefreshItem(listBoxTrees.SelectedIndex); + } + + private void numericUpDownTreeMatrixY_ValueChanged(object sender, EventArgs e) { + if (headbuttTree == null) return; + headbuttTree.matrixY = (ushort)((NumericUpDown)sender).Value; + listBoxTrees.RefreshItem(listBoxTrees.SelectedIndex); + } + + private void numericUpDownTreeMapX_ValueChanged(object sender, EventArgs e) { + if (headbuttTree == null) return; + headbuttTree.mapX = (ushort)((NumericUpDown)sender).Value; + listBoxTrees.RefreshItem(listBoxTrees.SelectedIndex); + } + + private void numericUpDownTreeMapY_ValueChanged(object sender, EventArgs e) { + if (headbuttTree == null) return; + headbuttTree.mapY = (ushort)((NumericUpDown)sender).Value; + listBoxTrees.RefreshItem(listBoxTrees.SelectedIndex); + } + + private void mapScreenshotButton_Click(object sender, EventArgs e) { + SaveFileDialog imageSFD = new SaveFileDialog { Filter = "PNG File(*.png)|*.png", }; + if (imageSFD.ShowDialog() != DialogResult.OK) return; + openGlPictureBox.BackgroundImage.Save(imageSFD.FileName); + MessageBox.Show("Screenshot saved.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void SetCam2DValues() { + perspective = 4f; + ang = 0f; + dist = 115.2f; + elev = 90f; + } + } +} diff --git a/DS_Map/Editors/HeadbuttEncounterEditor.resx b/DS_Map/Editors/HeadbuttEncounterEditor.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DS_Map/Editors/HeadbuttEncounterEditor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DS_Map/Editors/HeadbuttEncounterEditorTab.Designer.cs b/DS_Map/Editors/HeadbuttEncounterEditorTab.Designer.cs new file mode 100644 index 0000000..1735cbb --- /dev/null +++ b/DS_Map/Editors/HeadbuttEncounterEditorTab.Designer.cs @@ -0,0 +1,235 @@ + +namespace DSPRE.Editors +{ + partial class HeadbuttEncounterEditorTab + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.buttonDuplicateTreeGroup = new System.Windows.Forms.Button(); + this.buttonRemoveTreeGroup = new System.Windows.Forms.Button(); + this.numericUpDownMaxLevel = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownMinLevel = new System.Windows.Forms.NumericUpDown(); + this.buttonAddTreeGroup = new System.Windows.Forms.Button(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.comboBoxPokemon = new System.Windows.Forms.ComboBox(); + this.listBoxTreeGroups = new DSPRE.ListBox2(); + this.listBoxTrees = new DSPRE.ListBox2(); + this.listBoxEncounters = new DSPRE.ListBox2(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxLevel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMinLevel)).BeginInit(); + this.SuspendLayout(); + // + // buttonDuplicateTreeGroup + // + this.buttonDuplicateTreeGroup.Location = new System.Drawing.Point(177, 389); + this.buttonDuplicateTreeGroup.Name = "buttonDuplicateTreeGroup"; + this.buttonDuplicateTreeGroup.Size = new System.Drawing.Size(81, 23); + this.buttonDuplicateTreeGroup.TabIndex = 17; + this.buttonDuplicateTreeGroup.Text = "Duplicate"; + this.buttonDuplicateTreeGroup.UseVisualStyleBackColor = true; + this.buttonDuplicateTreeGroup.Click += new System.EventHandler(this.buttonDuplicateTreeGroup_Click); + // + // buttonRemoveTreeGroup + // + this.buttonRemoveTreeGroup.Location = new System.Drawing.Point(90, 389); + this.buttonRemoveTreeGroup.Name = "buttonRemoveTreeGroup"; + this.buttonRemoveTreeGroup.Size = new System.Drawing.Size(81, 23); + this.buttonRemoveTreeGroup.TabIndex = 17; + this.buttonRemoveTreeGroup.Text = "Remove"; + this.buttonRemoveTreeGroup.UseVisualStyleBackColor = true; + this.buttonRemoveTreeGroup.Click += new System.EventHandler(this.buttonRemoveTreeGroup_Click); + // + // numericUpDownMaxLevel + // + this.numericUpDownMaxLevel.Location = new System.Drawing.Point(200, 210); + this.numericUpDownMaxLevel.Name = "numericUpDownMaxLevel"; + this.numericUpDownMaxLevel.Size = new System.Drawing.Size(58, 20); + this.numericUpDownMaxLevel.TabIndex = 15; + this.numericUpDownMaxLevel.ValueChanged += new System.EventHandler(this.numericUpDownMaxLevel_ValueChanged); + // + // numericUpDownMinLevel + // + this.numericUpDownMinLevel.Location = new System.Drawing.Point(136, 210); + this.numericUpDownMinLevel.Name = "numericUpDownMinLevel"; + this.numericUpDownMinLevel.Size = new System.Drawing.Size(58, 20); + this.numericUpDownMinLevel.TabIndex = 15; + this.numericUpDownMinLevel.ValueChanged += new System.EventHandler(this.numericUpDownMinLevel_ValueChanged); + // + // buttonAddTreeGroup + // + this.buttonAddTreeGroup.Location = new System.Drawing.Point(3, 389); + this.buttonAddTreeGroup.Name = "buttonAddTreeGroup"; + this.buttonAddTreeGroup.Size = new System.Drawing.Size(81, 23); + this.buttonAddTreeGroup.TabIndex = 17; + this.buttonAddTreeGroup.Text = "Add"; + this.buttonAddTreeGroup.UseVisualStyleBackColor = true; + this.buttonAddTreeGroup.Click += new System.EventHandler(this.buttonAddTreeGroup_Click); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(0, 233); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(66, 13); + this.label5.TabIndex = 18; + this.label5.Text = "Tree Groups"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(0, 415); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(34, 13); + this.label6.TabIndex = 18; + this.label6.Text = "Trees"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(0, 193); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(52, 13); + this.label2.TabIndex = 18; + this.label2.Text = "Pokemon"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(133, 193); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(53, 13); + this.label3.TabIndex = 18; + this.label3.Text = "Min Level"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(86, 13); + this.label1.TabIndex = 18; + this.label1.Text = "Encounter Table"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(197, 193); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(56, 13); + this.label4.TabIndex = 18; + this.label4.Text = "Max Level"; + // + // comboBoxPokemon + // + this.comboBoxPokemon.FormattingEnabled = true; + this.comboBoxPokemon.Location = new System.Drawing.Point(3, 209); + this.comboBoxPokemon.Name = "comboBoxPokemon"; + this.comboBoxPokemon.Size = new System.Drawing.Size(127, 21); + this.comboBoxPokemon.TabIndex = 19; + this.comboBoxPokemon.SelectedIndexChanged += new System.EventHandler(this.comboBoxPokemon_SelectedIndexChanged); + // + // listBoxTreeGroups + // + this.listBoxTreeGroups.DisplayMember = "DisplayName"; + this.listBoxTreeGroups.FormattingEnabled = true; + this.listBoxTreeGroups.Location = new System.Drawing.Point(3, 249); + this.listBoxTreeGroups.Name = "listBoxTreeGroups"; + this.listBoxTreeGroups.Size = new System.Drawing.Size(255, 134); + this.listBoxTreeGroups.TabIndex = 11; + this.listBoxTreeGroups.SelectedIndexChanged += new System.EventHandler(this.listBoxTreeGroups_SelectedIndexChanged); + // + // listBoxTrees + // + this.listBoxTrees.DisplayMember = "DisplayName"; + this.listBoxTrees.FormattingEnabled = true; + this.listBoxTrees.Location = new System.Drawing.Point(3, 431); + this.listBoxTrees.Name = "listBoxTrees"; + this.listBoxTrees.Size = new System.Drawing.Size(255, 82); + this.listBoxTrees.TabIndex = 11; + // + // listBoxEncounters + // + this.listBoxEncounters.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listBoxEncounters.FormattingEnabled = true; + this.listBoxEncounters.ItemHeight = 14; + this.listBoxEncounters.Location = new System.Drawing.Point(3, 15); + this.listBoxEncounters.Name = "listBoxEncounters"; + this.listBoxEncounters.Size = new System.Drawing.Size(255, 172); + this.listBoxEncounters.TabIndex = 13; + this.listBoxEncounters.SelectedIndexChanged += new System.EventHandler(this.listBoxEncounters_SelectedIndexChanged); + // + // HeadbuttEncounterEditorTab + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.comboBoxPokemon); + this.Controls.Add(this.label4); + this.Controls.Add(this.label1); + this.Controls.Add(this.listBoxTreeGroups); + this.Controls.Add(this.label3); + this.Controls.Add(this.buttonDuplicateTreeGroup); + this.Controls.Add(this.label2); + this.Controls.Add(this.buttonRemoveTreeGroup); + this.Controls.Add(this.listBoxTrees); + this.Controls.Add(this.label6); + this.Controls.Add(this.numericUpDownMaxLevel); + this.Controls.Add(this.listBoxEncounters); + this.Controls.Add(this.label5); + this.Controls.Add(this.numericUpDownMinLevel); + this.Controls.Add(this.buttonAddTreeGroup); + this.Name = "HeadbuttEncounterEditorTab"; + this.Size = new System.Drawing.Size(262, 517); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxLevel)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMinLevel)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public DSPRE.ListBox2 listBoxTreeGroups; + private System.Windows.Forms.Button buttonDuplicateTreeGroup; + private System.Windows.Forms.Button buttonRemoveTreeGroup; + public ListBox2 listBoxTrees; + public System.Windows.Forms.NumericUpDown numericUpDownMaxLevel; + public DSPRE.ListBox2 listBoxEncounters; + public System.Windows.Forms.NumericUpDown numericUpDownMinLevel; + private System.Windows.Forms.Button buttonAddTreeGroup; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label4; + public System.Windows.Forms.ComboBox comboBoxPokemon; + } +} diff --git a/DS_Map/Editors/HeadbuttEncounterEditorTab.cs b/DS_Map/Editors/HeadbuttEncounterEditorTab.cs new file mode 100644 index 0000000..2ce87e4 --- /dev/null +++ b/DS_Map/Editors/HeadbuttEncounterEditorTab.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using DSPRE.ROMFiles; + +namespace DSPRE.Editors { + public partial class HeadbuttEncounterEditorTab : UserControl { + private List encounters; + private BindingList treeGroups; + + public HeadbuttEncounterEditorTab() { + InitializeComponent(); + } + + public void Reset() { + Helpers.DisableHandlers(); + listBoxEncounters.DataSource = null; + listBoxTreeGroups.DataSource = null; + listBoxTrees.DataSource = null; + comboBoxPokemon.SelectedIndex = 0; + numericUpDownMinLevel.Value = 0; + numericUpDownMaxLevel.Value = 0; + Helpers.EnableHandlers(); + } + + public void SetHeadbuttEncounter(List encounters, BindingList treeGroups) { + Helpers.DisableHandlers(); + this.encounters = encounters; + this.treeGroups = treeGroups; + listBoxEncounters.DataSource = this.encounters; + listBoxTreeGroups.DataSource = this.treeGroups; + listBoxEncounters.SelectedIndex = -1; + listBoxTreeGroups.SelectedIndex = -1; + Helpers.EnableHandlers(); + } + + private void listBoxEncounters_SelectedIndexChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + HeadbuttEncounter headbuttEncounter = (HeadbuttEncounter)listBoxEncounters.SelectedItem; + if (headbuttEncounter == null) return; + comboBoxPokemon.SelectedIndex = headbuttEncounter.pokemonID; + numericUpDownMinLevel.Value = headbuttEncounter.minLevel; + numericUpDownMaxLevel.Value = headbuttEncounter.maxLevel; + } + + private void comboBoxPokemon_SelectedIndexChanged(object sender, EventArgs e) + { + if (Helpers.HandlersDisabled) return; + HeadbuttEncounter headbuttEncounter = (HeadbuttEncounter)listBoxEncounters.SelectedItem; + if (headbuttEncounter == null) return; + headbuttEncounter.pokemonID = (ushort)comboBoxPokemon.SelectedIndex; + listBoxEncounters.RefreshItem(listBoxEncounters.SelectedIndex); + } + + private void numericUpDownMinLevel_ValueChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + HeadbuttEncounter headbuttEncounter = (HeadbuttEncounter)listBoxEncounters.SelectedItem; + if (headbuttEncounter == null) return; + headbuttEncounter.minLevel = (byte)numericUpDownMinLevel.Value; + listBoxEncounters.RefreshItem(listBoxEncounters.SelectedIndex); + } + + private void numericUpDownMaxLevel_ValueChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + HeadbuttEncounter headbuttEncounter = (HeadbuttEncounter)listBoxEncounters.SelectedItem; + if (headbuttEncounter == null) return; + headbuttEncounter.maxLevel = (byte)numericUpDownMaxLevel.Value; + listBoxEncounters.RefreshItem(listBoxEncounters.SelectedIndex); + } + + private void listBoxTreeGroups_SelectedIndexChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + HeadbuttTreeGroup headbuttTreeGroup = (HeadbuttTreeGroup)listBoxTreeGroups.SelectedItem; + if (headbuttTreeGroup == null) return; + listBoxTrees.DataSource = headbuttTreeGroup.trees; + } + + private void buttonAddTreeGroup_Click(object sender, EventArgs e) { + treeGroups.Add(new HeadbuttTreeGroup()); + } + + private void buttonRemoveTreeGroup_Click(object sender, EventArgs e) { + int selectedIndex = listBoxTreeGroups.SelectedIndex; + if (selectedIndex == -1) return; + treeGroups.RemoveAt(selectedIndex); + } + + private void buttonDuplicateTreeGroup_Click(object sender, EventArgs e) { + HeadbuttTreeGroup headbuttTreeGroup = (HeadbuttTreeGroup)listBoxTreeGroups.SelectedItem; + if (headbuttTreeGroup == null) return; + treeGroups.Add(new HeadbuttTreeGroup(headbuttTreeGroup)); + } + } +} diff --git a/DS_Map/Editors/HeadbuttEncounterEditorTab.resx b/DS_Map/Editors/HeadbuttEncounterEditorTab.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DS_Map/Editors/HeadbuttEncounterEditorTab.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DS_Map/Editors/SafariZoneEditor.Designer.cs b/DS_Map/Editors/SafariZoneEditor.Designer.cs new file mode 100644 index 0000000..5a675f4 --- /dev/null +++ b/DS_Map/Editors/SafariZoneEditor.Designer.cs @@ -0,0 +1,250 @@ + +namespace DSPRE.Editors +{ + partial class SafariZoneEditor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.buttonSaveAs = new System.Windows.Forms.Button(); + this.buttonSave = new System.Windows.Forms.Button(); + this.tabPageSuperRod = new System.Windows.Forms.TabPage(); + this.safariZoneEncounterGroupEditorSuperRod = new DSPRE.Editors.SafariZoneEncounterGroupEditor(); + this.tabPageGoodRod = new System.Windows.Forms.TabPage(); + this.safariZoneEncounterGroupEditorGoodRod = new DSPRE.Editors.SafariZoneEncounterGroupEditor(); + this.tabPageOldRod = new System.Windows.Forms.TabPage(); + this.safariZoneEncounterGroupEditorOldRod = new DSPRE.Editors.SafariZoneEncounterGroupEditor(); + this.tabPageSurf = new System.Windows.Forms.TabPage(); + this.safariZoneEncounterGroupEditorSurf = new DSPRE.Editors.SafariZoneEncounterGroupEditor(); + this.tabPageGrass = new System.Windows.Forms.TabPage(); + this.safariZoneEncounterGroupEditorGrass = new DSPRE.Editors.SafariZoneEncounterGroupEditor(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.label1 = new System.Windows.Forms.Label(); + this.comboBoxFileID = new System.Windows.Forms.ComboBox(); + this.buttonImport = new System.Windows.Forms.Button(); + this.tabPageSuperRod.SuspendLayout(); + this.tabPageGoodRod.SuspendLayout(); + this.tabPageOldRod.SuspendLayout(); + this.tabPageSurf.SuspendLayout(); + this.tabPageGrass.SuspendLayout(); + this.tabControl1.SuspendLayout(); + this.SuspendLayout(); + // + // buttonSaveAs + // + this.buttonSaveAs.Location = new System.Drawing.Point(236, 14); + this.buttonSaveAs.Name = "buttonSaveAs"; + this.buttonSaveAs.Size = new System.Drawing.Size(75, 23); + this.buttonSaveAs.TabIndex = 28; + this.buttonSaveAs.Text = "Save As"; + this.buttonSaveAs.UseVisualStyleBackColor = true; + this.buttonSaveAs.Click += new System.EventHandler(this.buttonSaveAs_Click); + // + // buttonSave + // + this.buttonSave.Location = new System.Drawing.Point(155, 14); + this.buttonSave.Name = "buttonSave"; + this.buttonSave.Size = new System.Drawing.Size(75, 23); + this.buttonSave.TabIndex = 28; + this.buttonSave.Text = "Save"; + this.buttonSave.UseVisualStyleBackColor = true; + this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click); + // + // tabPageSuperRod + // + this.tabPageSuperRod.Controls.Add(this.safariZoneEncounterGroupEditorSuperRod); + this.tabPageSuperRod.Location = new System.Drawing.Point(4, 22); + this.tabPageSuperRod.Name = "tabPageSuperRod"; + this.tabPageSuperRod.Padding = new System.Windows.Forms.Padding(3); + this.tabPageSuperRod.Size = new System.Drawing.Size(935, 264); + this.tabPageSuperRod.TabIndex = 4; + this.tabPageSuperRod.Text = "Super Rod"; + this.tabPageSuperRod.UseVisualStyleBackColor = true; + // + // safariZoneEncounterGroupEditorSuperRod + // + this.safariZoneEncounterGroupEditorSuperRod.Location = new System.Drawing.Point(6, 6); + this.safariZoneEncounterGroupEditorSuperRod.Name = "safariZoneEncounterGroupEditorSuperRod"; + this.safariZoneEncounterGroupEditorSuperRod.Size = new System.Drawing.Size(969, 255); + this.safariZoneEncounterGroupEditorSuperRod.TabIndex = 25; + // + // tabPageGoodRod + // + this.tabPageGoodRod.Controls.Add(this.safariZoneEncounterGroupEditorGoodRod); + this.tabPageGoodRod.Location = new System.Drawing.Point(4, 22); + this.tabPageGoodRod.Name = "tabPageGoodRod"; + this.tabPageGoodRod.Padding = new System.Windows.Forms.Padding(3); + this.tabPageGoodRod.Size = new System.Drawing.Size(935, 264); + this.tabPageGoodRod.TabIndex = 3; + this.tabPageGoodRod.Text = "Good Rod"; + this.tabPageGoodRod.UseVisualStyleBackColor = true; + // + // safariZoneEncounterGroupEditorGoodRod + // + this.safariZoneEncounterGroupEditorGoodRod.Location = new System.Drawing.Point(6, 6); + this.safariZoneEncounterGroupEditorGoodRod.Name = "safariZoneEncounterGroupEditorGoodRod"; + this.safariZoneEncounterGroupEditorGoodRod.Size = new System.Drawing.Size(969, 255); + this.safariZoneEncounterGroupEditorGoodRod.TabIndex = 25; + // + // tabPageOldRod + // + this.tabPageOldRod.Controls.Add(this.safariZoneEncounterGroupEditorOldRod); + this.tabPageOldRod.Location = new System.Drawing.Point(4, 22); + this.tabPageOldRod.Name = "tabPageOldRod"; + this.tabPageOldRod.Padding = new System.Windows.Forms.Padding(3); + this.tabPageOldRod.Size = new System.Drawing.Size(935, 264); + this.tabPageOldRod.TabIndex = 2; + this.tabPageOldRod.Text = "Old Rod"; + this.tabPageOldRod.UseVisualStyleBackColor = true; + // + // safariZoneEncounterGroupEditorOldRod + // + this.safariZoneEncounterGroupEditorOldRod.Location = new System.Drawing.Point(6, 6); + this.safariZoneEncounterGroupEditorOldRod.Name = "safariZoneEncounterGroupEditorOldRod"; + this.safariZoneEncounterGroupEditorOldRod.Size = new System.Drawing.Size(969, 255); + this.safariZoneEncounterGroupEditorOldRod.TabIndex = 25; + // + // tabPageSurf + // + this.tabPageSurf.Controls.Add(this.safariZoneEncounterGroupEditorSurf); + this.tabPageSurf.Location = new System.Drawing.Point(4, 22); + this.tabPageSurf.Name = "tabPageSurf"; + this.tabPageSurf.Padding = new System.Windows.Forms.Padding(3); + this.tabPageSurf.Size = new System.Drawing.Size(935, 264); + this.tabPageSurf.TabIndex = 1; + this.tabPageSurf.Text = "Surf"; + this.tabPageSurf.UseVisualStyleBackColor = true; + // + // safariZoneEncounterGroupEditorSurf + // + this.safariZoneEncounterGroupEditorSurf.Location = new System.Drawing.Point(6, 6); + this.safariZoneEncounterGroupEditorSurf.Name = "safariZoneEncounterGroupEditorSurf"; + this.safariZoneEncounterGroupEditorSurf.Size = new System.Drawing.Size(969, 255); + this.safariZoneEncounterGroupEditorSurf.TabIndex = 25; + // + // tabPageGrass + // + this.tabPageGrass.Controls.Add(this.safariZoneEncounterGroupEditorGrass); + this.tabPageGrass.Location = new System.Drawing.Point(4, 22); + this.tabPageGrass.Name = "tabPageGrass"; + this.tabPageGrass.Padding = new System.Windows.Forms.Padding(3); + this.tabPageGrass.Size = new System.Drawing.Size(935, 264); + this.tabPageGrass.TabIndex = 0; + this.tabPageGrass.Text = "Grass"; + this.tabPageGrass.UseVisualStyleBackColor = true; + // + // safariZoneEncounterGroupEditorGrass + // + this.safariZoneEncounterGroupEditorGrass.Location = new System.Drawing.Point(6, 6); + this.safariZoneEncounterGroupEditorGrass.Name = "safariZoneEncounterGroupEditorGrass"; + this.safariZoneEncounterGroupEditorGrass.Size = new System.Drawing.Size(969, 255); + this.safariZoneEncounterGroupEditorGrass.TabIndex = 25; + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPageGrass); + this.tabControl1.Controls.Add(this.tabPageSurf); + this.tabControl1.Controls.Add(this.tabPageOldRod); + this.tabControl1.Controls.Add(this.tabPageGoodRod); + this.tabControl1.Controls.Add(this.tabPageSuperRod); + this.tabControl1.Location = new System.Drawing.Point(4, 44); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(943, 290); + this.tabControl1.TabIndex = 27; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(3, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(59, 13); + this.label1.TabIndex = 26; + this.label1.Text = "Map Name"; + // + // comboBoxFileID + // + this.comboBoxFileID.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxFileID.FormattingEnabled = true; + this.comboBoxFileID.Location = new System.Drawing.Point(3, 16); + this.comboBoxFileID.Name = "comboBoxFileID"; + this.comboBoxFileID.Size = new System.Drawing.Size(146, 21); + this.comboBoxFileID.TabIndex = 0; + this.comboBoxFileID.SelectedIndexChanged += new System.EventHandler(this.comboBoxFileID_SelectedIndexChanged); + // + // buttonImport + // + this.buttonImport.Location = new System.Drawing.Point(317, 14); + this.buttonImport.Name = "buttonImport"; + this.buttonImport.Size = new System.Drawing.Size(75, 23); + this.buttonImport.TabIndex = 28; + this.buttonImport.Text = "Import"; + this.buttonImport.UseVisualStyleBackColor = true; + this.buttonImport.Click += new System.EventHandler(this.buttonImport_Click); + // + // SafariZoneEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.buttonImport); + this.Controls.Add(this.buttonSaveAs); + this.Controls.Add(this.buttonSave); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.label1); + this.Controls.Add(this.comboBoxFileID); + this.Name = "SafariZoneEditor"; + this.Size = new System.Drawing.Size(953, 340); + this.tabPageSuperRod.ResumeLayout(false); + this.tabPageGoodRod.ResumeLayout(false); + this.tabPageOldRod.ResumeLayout(false); + this.tabPageSurf.ResumeLayout(false); + this.tabPageGrass.ResumeLayout(false); + this.tabControl1.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button buttonSaveAs; + private System.Windows.Forms.Button buttonSave; + private System.Windows.Forms.TabPage tabPageSuperRod; + private SafariZoneEncounterGroupEditor safariZoneEncounterGroupEditorSuperRod; + private System.Windows.Forms.TabPage tabPageGoodRod; + private SafariZoneEncounterGroupEditor safariZoneEncounterGroupEditorGoodRod; + private System.Windows.Forms.TabPage tabPageOldRod; + private SafariZoneEncounterGroupEditor safariZoneEncounterGroupEditorOldRod; + private System.Windows.Forms.TabPage tabPageSurf; + private SafariZoneEncounterGroupEditor safariZoneEncounterGroupEditorSurf; + private System.Windows.Forms.TabPage tabPageGrass; + private SafariZoneEncounterGroupEditor safariZoneEncounterGroupEditorGrass; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ComboBox comboBoxFileID; + private System.Windows.Forms.Button buttonImport; + } +} diff --git a/DS_Map/Editors/SafariZoneEditor.cs b/DS_Map/Editors/SafariZoneEditor.cs new file mode 100644 index 0000000..fe11773 --- /dev/null +++ b/DS_Map/Editors/SafariZoneEditor.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Windows.Forms; +using DSPRE.ROMFiles; + +namespace DSPRE.Editors { + public partial class SafariZoneEditor : UserControl { + public bool safariZoneEditorIsReady { get; set; } = false; + private SafariZoneEncounterFile safariZoneEncounterFile; + + public SafariZoneEditor() { + InitializeComponent(); + } + + public void SetupSafariZoneEditor(bool force = false) { + if (safariZoneEditorIsReady && !force) return; + safariZoneEditorIsReady = true; + + DSUtils.TryUnpackNarcs(new List() { + RomInfo.DirNames.safariZone, + RomInfo.DirNames.textArchives, + }); + + safariZoneEncounterGroupEditorGrass.SetPokemonNames(); + safariZoneEncounterGroupEditorSurf.SetPokemonNames(); + safariZoneEncounterGroupEditorOldRod.SetPokemonNames(); + safariZoneEncounterGroupEditorGoodRod.SetPokemonNames(); + safariZoneEncounterGroupEditorSuperRod.SetPokemonNames(); + + int safariZoneCount = Filesystem.GetSafariZoneCount(); + comboBoxFileID.Items.Clear(); + for (int i = 0; i < safariZoneCount; i++) { + comboBoxFileID.Items.Add(SafariZoneEncounterFile.Names[i]); + } + + if (comboBoxFileID.Items.Count > 0) { + comboBoxFileID.SelectedIndex = 0; + } + } + + private void comboBoxFileID_SelectedIndexChanged(object sender, EventArgs e) { + if (comboBoxFileID.SelectedIndex == -1) { + safariZoneEncounterFile = null; + safariZoneEncounterGroupEditorGrass.Reset(); + safariZoneEncounterGroupEditorSurf.Reset(); + safariZoneEncounterGroupEditorOldRod.Reset(); + safariZoneEncounterGroupEditorGoodRod.Reset(); + safariZoneEncounterGroupEditorSuperRod.Reset(); + return; + } + + safariZoneEncounterFile = new SafariZoneEncounterFile(comboBoxFileID.SelectedIndex); + safariZoneEncounterGroupEditorGrass.SetData(safariZoneEncounterFile.grassEncounterGroup); + safariZoneEncounterGroupEditorSurf.SetData(safariZoneEncounterFile.surfEncounterGroup); + safariZoneEncounterGroupEditorOldRod.SetData(safariZoneEncounterFile.oldRodEncounterGroup); + safariZoneEncounterGroupEditorGoodRod.SetData(safariZoneEncounterFile.goodRodEncounterGroup); + safariZoneEncounterGroupEditorSuperRod.SetData(safariZoneEncounterFile.superRodEncounterGroup); + } + + private void buttonSave_Click(object sender, EventArgs e) { + if (safariZoneEncounterFile == null) return; + safariZoneEncounterFile.SaveToFile(); + } + + private void buttonSaveAs_Click(object sender, EventArgs e) { + if (safariZoneEncounterFile == null) return; + + 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) return; + + safariZoneEncounterFile.SaveToFile(sfd.FileName); + } + + private void buttonImport_Click(object sender, EventArgs e) { + if (safariZoneEncounterFile == null) return; + + OpenFileDialog ofd = new OpenFileDialog(); + try { + ofd.InitialDirectory = Path.GetDirectoryName(ofd.FileName); + ofd.FileName = Path.GetFileName(ofd.FileName); + } + catch (Exception ex) { + ofd.InitialDirectory = Path.GetDirectoryName(Environment.SpecialFolder.UserProfile.ToString()); + ofd.FileName = Path.GetFileName(ofd.FileName); + } + if (ofd.ShowDialog() != DialogResult.OK) return; + + safariZoneEncounterFile = new SafariZoneEncounterFile(ofd.FileName); + safariZoneEncounterGroupEditorGrass.SetData(safariZoneEncounterFile.grassEncounterGroup); + safariZoneEncounterGroupEditorSurf.SetData(safariZoneEncounterFile.surfEncounterGroup); + safariZoneEncounterGroupEditorOldRod.SetData(safariZoneEncounterFile.oldRodEncounterGroup); + safariZoneEncounterGroupEditorGoodRod.SetData(safariZoneEncounterFile.goodRodEncounterGroup); + safariZoneEncounterGroupEditorSuperRod.SetData(safariZoneEncounterFile.superRodEncounterGroup); + } + } +} diff --git a/DS_Map/Editors/SafariZoneEditor.resx b/DS_Map/Editors/SafariZoneEditor.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DS_Map/Editors/SafariZoneEditor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DS_Map/Editors/SafariZoneEncounterEditorTab.Designer.cs b/DS_Map/Editors/SafariZoneEncounterEditorTab.Designer.cs new file mode 100644 index 0000000..bb6a6cb --- /dev/null +++ b/DS_Map/Editors/SafariZoneEncounterEditorTab.Designer.cs @@ -0,0 +1,218 @@ + +namespace DSPRE.Editors +{ + partial class SafariZoneEncounterEditorTab + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.numericUpDownLevel = new System.Windows.Forms.NumericUpDown(); + this.comboBoxPokemon = new System.Windows.Forms.ComboBox(); + this.numericUpDownLevelObject = new System.Windows.Forms.NumericUpDown(); + this.comboBoxPokemonObject = new System.Windows.Forms.ComboBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.listBoxEncountersObject = new DSPRE.ListBox2(); + this.listBoxEncounters = new DSPRE.ListBox2(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLevel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLevelObject)).BeginInit(); + this.SuspendLayout(); + // + // numericUpDownLevel + // + this.numericUpDownLevel.Location = new System.Drawing.Point(139, 180); + this.numericUpDownLevel.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownLevel.Name = "numericUpDownLevel"; + this.numericUpDownLevel.Size = new System.Drawing.Size(58, 20); + this.numericUpDownLevel.TabIndex = 20; + this.numericUpDownLevel.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownLevel.ValueChanged += new System.EventHandler(this.numericUpDownLevel_ValueChanged); + // + // comboBoxPokemon + // + this.comboBoxPokemon.FormattingEnabled = true; + this.comboBoxPokemon.Location = new System.Drawing.Point(6, 179); + this.comboBoxPokemon.Name = "comboBoxPokemon"; + this.comboBoxPokemon.Size = new System.Drawing.Size(127, 21); + this.comboBoxPokemon.TabIndex = 21; + this.comboBoxPokemon.SelectedIndexChanged += new System.EventHandler(this.comboBoxPokemon_SelectedIndexChanged); + // + // numericUpDownLevelObject + // + this.numericUpDownLevelObject.Location = new System.Drawing.Point(339, 180); + this.numericUpDownLevelObject.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownLevelObject.Name = "numericUpDownLevelObject"; + this.numericUpDownLevelObject.Size = new System.Drawing.Size(58, 20); + this.numericUpDownLevelObject.TabIndex = 20; + this.numericUpDownLevelObject.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownLevelObject.ValueChanged += new System.EventHandler(this.numericUpDownLevelObject_ValueChanged); + // + // comboBoxPokemonObject + // + this.comboBoxPokemonObject.FormattingEnabled = true; + this.comboBoxPokemonObject.Location = new System.Drawing.Point(206, 179); + this.comboBoxPokemonObject.Name = "comboBoxPokemonObject"; + this.comboBoxPokemonObject.Size = new System.Drawing.Size(127, 21); + this.comboBoxPokemonObject.TabIndex = 21; + this.comboBoxPokemonObject.SelectedIndexChanged += new System.EventHandler(this.comboBoxPokemonObject_SelectedIndexChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(3, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(86, 13); + this.label2.TabIndex = 22; + this.label2.Text = "Encounter Table"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(203, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(120, 13); + this.label1.TabIndex = 22; + this.label1.Text = "Object Encounter Table"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(136, 163); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(33, 13); + this.label3.TabIndex = 23; + this.label3.Text = "Level"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(3, 163); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(52, 13); + this.label4.TabIndex = 24; + this.label4.Text = "Pokemon"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(203, 163); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(52, 13); + this.label5.TabIndex = 24; + this.label5.Text = "Pokemon"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(336, 163); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(33, 13); + this.label6.TabIndex = 23; + this.label6.Text = "Level"; + // + // listBoxEncountersObject + // + this.listBoxEncountersObject.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listBoxEncountersObject.FormattingEnabled = true; + this.listBoxEncountersObject.ItemHeight = 14; + this.listBoxEncountersObject.Location = new System.Drawing.Point(206, 16); + this.listBoxEncountersObject.Name = "listBoxEncountersObject"; + this.listBoxEncountersObject.Size = new System.Drawing.Size(191, 144); + this.listBoxEncountersObject.TabIndex = 1; + this.listBoxEncountersObject.SelectedIndexChanged += new System.EventHandler(this.listBoxEncountersObject_SelectedIndexChanged); + // + // listBoxEncounters + // + this.listBoxEncounters.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listBoxEncounters.FormattingEnabled = true; + this.listBoxEncounters.ItemHeight = 14; + this.listBoxEncounters.Location = new System.Drawing.Point(6, 16); + this.listBoxEncounters.Name = "listBoxEncounters"; + this.listBoxEncounters.Size = new System.Drawing.Size(191, 144); + this.listBoxEncounters.TabIndex = 1; + this.listBoxEncounters.SelectedIndexChanged += new System.EventHandler(this.listBoxEncounters_SelectedIndexChanged); + // + // SafariZoneEncounterEditorTab + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label6); + this.Controls.Add(this.label3); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label1); + this.Controls.Add(this.label2); + this.Controls.Add(this.comboBoxPokemonObject); + this.Controls.Add(this.comboBoxPokemon); + this.Controls.Add(this.numericUpDownLevelObject); + this.Controls.Add(this.numericUpDownLevel); + this.Controls.Add(this.listBoxEncountersObject); + this.Controls.Add(this.listBoxEncounters); + this.Name = "SafariZoneEncounterEditorTab"; + this.Size = new System.Drawing.Size(404, 208); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLevel)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLevelObject)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public ListBox2 listBoxEncounters; + public System.Windows.Forms.NumericUpDown numericUpDownLevel; + public System.Windows.Forms.ComboBox comboBoxPokemon; + public ListBox2 listBoxEncountersObject; + public System.Windows.Forms.NumericUpDown numericUpDownLevelObject; + public System.Windows.Forms.ComboBox comboBoxPokemonObject; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + } +} diff --git a/DS_Map/Editors/SafariZoneEncounterEditorTab.cs b/DS_Map/Editors/SafariZoneEncounterEditorTab.cs new file mode 100644 index 0000000..59416ba --- /dev/null +++ b/DS_Map/Editors/SafariZoneEncounterEditorTab.cs @@ -0,0 +1,63 @@ +using System; +using System.Windows.Forms; +using DSPRE.ROMFiles; + +namespace DSPRE.Editors { + public partial class SafariZoneEncounterEditorTab : UserControl { + public SafariZoneEncounterEditorTab() { + InitializeComponent(); + } + + private void listBoxEncounters_SelectedIndexChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + SafariZoneEncounter safariZoneEncounter = (SafariZoneEncounter)listBoxEncounters.SelectedItem; + if (safariZoneEncounter == null) return; + comboBoxPokemon.SelectedIndex = safariZoneEncounter.pokemonID; + numericUpDownLevel.Value = safariZoneEncounter.level; + } + + private void comboBoxPokemon_SelectedIndexChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + SafariZoneEncounter safariZoneEncounter = (SafariZoneEncounter)listBoxEncounters.SelectedItem; + if (safariZoneEncounter == null) return; + safariZoneEncounter.pokemonID = (ushort)comboBoxPokemon.SelectedIndex; + listBoxEncounters.RefreshItem(listBoxEncounters.SelectedIndex); + } + + private void numericUpDownLevel_ValueChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + SafariZoneEncounter safariZoneEncounter = (SafariZoneEncounter)listBoxEncounters.SelectedItem; + if (safariZoneEncounter == null) return; + safariZoneEncounter.level = (byte)numericUpDownLevel.Value; + listBoxEncounters.RefreshItem(listBoxEncounters.SelectedIndex); + } + + private void listBoxEncountersObject_SelectedIndexChanged(object sender, EventArgs e) + { + if (Helpers.HandlersDisabled) return; + SafariZoneEncounter safariZoneEncounter = (SafariZoneEncounter)listBoxEncountersObject.SelectedItem; + if (safariZoneEncounter == null) return; + + comboBoxPokemonObject.SelectedIndex = safariZoneEncounter.pokemonID; + numericUpDownLevelObject.Value = safariZoneEncounter.level; + } + + private void comboBoxPokemonObject_SelectedIndexChanged(object sender, EventArgs e) + { + if (Helpers.HandlersDisabled) return; + SafariZoneEncounter safariZoneEncounter = (SafariZoneEncounter)listBoxEncountersObject.SelectedItem; + if (safariZoneEncounter == null) return; + safariZoneEncounter.pokemonID = (ushort)comboBoxPokemonObject.SelectedIndex; + listBoxEncountersObject.RefreshItem(listBoxEncountersObject.SelectedIndex); + } + + private void numericUpDownLevelObject_ValueChanged(object sender, EventArgs e) + { + if (Helpers.HandlersDisabled) return; + SafariZoneEncounter safariZoneEncounter = (SafariZoneEncounter)listBoxEncountersObject.SelectedItem; + if (safariZoneEncounter == null) return; + safariZoneEncounter.level = (byte)numericUpDownLevelObject.Value; + listBoxEncountersObject.RefreshItem(listBoxEncountersObject.SelectedIndex); + } + } +} diff --git a/DS_Map/Editors/SafariZoneEncounterEditorTab.resx b/DS_Map/Editors/SafariZoneEncounterEditorTab.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DS_Map/Editors/SafariZoneEncounterEditorTab.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DS_Map/Editors/SafariZoneEncounterGroupEditor.Designer.cs b/DS_Map/Editors/SafariZoneEncounterGroupEditor.Designer.cs new file mode 100644 index 0000000..bf45296 --- /dev/null +++ b/DS_Map/Editors/SafariZoneEncounterGroupEditor.Designer.cs @@ -0,0 +1,323 @@ + +namespace DSPRE.Editors +{ + partial class SafariZoneEncounterGroupEditor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tabControlEncounters = new System.Windows.Forms.TabControl(); + this.tabPageMorning = new System.Windows.Forms.TabPage(); + this.safariZoneEncounterEditorMorningTab = new DSPRE.Editors.SafariZoneEncounterEditorTab(); + this.tabPageDay = new System.Windows.Forms.TabPage(); + this.safariZoneEncounterEditorDayTab = new DSPRE.Editors.SafariZoneEncounterEditorTab(); + this.tabPageNight = new System.Windows.Forms.TabPage(); + this.safariZoneEncounterEditorNightTab = new DSPRE.Editors.SafariZoneEncounterEditorTab(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.comboBoxObjectRequirementType = new System.Windows.Forms.ComboBox(); + this.numericUpDownObjectRequirementQty = new System.Windows.Forms.NumericUpDown(); + this.listBoxObjectRequirements = new DSPRE.ListBox2(); + this.listBoxObjectOptionalRequirements = new DSPRE.ListBox2(); + this.numericUpDownObjectOptionalRequirementQty = new System.Windows.Forms.NumericUpDown(); + this.comboBoxOptionalObjectRequirementType = new System.Windows.Forms.ComboBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.buttonRemoveObjectEncounter = new System.Windows.Forms.Button(); + this.buttonAddObjectEncounter = new System.Windows.Forms.Button(); + this.tabControlEncounters.SuspendLayout(); + this.tabPageMorning.SuspendLayout(); + this.tabPageDay.SuspendLayout(); + this.tabPageNight.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownObjectRequirementQty)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownObjectOptionalRequirementQty)).BeginInit(); + this.SuspendLayout(); + // + // tabControlEncounters + // + this.tabControlEncounters.Controls.Add(this.tabPageMorning); + this.tabControlEncounters.Controls.Add(this.tabPageDay); + this.tabControlEncounters.Controls.Add(this.tabPageNight); + this.tabControlEncounters.Location = new System.Drawing.Point(4, 7); + this.tabControlEncounters.Name = "tabControlEncounters"; + this.tabControlEncounters.SelectedIndex = 0; + this.tabControlEncounters.Size = new System.Drawing.Size(418, 244); + this.tabControlEncounters.TabIndex = 2; + // + // tabPageMorning + // + this.tabPageMorning.Controls.Add(this.safariZoneEncounterEditorMorningTab); + this.tabPageMorning.Location = new System.Drawing.Point(4, 22); + this.tabPageMorning.Name = "tabPageMorning"; + this.tabPageMorning.Padding = new System.Windows.Forms.Padding(3); + this.tabPageMorning.Size = new System.Drawing.Size(410, 218); + this.tabPageMorning.TabIndex = 0; + this.tabPageMorning.Text = "Morning"; + this.tabPageMorning.UseVisualStyleBackColor = true; + // + // safariZoneEncounterEditorMorningTab + // + this.safariZoneEncounterEditorMorningTab.Location = new System.Drawing.Point(6, 6); + this.safariZoneEncounterEditorMorningTab.Name = "safariZoneEncounterEditorMorningTab"; + this.safariZoneEncounterEditorMorningTab.Size = new System.Drawing.Size(405, 209); + this.safariZoneEncounterEditorMorningTab.TabIndex = 1; + // + // tabPageDay + // + this.tabPageDay.Controls.Add(this.safariZoneEncounterEditorDayTab); + this.tabPageDay.Location = new System.Drawing.Point(4, 22); + this.tabPageDay.Name = "tabPageDay"; + this.tabPageDay.Padding = new System.Windows.Forms.Padding(3); + this.tabPageDay.Size = new System.Drawing.Size(410, 218); + this.tabPageDay.TabIndex = 1; + this.tabPageDay.Text = "Day"; + this.tabPageDay.UseVisualStyleBackColor = true; + // + // safariZoneEncounterEditorDayTab + // + this.safariZoneEncounterEditorDayTab.Location = new System.Drawing.Point(6, 6); + this.safariZoneEncounterEditorDayTab.Name = "safariZoneEncounterEditorDayTab"; + this.safariZoneEncounterEditorDayTab.Size = new System.Drawing.Size(401, 206); + this.safariZoneEncounterEditorDayTab.TabIndex = 1; + // + // tabPageNight + // + this.tabPageNight.Controls.Add(this.safariZoneEncounterEditorNightTab); + this.tabPageNight.Location = new System.Drawing.Point(4, 22); + this.tabPageNight.Name = "tabPageNight"; + this.tabPageNight.Padding = new System.Windows.Forms.Padding(3); + this.tabPageNight.Size = new System.Drawing.Size(410, 218); + this.tabPageNight.TabIndex = 2; + this.tabPageNight.Text = "Night"; + this.tabPageNight.UseVisualStyleBackColor = true; + // + // safariZoneEncounterEditorNightTab + // + this.safariZoneEncounterEditorNightTab.Location = new System.Drawing.Point(6, 6); + this.safariZoneEncounterEditorNightTab.Name = "safariZoneEncounterEditorNightTab"; + this.safariZoneEncounterEditorNightTab.Size = new System.Drawing.Size(401, 206); + this.safariZoneEncounterEditorNightTab.TabIndex = 1; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(657, 198); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(23, 13); + this.label3.TabIndex = 29; + this.label3.Text = "Qty"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(524, 198); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(31, 13); + this.label4.TabIndex = 30; + this.label4.Text = "Type"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(524, 35); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(133, 13); + this.label2.TabIndex = 28; + this.label2.Text = "Object Type Requirements"; + // + // comboBoxObjectRequirementType + // + this.comboBoxObjectRequirementType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxObjectRequirementType.FormattingEnabled = true; + this.comboBoxObjectRequirementType.Location = new System.Drawing.Point(527, 214); + this.comboBoxObjectRequirementType.Name = "comboBoxObjectRequirementType"; + this.comboBoxObjectRequirementType.Size = new System.Drawing.Size(127, 21); + this.comboBoxObjectRequirementType.TabIndex = 27; + this.comboBoxObjectRequirementType.SelectedIndexChanged += new System.EventHandler(this.comboBoxObjectRequirementType_SelectedIndexChanged); + // + // numericUpDownObjectRequirementQty + // + this.numericUpDownObjectRequirementQty.Location = new System.Drawing.Point(660, 215); + this.numericUpDownObjectRequirementQty.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownObjectRequirementQty.Name = "numericUpDownObjectRequirementQty"; + this.numericUpDownObjectRequirementQty.Size = new System.Drawing.Size(58, 20); + this.numericUpDownObjectRequirementQty.TabIndex = 26; + this.numericUpDownObjectRequirementQty.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownObjectRequirementQty.ValueChanged += new System.EventHandler(this.numericUpDownObjectRequirementQty_ValueChanged); + // + // listBoxObjectRequirements + // + this.listBoxObjectRequirements.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listBoxObjectRequirements.FormattingEnabled = true; + this.listBoxObjectRequirements.ItemHeight = 14; + this.listBoxObjectRequirements.Location = new System.Drawing.Point(527, 51); + this.listBoxObjectRequirements.Name = "listBoxObjectRequirements"; + this.listBoxObjectRequirements.Size = new System.Drawing.Size(191, 144); + this.listBoxObjectRequirements.TabIndex = 25; + this.listBoxObjectRequirements.SelectedIndexChanged += new System.EventHandler(this.listBoxObjectRequirements_SelectedIndexChanged); + // + // listBoxObjectOptionalRequirements + // + this.listBoxObjectOptionalRequirements.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.listBoxObjectOptionalRequirements.FormattingEnabled = true; + this.listBoxObjectOptionalRequirements.ItemHeight = 14; + this.listBoxObjectOptionalRequirements.Location = new System.Drawing.Point(724, 51); + this.listBoxObjectOptionalRequirements.Name = "listBoxObjectOptionalRequirements"; + this.listBoxObjectOptionalRequirements.Size = new System.Drawing.Size(191, 144); + this.listBoxObjectOptionalRequirements.TabIndex = 25; + this.listBoxObjectOptionalRequirements.SelectedIndexChanged += new System.EventHandler(this.listBoxObjectOptionalRequirements_SelectedIndexChanged); + // + // numericUpDownObjectOptionalRequirementQty + // + this.numericUpDownObjectOptionalRequirementQty.Location = new System.Drawing.Point(857, 215); + this.numericUpDownObjectOptionalRequirementQty.Name = "numericUpDownObjectOptionalRequirementQty"; + this.numericUpDownObjectOptionalRequirementQty.Size = new System.Drawing.Size(58, 20); + this.numericUpDownObjectOptionalRequirementQty.TabIndex = 26; + this.numericUpDownObjectOptionalRequirementQty.ValueChanged += new System.EventHandler(this.numericUpDownObjectOptionalRequirementQty_ValueChanged); + // + // comboBoxOptionalObjectRequirementType + // + this.comboBoxOptionalObjectRequirementType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxOptionalObjectRequirementType.FormattingEnabled = true; + this.comboBoxOptionalObjectRequirementType.Location = new System.Drawing.Point(724, 214); + this.comboBoxOptionalObjectRequirementType.Name = "comboBoxOptionalObjectRequirementType"; + this.comboBoxOptionalObjectRequirementType.Size = new System.Drawing.Size(127, 21); + this.comboBoxOptionalObjectRequirementType.TabIndex = 27; + this.comboBoxOptionalObjectRequirementType.SelectedIndexChanged += new System.EventHandler(this.comboBoxOptionalObjectRequirementType_SelectedIndexChanged); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(721, 35); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(175, 13); + this.label5.TabIndex = 28; + this.label5.Text = "Optional Object Type Requirements"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(721, 198); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(31, 13); + this.label6.TabIndex = 30; + this.label6.Text = "Type"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(854, 198); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(23, 13); + this.label7.TabIndex = 29; + this.label7.Text = "Qty"; + // + // buttonRemoveObjectEncounter + // + this.buttonRemoveObjectEncounter.Location = new System.Drawing.Point(424, 77); + this.buttonRemoveObjectEncounter.Name = "buttonRemoveObjectEncounter"; + this.buttonRemoveObjectEncounter.Size = new System.Drawing.Size(97, 55); + this.buttonRemoveObjectEncounter.TabIndex = 31; + this.buttonRemoveObjectEncounter.Text = "Remove Last Object Encounter"; + this.buttonRemoveObjectEncounter.UseVisualStyleBackColor = true; + this.buttonRemoveObjectEncounter.Click += new System.EventHandler(this.buttonRemoveObjectEncounter_Click); + // + // buttonAddObjectEncounter + // + this.buttonAddObjectEncounter.Location = new System.Drawing.Point(424, 32); + this.buttonAddObjectEncounter.Name = "buttonAddObjectEncounter"; + this.buttonAddObjectEncounter.Size = new System.Drawing.Size(97, 39); + this.buttonAddObjectEncounter.TabIndex = 31; + this.buttonAddObjectEncounter.Text = "Add Object Encounter"; + this.buttonAddObjectEncounter.UseVisualStyleBackColor = true; + this.buttonAddObjectEncounter.Click += new System.EventHandler(this.buttonAddObjectEncounter_Click); + // + // SafariZoneEncounterGroupEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.buttonAddObjectEncounter); + this.Controls.Add(this.buttonRemoveObjectEncounter); + this.Controls.Add(this.label7); + this.Controls.Add(this.label3); + this.Controls.Add(this.label6); + this.Controls.Add(this.label4); + this.Controls.Add(this.tabControlEncounters); + this.Controls.Add(this.label5); + this.Controls.Add(this.comboBoxOptionalObjectRequirementType); + this.Controls.Add(this.label2); + this.Controls.Add(this.comboBoxObjectRequirementType); + this.Controls.Add(this.numericUpDownObjectOptionalRequirementQty); + this.Controls.Add(this.listBoxObjectOptionalRequirements); + this.Controls.Add(this.numericUpDownObjectRequirementQty); + this.Controls.Add(this.listBoxObjectRequirements); + this.Name = "SafariZoneEncounterGroupEditor"; + this.Size = new System.Drawing.Size(927, 257); + this.tabControlEncounters.ResumeLayout(false); + this.tabPageMorning.ResumeLayout(false); + this.tabPageDay.ResumeLayout(false); + this.tabPageNight.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownObjectRequirementQty)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownObjectOptionalRequirementQty)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.TabControl tabControlEncounters; + private System.Windows.Forms.TabPage tabPageMorning; + private System.Windows.Forms.TabPage tabPageDay; + private System.Windows.Forms.TabPage tabPageNight; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label2; + public System.Windows.Forms.ComboBox comboBoxObjectRequirementType; + public System.Windows.Forms.NumericUpDown numericUpDownObjectRequirementQty; + public ListBox2 listBoxObjectRequirements; + public ListBox2 listBoxObjectOptionalRequirements; + public System.Windows.Forms.NumericUpDown numericUpDownObjectOptionalRequirementQty; + public System.Windows.Forms.ComboBox comboBoxOptionalObjectRequirementType; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + public SafariZoneEncounterEditorTab safariZoneEncounterEditorMorningTab; + public SafariZoneEncounterEditorTab safariZoneEncounterEditorDayTab; + public SafariZoneEncounterEditorTab safariZoneEncounterEditorNightTab; + private System.Windows.Forms.Button buttonRemoveObjectEncounter; + private System.Windows.Forms.Button buttonAddObjectEncounter; + } +} diff --git a/DS_Map/Editors/SafariZoneEncounterGroupEditor.cs b/DS_Map/Editors/SafariZoneEncounterGroupEditor.cs new file mode 100644 index 0000000..32686ce --- /dev/null +++ b/DS_Map/Editors/SafariZoneEncounterGroupEditor.cs @@ -0,0 +1,143 @@ +using System; +using System.Windows.Forms; +using DSPRE.ROMFiles; + +namespace DSPRE.Editors { + public partial class SafariZoneEncounterGroupEditor : UserControl { + private SafariZoneEncounterGroup safariZoneEncounterGroup; + + public SafariZoneEncounterGroupEditor() { + InitializeComponent(); + safariZoneEncounterEditorMorningTab.listBoxEncountersObject.SelectedIndexChanged += ListBoxEncountersObject_SelectedIndexChanged; + safariZoneEncounterEditorDayTab.listBoxEncountersObject.SelectedIndexChanged += ListBoxEncountersObject_SelectedIndexChanged; + safariZoneEncounterEditorNightTab.listBoxEncountersObject.SelectedIndexChanged += ListBoxEncountersObject_SelectedIndexChanged; + listBoxObjectRequirements.SelectedIndexChanged += ListBoxEncountersObject_SelectedIndexChanged; + listBoxObjectOptionalRequirements.SelectedIndexChanged += ListBoxEncountersObject_SelectedIndexChanged; + } + + private void ListBoxEncountersObject_SelectedIndexChanged(object sender, EventArgs e) { + try { + ListBox2 s = sender as ListBox2; + safariZoneEncounterEditorMorningTab.listBoxEncountersObject.SelectedIndex = s.SelectedIndex; + safariZoneEncounterEditorDayTab.listBoxEncountersObject.SelectedIndex = s.SelectedIndex; + safariZoneEncounterEditorNightTab.listBoxEncountersObject.SelectedIndex = s.SelectedIndex; + listBoxObjectRequirements.SelectedIndex = s.SelectedIndex; + listBoxObjectOptionalRequirements.SelectedIndex = s.SelectedIndex; + } + catch (Exception ex) { + } + } + + public void SetPokemonNames() { + string[] pokemonNames = RomInfo.GetPokemonNames(); + safariZoneEncounterEditorMorningTab.comboBoxPokemon.Items.AddRange(pokemonNames); + safariZoneEncounterEditorMorningTab.comboBoxPokemonObject.Items.AddRange(pokemonNames); + safariZoneEncounterEditorDayTab.comboBoxPokemon.Items.AddRange(pokemonNames); + safariZoneEncounterEditorDayTab.comboBoxPokemonObject.Items.AddRange(pokemonNames); + safariZoneEncounterEditorNightTab.comboBoxPokemon.Items.AddRange(pokemonNames); + safariZoneEncounterEditorNightTab.comboBoxPokemonObject.Items.AddRange(pokemonNames); + + foreach (string type in SafariZoneObjectRequirement.ObjectTypes.Values) { + comboBoxObjectRequirementType.Items.Add(type); + comboBoxOptionalObjectRequirementType.Items.Add(type); + } + } + + public void Reset() { + this.safariZoneEncounterGroup = null; + safariZoneEncounterEditorMorningTab.listBoxEncounters.DataSource = null; + safariZoneEncounterEditorDayTab.listBoxEncounters.DataSource = null; + safariZoneEncounterEditorNightTab.listBoxEncounters.DataSource = null; + + safariZoneEncounterEditorMorningTab.listBoxEncountersObject.DataSource = null; + safariZoneEncounterEditorDayTab.listBoxEncountersObject.DataSource = null; + safariZoneEncounterEditorNightTab.listBoxEncountersObject.DataSource = null; + listBoxObjectRequirements.DataSource = null; + listBoxObjectOptionalRequirements.DataSource = null; + } + + public void SetData(SafariZoneEncounterGroup safariZoneEncounterGroup) { + this.safariZoneEncounterGroup = safariZoneEncounterGroup; + safariZoneEncounterEditorMorningTab.listBoxEncounters.DataSource = this.safariZoneEncounterGroup.MorningEncounters; + safariZoneEncounterEditorDayTab.listBoxEncounters.DataSource = this.safariZoneEncounterGroup.DayEncounters; + safariZoneEncounterEditorNightTab.listBoxEncounters.DataSource = this.safariZoneEncounterGroup.NightEncounters; + + safariZoneEncounterEditorMorningTab.listBoxEncountersObject.DataSource = this.safariZoneEncounterGroup.MorningEncountersObject; + safariZoneEncounterEditorDayTab.listBoxEncountersObject.DataSource = this.safariZoneEncounterGroup.DayEncountersObject; + safariZoneEncounterEditorNightTab.listBoxEncountersObject.DataSource = this.safariZoneEncounterGroup.NightEncountersObject; + listBoxObjectRequirements.DataSource = this.safariZoneEncounterGroup.ObjectRequirements; + listBoxObjectOptionalRequirements.DataSource = this.safariZoneEncounterGroup.OptionalObjectRequirements; + } + + private void listBoxObjectRequirements_SelectedIndexChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + SafariZoneObjectRequirement safariZoneObjectRequirement = (SafariZoneObjectRequirement)listBoxObjectRequirements.SelectedItem; + if (safariZoneObjectRequirement == null) return; + comboBoxObjectRequirementType.SelectedIndex = safariZoneObjectRequirement.typeID; + numericUpDownObjectRequirementQty.Value = safariZoneObjectRequirement.quantity; + } + + private void comboBoxObjectRequirementType_SelectedIndexChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + // if (comboBoxObjectRequirementType.SelectedIndex == 0) comboBoxObjectRequirementType.SelectedIndex = 1; //no requirement is not valid + SafariZoneObjectRequirement safariZoneObjectRequirement = (SafariZoneObjectRequirement)listBoxObjectRequirements.SelectedItem; + if (safariZoneObjectRequirement == null) return; + safariZoneObjectRequirement.typeID = (byte)comboBoxObjectRequirementType.SelectedIndex; + listBoxObjectRequirements.RefreshItem(listBoxObjectRequirements.SelectedIndex); + } + + private void numericUpDownObjectRequirementQty_ValueChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + SafariZoneObjectRequirement safariZoneObjectRequirement = (SafariZoneObjectRequirement)listBoxObjectRequirements.SelectedItem; + if (safariZoneObjectRequirement == null) return; + safariZoneObjectRequirement.quantity = (byte)numericUpDownObjectRequirementQty.Value; + listBoxObjectRequirements.RefreshItem(listBoxObjectRequirements.SelectedIndex); + } + + private void listBoxObjectOptionalRequirements_SelectedIndexChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + SafariZoneObjectRequirement safariZoneObjectRequirement = (SafariZoneObjectRequirement)listBoxObjectOptionalRequirements.SelectedItem; + if (safariZoneObjectRequirement == null) return; + comboBoxOptionalObjectRequirementType.SelectedIndex = safariZoneObjectRequirement.typeID; + numericUpDownObjectOptionalRequirementQty.Value = safariZoneObjectRequirement.quantity; + } + + private void comboBoxOptionalObjectRequirementType_SelectedIndexChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + SafariZoneObjectRequirement safariZoneObjectRequirement = (SafariZoneObjectRequirement)listBoxObjectOptionalRequirements.SelectedItem; + if (safariZoneObjectRequirement == null) return; + safariZoneObjectRequirement.typeID = (byte)comboBoxOptionalObjectRequirementType.SelectedIndex; + listBoxObjectOptionalRequirements.RefreshItem(listBoxObjectOptionalRequirements.SelectedIndex); + } + + private void numericUpDownObjectOptionalRequirementQty_ValueChanged(object sender, EventArgs e) { + if (Helpers.HandlersDisabled) return; + SafariZoneObjectRequirement safariZoneObjectRequirement = (SafariZoneObjectRequirement)listBoxObjectOptionalRequirements.SelectedItem; + if (safariZoneObjectRequirement == null) return; + safariZoneObjectRequirement.quantity = (byte)numericUpDownObjectOptionalRequirementQty.Value; + listBoxObjectOptionalRequirements.RefreshItem(listBoxObjectOptionalRequirements.SelectedIndex); + } + + private void buttonAddObjectEncounter_Click(object sender, EventArgs e) { + if (this.safariZoneEncounterGroup == null) return; + if (listBoxObjectOptionalRequirements.SelectedIndex == -1) return; + safariZoneEncounterGroup.MorningEncountersObject.Add(new SafariZoneEncounter()); + safariZoneEncounterGroup.DayEncountersObject.Add(new SafariZoneEncounter()); + safariZoneEncounterGroup.NightEncountersObject.Add(new SafariZoneEncounter()); + safariZoneEncounterGroup.ObjectRequirements.Add(new SafariZoneObjectRequirement(1, 1)); + safariZoneEncounterGroup.OptionalObjectRequirements.Add(new SafariZoneObjectRequirement(0, 0)); + safariZoneEncounterGroup.ObjectSlots = (byte)safariZoneEncounterGroup.ObjectRequirements.Count; //all the list counts should be the same + } + + private void buttonRemoveObjectEncounter_Click(object sender, EventArgs e) { + if (this.safariZoneEncounterGroup == null) return; + if (listBoxObjectOptionalRequirements.SelectedIndex == -1) return; + safariZoneEncounterGroup.MorningEncountersObject.RemoveAt(safariZoneEncounterGroup.MorningEncountersObject.Count - 1); + safariZoneEncounterGroup.DayEncountersObject.RemoveAt(safariZoneEncounterGroup.DayEncountersObject.Count - 1); + safariZoneEncounterGroup.NightEncountersObject.RemoveAt(safariZoneEncounterGroup.NightEncountersObject.Count - 1); + safariZoneEncounterGroup.ObjectRequirements.RemoveAt(safariZoneEncounterGroup.ObjectRequirements.Count - 1); + safariZoneEncounterGroup.OptionalObjectRequirements.RemoveAt(safariZoneEncounterGroup.OptionalObjectRequirements.Count - 1); + safariZoneEncounterGroup.ObjectSlots = (byte)safariZoneEncounterGroup.ObjectRequirements.Count; //all the list counts should be the same + } + } +} diff --git a/DS_Map/Editors/SafariZoneEncounterGroupEditor.resx b/DS_Map/Editors/SafariZoneEncounterGroupEditor.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DS_Map/Editors/SafariZoneEncounterGroupEditor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DS_Map/Main Window.Designer.cs b/DS_Map/Main Window.Designer.cs index 58ed43f..6c3edb1 100644 --- a/DS_Map/Main Window.Designer.cs +++ b/DS_Map/Main Window.Designer.cs @@ -30,22 +30,22 @@ { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainProgram)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle41 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle42 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle45 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle46 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle47 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle48 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); this.mainTabControl = new System.Windows.Forms.TabControl(); this.headerEditorTabPage = new System.Windows.Forms.TabPage(); this.removeLastHeaderBTN = new System.Windows.Forms.Button(); @@ -774,7 +774,11 @@ this.headerConditionalMusicComboBox = new System.Windows.Forms.ComboBox(); this.conditionalMusicTableListBox = new System.Windows.Forms.ListBox(); this.tabPageScriptEditor = new System.Windows.Forms.TabPage(); + this.scriptEditor = new DSPRE.Editors.ScriptEditor(); this.tabPageLevelScriptEditor = new System.Windows.Forms.TabPage(); + this.levelScriptEditor = new DSPRE.Editors.LevelScriptEditor(); + this.tabPageEncountersEditor = new System.Windows.Forms.TabPage(); + this.encountersEditor = new DSPRE.Editors.EncountersEditor(); this.mainTabImageList = new System.Windows.Forms.ImageList(this.components); this.gameIcon = new System.Windows.Forms.PictureBox(); this.languageLabel = new System.Windows.Forms.Label(); @@ -847,8 +851,6 @@ this.separator_afterMiscButtons = new System.Windows.Forms.ToolStripSeparator(); this.versionLabel = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.scriptEditor = new DSPRE.Editors.ScriptEditor(); - this.levelScriptEditor = new DSPRE.Editors.LevelScriptEditor(); this.mainTabControl.SuspendLayout(); this.headerEditorTabPage.SuspendLayout(); this.worldmapCoordsGroupBox.SuspendLayout(); @@ -1082,6 +1084,7 @@ ((System.ComponentModel.ISupportInitialize)(this.flagConditionalMusicUpDown)).BeginInit(); this.tabPageScriptEditor.SuspendLayout(); this.tabPageLevelScriptEditor.SuspendLayout(); + this.tabPageEncountersEditor.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gameIcon)).BeginInit(); this.menuStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); @@ -1102,11 +1105,12 @@ this.mainTabControl.Controls.Add(this.tableEditorTabPage); this.mainTabControl.Controls.Add(this.tabPageScriptEditor); this.mainTabControl.Controls.Add(this.tabPageLevelScriptEditor); + this.mainTabControl.Controls.Add(this.tabPageEncountersEditor); this.mainTabControl.ImageList = this.mainTabImageList; this.mainTabControl.Location = new System.Drawing.Point(11, 72); this.mainTabControl.Name = "mainTabControl"; this.mainTabControl.SelectedIndex = 0; - this.mainTabControl.Size = new System.Drawing.Size(1193, 660); + this.mainTabControl.Size = new System.Drawing.Size(1193, 702); this.mainTabControl.TabIndex = 5; this.mainTabControl.Visible = false; this.mainTabControl.SelectedIndexChanged += new System.EventHandler(this.mainTabControl_SelectedIndexChanged); @@ -1141,7 +1145,7 @@ this.headerEditorTabPage.Location = new System.Drawing.Point(4, 23); this.headerEditorTabPage.Name = "headerEditorTabPage"; this.headerEditorTabPage.Padding = new System.Windows.Forms.Padding(3); - this.headerEditorTabPage.Size = new System.Drawing.Size(1185, 633); + this.headerEditorTabPage.Size = new System.Drawing.Size(1185, 675); this.headerEditorTabPage.TabIndex = 0; this.headerEditorTabPage.Text = "Header Editor"; // @@ -2529,7 +2533,7 @@ this.matrixEditorTabPage.Location = new System.Drawing.Point(4, 23); this.matrixEditorTabPage.Name = "matrixEditorTabPage"; this.matrixEditorTabPage.Padding = new System.Windows.Forms.Padding(3); - this.matrixEditorTabPage.Size = new System.Drawing.Size(1185, 633); + this.matrixEditorTabPage.Size = new System.Drawing.Size(1185, 675); this.matrixEditorTabPage.TabIndex = 1; this.matrixEditorTabPage.Text = "Matrix Editor"; // @@ -2539,7 +2543,7 @@ this.setSpawnPointButton.Image = global::DSPRE.Properties.Resources.spawnCoordsMatrixeditorIcon; this.setSpawnPointButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.setSpawnPointButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.setSpawnPointButton.Location = new System.Drawing.Point(12, 522); + this.setSpawnPointButton.Location = new System.Drawing.Point(12, -2832); this.setSpawnPointButton.Name = "setSpawnPointButton"; this.setSpawnPointButton.Size = new System.Drawing.Size(117, 43); this.setSpawnPointButton.TabIndex = 35; @@ -2555,7 +2559,7 @@ this.saveMatrixButton.Image = global::DSPRE.Properties.Resources.save_rom; this.saveMatrixButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.saveMatrixButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.saveMatrixButton.Location = new System.Drawing.Point(12, 567); + this.saveMatrixButton.Location = new System.Drawing.Point(12, -2787); this.saveMatrixButton.Name = "saveMatrixButton"; this.saveMatrixButton.Size = new System.Drawing.Size(117, 43); this.saveMatrixButton.TabIndex = 34; @@ -2737,16 +2741,16 @@ this.matrixTabControl.Multiline = true; this.matrixTabControl.Name = "matrixTabControl"; this.matrixTabControl.SelectedIndex = 0; - this.matrixTabControl.Size = new System.Drawing.Size(1040, 616); + this.matrixTabControl.Size = new System.Drawing.Size(0, 0); this.matrixTabControl.TabIndex = 18; // // headersTabPage // this.headersTabPage.Controls.Add(this.headersGridView); - this.headersTabPage.Location = new System.Drawing.Point(4, 22); + this.headersTabPage.Location = new System.Drawing.Point(4, 58); this.headersTabPage.Name = "headersTabPage"; this.headersTabPage.Padding = new System.Windows.Forms.Padding(3); - this.headersTabPage.Size = new System.Drawing.Size(1032, 590); + this.headersTabPage.Size = new System.Drawing.Size(0, 0); this.headersTabPage.TabIndex = 1; this.headersTabPage.Text = "Map Headers"; this.headersTabPage.UseVisualStyleBackColor = true; @@ -2758,40 +2762,40 @@ this.headersGridView.AllowUserToResizeColumns = false; this.headersGridView.AllowUserToResizeRows = false; this.headersGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; - dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle33.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle33.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle33.ForeColor = System.Drawing.SystemColors.Info; - dataGridViewCellStyle33.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle33.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle33.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.headersGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle33; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.Info; + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.headersGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.headersGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle34.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle34.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle34.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle34.Format = "D4"; - dataGridViewCellStyle34.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle34.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle34.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.headersGridView.DefaultCellStyle = dataGridViewCellStyle34; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle2.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle2.Format = "D4"; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.headersGridView.DefaultCellStyle = dataGridViewCellStyle2; this.headersGridView.Location = new System.Drawing.Point(0, 0); this.headersGridView.MultiSelect = false; this.headersGridView.Name = "headersGridView"; - dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle35.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle35.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); - dataGridViewCellStyle35.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle35.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle35.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle35.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.headersGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle35; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.headersGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; this.headersGridView.RowHeadersWidth = 50; this.headersGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle36.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.headersGridView.RowsDefaultCellStyle = dataGridViewCellStyle36; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle4.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.headersGridView.RowsDefaultCellStyle = dataGridViewCellStyle4; this.headersGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.headersGridView.RowTemplate.Height = 18; this.headersGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; @@ -2807,9 +2811,9 @@ // heightsTabPage // this.heightsTabPage.Controls.Add(this.heightsGridView); - this.heightsTabPage.Location = new System.Drawing.Point(4, 22); + this.heightsTabPage.Location = new System.Drawing.Point(4, 58); this.heightsTabPage.Name = "heightsTabPage"; - this.heightsTabPage.Size = new System.Drawing.Size(1032, 590); + this.heightsTabPage.Size = new System.Drawing.Size(0, 0); this.heightsTabPage.TabIndex = 2; this.heightsTabPage.Text = "Map Heights"; this.heightsTabPage.UseVisualStyleBackColor = true; @@ -2820,43 +2824,43 @@ this.heightsGridView.AllowUserToDeleteRows = false; this.heightsGridView.AllowUserToResizeColumns = false; this.heightsGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle37.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.heightsGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle37; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.heightsGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5; this.heightsGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; - dataGridViewCellStyle38.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle38.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle38.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); - dataGridViewCellStyle38.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle38.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle38.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle38.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.heightsGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle38; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.heightsGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6; this.heightsGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridViewCellStyle39.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle39.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle39.Font = new System.Drawing.Font("Tahoma", 8.25F); - dataGridViewCellStyle39.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle39.Format = "D2"; - dataGridViewCellStyle39.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle39.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle39.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.heightsGridView.DefaultCellStyle = dataGridViewCellStyle39; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle7.Font = new System.Drawing.Font("Tahoma", 8.25F); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle7.Format = "D2"; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.heightsGridView.DefaultCellStyle = dataGridViewCellStyle7; this.heightsGridView.Location = new System.Drawing.Point(0, 0); this.heightsGridView.MultiSelect = false; this.heightsGridView.Name = "heightsGridView"; - dataGridViewCellStyle40.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle40.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle40.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); - dataGridViewCellStyle40.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle40.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle40.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle40.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.heightsGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle40; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.heightsGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle8; this.heightsGridView.RowHeadersWidth = 50; this.heightsGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle41.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle41.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.heightsGridView.RowsDefaultCellStyle = dataGridViewCellStyle41; + dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle9.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.heightsGridView.RowsDefaultCellStyle = dataGridViewCellStyle9; this.heightsGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.heightsGridView.RowTemplate.Height = 18; this.heightsGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; @@ -2870,9 +2874,9 @@ // mapFilesTabPage // this.mapFilesTabPage.Controls.Add(this.mapFilesGridView); - this.mapFilesTabPage.Location = new System.Drawing.Point(4, 22); + this.mapFilesTabPage.Location = new System.Drawing.Point(4, 58); this.mapFilesTabPage.Name = "mapFilesTabPage"; - this.mapFilesTabPage.Size = new System.Drawing.Size(1032, 590); + this.mapFilesTabPage.Size = new System.Drawing.Size(0, 0); this.mapFilesTabPage.TabIndex = 3; this.mapFilesTabPage.Text = "Map Files"; this.mapFilesTabPage.UseVisualStyleBackColor = true; @@ -2883,43 +2887,43 @@ this.mapFilesGridView.AllowUserToDeleteRows = false; this.mapFilesGridView.AllowUserToResizeColumns = false; this.mapFilesGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle42.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.mapFilesGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle42; + dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.mapFilesGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10; this.mapFilesGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; - dataGridViewCellStyle43.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle43.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle43.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); - dataGridViewCellStyle43.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle43.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle43.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle43.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.mapFilesGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle43; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.mapFilesGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.mapFilesGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridViewCellStyle44.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle44.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle44.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle44.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle44.Format = "D4"; - dataGridViewCellStyle44.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle44.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle44.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.mapFilesGridView.DefaultCellStyle = dataGridViewCellStyle44; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle12.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle12.Format = "D4"; + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.mapFilesGridView.DefaultCellStyle = dataGridViewCellStyle12; this.mapFilesGridView.Location = new System.Drawing.Point(0, 0); this.mapFilesGridView.MultiSelect = false; this.mapFilesGridView.Name = "mapFilesGridView"; - dataGridViewCellStyle45.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle45.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle45.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); - dataGridViewCellStyle45.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle45.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle45.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle45.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.mapFilesGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle45; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.mapFilesGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle13; this.mapFilesGridView.RowHeadersWidth = 50; this.mapFilesGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle46.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle46.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.mapFilesGridView.RowsDefaultCellStyle = dataGridViewCellStyle46; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.mapFilesGridView.RowsDefaultCellStyle = dataGridViewCellStyle14; this.mapFilesGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.mapFilesGridView.RowTemplate.Height = 18; this.mapFilesGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; @@ -3026,7 +3030,7 @@ this.mapEditorTabPage.Location = new System.Drawing.Point(4, 23); this.mapEditorTabPage.Name = "mapEditorTabPage"; this.mapEditorTabPage.Padding = new System.Windows.Forms.Padding(3); - this.mapEditorTabPage.Size = new System.Drawing.Size(1185, 633); + this.mapEditorTabPage.Size = new System.Drawing.Size(1185, 675); this.mapEditorTabPage.TabIndex = 2; this.mapEditorTabPage.Text = "Map Editor"; this.mapEditorTabPage.Enter += new System.EventHandler(this.mapEditorTabPage_Enter); @@ -4320,7 +4324,7 @@ this.radio3D.AutoSize = true; this.radio3D.Checked = true; this.radio3D.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.radio3D.Location = new System.Drawing.Point(1140, 546); + this.radio3D.Location = new System.Drawing.Point(-4818, -2808); this.radio3D.Name = "radio3D"; this.radio3D.Size = new System.Drawing.Size(31, 23); this.radio3D.TabIndex = 26; @@ -4335,7 +4339,7 @@ this.radio2D.Appearance = System.Windows.Forms.Appearance.Button; this.radio2D.AutoSize = true; this.radio2D.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.radio2D.Location = new System.Drawing.Point(1140, 570); + this.radio2D.Location = new System.Drawing.Point(-4818, -2784); this.radio2D.Name = "radio2D"; this.radio2D.Size = new System.Drawing.Size(31, 23); this.radio2D.TabIndex = 25; @@ -4350,7 +4354,7 @@ this.wireframeCheckBox.Appearance = System.Windows.Forms.Appearance.Button; this.wireframeCheckBox.AutoSize = true; this.wireframeCheckBox.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.wireframeCheckBox.Location = new System.Drawing.Point(1140, 594); + this.wireframeCheckBox.Location = new System.Drawing.Point(1140, -2760); this.wireframeCheckBox.Name = "wireframeCheckBox"; this.wireframeCheckBox.Size = new System.Drawing.Size(31, 23); this.wireframeCheckBox.TabIndex = 27; @@ -4365,7 +4369,7 @@ this.nsbtxEditorTabPage.Location = new System.Drawing.Point(4, 23); this.nsbtxEditorTabPage.Name = "nsbtxEditorTabPage"; this.nsbtxEditorTabPage.Padding = new System.Windows.Forms.Padding(3); - this.nsbtxEditorTabPage.Size = new System.Drawing.Size(1185, 633); + this.nsbtxEditorTabPage.Size = new System.Drawing.Size(1185, 675); this.nsbtxEditorTabPage.TabIndex = 6; this.nsbtxEditorTabPage.Text = "NSBTX Editor"; this.nsbtxEditorTabPage.UseVisualStyleBackColor = true; @@ -4906,7 +4910,7 @@ this.eventEditorTabPage.Location = new System.Drawing.Point(4, 23); this.eventEditorTabPage.Name = "eventEditorTabPage"; this.eventEditorTabPage.Padding = new System.Windows.Forms.Padding(3); - this.eventEditorTabPage.Size = new System.Drawing.Size(1185, 633); + this.eventEditorTabPage.Size = new System.Drawing.Size(1185, 675); this.eventEditorTabPage.TabIndex = 3; this.eventEditorTabPage.Text = "Event Editor"; this.eventEditorTabPage.Enter += new System.EventHandler(this.eventEditorTabPage_Enter); @@ -6786,7 +6790,7 @@ this.rightClickPicture.ImageLocation = ""; this.rightClickPicture.Location = new System.Drawing.Point(468, 420); this.rightClickPicture.Name = "rightClickPicture"; - this.rightClickPicture.Size = new System.Drawing.Size(38, 38); + this.rightClickPicture.Size = new System.Drawing.Size(0, 38); this.rightClickPicture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.rightClickPicture.TabIndex = 59; this.rightClickPicture.TabStop = false; @@ -6799,7 +6803,7 @@ this.wheelClickPicture.ImageLocation = ""; this.wheelClickPicture.Location = new System.Drawing.Point(552, 420); this.wheelClickPicture.Name = "wheelClickPicture"; - this.wheelClickPicture.Size = new System.Drawing.Size(38, 38); + this.wheelClickPicture.Size = new System.Drawing.Size(0, 38); this.wheelClickPicture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.wheelClickPicture.TabIndex = 56; this.wheelClickPicture.TabStop = false; @@ -6812,7 +6816,7 @@ this.LeftClickPicture.ImageLocation = ""; this.LeftClickPicture.Location = new System.Drawing.Point(510, 420); this.LeftClickPicture.Name = "LeftClickPicture"; - this.LeftClickPicture.Size = new System.Drawing.Size(38, 38); + this.LeftClickPicture.Size = new System.Drawing.Size(0, 38); this.LeftClickPicture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.LeftClickPicture.TabIndex = 55; this.LeftClickPicture.TabStop = false; @@ -6938,7 +6942,7 @@ this.textEditorTabPage.Location = new System.Drawing.Point(4, 23); this.textEditorTabPage.Name = "textEditorTabPage"; this.textEditorTabPage.Padding = new System.Windows.Forms.Padding(3); - this.textEditorTabPage.Size = new System.Drawing.Size(1185, 633); + this.textEditorTabPage.Size = new System.Drawing.Size(1185, 675); this.textEditorTabPage.TabIndex = 5; this.textEditorTabPage.Text = "Text Editor"; this.textEditorTabPage.UseVisualStyleBackColor = true; @@ -7312,8 +7316,8 @@ this.textEditorDataGridView.Location = new System.Drawing.Point(12, 77); this.textEditorDataGridView.Name = "textEditorDataGridView"; this.textEditorDataGridView.RowHeadersWidth = 68; - dataGridViewCellStyle47.Font = new System.Drawing.Font("Consolas", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textEditorDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle47; + dataGridViewCellStyle15.Font = new System.Drawing.Font("Consolas", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textEditorDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle15; this.textEditorDataGridView.Size = new System.Drawing.Size(873, 500); this.textEditorDataGridView.TabIndex = 24; this.textEditorDataGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.textEditorDataGridView_CellValueChanged); @@ -7362,7 +7366,7 @@ this.cameraEditorTabPage.ImageIndex = 7; this.cameraEditorTabPage.Location = new System.Drawing.Point(4, 23); this.cameraEditorTabPage.Name = "cameraEditorTabPage"; - this.cameraEditorTabPage.Size = new System.Drawing.Size(1185, 633); + this.cameraEditorTabPage.Size = new System.Drawing.Size(1185, 675); this.cameraEditorTabPage.TabIndex = 7; this.cameraEditorTabPage.Text = "Camera Editor"; this.cameraEditorTabPage.UseVisualStyleBackColor = true; @@ -7416,9 +7420,9 @@ this.cameraEditorDataGridView.CausesValidation = false; this.cameraEditorDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised; this.cameraEditorDataGridView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; - dataGridViewCellStyle48.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle48.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.cameraEditorDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle48; + dataGridViewCellStyle16.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.cameraEditorDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle16; this.cameraEditorDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.cameraEditorDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.DistanceGVCol, @@ -7552,7 +7556,7 @@ this.trainerEditorTabPage.ImageIndex = 8; this.trainerEditorTabPage.Location = new System.Drawing.Point(4, 23); this.trainerEditorTabPage.Name = "trainerEditorTabPage"; - this.trainerEditorTabPage.Size = new System.Drawing.Size(1185, 633); + this.trainerEditorTabPage.Size = new System.Drawing.Size(1185, 675); this.trainerEditorTabPage.TabIndex = 8; this.trainerEditorTabPage.Text = "Trainer Editor"; this.trainerEditorTabPage.UseVisualStyleBackColor = true; @@ -9562,7 +9566,7 @@ this.tableEditorTabPage.Location = new System.Drawing.Point(4, 23); this.tableEditorTabPage.Name = "tableEditorTabPage"; this.tableEditorTabPage.Padding = new System.Windows.Forms.Padding(3); - this.tableEditorTabPage.Size = new System.Drawing.Size(1185, 633); + this.tableEditorTabPage.Size = new System.Drawing.Size(1185, 675); this.tableEditorTabPage.TabIndex = 9; this.tableEditorTabPage.Text = "Table Editor"; this.tableEditorTabPage.UseVisualStyleBackColor = true; @@ -10040,22 +10044,57 @@ this.tabPageScriptEditor.Location = new System.Drawing.Point(4, 23); this.tabPageScriptEditor.Name = "tabPageScriptEditor"; this.tabPageScriptEditor.Padding = new System.Windows.Forms.Padding(3); - this.tabPageScriptEditor.Size = new System.Drawing.Size(1185, 633); + this.tabPageScriptEditor.Size = new System.Drawing.Size(1185, 675); this.tabPageScriptEditor.TabIndex = 10; this.tabPageScriptEditor.Text = "Script Editor New"; this.tabPageScriptEditor.UseVisualStyleBackColor = true; // + // scriptEditor + // + this.scriptEditor.Location = new System.Drawing.Point(2, 3); + this.scriptEditor.Name = "scriptEditor"; + this.scriptEditor.scriptEditorIsReady = false; + this.scriptEditor.Size = new System.Drawing.Size(1177, 735); + this.scriptEditor.TabIndex = 0; + // // tabPageLevelScriptEditor // this.tabPageLevelScriptEditor.Controls.Add(this.levelScriptEditor); this.tabPageLevelScriptEditor.Location = new System.Drawing.Point(4, 23); this.tabPageLevelScriptEditor.Name = "tabPageLevelScriptEditor"; this.tabPageLevelScriptEditor.Padding = new System.Windows.Forms.Padding(3); - this.tabPageLevelScriptEditor.Size = new System.Drawing.Size(1185, 633); + this.tabPageLevelScriptEditor.Size = new System.Drawing.Size(1185, 675); this.tabPageLevelScriptEditor.TabIndex = 11; this.tabPageLevelScriptEditor.Text = "Level Script Editor"; this.tabPageLevelScriptEditor.UseVisualStyleBackColor = true; // + // levelScriptEditor + // + this.levelScriptEditor.BackColor = System.Drawing.SystemColors.Control; + this.levelScriptEditor.levelScriptEditorIsReady = false; + this.levelScriptEditor.Location = new System.Drawing.Point(6, 8); + this.levelScriptEditor.Name = "levelScriptEditor"; + this.levelScriptEditor.Size = new System.Drawing.Size(408, 622); + this.levelScriptEditor.TabIndex = 0; + // + // tabPageEncountersEditor + // + this.tabPageEncountersEditor.Controls.Add(this.encountersEditor); + this.tabPageEncountersEditor.Location = new System.Drawing.Point(4, 23); + this.tabPageEncountersEditor.Name = "tabPageEncountersEditor"; + this.tabPageEncountersEditor.Padding = new System.Windows.Forms.Padding(3); + this.tabPageEncountersEditor.Size = new System.Drawing.Size(1185, 675); + this.tabPageEncountersEditor.TabIndex = 12; + this.tabPageEncountersEditor.Text = "Encounters"; + this.tabPageEncountersEditor.UseVisualStyleBackColor = true; + // + // encountersEditor + // + this.encountersEditor.Location = new System.Drawing.Point(6, 3); + this.encountersEditor.Name = "encountersEditor"; + this.encountersEditor.Size = new System.Drawing.Size(1176, 672); + this.encountersEditor.TabIndex = 0; + // // mainTabImageList // this.mainTabImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("mainTabImageList.ImageStream"))); @@ -10429,7 +10468,7 @@ this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusLabel, this.toolStripProgressBar}); - this.statusStrip1.Location = new System.Drawing.Point(0, 739); + this.statusStrip1.Location = new System.Drawing.Point(0, 777); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(1214, 22); this.statusStrip1.TabIndex = 13; @@ -10788,29 +10827,12 @@ this.versionLabel.Text = "ROM:"; this.versionLabel.Visible = false; // - // scriptEditor - // - this.scriptEditor.Location = new System.Drawing.Point(2, 3); - this.scriptEditor.Name = "scriptEditor"; - this.scriptEditor.scriptEditorIsReady = false; - this.scriptEditor.Size = new System.Drawing.Size(1177, 735); - this.scriptEditor.TabIndex = 0; - // - // levelScriptEditor - // - this.levelScriptEditor.BackColor = System.Drawing.SystemColors.Control; - this.levelScriptEditor.levelScriptEditorIsReady = false; - this.levelScriptEditor.Location = new System.Drawing.Point(6, 8); - this.levelScriptEditor.Name = "levelScriptEditor"; - this.levelScriptEditor.Size = new System.Drawing.Size(408, 622); - this.levelScriptEditor.TabIndex = 0; - // // MainProgram // this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1214, 761); + this.ClientSize = new System.Drawing.Size(1214, 799); this.Controls.Add(this.versionLabel); this.Controls.Add(this.languageLabel); this.Controls.Add(this.gameIcon); @@ -11121,6 +11143,7 @@ ((System.ComponentModel.ISupportInitialize)(this.flagConditionalMusicUpDown)).EndInit(); this.tabPageScriptEditor.ResumeLayout(false); this.tabPageLevelScriptEditor.ResumeLayout(false); + this.tabPageEncountersEditor.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.gameIcon)).EndInit(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); @@ -11937,6 +11960,8 @@ public DSPRE.Editors.LevelScriptEditor levelScriptEditor; public System.Windows.Forms.TabControl mainTabControl; public System.Windows.Forms.NumericUpDown scriptFileUpDown; + private System.Windows.Forms.TabPage tabPageEncountersEditor; + private Editors.EncountersEditor encountersEditor; } } diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index bc90567..75f6e63 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -889,6 +889,10 @@ namespace DSPRE { levelScriptEditor.SetUpLevelScriptEditor(this); } + private void tabPageEncountersEditor_Enter(object sender, EventArgs e) { + encountersEditor.SetupEncountersEditor(); + } + private void spawnEditorToolStripButton_Click(object sender, EventArgs e) { if (!matrixEditorIsReady) { SetupMatrixEditor(); @@ -964,20 +968,13 @@ namespace DSPRE { /* Read Header internal names */ try { - using (DSUtils.EasyReader reader = new DSUtils.EasyReader(RomInfo.internalNamesLocation)) { - for (int i = 0; i < headerCount; i++) { - byte[] row = reader.ReadBytes(RomInfo.internalNameLength); - - string internalName = Encoding.ASCII.GetString(row);//.TrimEnd(); - headerListBoxNames.Add(i.ToString("D3") + MapHeader.nameSeparator + internalName); - internalNames.Add(internalName.TrimEnd('\0')); - } - } + headerListBoxNames = Helpers.getHeaderListBoxNames(); + internalNames = Helpers.getInternalNames(); headerListBox.Items.Clear(); headerListBox.Items.AddRange(headerListBoxNames.ToArray()); } catch (FileNotFoundException) { - MessageBox.Show(RomInfo.internalNamesLocation + " doesn't exist.", "Couldn't read internal names", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(RomInfo.internalNamesPath + " doesn't exist.", "Couldn't read internal names", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } diff --git a/DS_Map/Main Window.resx b/DS_Map/Main Window.resx index c9f95b4..af8eb9d 100644 --- a/DS_Map/Main Window.resx +++ b/DS_Map/Main Window.resx @@ -117,96 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 239, 17 - - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w - LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM - EgAAAk1TRnQBSQFMAgEBCgEAAegBGwHoARsBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo - AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA - AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 - AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B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AcABAwGgAbMBJAHNAUABBQHgAQcBoAGnARgB7QFAAQUB8AEPAb8BzwEAAf0BfwH9AfwBPwGA + AR8BAAEBAQABAQL/Cw== @@ -1047,9 +1047,6 @@ 386, 19 - - 533, 20 - 67 diff --git a/DS_Map/Properties/AssemblyInfo.cs b/DS_Map/Properties/AssemblyInfo.cs index 5def708..0f9c7d6 100644 --- a/DS_Map/Properties/AssemblyInfo.cs +++ b/DS_Map/Properties/AssemblyInfo.cs @@ -4,11 +4,11 @@ using System.Runtime.InteropServices; // Le informazioni generali relative a un assembly sono controllate dal seguente // set di attributi. Modificare i valori di questi attributi per modificare le informazioni // associate a un assembly. -[assembly: AssemblyTitle("DSPRE Reloaded 1.11.2")] +[assembly: AssemblyTitle("DSPRE Reloaded 1.12.0")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("DSPRE Reloaded 1.11.2")] +[assembly: AssemblyProduct("DSPRE Reloaded 1.12.0")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build // usando l'asterisco '*' come illustrato di seguito: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.11.2")] -[assembly: AssemblyFileVersion("1.11.2")] +[assembly: AssemblyVersion("1.12.0")] +[assembly: AssemblyFileVersion("1.12.0")] diff --git a/DS_Map/ROMFiles/MapFile.cs b/DS_Map/ROMFiles/MapFile.cs index 0bc4a22..a9b0a64 100644 --- a/DS_Map/ROMFiles/MapFile.cs +++ b/DS_Map/ROMFiles/MapFile.cs @@ -341,6 +341,24 @@ namespace DSPRE.ROMFiles { public void LoadModelData(string dir) { LoadModelDataFromID((int)modelID, dir); } + + public void LoadModelData(bool interior) { + string modelPath = Filesystem.GetBuildingModelPath(interior, (int)modelID); + + if (string.IsNullOrWhiteSpace(modelPath) || !File.Exists(modelPath)) { + MessageBox.Show("Building " + modelID + " could not be found in\n" + '"' + Path.GetDirectoryName(modelPath) + '"', "Building not found", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + try { + using (Stream fs = new FileStream(modelPath, FileMode.Open)) { + this.NSBMDFile = NSBMDLoader.LoadNSBMD(fs); + } + } catch (FileNotFoundException) { + MessageBox.Show("Building " + modelID + " could not be found in\n" + '"' + Path.GetDirectoryName(modelPath) + '"', "Building not found", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + public void LoadModelDataFromID(int modelID, string bmDir) { string modelPath = bmDir + "\\" + modelID.ToString("D4"); diff --git a/DS_Map/RomInfo.cs b/DS_Map/RomInfo.cs index 3c10a0d..21746b6 100644 --- a/DS_Map/RomInfo.cs +++ b/DS_Map/RomInfo.cs @@ -7,6 +7,8 @@ using DSPRE.Resources; using System; using DSPRE.ROMFiles; using static DSPRE.RomInfo; +using System.Windows.Shapes; +using Path = System.IO.Path; namespace DSPRE { @@ -22,8 +24,14 @@ namespace DSPRE { public static string fileName { get; private set; } public static string workDir { get; private set; } public static string arm9Path { get; private set; } + public static string arm7Path { get; private set; } public static string overlayTablePath { get; set; } + public static string y7Path { get; set; } + public static string dataPath { get; set; } public static string overlayPath { get; set; } + public static string unpackedPath { get; set; } + public static string bannerPath { get; set; } + public static string headerPath { get; set; } public static GameLanguages gameLanguage { get; private set; } public static GameVersions gameVersion { get; private set; } @@ -160,11 +168,19 @@ namespace DSPRE { folderSuffix = ""; } - workDir = Path.GetDirectoryName(romName) + "\\" + Path.GetFileNameWithoutExtension(romName) + folderSuffix + "\\"; - arm9Path = workDir + @"arm9.bin"; - overlayTablePath = workDir + @"y9.bin"; - overlayPath = workDir + "overlay"; - internalNamesLocation = workDir + @"data\fielddata\maptable\mapname.bin"; + string path = System.IO.Path.GetDirectoryName(romName) + "\\" + Path.GetFileNameWithoutExtension(romName) + folderSuffix + "\\"; + + workDir = path; + arm9Path = Path.Combine(workDir, @"arm9.bin"); + arm7Path = Path.Combine(workDir, @"arm7.bin"); + overlayTablePath = Path.Combine(workDir, @"y9.bin"); + y7Path = Path.Combine(workDir, @"y7.bin"); + dataPath = Path.Combine(workDir, dataFolderName); + overlayPath = Path.Combine(workDir, @"overlay"); + bannerPath = Path.Combine(workDir, @"banner.bin"); + headerPath = Path.Combine(workDir, @"header.bin"); + unpackedPath = Path.Combine(workDir, @"unpacked"); + internalNamesPath = Path.Combine(workDir, $@"{dataFolderName}\fielddata\maptable\mapname.bin"); try { gameVersion = PokeDatabase.System.versionsDict[id]; @@ -966,7 +982,7 @@ namespace DSPRE { public string GetBuildingModelsDirPath(bool interior) => interior ? gameDirs[DirNames.interiorBuildingModels].unpackedDir : gameDirs[DirNames.exteriorBuildingModels].unpackedDir; public string GetRomNameFromWorkdir() => workDir.Substring(0, workDir.Length - folderSuffix.Length - 1); - public static int GetHeaderCount() => (int)new FileInfo(internalNamesLocation).Length / internalNameLength; + public static int GetHeaderCount() => (int)new FileInfo(internalNamesPath).Length / internalNameLength; public static List GetLocationNames() => new TextArchive(locationNamesTextNumber).messages; public static string[] GetSimpleTrainerNames() => new TextArchive(trainerNamesMessageNumber).messages.ToArray(); public static string[] GetTrainerClassNames() => new TextArchive(trainerClassMessageNumber).messages.ToArray(); @@ -1172,6 +1188,9 @@ namespace DSPRE { [DirNames.interiorBuildingModels] = @"data\a\1\4\8", [DirNames.learnsets] = @"data\a\0\3\3", [DirNames.evolutions] = @"data\a\0\3\4", + + [DirNames.safariZone] = @"data\a\2\3\0", + [DirNames.headbutt] = @"data\a\2\5\2", //both versions use the same folder with different data }; //Encounter archive is different for SS