private void duplicateSelectedToolStripMenuItem_Click(object sender, EventArgs e) { if (SelectedItem == string.Empty) { MessageBox.Show("Nothing to duplicate!"); return; } DPOW.Reader.Animation obj = dpow.getAnimation(treObjects.SelectedNode.Text); if (SelectedItem.Contains("flag")) { int k = int.Parse(SelectedItem.Split('_')[0].Replace("Element", "")); int l = int.Parse(SelectedItem.Split('_')[1].Replace("flag", "")); obj.getFrameOnTime(trcFrameBar.Value).Element.addIcon(DPOW.Reader.Animation.DeepClone <DPOW.Reader.Icon>(dpow.Elements[k].Icons[l])); } else if (SelectedItem.Contains("str")) { int k = int.Parse(SelectedItem.Split('_')[0].Replace("Element", "")); int l = int.Parse(SelectedItem.Split('_')[1].Replace("str", "")); obj.getFrameOnTime(trcFrameBar.Value).Element.addText(DPOW.Reader.Animation.DeepClone <DPOW.Reader.Text>(dpow.Elements[k].Texts[l])); } else if (SelectedItem.Contains("text")) { int k = int.Parse(SelectedItem.Split('_')[0].Replace("Element", "")); int l = int.Parse(SelectedItem.Split('_')[1].Replace("text", "")); obj.getFrameOnTime(trcFrameBar.Value).Element.addImage(DPOW.Reader.Animation.DeepClone <DPOW.Reader.Image>(dpow.Elements[k].Images[l])); } }
private void radExisingAnimation_CheckedChanged(object sender, EventArgs e) { selectedAnimation = currentAnimations[cmbAnimations.SelectedIndex]; cmbAnimations.Enabled = true; prpNewAnimation.Enabled = false; }
private void timeLine1_SameKeyFrameAdded(DPOW.Reader.Animation animation, int Time) { if (SameKeyFrameAdded != null) { SameKeyFrameAdded(animation, Time); } }
private void timeLine1_KeyFrameRemoved(DPOW.Reader.Animation animation, int Time) { if (KeyFrameRemoved != null) { KeyFrameRemoved(animation, Time); } }
private void cmbAnimations_SelectedIndexChanged(object sender, EventArgs e) { if (cmbAnimations.Text != string.Empty) { activeAnimation = refDpow.getAnimation(cmbAnimations.Text); refreshControls(); } }
private void drawFrame() { DPOW.Reader.Animation obj = dpow.getAnimation(treObjects.SelectedNode.Text); clearScene(mgr.RootSceneNode); loadFrame(obj, trcFrameBar.Value, mgr.RootSceneNode); mRoot.RenderOneFrame(); }
private void addnode(DPOW.Reader.Animation newanim, TreeNodeCollection parent) { TreeNode newnode = parent.Add(newanim.Name); for (int i = 0; i < newanim.Childs.Length; i++) { addnode(newanim.getChild(i), newnode.Nodes); } }
private void frmAddAnimationChild_Load(object sender, EventArgs e) { for (int i = 0; i < currentAnimations.Length; i++) { cmbAnimations.Items.Add(currentAnimations[i].Name); } cmbAnimations.SelectedIndex = 0; selectedAnimation = currentAnimations[0]; numericUpDown1.Maximum = icons - 1; icon = -1; }
public frmInterpolateDialog(DPOW.Reader.DPOWObject dpow, DPOW.Reader.Animation animation) { InitializeComponent(); refDpow = dpow; cmbAnimations.Enabled = false; activeAnimation = animation; refreshControls(); }
private void timeLine1_KeyFrameRemoved(DPOW.Reader.Animation animation, int Time) { DPOW.Reader.Element elem = animation.getFrameOnTime(Time, false).Element; animation.RemoveKeyFrame((short)Time); if (!animation.HasElement(elem)) { dpow.RemoveElement(elem); } trcFrameBar.Maximum = dpow.getAnimation(treObjects.SelectedNode.Text).MaxTime; }
private int DrawChild(DPOW.Reader.Animation anim, int y, Graphics g) { for (int i = 0; i < anim.Childs.Length; i++) { mListedAnimations.Add(anim.getChild(i)); DrawLine(anim.getChild(i), y, g); y += 20; y = DrawChild(anim.getChild(i), y, g); } return(y); }
private int DrawChilds(DPOW.Reader.Animation anim, int y, int offset, Graphics g) { offset += 10; for (int i = 0; i < anim.Childs.Length; i++) { g.DrawString(anim.getChild(i).Name, Font, Brushes.Black, offset, y + 4 - scrVerticalBar.Value); y += 20; y = DrawChilds(anim.getChild(i), y, offset, g); } return(y); }
private void radNewAnimation_CheckedChanged(object sender, EventArgs e) { if (prpNewAnimation.SelectedObject == null) { prpNewAnimation.SelectedObject = new DPOW.Reader.Animation(); } selectedAnimation = (DPOW.Reader.Animation)prpNewAnimation.SelectedObject; cmbAnimations.Enabled = false; prpNewAnimation.Enabled = true; }
private void addVariablesOnList(DPOW.Reader.Animation obj) { for (int i = 0; i < obj.Events.Length; i++) { if (!lstVariables.Items.ContainsKey(obj.getVariable(i).Name)) { lstVariables.Items.Add(obj.getVariable(i).Name, obj.getVariable(i).Name, 0).Checked = obj.getVariable(i).Enabled; } } for (int j = 0; j < obj.Childs.Length; j++) { addVariablesOnList(obj.getChild(j)); } }
private void DrawLine(DPOW.Reader.Animation anim, int y, Graphics g) { List <int> starts = new List <int>(); if (anim.getFrameOnTime(scrHorizontalBar.Value, handleEvents) != null) { if (scrHorizontalBar.Value != anim.getFrameOnTime(scrHorizontalBar.Value, handleEvents).Time) { starts.Add(anim.getFrameOnTime(scrHorizontalBar.Value).Time); } } for (int i = scrHorizontalBar.Value; i <= Math.Min(anim.MaxTime, scrHorizontalBar.Value + Width / mColumnWidth + 1); i++) { if (anim.getFrameOnTime(i) == null) { g.DrawRectangle(Pens.LightGray, (i - scrHorizontalBar.Value) * mColumnWidth, y, mColumnWidth, 20); } else { if (anim.getFrameOnTime(i, handleEvents).Time == i) { starts.Add(i); } } } starts.Add(Math.Min(anim.MaxTime + 1, scrHorizontalBar.Value + Width / mColumnWidth + 1)); // Draw timeline for (int i = 0; i < starts.Count - 1; i++) { g.FillRectangle(Brushes.DarkSeaGreen, (starts[i] - scrHorizontalBar.Value) * mColumnWidth, y, (starts[i + 1] - starts[i]) * mColumnWidth, 20); g.DrawRectangle(Pens.Black, (starts[i] - scrHorizontalBar.Value) * mColumnWidth, y, (starts[i + 1] - starts[i]) * mColumnWidth, 20); g.DrawString(anim.getFrameOnTime(starts[i], handleEvents).ElementId.ToString(), Font, Brushes.Black, (starts[i] - scrHorizontalBar.Value) * mColumnWidth, y + 4); } Pen boldpen = new Pen(Color.DarkRed, 2); boldpen.Alignment = System.Drawing.Drawing2D.PenAlignment.Center; // Draw events for (int i = 0; i < anim.Events.Length; i++) { g.DrawRectangle(boldpen, (anim.Events[i].Start - scrHorizontalBar.Value) * mColumnWidth, y, (anim.Events[i].End - anim.Events[i].Start + 1) * mColumnWidth, 20); } }
private void pastToolStripMenuItem_Click(object sender, EventArgs e) { DPOW.Reader.Animation obj = dpow.getAnimation(treObjects.SelectedNode.Text); if (Clipboard.ContainsData("DPOWImage")) { DPOW.Reader.Image temp = (DPOW.Reader.Image)DeSerialize(Clipboard.GetData("DPOWImage").ToString()); if (temp.TextureId >= dpow.Textures.Length) { temp.TextureId = 0; } obj.getFrameOnTime(trcFrameBar.Value).Element.addImage(temp); } else if (Clipboard.ContainsData("DPOWText")) { obj.getFrameOnTime(trcFrameBar.Value).Element.addText((DPOW.Reader.Text)DeSerialize(Clipboard.GetData("DPOWText").ToString())); } else if (Clipboard.ContainsData("DPOWIcon")) { obj.getFrameOnTime(trcFrameBar.Value).Element.addIcon((DPOW.Reader.Icon)DeSerialize(Clipboard.GetData("DPOWIcon").ToString())); } drawFrame(); }
private void loadFrame(DPOW.Reader.Animation obj, int time, SceneNode parent) { SceneNode node; if (obj.getFrameOnTime(time) == null) { return; } int objid = obj.getFrameOnTime(time).ElementId; if (mgr.HasSceneNode("Element" + objid.ToString() + "_node")) { node = mgr.GetSceneNode("Element" + objid.ToString() + "_node"); if (node.Parent != null) { node.Parent.RemoveChild(node); } parent.AddChild(node); } else { node = buildElement(dpow.Elements[objid], "Element" + objid.ToString()); parent.AddChild(node); } for (int i = 0; i < obj.Childs.Length; i++) { if (obj.Childs[i].ChildIcon < 0) { loadFrame(dpow.Animations[obj.Childs[i].ChildId], time, node); } else { loadFrame(dpow.Animations[obj.Childs[i].ChildId], time, mgr.GetSceneNode("Element" + objid.ToString() + "_flag" + obj.Childs[i].ChildIcon.ToString() + "_node")); } } }
private void treObjects_AfterSelect(object sender, TreeViewEventArgs e) { trcFrameBar.Value = 0; lstVariables.Items.Clear(); DPOW.Reader.Animation obj = dpow.getAnimation(e.Node.Text); lstVariables.ItemChecked -= new ItemCheckedEventHandler(lstVariables_ItemChecked); addVariablesOnList(obj); lstVariables.ItemChecked += new ItemCheckedEventHandler(lstVariables_ItemChecked); trcFrameBar.Maximum = obj.MaxTime; prpProperties.SelectedObject = obj; tmlMainTimeLine.SelectedAnimation = obj; if (autoplay) { tmrPlay.Enabled = true; } else { drawFrame(); } }
private void cmbAnimations_SelectedIndexChanged(object sender, EventArgs e) { selectedAnimation = currentAnimations[cmbAnimations.SelectedIndex]; }
private void timeLine1_KeyFrameAdded(DPOW.Reader.Animation animation, int Time) { animation.AddKeyFrame((short)Time); trcFrameBar.Maximum = dpow.getAnimation(treObjects.SelectedNode.Text).MaxTime; }
public DPOWObject(Stream thefile) { int imageoff, elementsoff, animoff, unknownoff, eventsoff, tempoff1, tempoff2; int[] imageoffs; BinaryReader binfile = new BinaryReader(thefile); //Read basic block offsets thefile.Seek(8, SeekOrigin.Begin); imageoff = binfile.ReadInt32(); elementsoff = binfile.ReadInt32(); animoff = binfile.ReadInt32(); unknownoff = binfile.ReadInt32(); eventsoff = binfile.ReadInt32(); //Read images thefile.Seek(imageoff, SeekOrigin.Begin); textures = new string[binfile.ReadInt32()]; imageoffs = new int[textures.Length]; thefile.Seek(binfile.ReadInt32(), SeekOrigin.Begin); for (int i = 0; i < textures.Length; i++) { imageoffs[i] = binfile.ReadInt32(); } for (int i = 0; i < textures.Length; i++) { thefile.Seek(imageoffs[i], SeekOrigin.Begin); textures[i] = loadstring(thefile); } //Read elements thefile.Seek(elementsoff, SeekOrigin.Begin); Elements = new DPOW.Reader.Element[binfile.ReadInt32()]; int[] eloffset = new int[Elements.Length]; thefile.Seek(binfile.ReadInt32(), SeekOrigin.Begin); for (int i = 0; i < Elements.Length; i++) { eloffset[i] = binfile.ReadInt32(); } //Fill the elements for (int i = 0; i < Elements.Length; i++) { thefile.Seek(eloffset[i], SeekOrigin.Begin); Elements[i] = new DPOW.Reader.Element(thefile); } //ANIMATIONS thefile.Seek(animoff, SeekOrigin.Begin); Animations = new DPOW.Reader.Animation[binfile.ReadInt32()]; int[] anoffset = new int[Animations.Length]; tempoff1 = binfile.ReadInt32(); tempoff2 = binfile.ReadInt32(); thefile.Seek(tempoff1, SeekOrigin.Begin); for (int i = 0; i < Animations.Length; i++) { anoffset[i] = binfile.ReadInt32(); } for (int i = 0; i < Animations.Length; i++) { thefile.Seek(anoffset[i], SeekOrigin.Begin); Animations[i] = new DPOW.Reader.Animation(thefile, this); } for (int i = 0; i < Animations.Length; i++) { thefile.Seek(tempoff2 + i * 4, SeekOrigin.Begin); thefile.Seek(binfile.ReadInt32(), SeekOrigin.Begin); Animations[i].Name = loadstring(thefile); } thefile.Seek(unknownoff, SeekOrigin.Begin); unknowntable = new int[binfile.ReadInt32()]; tempoff1 = binfile.ReadInt32(); for (int i = 0; i < unknowntable.Length; i++) { thefile.Seek(tempoff1 + i * 4, SeekOrigin.Begin); thefile.Seek(binfile.ReadInt32(), SeekOrigin.Begin); unknowntable[i] = binfile.ReadInt32(); } // EVENTS thefile.Seek(eventsoff, SeekOrigin.Begin); variables = new Variable[binfile.ReadInt32()]; tempoff1 = binfile.ReadInt32(); tempoff2 = binfile.ReadInt32(); thefile.Seek(tempoff1, SeekOrigin.Begin); for (int i = 0; i < variables.Length; i++) { variables[i] = new Variable(); variables[i].Enabled = binfile.ReadBoolean(); } for (int i = 0; i < variables.Length; i++) { thefile.Seek(tempoff2 + i * 4, SeekOrigin.Begin); thefile.Seek(binfile.ReadInt32(), SeekOrigin.Begin); variables[i].Name = loadstring(thefile); } }