Dat151 progress

This commit is contained in:
dexy
2018-12-27 00:20:39 +11:00
Unverified
parent 05d302a4e1
commit 77d9c4e4c8
16 changed files with 2177 additions and 247 deletions
@@ -25,6 +25,7 @@ namespace CodeWalker.Project.Panels
public void SetEmitterList(Dat151AmbientEmitterList list)
{
CurrentEmitterList = list;
Tag = list;
UpdateFormTitle();
}
+1
View File
@@ -25,6 +25,7 @@ namespace CodeWalker.Project.Panels
public void SetEmitter(AudioPlacement emitter)
{
CurrentEmitter = emitter;
Tag = emitter;
UpdateFormTitle();
}
+1
View File
@@ -25,6 +25,7 @@ namespace CodeWalker.Project.Panels
public void SetFile(RelFile file)
{
CurrentFile = file;
Tag = file;
UpdateFormTitle();
}
+63
View File
@@ -29,20 +29,83 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditAudioZoneListPanel));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.label19 = new System.Windows.Forms.Label();
this.HashesTextBox = new CodeWalker.WinForms.TextBoxFix();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Location = new System.Drawing.Point(2, 3);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(559, 446);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.label19);
this.tabPage1.Controls.Add(this.HashesTextBox);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(551, 420);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Ambient Zone List";
this.tabPage1.UseVisualStyleBackColor = true;
//
// label19
//
this.label19.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(11, 11);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(72, 13);
this.label19.TabIndex = 72;
this.label19.Text = "Zone hashes:";
//
// HashesTextBox
//
this.HashesTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.HashesTextBox.Location = new System.Drawing.Point(6, 28);
this.HashesTextBox.Multiline = true;
this.HashesTextBox.Name = "HashesTextBox";
this.HashesTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.HashesTextBox.Size = new System.Drawing.Size(428, 330);
this.HashesTextBox.TabIndex = 73;
this.HashesTextBox.WordWrap = false;
this.HashesTextBox.TextChanged += new System.EventHandler(this.HashesTextBox_TextChanged);
//
// EditAudioZoneListPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(562, 450);
this.Controls.Add(this.tabControl1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "EditAudioZoneListPanel";
this.Text = "Edit Audio Zone List";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.Label label19;
private WinForms.TextBoxFix HashesTextBox;
}
}
+80
View File
@@ -16,6 +16,9 @@ namespace CodeWalker.Project.Panels
public ProjectForm ProjectForm;
public Dat151AmbientZoneList CurrentZoneList { get; set; }
private bool populatingui = false;
public EditAudioZoneListPanel(ProjectForm owner)
{
ProjectForm = owner;
@@ -25,7 +28,9 @@ namespace CodeWalker.Project.Panels
public void SetZoneList(Dat151AmbientZoneList list)
{
CurrentZoneList = list;
Tag = list;
UpdateFormTitle();
UpdateUI();
}
private void UpdateFormTitle()
@@ -33,5 +38,80 @@ namespace CodeWalker.Project.Panels
Text = CurrentZoneList?.NameHash.ToString() ?? "";
}
private void UpdateUI()
{
if (CurrentZoneList == null)
{
//AddToProjectButton.Enabled = false;
//DeleteButton.Enabled = false;
populatingui = true;
HashesTextBox.Text = string.Empty;
populatingui = false;
}
else
{
//AddToProjectButton.Enabled = CurrentZoneList?.Rel != null ? !ProjectForm.AudioFileExistsInProject(CurrentZoneList.Rel) : false;
//DeleteButton.Enabled = !AddToProjectButton.Enabled;
populatingui = true;
var zl = CurrentZoneList;
StringBuilder sb = new StringBuilder();
if (zl.ZoneHashes != null)
{
foreach (var hash in zl.ZoneHashes)
{
sb.AppendLine(hash.ToString());
}
}
HashesTextBox.Text = sb.ToString();
populatingui = false;
}
}
private void ProjectItemChanged()
{
if (CurrentZoneList?.Rel != null)
{
ProjectForm.SetAudioFileHasChanged(true);
}
}
private void HashesTextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZoneList == null) return;
var hashstrs = HashesTextBox.Text.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (hashstrs?.Length > 0)
{
var hashlist = new List<MetaHash>();
foreach (var hashstr in hashstrs)
{
uint hash = 0;
if (!uint.TryParse(hashstr, out hash))//don't re-hash hashes
{
hash = JenkHash.GenHash(hashstr);
JenkIndex.Ensure(hashstr);
}
hashlist.Add(hash);
}
CurrentZoneList.ZoneHashes = hashlist.ToArray();
CurrentZoneList.ZoneCount = (byte)hashlist.Count;
ProjectItemChanged();
}
}
}
}
+631 -1
View File
@@ -31,7 +31,57 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditAudioZonePanel));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.DeleteButton = new System.Windows.Forms.Button();
this.AddToProjectButton = new System.Windows.Forms.Button();
this.label21 = new System.Windows.Forms.Label();
this.Flags2TextBox = new System.Windows.Forms.TextBox();
this.label20 = new System.Windows.Forms.Label();
this.ExtParamsTextBox = new CodeWalker.WinForms.TextBoxFix();
this.label19 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.UnkVec3TextBox = new System.Windows.Forms.TextBox();
this.label17 = new System.Windows.Forms.Label();
this.UnkVec2TextBox = new System.Windows.Forms.TextBox();
this.label18 = new System.Windows.Forms.Label();
this.UnkVec1TextBox = new System.Windows.Forms.TextBox();
this.HashesTextBox = new CodeWalker.WinForms.TextBoxFix();
this.label14 = new System.Windows.Forms.Label();
this.Flags1TextBox = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.Flags0TextBox = new System.Windows.Forms.TextBox();
this.ShapeComboBox = new System.Windows.Forms.ComboBox();
this.label23 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.NameTextBox = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.OuterVec3TextBox = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.OuterVec2TextBox = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.OuterVec1TextBox = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.OuterAngleTextBox = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.OuterSizeTextBox = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.OuterPosTextBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.InnerVec3TextBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.InnerVec2TextBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.InnerVec1TextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.InnerAngleTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.InnerSizeTextBox = new System.Windows.Forms.TextBox();
this.label16 = new System.Windows.Forms.Label();
this.InnerPosTextBox = new System.Windows.Forms.TextBox();
this.GoToButton = new System.Windows.Forms.Button();
this.label22 = new System.Windows.Forms.Label();
this.UnkBytesTextBox = new System.Windows.Forms.TextBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
@@ -48,24 +98,555 @@
//
// tabPage1
//
this.tabPage1.Controls.Add(this.label22);
this.tabPage1.Controls.Add(this.UnkBytesTextBox);
this.tabPage1.Controls.Add(this.DeleteButton);
this.tabPage1.Controls.Add(this.AddToProjectButton);
this.tabPage1.Controls.Add(this.label21);
this.tabPage1.Controls.Add(this.Flags2TextBox);
this.tabPage1.Controls.Add(this.label20);
this.tabPage1.Controls.Add(this.ExtParamsTextBox);
this.tabPage1.Controls.Add(this.label19);
this.tabPage1.Controls.Add(this.label15);
this.tabPage1.Controls.Add(this.UnkVec3TextBox);
this.tabPage1.Controls.Add(this.label17);
this.tabPage1.Controls.Add(this.UnkVec2TextBox);
this.tabPage1.Controls.Add(this.label18);
this.tabPage1.Controls.Add(this.UnkVec1TextBox);
this.tabPage1.Controls.Add(this.HashesTextBox);
this.tabPage1.Controls.Add(this.label14);
this.tabPage1.Controls.Add(this.Flags1TextBox);
this.tabPage1.Controls.Add(this.label13);
this.tabPage1.Controls.Add(this.Flags0TextBox);
this.tabPage1.Controls.Add(this.ShapeComboBox);
this.tabPage1.Controls.Add(this.label23);
this.tabPage1.Controls.Add(this.label12);
this.tabPage1.Controls.Add(this.NameTextBox);
this.tabPage1.Controls.Add(this.label6);
this.tabPage1.Controls.Add(this.OuterVec3TextBox);
this.tabPage1.Controls.Add(this.label7);
this.tabPage1.Controls.Add(this.OuterVec2TextBox);
this.tabPage1.Controls.Add(this.label8);
this.tabPage1.Controls.Add(this.OuterVec1TextBox);
this.tabPage1.Controls.Add(this.label9);
this.tabPage1.Controls.Add(this.OuterAngleTextBox);
this.tabPage1.Controls.Add(this.label10);
this.tabPage1.Controls.Add(this.OuterSizeTextBox);
this.tabPage1.Controls.Add(this.label11);
this.tabPage1.Controls.Add(this.OuterPosTextBox);
this.tabPage1.Controls.Add(this.label5);
this.tabPage1.Controls.Add(this.InnerVec3TextBox);
this.tabPage1.Controls.Add(this.label4);
this.tabPage1.Controls.Add(this.InnerVec2TextBox);
this.tabPage1.Controls.Add(this.label3);
this.tabPage1.Controls.Add(this.InnerVec1TextBox);
this.tabPage1.Controls.Add(this.label2);
this.tabPage1.Controls.Add(this.InnerAngleTextBox);
this.tabPage1.Controls.Add(this.label1);
this.tabPage1.Controls.Add(this.InnerSizeTextBox);
this.tabPage1.Controls.Add(this.label16);
this.tabPage1.Controls.Add(this.InnerPosTextBox);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(551, 421);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Ambient Emitter";
this.tabPage1.Text = "Ambient Zone";
this.tabPage1.UseVisualStyleBackColor = true;
//
// DeleteButton
//
this.DeleteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.DeleteButton.Location = new System.Drawing.Point(343, 3);
this.DeleteButton.Name = "DeleteButton";
this.DeleteButton.Size = new System.Drawing.Size(93, 23);
this.DeleteButton.TabIndex = 75;
this.DeleteButton.Text = "Delete zone";
this.DeleteButton.UseVisualStyleBackColor = true;
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
//
// AddToProjectButton
//
this.AddToProjectButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.AddToProjectButton.Location = new System.Drawing.Point(452, 3);
this.AddToProjectButton.Name = "AddToProjectButton";
this.AddToProjectButton.Size = new System.Drawing.Size(93, 23);
this.AddToProjectButton.TabIndex = 74;
this.AddToProjectButton.Text = "Add to project";
this.AddToProjectButton.UseVisualStyleBackColor = true;
this.AddToProjectButton.Click += new System.EventHandler(this.AddToProjectButton_Click);
//
// label21
//
this.label21.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(340, 106);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(44, 13);
this.label21.TabIndex = 68;
this.label21.Text = "Flags 2:";
//
// Flags2TextBox
//
this.Flags2TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.Flags2TextBox.Location = new System.Drawing.Point(390, 103);
this.Flags2TextBox.Name = "Flags2TextBox";
this.Flags2TextBox.Size = new System.Drawing.Size(155, 20);
this.Flags2TextBox.TabIndex = 69;
this.Flags2TextBox.TextChanged += new System.EventHandler(this.Flags2TextBox_TextChanged);
//
// label20
//
this.label20.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(340, 278);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(193, 13);
this.label20.TabIndex = 72;
this.label20.Text = "Ext params: Name (hash), Value (float)";
//
// ExtParamsTextBox
//
this.ExtParamsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ExtParamsTextBox.Location = new System.Drawing.Point(335, 295);
this.ExtParamsTextBox.Multiline = true;
this.ExtParamsTextBox.Name = "ExtParamsTextBox";
this.ExtParamsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.ExtParamsTextBox.Size = new System.Drawing.Size(209, 116);
this.ExtParamsTextBox.TabIndex = 73;
this.ExtParamsTextBox.WordWrap = false;
this.ExtParamsTextBox.TextChanged += new System.EventHandler(this.ExtParamsTextBox_TextChanged);
//
// label19
//
this.label19.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(340, 134);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(46, 13);
this.label19.TabIndex = 70;
this.label19.Text = "Hashes:";
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(7, 394);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(60, 13);
this.label15.TabIndex = 62;
this.label15.Text = "Unk vec 3:";
//
// UnkVec3TextBox
//
this.UnkVec3TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.UnkVec3TextBox.Location = new System.Drawing.Point(84, 391);
this.UnkVec3TextBox.Name = "UnkVec3TextBox";
this.UnkVec3TextBox.Size = new System.Drawing.Size(237, 20);
this.UnkVec3TextBox.TabIndex = 63;
this.UnkVec3TextBox.TextChanged += new System.EventHandler(this.UnkVec3TextBox_TextChanged);
//
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(7, 370);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(60, 13);
this.label17.TabIndex = 60;
this.label17.Text = "Unk vec 2:";
//
// UnkVec2TextBox
//
this.UnkVec2TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.UnkVec2TextBox.Location = new System.Drawing.Point(84, 367);
this.UnkVec2TextBox.Name = "UnkVec2TextBox";
this.UnkVec2TextBox.Size = new System.Drawing.Size(237, 20);
this.UnkVec2TextBox.TabIndex = 61;
this.UnkVec2TextBox.TextChanged += new System.EventHandler(this.UnkVec2TextBox_TextChanged);
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(7, 346);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(60, 13);
this.label18.TabIndex = 58;
this.label18.Text = "Unk vec 1:";
//
// UnkVec1TextBox
//
this.UnkVec1TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.UnkVec1TextBox.Location = new System.Drawing.Point(84, 343);
this.UnkVec1TextBox.Name = "UnkVec1TextBox";
this.UnkVec1TextBox.Size = new System.Drawing.Size(237, 20);
this.UnkVec1TextBox.TabIndex = 59;
this.UnkVec1TextBox.TextChanged += new System.EventHandler(this.UnkVec1TextBox_TextChanged);
//
// HashesTextBox
//
this.HashesTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.HashesTextBox.Location = new System.Drawing.Point(335, 151);
this.HashesTextBox.Multiline = true;
this.HashesTextBox.Name = "HashesTextBox";
this.HashesTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.HashesTextBox.Size = new System.Drawing.Size(209, 116);
this.HashesTextBox.TabIndex = 71;
this.HashesTextBox.WordWrap = false;
this.HashesTextBox.TextChanged += new System.EventHandler(this.HashesTextBox_TextChanged);
//
// label14
//
this.label14.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(340, 82);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(44, 13);
this.label14.TabIndex = 66;
this.label14.Text = "Flags 1:";
//
// Flags1TextBox
//
this.Flags1TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.Flags1TextBox.Location = new System.Drawing.Point(390, 79);
this.Flags1TextBox.Name = "Flags1TextBox";
this.Flags1TextBox.Size = new System.Drawing.Size(155, 20);
this.Flags1TextBox.TabIndex = 67;
this.Flags1TextBox.TextChanged += new System.EventHandler(this.Flags1TextBox_TextChanged);
//
// label13
//
this.label13.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(340, 58);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(44, 13);
this.label13.TabIndex = 64;
this.label13.Text = "Flags 0:";
//
// Flags0TextBox
//
this.Flags0TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.Flags0TextBox.Location = new System.Drawing.Point(390, 55);
this.Flags0TextBox.Name = "Flags0TextBox";
this.Flags0TextBox.Size = new System.Drawing.Size(155, 20);
this.Flags0TextBox.TabIndex = 65;
this.Flags0TextBox.TextChanged += new System.EventHandler(this.Flags0TextBox_TextChanged);
//
// ShapeComboBox
//
this.ShapeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ShapeComboBox.FormattingEnabled = true;
this.ShapeComboBox.Items.AddRange(new object[] {
"Box",
"Line",
"Sphere"});
this.ShapeComboBox.Location = new System.Drawing.Point(84, 30);
this.ShapeComboBox.Name = "ShapeComboBox";
this.ShapeComboBox.Size = new System.Drawing.Size(151, 21);
this.ShapeComboBox.TabIndex = 33;
this.ShapeComboBox.SelectedIndexChanged += new System.EventHandler(this.ShapeComboBox_SelectedIndexChanged);
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(7, 33);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(41, 13);
this.label23.TabIndex = 32;
this.label23.Text = "Shape:";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(7, 9);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(64, 13);
this.label12.TabIndex = 29;
this.label12.Text = "Name hash:";
//
// NameTextBox
//
this.NameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.NameTextBox.Location = new System.Drawing.Point(84, 6);
this.NameTextBox.Name = "NameTextBox";
this.NameTextBox.Size = new System.Drawing.Size(237, 20);
this.NameTextBox.TabIndex = 30;
this.NameTextBox.TextChanged += new System.EventHandler(this.NameTextBox_TextChanged);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(7, 322);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(66, 13);
this.label6.TabIndex = 56;
this.label6.Text = "Outer vec 3:";
//
// OuterVec3TextBox
//
this.OuterVec3TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.OuterVec3TextBox.Location = new System.Drawing.Point(84, 319);
this.OuterVec3TextBox.Name = "OuterVec3TextBox";
this.OuterVec3TextBox.Size = new System.Drawing.Size(237, 20);
this.OuterVec3TextBox.TabIndex = 57;
this.OuterVec3TextBox.TextChanged += new System.EventHandler(this.OuterVec3TextBox_TextChanged);
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(7, 298);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(66, 13);
this.label7.TabIndex = 54;
this.label7.Text = "Outer vec 2:";
//
// OuterVec2TextBox
//
this.OuterVec2TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.OuterVec2TextBox.Location = new System.Drawing.Point(84, 295);
this.OuterVec2TextBox.Name = "OuterVec2TextBox";
this.OuterVec2TextBox.Size = new System.Drawing.Size(237, 20);
this.OuterVec2TextBox.TabIndex = 55;
this.OuterVec2TextBox.TextChanged += new System.EventHandler(this.OuterVec2TextBox_TextChanged);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(7, 274);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(66, 13);
this.label8.TabIndex = 52;
this.label8.Text = "Outer vec 1:";
//
// OuterVec1TextBox
//
this.OuterVec1TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.OuterVec1TextBox.Location = new System.Drawing.Point(84, 271);
this.OuterVec1TextBox.Name = "OuterVec1TextBox";
this.OuterVec1TextBox.Size = new System.Drawing.Size(237, 20);
this.OuterVec1TextBox.TabIndex = 53;
this.OuterVec1TextBox.TextChanged += new System.EventHandler(this.OuterVec1TextBox_TextChanged);
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(7, 250);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(65, 13);
this.label9.TabIndex = 50;
this.label9.Text = "Outer angle:";
//
// OuterAngleTextBox
//
this.OuterAngleTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.OuterAngleTextBox.Location = new System.Drawing.Point(84, 247);
this.OuterAngleTextBox.Name = "OuterAngleTextBox";
this.OuterAngleTextBox.Size = new System.Drawing.Size(237, 20);
this.OuterAngleTextBox.TabIndex = 51;
this.OuterAngleTextBox.TextChanged += new System.EventHandler(this.OuterAngleTextBox_TextChanged);
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(7, 226);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(57, 13);
this.label10.TabIndex = 48;
this.label10.Text = "Outer size:";
//
// OuterSizeTextBox
//
this.OuterSizeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.OuterSizeTextBox.Location = new System.Drawing.Point(84, 223);
this.OuterSizeTextBox.Name = "OuterSizeTextBox";
this.OuterSizeTextBox.Size = new System.Drawing.Size(237, 20);
this.OuterSizeTextBox.TabIndex = 49;
this.OuterSizeTextBox.TextChanged += new System.EventHandler(this.OuterSizeTextBox_TextChanged);
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(7, 202);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(75, 13);
this.label11.TabIndex = 46;
this.label11.Text = "Outer position:";
//
// OuterPosTextBox
//
this.OuterPosTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.OuterPosTextBox.Location = new System.Drawing.Point(84, 199);
this.OuterPosTextBox.Name = "OuterPosTextBox";
this.OuterPosTextBox.Size = new System.Drawing.Size(237, 20);
this.OuterPosTextBox.TabIndex = 47;
this.OuterPosTextBox.TextChanged += new System.EventHandler(this.OuterPosTextBox_TextChanged);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(7, 178);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(64, 13);
this.label5.TabIndex = 44;
this.label5.Text = "Inner vec 3:";
//
// InnerVec3TextBox
//
this.InnerVec3TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.InnerVec3TextBox.Location = new System.Drawing.Point(84, 175);
this.InnerVec3TextBox.Name = "InnerVec3TextBox";
this.InnerVec3TextBox.Size = new System.Drawing.Size(237, 20);
this.InnerVec3TextBox.TabIndex = 45;
this.InnerVec3TextBox.TextChanged += new System.EventHandler(this.InnerVec3TextBox_TextChanged);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(7, 154);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(64, 13);
this.label4.TabIndex = 42;
this.label4.Text = "Inner vec 2:";
//
// InnerVec2TextBox
//
this.InnerVec2TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.InnerVec2TextBox.Location = new System.Drawing.Point(84, 151);
this.InnerVec2TextBox.Name = "InnerVec2TextBox";
this.InnerVec2TextBox.Size = new System.Drawing.Size(237, 20);
this.InnerVec2TextBox.TabIndex = 43;
this.InnerVec2TextBox.TextChanged += new System.EventHandler(this.InnerVec2TextBox_TextChanged);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(7, 130);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 13);
this.label3.TabIndex = 40;
this.label3.Text = "Inner vec 1:";
//
// InnerVec1TextBox
//
this.InnerVec1TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.InnerVec1TextBox.Location = new System.Drawing.Point(84, 127);
this.InnerVec1TextBox.Name = "InnerVec1TextBox";
this.InnerVec1TextBox.Size = new System.Drawing.Size(237, 20);
this.InnerVec1TextBox.TabIndex = 41;
this.InnerVec1TextBox.TextChanged += new System.EventHandler(this.InnerVec1TextBox_TextChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(7, 106);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(63, 13);
this.label2.TabIndex = 38;
this.label2.Text = "Inner angle:";
//
// InnerAngleTextBox
//
this.InnerAngleTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.InnerAngleTextBox.Location = new System.Drawing.Point(84, 103);
this.InnerAngleTextBox.Name = "InnerAngleTextBox";
this.InnerAngleTextBox.Size = new System.Drawing.Size(237, 20);
this.InnerAngleTextBox.TabIndex = 39;
this.InnerAngleTextBox.TextChanged += new System.EventHandler(this.InnerAngleTextBox_TextChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(7, 82);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(55, 13);
this.label1.TabIndex = 36;
this.label1.Text = "Inner size:";
//
// InnerSizeTextBox
//
this.InnerSizeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.InnerSizeTextBox.Location = new System.Drawing.Point(84, 79);
this.InnerSizeTextBox.Name = "InnerSizeTextBox";
this.InnerSizeTextBox.Size = new System.Drawing.Size(237, 20);
this.InnerSizeTextBox.TabIndex = 37;
this.InnerSizeTextBox.TextChanged += new System.EventHandler(this.InnerSizeTextBox_TextChanged);
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(7, 58);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(73, 13);
this.label16.TabIndex = 34;
this.label16.Text = "Inner position:";
//
// InnerPosTextBox
//
this.InnerPosTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.InnerPosTextBox.Location = new System.Drawing.Point(84, 55);
this.InnerPosTextBox.Name = "InnerPosTextBox";
this.InnerPosTextBox.Size = new System.Drawing.Size(237, 20);
this.InnerPosTextBox.TabIndex = 35;
this.InnerPosTextBox.TextChanged += new System.EventHandler(this.InnerPosTextBox_TextChanged);
//
// GoToButton
//
this.GoToButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.GoToButton.Location = new System.Drawing.Point(483, 0);
this.GoToButton.Name = "GoToButton";
this.GoToButton.Size = new System.Drawing.Size(68, 23);
this.GoToButton.TabIndex = 31;
this.GoToButton.Text = "Go to";
this.GoToButton.UseVisualStyleBackColor = true;
this.GoToButton.Click += new System.EventHandler(this.GoToButton_Click);
//
// label22
//
this.label22.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(327, 34);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(58, 13);
this.label22.TabIndex = 76;
this.label22.Text = "Unk bytes:";
//
// UnkBytesTextBox
//
this.UnkBytesTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.UnkBytesTextBox.Location = new System.Drawing.Point(390, 31);
this.UnkBytesTextBox.Name = "UnkBytesTextBox";
this.UnkBytesTextBox.Size = new System.Drawing.Size(155, 20);
this.UnkBytesTextBox.TabIndex = 77;
this.UnkBytesTextBox.TextChanged += new System.EventHandler(this.UnkBytesTextBox_TextChanged);
//
// EditAudioZonePanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(562, 450);
this.Controls.Add(this.GoToButton);
this.Controls.Add(this.tabControl1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "EditAudioZonePanel";
this.Text = "Edit Audio Zone";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.ResumeLayout(false);
}
@@ -73,5 +654,54 @@
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.TextBox InnerPosTextBox;
private System.Windows.Forms.Button GoToButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox InnerSizeTextBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox InnerVec2TextBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox InnerVec1TextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox InnerAngleTextBox;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox InnerVec3TextBox;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.TextBox NameTextBox;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox OuterVec3TextBox;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox OuterVec2TextBox;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox OuterVec1TextBox;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox OuterAngleTextBox;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox OuterSizeTextBox;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox OuterPosTextBox;
private System.Windows.Forms.ComboBox ShapeComboBox;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox Flags1TextBox;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox Flags0TextBox;
private WinForms.TextBoxFix HashesTextBox;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.TextBox UnkVec3TextBox;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.TextBox UnkVec2TextBox;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.TextBox UnkVec1TextBox;
private System.Windows.Forms.Label label20;
private WinForms.TextBoxFix ExtParamsTextBox;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.TextBox Flags2TextBox;
private System.Windows.Forms.Button AddToProjectButton;
private System.Windows.Forms.Button DeleteButton;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.TextBox UnkBytesTextBox;
}
}
+537 -1
View File
@@ -1,9 +1,12 @@
using CodeWalker.World;
using CodeWalker.GameFiles;
using CodeWalker.World;
using SharpDX;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -16,6 +19,9 @@ namespace CodeWalker.Project.Panels
public ProjectForm ProjectForm;
public AudioPlacement CurrentZone { get; set; }
private bool populatingui = false;
public EditAudioZonePanel(ProjectForm owner)
{
ProjectForm = owner;
@@ -25,7 +31,9 @@ namespace CodeWalker.Project.Panels
public void SetZone(AudioPlacement zone)
{
CurrentZone = zone;
Tag = zone;
UpdateFormTitle();
UpdateUI();
}
private void UpdateFormTitle()
@@ -34,5 +42,533 @@ namespace CodeWalker.Project.Panels
}
private void UpdateUI()
{
if (CurrentZone?.AudioZone == null)
{
AddToProjectButton.Enabled = false;
DeleteButton.Enabled = false;
populatingui = true;
NameTextBox.Text = string.Empty;
ShapeComboBox.Text = string.Empty;
InnerPosTextBox.Text = string.Empty;
InnerSizeTextBox.Text = string.Empty;
InnerAngleTextBox.Text = string.Empty;
InnerVec1TextBox.Text = string.Empty;
InnerVec2TextBox.Text = string.Empty;
InnerVec3TextBox.Text = string.Empty;
OuterPosTextBox.Text = string.Empty;
OuterSizeTextBox.Text = string.Empty;
OuterAngleTextBox.Text = string.Empty;
OuterVec1TextBox.Text = string.Empty;
OuterVec2TextBox.Text = string.Empty;
OuterVec3TextBox.Text = string.Empty;
UnkVec1TextBox.Text = string.Empty;
UnkVec2TextBox.Text = string.Empty;
UnkVec3TextBox.Text = string.Empty;
UnkBytesTextBox.Text = string.Empty;
Flags0TextBox.Text = string.Empty;
Flags1TextBox.Text = string.Empty;
Flags2TextBox.Text = string.Empty;
HashesTextBox.Text = string.Empty;
ExtParamsTextBox.Text = string.Empty;
populatingui = false;
}
else
{
AddToProjectButton.Enabled = CurrentZone?.RelFile != null ? !ProjectForm.AudioFileExistsInProject(CurrentZone.RelFile) : false;
DeleteButton.Enabled = !AddToProjectButton.Enabled;
populatingui = true;
var z = CurrentZone.AudioZone;
NameTextBox.Text = z.NameHash.ToString();
ShapeComboBox.Text = z.Shape.ToString();
InnerPosTextBox.Text = FloatUtil.GetVector3String(z.InnerPos);
InnerSizeTextBox.Text = FloatUtil.GetVector3String(z.InnerSize);
InnerAngleTextBox.Text = z.InnerAngle.ToString();
InnerVec1TextBox.Text = FloatUtil.GetVector4String(z.InnerVec1);
InnerVec2TextBox.Text = FloatUtil.GetVector4String(z.InnerVec2);
InnerVec3TextBox.Text = FloatUtil.GetVector3String(z.InnerVec3);
OuterPosTextBox.Text = FloatUtil.GetVector3String(z.OuterPos);
OuterSizeTextBox.Text = FloatUtil.GetVector3String(z.OuterSize);
OuterAngleTextBox.Text = z.OuterAngle.ToString();
OuterVec1TextBox.Text = FloatUtil.GetVector4String(z.OuterVec1);
OuterVec2TextBox.Text = FloatUtil.GetVector4String(z.OuterVec2);
OuterVec3TextBox.Text = FloatUtil.GetVector3String(z.OuterVec3);
UnkVec1TextBox.Text = FloatUtil.GetVector4String(z.UnkVec1);
UnkVec2TextBox.Text = FloatUtil.GetVector4String(z.UnkVec2);
UnkVec3TextBox.Text = FloatUtil.GetVector4String(z.UnkVec3);
UnkBytesTextBox.Text = string.Format("{0}, {1}, {2}", z.Unk14, z.Unk15, z.Unk16);
Flags0TextBox.Text = z.Flags0.Hex;
Flags1TextBox.Text = z.Flags1.Hex;
Flags2TextBox.Text = z.Flags2.Hex;
StringBuilder sb = new StringBuilder();
if (z.Hashes != null)
{
foreach (var hash in z.Hashes)
{
sb.AppendLine(hash.ToString());
}
}
HashesTextBox.Text = sb.ToString();
sb.Clear();
if (z.ExtParams != null)
{
foreach (var extparam in z.ExtParams)
{
sb.Append(extparam.Hash.ToString());
sb.Append(", ");
sb.Append(FloatUtil.ToString(extparam.Value));
sb.AppendLine();
}
}
ExtParamsTextBox.Text = sb.ToString();
populatingui = false;
if (ProjectForm.WorldForm != null)
{
ProjectForm.WorldForm.SelectAudio(CurrentZone);
}
}
}
private void ProjectItemChanged()
{
CurrentZone?.UpdateFromZone();//also update the placement wrapper
if (CurrentZone?.RelFile != null)
{
ProjectForm.SetAudioFileHasChanged(true);
}
}
private void NameTextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
uint hash = 0;
string name = NameTextBox.Text;
if (!uint.TryParse(name, out hash))//don't re-hash hashes
{
hash = JenkHash.GenHash(name);
JenkIndex.Ensure(name);
}
//NameHashLabel.Text = "Hash: " + hash.ToString();
if (CurrentZone.AudioZone.NameHash != hash)
{
CurrentZone.AudioZone.Name = NameTextBox.Text;
CurrentZone.AudioZone.NameHash = hash;
ProjectItemChanged();
}
}
private void ShapeComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
Dat151ZoneShape shape = Dat151ZoneShape.Box;
if (Enum.TryParse<Dat151ZoneShape>(ShapeComboBox.Text, out shape))
{
if (CurrentZone.AudioZone.Shape != shape)
{
CurrentZone.AudioZone.Shape = shape;
ProjectItemChanged();
}
}
}
private void InnerPosTextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector3String(InnerPosTextBox.Text);
if (CurrentZone.AudioZone.InnerPos != vec)
{
CurrentZone.AudioZone.InnerPos = vec;
ProjectItemChanged();
//var wf = ProjectForm.WorldForm;
//if (wf != null)
//{
// wf.BeginInvoke(new Action(() =>
// {
// wf.SetWidgetPosition(CurrentZone.Position, true);
// }));
//}
}
}
private void InnerSizeTextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector3String(InnerSizeTextBox.Text);
if (CurrentZone.AudioZone.InnerSize != vec)
{
CurrentZone.AudioZone.InnerSize = vec;
ProjectItemChanged();
}
}
private void InnerAngleTextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
uint ang = 0;
if (uint.TryParse(InnerAngleTextBox.Text, out ang))
{
if (CurrentZone.AudioZone.InnerAngle != ang)
{
CurrentZone.AudioZone.InnerAngle = ang;
ProjectItemChanged();
}
}
}
private void InnerVec1TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector4String(InnerVec1TextBox.Text);
if (CurrentZone.AudioZone.InnerVec1 != vec)
{
CurrentZone.AudioZone.InnerVec1 = vec;
ProjectItemChanged();
}
}
private void InnerVec2TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector4String(InnerVec2TextBox.Text);
if (CurrentZone.AudioZone.InnerVec2 != vec)
{
CurrentZone.AudioZone.InnerVec2 = vec;
ProjectItemChanged();
}
}
private void InnerVec3TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector3String(InnerVec3TextBox.Text);
if (CurrentZone.AudioZone.InnerVec3 != vec)
{
CurrentZone.AudioZone.InnerVec3 = vec;
ProjectItemChanged();
}
}
private void OuterPosTextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector3String(OuterPosTextBox.Text);
if (CurrentZone.AudioZone.OuterPos != vec)
{
CurrentZone.AudioZone.OuterPos = vec;
ProjectItemChanged();
}
}
private void OuterSizeTextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector3String(OuterSizeTextBox.Text);
if (CurrentZone.AudioZone.OuterSize != vec)
{
CurrentZone.AudioZone.OuterSize = vec;
ProjectItemChanged();
}
}
private void OuterAngleTextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
uint ang = 0;
if (uint.TryParse(OuterAngleTextBox.Text, out ang))
{
if (CurrentZone.AudioZone.OuterAngle != ang)
{
CurrentZone.AudioZone.OuterAngle = ang;
ProjectItemChanged();
}
}
}
private void OuterVec1TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector4String(OuterVec1TextBox.Text);
if (CurrentZone.AudioZone.OuterVec1 != vec)
{
CurrentZone.AudioZone.OuterVec1 = vec;
ProjectItemChanged();
}
}
private void OuterVec2TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector4String(OuterVec2TextBox.Text);
if (CurrentZone.AudioZone.OuterVec2 != vec)
{
CurrentZone.AudioZone.OuterVec2 = vec;
ProjectItemChanged();
}
}
private void OuterVec3TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector3String(OuterVec3TextBox.Text);
if (CurrentZone.AudioZone.OuterVec3 != vec)
{
CurrentZone.AudioZone.OuterVec3 = vec;
ProjectItemChanged();
}
}
private void UnkVec1TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector4String(UnkVec1TextBox.Text);
if (CurrentZone.AudioZone.UnkVec1 != vec)
{
CurrentZone.AudioZone.UnkVec1 = vec;
ProjectItemChanged();
}
}
private void UnkVec2TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector4String(UnkVec2TextBox.Text);
if (CurrentZone.AudioZone.UnkVec2 != vec)
{
CurrentZone.AudioZone.UnkVec2 = vec;
ProjectItemChanged();
}
}
private void UnkVec3TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var vec = FloatUtil.ParseVector4String(UnkVec3TextBox.Text);
if (CurrentZone.AudioZone.UnkVec3 != vec)
{
CurrentZone.AudioZone.UnkVec3 = vec;
ProjectItemChanged();
}
}
private void UnkBytesTextBox_TextChanged(object sender, EventArgs e)
{
var vals = UnkBytesTextBox.Text.Split(',');
if (vals?.Length == 3)
{
byte val0 = 0, val1 = 0, val2 = 0;
byte.TryParse(vals[0].Trim(), out val0);
byte.TryParse(vals[1].Trim(), out val1);
byte.TryParse(vals[2].Trim(), out val2);
CurrentZone.AudioZone.Unk14 = val0;
CurrentZone.AudioZone.Unk15 = val1;
CurrentZone.AudioZone.Unk16 = val2;
ProjectItemChanged();
}
}
private void Flags0TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
uint flags = 0;
if (uint.TryParse(Flags0TextBox.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out flags))
{
if (CurrentZone.AudioZone.Flags0.Value != flags)
{
CurrentZone.AudioZone.Flags0 = flags;
ProjectItemChanged();
}
}
}
private void Flags1TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
uint flags = 0;
if (uint.TryParse(Flags1TextBox.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out flags))
{
if (CurrentZone.AudioZone.Flags1.Value != flags)
{
CurrentZone.AudioZone.Flags1 = flags;
ProjectItemChanged();
}
}
}
private void Flags2TextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
uint flags = 0;
if (uint.TryParse(Flags2TextBox.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out flags))
{
if (CurrentZone.AudioZone.Flags2.Value != flags)
{
CurrentZone.AudioZone.Flags2 = flags;
ProjectItemChanged();
}
}
}
private void HashesTextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var hashstrs = HashesTextBox.Text.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (hashstrs?.Length > 0)
{
var hashlist = new List<MetaHash>();
foreach (var hashstr in hashstrs)
{
uint hash = 0;
if (!uint.TryParse(hashstr, out hash))//don't re-hash hashes
{
hash = JenkHash.GenHash(hashstr);
JenkIndex.Ensure(hashstr);
}
hashlist.Add(hash);
}
CurrentZone.AudioZone.Hashes = hashlist.ToArray();
CurrentZone.AudioZone.HashesCount = (byte)hashlist.Count;
ProjectItemChanged();
}
}
private void ExtParamsTextBox_TextChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentZone?.AudioZone == null) return;
var paramstrs = ExtParamsTextBox.Text.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (paramstrs?.Length > 0)
{
var paramlist = new List<Dat151AmbientZone.ExtParam>();
foreach (var paramstr in paramstrs)
{
var paramvals = paramstr.Split(',');
if (paramvals?.Length == 2)
{
var param = new Dat151AmbientZone.ExtParam();
var hashstr = paramvals[0].Trim();
var valstr = paramvals[1].Trim();
uint hash = 0;
if (!uint.TryParse(hashstr, out hash))//don't re-hash hashes
{
hash = JenkHash.GenHash(hashstr);
JenkIndex.Ensure(hashstr);
}
param.Hash = hash;
param.Value = FloatUtil.Parse(valstr);
paramlist.Add(param);
}
}
CurrentZone.AudioZone.ExtParams = paramlist.ToArray();
CurrentZone.AudioZone.ExtParamsCount = (uint)paramlist.Count;
ProjectItemChanged();
}
}
private void GoToButton_Click(object sender, EventArgs e)
{
if (CurrentZone == null) return;
if (ProjectForm.WorldForm == null) return;
ProjectForm.WorldForm.GoToPosition(CurrentZone.Position, CurrentZone.AudioZone.InnerSize);
}
private void AddToProjectButton_Click(object sender, EventArgs e)
{
ProjectForm.SetProjectItem(CurrentZone);
ProjectForm.AddAudioFileToProject(CurrentZone.RelFile);
}
private void DeleteButton_Click(object sender, EventArgs e)
{
ProjectForm.SetProjectItem(CurrentZone);
ProjectForm.DeleteAudioZone();
}
}
}