diff --git a/Editor.cs b/Editor.cs index 57a1c7a..f6adcbd 100644 --- a/Editor.cs +++ b/Editor.cs @@ -9,7 +9,6 @@ namespace OMF_Editor { public class OMFEditor { - public void CopyAnims(AnimationsContainer omf_1, AnimationsContainer omf_2) { //bool omf_1.bone_cont.OGF_V != omf_2.bone_cont.OGF_V diff --git a/Form1.Designer.cs b/Form1.Designer.cs index 555a88d..2f47767 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -59,6 +59,7 @@ private void InitializeComponent() this.cloneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); @@ -126,9 +127,9 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.textBox3); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.textBox1); - this.groupBox1.Location = new System.Drawing.Point(223, 158); + this.groupBox1.Location = new System.Drawing.Point(223, 170); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(251, 225); + this.groupBox1.Size = new System.Drawing.Size(251, 239); this.groupBox1.TabIndex = 5; this.groupBox1.TabStop = false; // @@ -306,9 +307,9 @@ private void InitializeComponent() // // groupBox2 // - this.groupBox2.Location = new System.Drawing.Point(223, 389); + this.groupBox2.Location = new System.Drawing.Point(223, 415); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(251, 43); + this.groupBox2.Size = new System.Drawing.Size(251, 17); this.groupBox2.TabIndex = 6; this.groupBox2.TabStop = false; // @@ -367,11 +368,22 @@ private void InitializeComponent() this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.button4_Click); // + // button5 + // + this.button5.Location = new System.Drawing.Point(217, 144); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(257, 24); + this.button5.TabIndex = 9; + this.button5.Text = "Try Repair"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(481, 453); + this.Controls.Add(this.button5); this.Controls.Add(this.button4); this.Controls.Add(this.button3); this.Controls.Add(this.label2); @@ -383,7 +395,7 @@ private void InitializeComponent() this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.Name = "Form1"; - this.Text = "OMF Editor 1.05"; + this.Text = "OMF Editor 1.06"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.contextMenuStrip1.ResumeLayout(false); @@ -424,6 +436,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox checkBox2; private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; } } diff --git a/Form1.cs b/Form1.cs index 00f14e1..1be75ac 100644 --- a/Form1.cs +++ b/Form1.cs @@ -105,6 +105,12 @@ private void AppendFile(string filename, List list) { AnimationsContainer new_omf = OpenSecondOMF(filename); if (new_omf == null) return; + + for (int i = 0; i < Main_OMF.Anims.Count; i++) + { + list.Remove(Main_OMF.Anims[i].MotionName); + } + editor.CopyAnims(Main_OMF, new_omf, list); UpdateList(); @@ -385,5 +391,12 @@ private void button4_Click(object sender, EventArgs e) } } } + + private void button5_Click(object sender, EventArgs e) + { + if (Main_OMF == null) return; + + Main_OMF.GunslingerRepair(); + } } } diff --git a/OMF.cs b/OMF.cs index 078011b..6c27ca4 100644 --- a/OMF.cs +++ b/OMF.cs @@ -31,10 +31,15 @@ public void RecalcSectionSize() SectionSize = new_size; // Recalc second section size - new_size = 2; // motions count ( short ) + new_size = 6; // motions count ( short ) foreach (AnimationParams anim in AnimsParams) - new_size += (uint)anim.Size(bone_cont.OGF_V); + { + uint temp = (uint)anim.Size(bone_cont.OGF_V); + + new_size += temp; + } + new_size += (uint)bone_cont.Size(); @@ -64,7 +69,22 @@ public void RecalcAllAnimIndex() } } - + public void GunslingerRepair() + { + short i = 0; + foreach (AnimationParams anm in AnimsParams) + { + anm.MotionID = i; + i++; + } + i = 1; + foreach (AnimVector anm in Anims) + { + anm.Name = AnimsParams[i - 1].Name; + anm.SectionId = i; + i++; + } + } public BoneContainer bone_cont; @@ -200,7 +220,7 @@ public int Size() new_size += bonesparts.Size(); } - return new_size + 4; + return new_size; } public List parts = new List(); @@ -274,6 +294,13 @@ public MotionMark(BinaryReader reader, OMFEditor editor) } } + public uint Size() + { + uint temp = (uint)(Name.Length + 8 * Count + 6); + + return temp; + } + public void WriteMotionMark(BinaryWriter writer, OMFEditor editor) { editor.WriteMarkString(writer, Name); @@ -310,16 +337,26 @@ public class AnimationParams public float Falloff { get; set; } public int MarksCount { get; set; } - public int Size(short motion_version) + public uint Size(short motion_version) { - int new_size = 0; + uint new_size = 0; if(motion_version == 4) { - new_size += (8 * MarksCount) + 4; - } + new_size += 4; - return new_size + Name.Length + 25; + if (m_marks != null) + { + foreach (MotionMark mark in m_marks) + { + uint temp = mark.Size(); + new_size += temp; + } + + } + } + + return new_size + (uint)(Name.Length + 25); } public List m_marks; // = new List();