From 572ee845952450d6401c62dc368f43379396f97e Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 9 Nov 2015 20:54:49 -0800 Subject: [PATCH] More insight on coordinates Multiples of 18 for coordinates; k. OWSE now displays coordinates for warps/NPCs. Still no saving changes. --- pk3DS/Structs.cs | 6 ++ pk3DS/Subforms/OWSE.cs | 23 +++++++ pk3DS/Subforms/OWSE.designer.cs | 115 ++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+) diff --git a/pk3DS/Structs.cs b/pk3DS/Structs.cs index 9cce6f3..363a7c1 100644 --- a/pk3DS/Structs.cs +++ b/pk3DS/Structs.cs @@ -1244,6 +1244,9 @@ public class EntityNPC public int X { get { return BitConverter.ToUInt16(Raw, 0x28); } set { BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x28); } } public int Y { get { return BitConverter.ToUInt16(Raw, 0x2A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x2A); } } + public decimal pX { get { return (decimal)X / 18; } } + public decimal pY { get { return (decimal)Y / 18; } } + // -360, 360 ???? public float Degrees { get { return BitConverter.ToSingle(Raw, 0x2C); } set { BitConverter.GetBytes(value).CopyTo(Raw, 0x2C); } } @@ -1275,6 +1278,9 @@ public class EntityWarp public int Z { get { return BitConverter.ToInt16(Raw, 0x0A); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0A); } } public int Y { get { return BitConverter.ToUInt16(Raw, 0x0C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x0C); } } + public decimal pX { get { return (decimal)X / 18; } } + public decimal pY { get { return (decimal)Y / 18; } } + // Not sure. public int U0E { get { return BitConverter.ToInt16(Raw, 0x0E); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0E); } } public int U10 { get { return BitConverter.ToInt16(Raw, 0x10); } set { BitConverter.GetBytes((short)value).CopyTo(Raw, 0x10); } } diff --git a/pk3DS/Subforms/OWSE.cs b/pk3DS/Subforms/OWSE.cs index 58ccf48..93f4231 100644 --- a/pk3DS/Subforms/OWSE.cs +++ b/pk3DS/Subforms/OWSE.cs @@ -330,6 +330,8 @@ private void changeWarp(object sender, EventArgs e) { CurrentZone.Entities.Warps[wEntry].DestinationMap = (int)NUD_WMap.Value; CurrentZone.Entities.Warps[wEntry].DestinationTileIndex = (int)NUD_WTile.Value; + CurrentZone.Entities.Warps[wEntry].X = (int)NUD_WX.Value; + CurrentZone.Entities.Warps[wEntry].Y = (int)NUD_WY.Value; } wEntry = (int)NUD_WE.Value; @@ -341,6 +343,9 @@ private void changeWarp(object sender, EventArgs e) NUD_WMap.Value = Warp.DestinationMap; NUD_WTile.Value = Warp.DestinationTileIndex; + NUD_WX.Value = Warp.X; + NUD_WY.Value = Warp.Y; + // Flavor Mods L_WarpDest.Text = zdLocations[Warp.DestinationMap]; } @@ -609,5 +614,23 @@ private void pasteScript(object sender, EventArgs e) RTB_DecompressedScript.Text = "DECMP ERROR"; } } + + // Coordinate Simplifiers + private void changeNPC_X(object sender, EventArgs e) + { + L_NpX.Text = (NUD_NX.Value/18).ToString(); + } + private void changeNPC_Y(object sender, EventArgs e) + { + L_NpY.Text = (NUD_NY.Value / 18).ToString(); + } + private void changeWarp_X(object sender, EventArgs e) + { + L_WpX.Text = (NUD_WX.Value / 18).ToString(); + } + private void changeWarp_Y(object sender, EventArgs e) + { + L_WpY.Text = (NUD_WY.Value / 18).ToString(); + } } } \ No newline at end of file diff --git a/pk3DS/Subforms/OWSE.designer.cs b/pk3DS/Subforms/OWSE.designer.cs index 486aac7..8c24b90 100644 --- a/pk3DS/Subforms/OWSE.designer.cs +++ b/pk3DS/Subforms/OWSE.designer.cs @@ -149,6 +149,14 @@ private void InitializeComponent() this.L_Move1 = new System.Windows.Forms.Label(); this.NUD_NMove2 = new System.Windows.Forms.NumericUpDown(); this.L_Move2 = new System.Windows.Forms.Label(); + this.L_NpX = new System.Windows.Forms.Label(); + this.L_NpY = new System.Windows.Forms.Label(); + this.L_WpY = new System.Windows.Forms.Label(); + this.L_WpX = new System.Windows.Forms.Label(); + this.NUD_WY = new System.Windows.Forms.NumericUpDown(); + this.L_WY = new System.Windows.Forms.Label(); + this.NUD_WX = new System.Windows.Forms.NumericUpDown(); + this.L_WX = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.tb_ZoneData.SuspendLayout(); this.tb_OWSC.SuspendLayout(); @@ -195,6 +203,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_NRange)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_NMove1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_NMove2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_WY)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_WX)).BeginInit(); this.SuspendLayout(); // // CB_LocationID @@ -483,6 +493,8 @@ private void InitializeComponent() // // GB_N // + this.GB_N.Controls.Add(this.L_NpY); + this.GB_N.Controls.Add(this.L_NpX); this.GB_N.Controls.Add(this.NUD_NMove2); this.GB_N.Controls.Add(this.L_Move2); this.GB_N.Controls.Add(this.NUD_NMove1); @@ -600,6 +612,7 @@ private void InitializeComponent() this.NUD_NY.Name = "NUD_NY"; this.NUD_NY.Size = new System.Drawing.Size(53, 20); this.NUD_NY.TabIndex = 441; + this.NUD_NY.ValueChanged += new System.EventHandler(this.changeNPC_Y); // // L_NY // @@ -621,6 +634,7 @@ private void InitializeComponent() this.NUD_NX.Name = "NUD_NX"; this.NUD_NX.Size = new System.Drawing.Size(53, 20); this.NUD_NX.TabIndex = 439; + this.NUD_NX.ValueChanged += new System.EventHandler(this.changeNPC_X); // // L_NX // @@ -722,6 +736,12 @@ private void InitializeComponent() // // GB_W // + this.GB_W.Controls.Add(this.L_WpY); + this.GB_W.Controls.Add(this.L_WpX); + this.GB_W.Controls.Add(this.NUD_WY); + this.GB_W.Controls.Add(this.L_WY); + this.GB_W.Controls.Add(this.NUD_WX); + this.GB_W.Controls.Add(this.L_WX); this.GB_W.Controls.Add(this.RTB_W); this.GB_W.Controls.Add(this.L_WarpDest); this.GB_W.Controls.Add(this.L_DestMap); @@ -1563,6 +1583,90 @@ private void InitializeComponent() this.L_Move2.Text = "Move2:"; this.L_Move2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // + // L_NpX + // + this.L_NpX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.L_NpX.AutoSize = true; + this.L_NpX.Location = new System.Drawing.Point(152, 174); + this.L_NpX.Name = "L_NpX"; + this.L_NpX.Size = new System.Drawing.Size(29, 13); + this.L_NpX.TabIndex = 458; + this.L_NpX.Text = "HEX"; + // + // L_NpY + // + this.L_NpY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.L_NpY.AutoSize = true; + this.L_NpY.Location = new System.Drawing.Point(152, 200); + this.L_NpY.Name = "L_NpY"; + this.L_NpY.Size = new System.Drawing.Size(29, 13); + this.L_NpY.TabIndex = 459; + this.L_NpY.Text = "HEX"; + // + // L_WpY + // + this.L_WpY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.L_WpY.AutoSize = true; + this.L_WpY.Location = new System.Drawing.Point(184, 191); + this.L_WpY.Name = "L_WpY"; + this.L_WpY.Size = new System.Drawing.Size(29, 13); + this.L_WpY.TabIndex = 465; + this.L_WpY.Text = "HEX"; + // + // L_WpX + // + this.L_WpX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.L_WpX.AutoSize = true; + this.L_WpX.Location = new System.Drawing.Point(184, 165); + this.L_WpX.Name = "L_WpX"; + this.L_WpX.Size = new System.Drawing.Size(29, 13); + this.L_WpX.TabIndex = 464; + this.L_WpX.Text = "HEX"; + // + // NUD_WY + // + this.NUD_WY.Location = new System.Drawing.Point(125, 189); + this.NUD_WY.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.NUD_WY.Name = "NUD_WY"; + this.NUD_WY.Size = new System.Drawing.Size(53, 20); + this.NUD_WY.TabIndex = 463; + this.NUD_WY.ValueChanged += new System.EventHandler(this.changeWarp_Y); + // + // L_WY + // + this.L_WY.Location = new System.Drawing.Point(43, 189); + this.L_WY.Name = "L_WY"; + this.L_WY.Size = new System.Drawing.Size(76, 16); + this.L_WY.TabIndex = 462; + this.L_WY.Text = "Y Coordinate:"; + this.L_WY.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_WX + // + this.NUD_WX.Location = new System.Drawing.Point(125, 163); + this.NUD_WX.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.NUD_WX.Name = "NUD_WX"; + this.NUD_WX.Size = new System.Drawing.Size(53, 20); + this.NUD_WX.TabIndex = 461; + this.NUD_WX.ValueChanged += new System.EventHandler(this.changeWarp_X); + // + // L_WX + // + this.L_WX.Location = new System.Drawing.Point(43, 163); + this.L_WX.Name = "L_WX"; + this.L_WX.Size = new System.Drawing.Size(76, 16); + this.L_WX.TabIndex = 460; + this.L_WX.Text = "X Coordinate:"; + this.L_WX.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // OWSE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1604,6 +1708,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_NE)).EndInit(); this.tb_Warp.ResumeLayout(false); this.GB_W.ResumeLayout(false); + this.GB_W.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_WTile)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_WMap)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_WE)).EndInit(); @@ -1633,6 +1738,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_NRange)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_NMove1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_NMove2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_WY)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_WX)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -1761,6 +1868,14 @@ private void InitializeComponent() private System.Windows.Forms.Label L_Move2; private System.Windows.Forms.NumericUpDown NUD_NMove1; private System.Windows.Forms.Label L_Move1; + private System.Windows.Forms.Label L_NpY; + private System.Windows.Forms.Label L_NpX; + private System.Windows.Forms.Label L_WpY; + private System.Windows.Forms.Label L_WpX; + private System.Windows.Forms.NumericUpDown NUD_WY; + private System.Windows.Forms.Label L_WY; + private System.Windows.Forms.NumericUpDown NUD_WX; + private System.Windows.Forms.Label L_WX; } }