diff --git a/DS_Map/Main Window.Designer.cs b/DS_Map/Main Window.Designer.cs index fae7766..ed0cb08 100644 --- a/DS_Map/Main Window.Designer.cs +++ b/DS_Map/Main Window.Designer.cs @@ -189,7 +189,6 @@ this.matrixNameTextBox = new System.Windows.Forms.TextBox(); this.heightUpDown = new System.Windows.Forms.NumericUpDown(); this.widthUpDown = new System.Windows.Forms.NumericUpDown(); - this.heightLabel = new System.Windows.Forms.Label(); this.widthLabel = new System.Windows.Forms.Label(); this.selectMatrixComboBox = new System.Windows.Forms.ComboBox(); this.saveMatrixButton = new System.Windows.Forms.Button(); @@ -2477,7 +2476,6 @@ this.matrixEditorTabPage.Controls.Add(this.matrixNameTextBox); this.matrixEditorTabPage.Controls.Add(this.heightUpDown); this.matrixEditorTabPage.Controls.Add(this.widthUpDown); - this.matrixEditorTabPage.Controls.Add(this.heightLabel); this.matrixEditorTabPage.Controls.Add(this.widthLabel); this.matrixEditorTabPage.Controls.Add(this.selectMatrixComboBox); this.matrixEditorTabPage.Controls.Add(this.saveMatrixButton); @@ -2535,7 +2533,7 @@ // this.importMatrixButton.Image = global::DSPRE.Properties.Resources.importArrow; this.importMatrixButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.importMatrixButton.Location = new System.Drawing.Point(11, 228); + this.importMatrixButton.Location = new System.Drawing.Point(11, 152); this.importMatrixButton.Name = "importMatrixButton"; this.importMatrixButton.Size = new System.Drawing.Size(117, 29); this.importMatrixButton.TabIndex = 29; @@ -2548,7 +2546,7 @@ // this.exportMatrixButton.Image = global::DSPRE.Properties.Resources.exportArrow; this.exportMatrixButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.exportMatrixButton.Location = new System.Drawing.Point(11, 197); + this.exportMatrixButton.Location = new System.Drawing.Point(11, 122); this.exportMatrixButton.Name = "exportMatrixButton"; this.exportMatrixButton.Size = new System.Drawing.Size(117, 29); this.exportMatrixButton.TabIndex = 28; @@ -2561,7 +2559,7 @@ // this.removeMatrixButton.Image = ((System.Drawing.Image)(resources.GetObject("removeMatrixButton.Image"))); this.removeMatrixButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.removeMatrixButton.Location = new System.Drawing.Point(64, 152); + this.removeMatrixButton.Location = new System.Drawing.Point(64, 183); this.removeMatrixButton.Name = "removeMatrixButton"; this.removeMatrixButton.Size = new System.Drawing.Size(64, 35); this.removeMatrixButton.TabIndex = 27; @@ -2574,7 +2572,7 @@ // this.addMatrixButton.Image = ((System.Drawing.Image)(resources.GetObject("addMatrixButton.Image"))); this.addMatrixButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.addMatrixButton.Location = new System.Drawing.Point(11, 152); + this.addMatrixButton.Location = new System.Drawing.Point(11, 183); this.addMatrixButton.Name = "addMatrixButton"; this.addMatrixButton.Size = new System.Drawing.Size(51, 35); this.addMatrixButton.TabIndex = 2; @@ -2645,7 +2643,7 @@ // this.matrixNameLabel.AutoSize = true; this.matrixNameLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.matrixNameLabel.Location = new System.Drawing.Point(10, 59); + this.matrixNameLabel.Location = new System.Drawing.Point(10, 55); this.matrixNameLabel.Name = "matrixNameLabel"; this.matrixNameLabel.Size = new System.Drawing.Size(64, 13); this.matrixNameLabel.TabIndex = 20; @@ -2859,7 +2857,7 @@ // // matrixNameTextBox // - this.matrixNameTextBox.Location = new System.Drawing.Point(13, 73); + this.matrixNameTextBox.Location = new System.Drawing.Point(13, 69); this.matrixNameTextBox.MaxLength = 16; this.matrixNameTextBox.Name = "matrixNameTextBox"; this.matrixNameTextBox.Size = new System.Drawing.Size(112, 20); @@ -2868,7 +2866,7 @@ // // heightUpDown // - this.heightUpDown.Location = new System.Drawing.Point(64, 124); + this.heightUpDown.Location = new System.Drawing.Point(84, 98); this.heightUpDown.Maximum = new decimal(new int[] { 255, 0, @@ -2880,7 +2878,7 @@ 0, 0}); this.heightUpDown.Name = "heightUpDown"; - this.heightUpDown.Size = new System.Drawing.Size(61, 20); + this.heightUpDown.Size = new System.Drawing.Size(37, 20); this.heightUpDown.TabIndex = 16; this.heightUpDown.Value = new decimal(new int[] { 1, @@ -2891,7 +2889,7 @@ // // widthUpDown // - this.widthUpDown.Location = new System.Drawing.Point(64, 98); + this.widthUpDown.Location = new System.Drawing.Point(41, 98); this.widthUpDown.Maximum = new decimal(new int[] { 255, 0, @@ -2903,7 +2901,7 @@ 0, 0}); this.widthUpDown.Name = "widthUpDown"; - this.widthUpDown.Size = new System.Drawing.Size(61, 20); + this.widthUpDown.Size = new System.Drawing.Size(37, 20); this.widthUpDown.TabIndex = 15; this.widthUpDown.Value = new decimal(new int[] { 1, @@ -2912,25 +2910,15 @@ 0}); this.widthUpDown.ValueChanged += new System.EventHandler(this.widthUpDown_ValueChanged); // - // heightLabel - // - this.heightLabel.AutoSize = true; - this.heightLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.heightLabel.Location = new System.Drawing.Point(10, 127); - this.heightLabel.Name = "heightLabel"; - this.heightLabel.Size = new System.Drawing.Size(38, 13); - this.heightLabel.TabIndex = 14; - this.heightLabel.Text = "Height"; - // // widthLabel // this.widthLabel.AutoSize = true; this.widthLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.widthLabel.Location = new System.Drawing.Point(10, 101); this.widthLabel.Name = "widthLabel"; - this.widthLabel.Size = new System.Drawing.Size(35, 13); + this.widthLabel.Size = new System.Drawing.Size(27, 13); this.widthLabel.TabIndex = 13; - this.widthLabel.Text = "Width"; + this.widthLabel.Text = "Size"; // // selectMatrixComboBox // @@ -2988,6 +2976,7 @@ // // mapScreenshotButton // + this.mapScreenshotButton.Image = global::DSPRE.Properties.Resources.cameraIcon; this.mapScreenshotButton.Location = new System.Drawing.Point(1135, 499); this.mapScreenshotButton.Name = "mapScreenshotButton"; this.mapScreenshotButton.Size = new System.Drawing.Size(41, 40); @@ -3076,6 +3065,7 @@ this.mapOpenGlControl.StencilBits = ((byte)(0)); this.mapOpenGlControl.TabIndex = 2; this.mapOpenGlControl.Click += new System.EventHandler(this.mapOpenGlControl_Click); + this.mapOpenGlControl.KeyUp += new System.Windows.Forms.KeyEventHandler(this.mapOpenGlControl_KeyUp); this.mapOpenGlControl.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.mapOpenGlControl_PreviewKeyDown); // // movPictureBox @@ -4151,7 +4141,7 @@ this.radio3D.AutoSize = true; this.radio3D.Checked = true; this.radio3D.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.radio3D.Location = new System.Drawing.Point(1141, 542); + this.radio3D.Location = new System.Drawing.Point(1140, 542); this.radio3D.Name = "radio3D"; this.radio3D.Size = new System.Drawing.Size(31, 23); this.radio3D.TabIndex = 26; @@ -4166,7 +4156,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(1141, 566); + this.radio2D.Location = new System.Drawing.Point(1140, 566); this.radio2D.Name = "radio2D"; this.radio2D.Size = new System.Drawing.Size(31, 23); this.radio2D.TabIndex = 25; @@ -4181,7 +4171,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(1141, 590); + this.wireframeCheckBox.Location = new System.Drawing.Point(1140, 590); this.wireframeCheckBox.Name = "wireframeCheckBox"; this.wireframeCheckBox.Size = new System.Drawing.Size(31, 23); this.wireframeCheckBox.TabIndex = 27; @@ -6506,7 +6496,7 @@ this.removeEventFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.removeEventFileButton.Location = new System.Drawing.Point(354, 36); this.removeEventFileButton.Name = "removeEventFileButton"; - this.removeEventFileButton.Size = new System.Drawing.Size(98, 25); + this.removeEventFileButton.Size = new System.Drawing.Size(101, 25); this.removeEventFileButton.TabIndex = 54; this.removeEventFileButton.Text = "Remove Last"; this.removeEventFileButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -6519,9 +6509,9 @@ this.addEventFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.addEventFileButton.Location = new System.Drawing.Point(354, 9); this.addEventFileButton.Name = "addEventFileButton"; - this.addEventFileButton.Size = new System.Drawing.Size(98, 25); + this.addEventFileButton.Size = new System.Drawing.Size(101, 25); this.addEventFileButton.TabIndex = 53; - this.addEventFileButton.Text = "Add Event"; + this.addEventFileButton.Text = "Add Event File"; this.addEventFileButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.addEventFileButton.UseVisualStyleBackColor = true; this.addEventFileButton.Click += new System.EventHandler(this.addEventFileButton_Click); @@ -6606,7 +6596,7 @@ this.saveEventsButton.Name = "saveEventsButton"; this.saveEventsButton.Size = new System.Drawing.Size(166, 25); this.saveEventsButton.TabIndex = 34; - this.saveEventsButton.Text = "Save Events"; + this.saveEventsButton.Text = "Save Event File"; this.saveEventsButton.UseVisualStyleBackColor = true; this.saveEventsButton.Click += new System.EventHandler(this.saveEventsButton_Click); // @@ -10644,7 +10634,6 @@ private System.Windows.Forms.TextBox matrixNameTextBox; private System.Windows.Forms.NumericUpDown heightUpDown; private System.Windows.Forms.NumericUpDown widthUpDown; - private System.Windows.Forms.Label heightLabel; private System.Windows.Forms.Label widthLabel; private System.Windows.Forms.ComboBox selectMatrixComboBox; private System.Windows.Forms.Button saveMatrixButton; diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index c8894b0..dd0a33d 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -718,9 +718,7 @@ namespace DSPRE { DSUtils.ForceUnpackNarcs(Enum.GetValues(typeof(DirNames)).Cast().ToList()); - MessageBox.Show("Operation completed.", "Success", - MessageBoxButtons.OK, MessageBoxIcon.Information); - statusLabel.Text = "Ready"; + MessageBox.Show("Operation completed.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); toolStripProgressBar.Value = 0; toolStripProgressBar.Visible = false; @@ -729,11 +727,13 @@ namespace DSPRE { SetupMatrixEditor(); SetupMapEditor(); SetupNSBTXEditor(); - SetupTextEditor(); + SetupEventEditor(); SetupScriptEditorTextAreas(); SetupScriptEditor(); + SetupTextEditor(); SetupTrainerEditor(); + statusLabel.Text = "Ready"; Update(); } } @@ -822,7 +822,6 @@ namespace DSPRE { tableEditorIsReady = true; } } - statusLabel.Text = "Ready"; } private void spawnEditorToolStripButton_Click(object sender, EventArgs e) { @@ -1000,6 +999,7 @@ namespace DSPRE { if (headerListBox.Items.Count > 0) { headerListBox.SelectedIndex = 0; } + statusLabel.Text = "Ready"; } private void addHeaderBTN_Click(object sender, EventArgs e) { // Add new file in the dynamic headers directory @@ -2145,14 +2145,14 @@ namespace DSPRE { } } private void addMatrixButton_Click(object sender, EventArgs e) { - /* Load new matrix, a copy of Matrix 0 */ - GameMatrix newMatrix = new GameMatrix(0); + GameMatrix blankMatrix = new GameMatrix(); /* Add new matrix file to matrix folder */ - newMatrix.SaveToFile(RomInfo.gameDirs[DirNames.matrices].unpackedDir + "\\" + romInfo.GetMatrixCount().ToString("D4"), false); + blankMatrix.SaveToFile(RomInfo.gameDirs[DirNames.matrices].unpackedDir + "\\" + romInfo.GetMatrixCount().ToString("D4"), false); /* Update ComboBox*/ - selectMatrixComboBox.Items.Add(new GameMatrix(newMatrix, romInfo.GetMatrixCount() - 1)); + selectMatrixComboBox.Items.Add( selectMatrixComboBox.Items.Count.ToString() + blankMatrix ); + selectMatrixComboBox.SelectedIndex = selectMatrixComboBox.Items.Count - 1; } private void exportMatrixButton_Click(object sender, EventArgs e) { currentMatrix.SaveToFileExplorePath("Matrix " + selectMatrixComboBox.SelectedIndex); @@ -2393,12 +2393,42 @@ namespace DSPRE { } /* Determine area data */ - ushort headerID; + ushort headerID = 0; if (currentMatrix.hasHeadersSection) { headerID = currentMatrix.headers[e.RowIndex, e.ColumnIndex]; } else { - headerID = currentHeader.ID; + List result = HeaderSearch.AdvancedSearch(0, (ushort)internalNames.Count, internalNames, (int)MapHeader.SearchableFields.MatrixID, (int)HeaderSearch.NumOperators.Equal, selectMatrixComboBox.SelectedIndex.ToString()); + if (result.Count < 1) { + headerID = currentHeader.ID; + statusLabel.Text = "The current Matrix is unused. Displaying the last selected Header (" + headerID + ")'s textures."; + } else { + if (result.Count > 1) { + if (gameFamily.Equals(gFamEnum.DP)) { + foreach (string r in result) { + HeaderDP hdp = (HeaderDP)MapHeader.LoadFromARM9(ushort.Parse(r.Split()[0])); + if (hdp.locationName != 0) { + headerID = hdp.ID; + break; + } + } + } else { + foreach (string r in result) { + HeaderPt hpt = (HeaderPt)MapHeader.LoadFromARM9(ushort.Parse(r.Split()[0])); + if (hpt.locationName != 0) { + headerID = hpt.ID; + break; + } + } + } + + statusLabel.Text = "Multiple Headers are associated to this Matrix. Header " + headerID + "'s textures are currently being used."; + } else { + headerID = ushort.Parse(result.First().Split()[0]); + statusLabel.Text = "Loading Header " + headerID + "'s textures."; + } + } } + Update(); if (headerID > internalNames.Count) { MessageBox.Show("This map is associated to a non-existent header.\nThis will lead to unpredictable behaviour and, possibily, problems, if you attempt to load it in game.", @@ -2495,8 +2525,7 @@ namespace DSPRE { /* Remove entry from ComboBox, and decrease matrix count */ selectMatrixComboBox.Items.RemoveAt(matrixToDelete); } else { - MessageBox.Show("At least one matrix must be kept.", "Can't delete matrix", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return; + MessageBox.Show("At least one matrix must be kept.", "Can't delete Matrix", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } private void setSpawnPointButton_Click(object sender, EventArgs e) { @@ -2521,8 +2550,8 @@ namespace DSPRE { headerNumber = Convert.ToUInt16(selectedCell.Value); } else { DialogResult d; - d = MessageBox.Show("The current matrix doesn't have a Header Tab. " + - Environment.NewLine + "Do you want to check if any Header is using it and choose that one as your Spawn Point? " + + d = MessageBox.Show("This Matrix doesn't have a Header Tab. " + + Environment.NewLine + "Do you want to check if any Header uses this Matrix and choose that one as your Spawn Header? " + Environment.NewLine + "\nChoosing 'No' will pick the last selected Header.", "Couldn't find Header Tab", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d == DialogResult.Yes) { result = HeaderSearch.AdvancedSearch(0, (ushort)internalNames.Count, internalNames, (int)MapHeader.SearchableFields.MatrixID, (int)HeaderSearch.NumOperators.Equal, selectMatrixComboBox.SelectedIndex.ToString()); @@ -2706,6 +2735,12 @@ namespace DSPRE { #region Variables & Constants public const int mapEditorSquareSize = 19; + /* Map Rotation vars */ + public bool lRot; + public bool rRot; + public bool uRot; + public bool dRot; + /* Screenshot Interpolation mode */ public InterpolationMode intMode; @@ -2806,15 +2841,20 @@ namespace DSPRE { Gl.glScalef(mapFile.mapModel.models[0].modelScale / 64, mapFile.mapModel.models[0].modelScale / 64, mapFile.mapModel.models[0].modelScale / 64); /* Determine if map textures must be rendered */ - if (!mapTexturesON) Gl.glDisable(Gl.GL_TEXTURE_2D); - else Gl.glEnable(Gl.GL_TEXTURE_2D); + if (!mapTexturesON) { + Gl.glDisable(Gl.GL_TEXTURE_2D); + } else { + Gl.glEnable(Gl.GL_TEXTURE_2D); + } mapRenderer.RenderModel("", ani, aniframeS, aniframeS, aniframeS, aniframeS, aniframeS, ca, false, -1, 0.0f, 0.0f, dist, elev, ang, true, tp, mapFile.mapModel); // Render map model if (!hideBuildings) { - if (buildingTexturesON) + if (buildingTexturesON) { Gl.glEnable(Gl.GL_TEXTURE_2D); - else Gl.glDisable(Gl.GL_TEXTURE_2D); + } else { + Gl.glDisable(Gl.GL_TEXTURE_2D); + } for (int i = 0; i < mapFile.buildings.Count; i++) { NSBMD file = mapFile.buildings[i].NSBMDFile; @@ -2840,6 +2880,7 @@ namespace DSPRE { Gl.glTranslatef(fullXcoord * translateFactor / building.width, fullYcoord * translateFactor / building.height, fullZcoord * translateFactor / building.length); } private void SetupRenderer(float ang, float dist, float elev, float perspective, int width, int height) { + //TODO: improve this Gl.glEnable(Gl.GL_RESCALE_NORMAL); Gl.glEnable(Gl.GL_COLOR_MATERIAL); Gl.glEnable(Gl.GL_DEPTH_TEST); @@ -2995,6 +3036,8 @@ namespace DSPRE { buildTextureComboBox.SelectedIndex = 1; break; }; + + statusLabel.Text = "Ready"; } private void addMapFileButton_Click(object sender, EventArgs e) { /* Add new map file to map folder */ @@ -3117,23 +3160,67 @@ namespace DSPRE { RenderMap(ref mapRenderer, ref buildingsRenderer, ref currentMapFile, ang, dist, elev, perspective, mapOpenGlControl.Width, mapOpenGlControl.Height, mapTexturesOn, showBuildingTextures); } private void mapOpenGlControl_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { + byte multiplier = 2; + if (e.Modifiers == Keys.Shift) { + multiplier = 1; + } else if (e.Modifiers == Keys.Control) { + multiplier = 4; + } + switch (e.KeyCode) { case Keys.Right: - ang += 1; + rRot = true; + lRot = false; break; case Keys.Left: - ang -= 1; - break; - case Keys.Down: - elev += 1; + rRot = false; + lRot = true; break; case Keys.Up: - elev -= 1; + dRot = false; + uRot = true; + break; + case Keys.Down: + dRot = true; + uRot = false; break; } + + if (rRot ^ lRot) { + if (rRot) { + ang += 1 * multiplier; + } else if (lRot) { + ang -= 1 * multiplier; + } + } + + if (uRot ^ dRot) { + if (uRot) { + elev -= 1 * multiplier; + } else if (dRot) { + elev += 1 * multiplier; + } + } + mapOpenGlControl.Invalidate(); RenderMap(ref mapRenderer, ref buildingsRenderer, ref currentMapFile, ang, dist, elev, perspective, mapOpenGlControl.Width, mapOpenGlControl.Height, mapTexturesOn, showBuildingTextures); } + private void mapOpenGlControl_KeyUp(object sender, KeyEventArgs e) { + switch (e.KeyCode) { + case Keys.Right: + rRot = false; + break; + case Keys.Left: + lRot = false; + break; + case Keys.Up: + uRot = false; + break; + case Keys.Down: + dRot = false; + break; + } + } private void mapOpenGlControl_Click(object sender, EventArgs e) { if (radio2D.Checked && bldPlaceWithMouseCheckbox.Checked) { PointF coordinates = mapRenderPanel.PointToClient(Cursor.Position); @@ -4835,10 +4922,12 @@ namespace DSPRE { toolStripProgressBar.Value = 0; toolStripProgressBar.Visible = false; + + statusLabel.Text = "Ready"; } private void addEventFileButton_Click(object sender, EventArgs e) { /* Add copy of event 0 to event folder */ - new EventFile(0).SaveToFileDefaultDir(selectEventComboBox.Items.Count); + new EventFile().SaveToFileDefaultDir(selectEventComboBox.Items.Count); /* Update ComboBox and select new file */ selectEventComboBox.Items.Add("Event File " + selectEventComboBox.Items.Count); @@ -7069,6 +7158,7 @@ namespace DSPRE { if (palettesListBox.Items.Count > 0) { palettesListBox.SelectedIndex = 0; } + statusLabel.Text = "Ready"; } private void buildingsTilesetRadioButton_CheckedChanged(object sender, EventArgs e) { FillTilesetBox(); diff --git a/DS_Map/Main Window.resx b/DS_Map/Main Window.resx index dde7572..858d517 100644 --- a/DS_Map/Main Window.resx +++ b/DS_Map/Main Window.resx @@ -943,7 +943,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM - EgAAAk1TRnQBSQFMAgEBCgEAASgBGAEoARgBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + EgAAAk1TRnQBSQFMAgEBCgEAAUgBGAFIARgBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -1035,7 +1035,7 @@ 386, 19 - 36 + 35 diff --git a/DS_Map/ROMFiles/EventFile.cs b/DS_Map/ROMFiles/EventFile.cs index e460346..2293117 100644 --- a/DS_Map/ROMFiles/EventFile.cs +++ b/DS_Map/ROMFiles/EventFile.cs @@ -20,29 +20,37 @@ namespace DSPRE.ROMFiles { using (BinaryReader reader = new BinaryReader(data)) { /* Read spawnables */ uint spawnablesCount = reader.ReadUInt32(); - for (int i = 0; i < spawnablesCount; i++) + for (int i = 0; i < spawnablesCount; i++) { spawnables.Add(new Spawnable(new MemoryStream(reader.ReadBytes(0x14)))); + } /* Read overworlds */ uint overworldsCount = reader.ReadUInt32(); - for (int i = 0; i < overworldsCount; i++) + for (int i = 0; i < overworldsCount; i++) { overworlds.Add(new Overworld(new MemoryStream(reader.ReadBytes(0x20)))); + } /* Read warps */ uint warpsCount = reader.ReadUInt32(); - for (int i = 0; i < warpsCount; i++) + for (int i = 0; i < warpsCount; i++) { warps.Add(new Warp(new MemoryStream(reader.ReadBytes(0xC)))); + } /* Read triggers */ uint triggersCount = reader.ReadUInt32(); - for (int i = 0; i < triggersCount; i++) + for (int i = 0; i < triggersCount; i++) { triggers.Add(new Trigger(new MemoryStream(reader.ReadBytes(0x10)))); + } } } public EventFile(int ID) : this(new FileStream(RomInfo.gameDirs[DirNames.eventFiles].unpackedDir + "\\" + ID.ToString("D4"), FileMode.Open)) { } + public EventFile() { } #endregion #region Methods (1) + public override string ToString() { + return base.ToString(); + } public override byte[] ToByteArray() { MemoryStream newData = new MemoryStream(); using (BinaryWriter writer = new BinaryWriter(newData)) { diff --git a/DS_Map/ROMFiles/GameMatrix.cs b/DS_Map/ROMFiles/GameMatrix.cs index 5963e09..eef2a4c 100644 --- a/DS_Map/ROMFiles/GameMatrix.cs +++ b/DS_Map/ROMFiles/GameMatrix.cs @@ -97,12 +97,22 @@ namespace DSPRE.ROMFiles { this.width = copy.width; this.height = copy.height; + this.hasHeadersSection = copy.hasHeadersSection; + this.hasHeightsSection = copy.hasHeightsSection; + this.maps = (ushort[,])copy.maps.Clone(); this.altitudes = (byte[,])copy.altitudes.Clone(); this.headers = (ushort[,])copy.headers.Clone(); + } - this.hasHeadersSection = copy.hasHeadersSection; - this.hasHeightsSection = copy.hasHeightsSection; + public GameMatrix() { + this.name = "newMatrix"; + this.hasHeadersSection = false; + this.hasHeightsSection = false; + + this.width = 1; + this.height = 1; + this.maps = new ushort[1, 1] { { 0 } }; } #endregion