private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ModelForm)); this.modelEditControl1 = new System.Windows.Forms.ModelEditControl(); this.SuspendLayout(); // // modelEditControl1 // this.modelEditControl1.AllowDrop = true; this.modelEditControl1.BackColor = System.Drawing.Color.Lavender; this.modelEditControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.modelEditControl1.ScreenCaptureType = 0; this.modelEditControl1.Location = new System.Drawing.Point(0, 0); this.modelEditControl1.Name = "modelEditControl1"; this.modelEditControl1.Size = new System.Drawing.Size(639, 528); this.modelEditControl1.TabIndex = 0; this.modelEditControl1.TargetAnimation = null; this.modelEditControl1.TargetAnimType = System.Windows.Forms.NW4RAnimType.CHR; this.modelEditControl1.TargetModelChanged += new System.EventHandler(this.TargetModelChanged); this.modelEditControl1.ModelViewerChanged += new System.EventHandler(this.ModelViewerChanged); // // ModelForm // this.BackColor = System.Drawing.Color.PowderBlue; this.ClientSize = new System.Drawing.Size(639, 528); this.Controls.Add(this.modelEditControl1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "ModelForm"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ModelForm_FormClosing); this.ResumeLayout(false); }
private void InitializeComponent() { modelEditControl1 = new ModelEditControl(); SuspendLayout(); // // modelEditControl1 // modelEditControl1.AllowDrop = true; modelEditControl1.BackColor = Color.Lavender; modelEditControl1.Dock = DockStyle.Fill; modelEditControl1.ScreenCaptureType = 0; modelEditControl1.Location = new Point(0, 0); modelEditControl1.Name = "modelEditControl1"; modelEditControl1.Size = new Size(639, 528); modelEditControl1.TabIndex = 0; modelEditControl1.TargetAnimation = null; modelEditControl1.TargetAnimType = NW4RAnimType.CHR; modelEditControl1.TargetModelChanged += TargetModelChanged; modelEditControl1.ModelViewerChanged += ModelViewerChanged; // // ModelForm // BackColor = Color.PowderBlue; ClientSize = new Size(639, 528); Controls.Add(modelEditControl1); Icon = BrawlLib.Properties.Resources.Icon; Name = "ModelForm"; FormClosing += new FormClosingEventHandler(ModelForm_FormClosing); ResumeLayout(false); }
private void InitializeComponent() { this.modelEditControl1 = new System.Windows.Forms.ModelEditControl(); this.SuspendLayout(); // // modelEditControl1 // this.modelEditControl1.BackColor = System.Drawing.Color.Lavender; this.modelEditControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.modelEditControl1.Location = new System.Drawing.Point(0, 0); this.modelEditControl1.Name = "modelEditControl1"; this.modelEditControl1.Size = new System.Drawing.Size(639, 528); this.modelEditControl1.TabIndex = 0; // // ModelForm // this.BackColor = System.Drawing.Color.PowderBlue; this.ClientSize = new System.Drawing.Size(639, 528); this.Controls.Add(this.modelEditControl1); this.MinimizeBox = false; this.Name = "ModelForm"; this.ShowIcon = false; this.ShowInTaskbar = false; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ModelForm_FormClosing); this.ResumeLayout(false); }
public void Reset(ModelEditControl _mainWindow) { _eventIndex = 0; _looping = false; _totalFrames = 0; _loopCount = -1; _loopStartIndex = -1; _loopEndIndex = -1; _loopTime = 0; _waitFrames = 0; catchCollisions = new List <MoveDefEventNode>(); offensiveCollisions = new List <MoveDefEventNode>(); specialOffensiveCollisions = new List <MoveDefEventNode>(); _idling = false; _delete = false; _subRoutine = false; foreach (MDL0BoneNode bone in _mainWindow.boneCollisions) { bone._nodeColor = bone._boneColor = Color.Transparent; } _mainWindow.boneCollisions = new List <MDL0BoneNode>(); _mainWindow.hurtBoxType = 0; //if (scriptEditor1.EventList.Items.Count > 0) // scriptEditor1.EventList.SelectedIndex = 0; }
public void Advance(int eventid, ModelEditControl _mainWindow) { if (eventid >= Children.Count) { return; } int list, index, type; MoveDefEventNode e = Children[eventid] as MoveDefEventNode; if (!_runEvents && e._event != 0x00050000 && e._event != 0x00110100 && e._event != 0x00120000 && e._event != 0x00130000) { return; } //Code what to do for each event here. switch (e._event) { case 0x00010100: //Synchronous Timer _waitFrames = (int)((float)e.EventData.parameters[0]._data / 60000f); break; case 0x00020000: //No Operation break; case 0x00020100: //Asynchronous Timer _waitFrames = Math.Max((int)((float)e.EventData.parameters[0]._data / 60000f) - _totalFrames, 0); break; case 0x00040100: //Set loop data _loopCount = (int)e.EventData.parameters[0]._data; _loopStartIndex = e.Index + 1; _runEvents = false; break; case 0x00050000: //Start looping _looping = true; _loopEndIndex = e.Index; _eventIndex = _loopStartIndex; _runEvents = true; break; case 0x01010000: //Loop Rest _waitFrames = 1; break; case 0x06000D00: //Offensive Collison case 0x062B0D00: //Thrown Collision e.HitboxID = (int)(e.EventData.parameters[0]._data & 0xFFFF); e.HitboxSize = (int)(e.EventData.parameters[5]._data); offensiveCollisions.Add(e); break; case 0x06050100: //Body Collision _mainWindow.hurtBoxType = (int)(e.EventData.parameters[0]._data); break; case 0x06080200: //Bone Collision int id = (int)(e.EventData.parameters[0]._data); if (Root.Model != null && Root.Model._linker.BoneCache.Length > id && id > 0) { MDL0BoneNode bone = Root.Model._linker.BoneCache[id] as MDL0BoneNode; switch ((int)(e.EventData.parameters[1]._data)) { case 0: bone._nodeColor = Color.Transparent; bone._boneColor = Color.Transparent; break; case 1: bone._nodeColor = bone._boneColor = Color.FromArgb(255, 255, 0); break; default: bone._nodeColor = bone._boneColor = Color.FromArgb(0, 0, 255); break; } _mainWindow.boneCollisions.Add(bone); } break; case 0x06060100: //Undo Bone Collision foreach (MDL0BoneNode bone in _mainWindow.boneCollisions) { bone._nodeColor = bone._boneColor = Color.Transparent; } _mainWindow.boneCollisions = new List <MDL0BoneNode>(); break; case 0x060A0800: //Catch Collision 1 case 0x060A0900: //Catch Collision 2 case 0x060A0A00: //Catch Collision 3 e.HitboxID = (int)(e.EventData.parameters[0]._data); e.HitboxSize = (int)(e.EventData.parameters[2]._data); catchCollisions.Add(e); break; case 0x060D0000: //Terminate Catch Collisions catchCollisions = new List <MoveDefEventNode>(); break; case 0x00060000: //Loop break? _looping = false; _eventIndex = _loopEndIndex + 1; _loopTime = 0; break; case 0x06150F00: //Special Offensive Collison e.HitboxID = (int)(e.EventData.parameters[0]._data & 0xFFFF); e.HitboxSize = (int)(e.EventData.parameters[5]._data); specialOffensiveCollisions.Add(e); break; case 0x06040000: //Terminate Collisions offensiveCollisions = new List <MoveDefEventNode>(); specialOffensiveCollisions = new List <MoveDefEventNode>(); break; case 0x06030100: //Delete hitbox foreach (MoveDefEventNode ev in offensiveCollisions) { if (ev.HitboxID == (int)(ev.EventData.parameters[0]._data)) { offensiveCollisions.Remove(ev); break; } } foreach (MoveDefEventNode ev in specialOffensiveCollisions) { if (ev.HitboxID == (int)(ev.EventData.parameters[0]._data)) { specialOffensiveCollisions.Remove(ev); break; } } break; case 0x04060100: //Set anim frame - subaction timer unaffected _mainWindow.SetFrame((int)((float)e.EventData.parameters[0]._data / 60000f)); break; case 0x00070100: //Go to subroutine and return Root.GetLocation((int)e.EventData.parameters[0]._data, out list, out type, out index); subRoutine = Root.GetAction(list, type, index); if (subRoutine != null) { subRoutineSetAt = _totalFrames; subRoutine.actionReferencedBy = this; subRoutine._subRoutine = true; } break; case 0x00080000: //Return _return = true; _eventIndex = Children.Count; _idling = true; break; case 0x00090100: //Go to and do not return unless called Root.GetLocation((int)e.EventData.parameters[0]._data, out list, out type, out index); MoveDefActionNode a = Root.GetAction(list, type, index); if (a != null) { subRoutineSetAt = _totalFrames; a.actionReferencedBy = this; a._delete = true; _mainWindow.pnlMoveset.selectedActionNodes.Add(a); //if (_eventIndex == Children.Count) _mainWindow.pnlMoveset.selectedActionNodes.Remove(this); } break; case 0x0B000200: //Model Changer 1 case 0x0B010200: //Model Changer 2 if (Root.Model._polyList == null) { break; } if (Root.data.mdlVisibility.Children.Count == 0) { break; } MoveDefModelVisRefNode entry = Root.data.mdlVisibility.Children[(e._event >> 16 & 1)] as MoveDefModelVisRefNode; if (entry.Children.Count == 0) { break; } MoveDefBoneSwitchNode list1 = entry.Children[(int)e.EventData.parameters[0]._data] as MoveDefBoneSwitchNode; if (list1.Children.Count == 0) { break; } if ((int)e.EventData.parameters[1]._data > list1.Children.Count) { foreach (MDL0PolygonNode p in Root.Model._polyList) { p._render = false; } break; } else if ((int)e.EventData.parameters[1]._data < 0) { foreach (MoveDefModelVisGroupNode l in list1.Children) { foreach (MoveDefBoneIndexNode b in l.Children) { if (b.BoneNode == null) { continue; } foreach (MDL0PolygonNode p in b.BoneNode._manPolys) { p._render = false; } } } break; } MoveDefModelVisGroupNode list2 = list1.Children[(int)e.EventData.parameters[1]._data] as MoveDefModelVisGroupNode; if (list2.Children.Count == 0) { break; } foreach (MoveDefModelVisGroupNode l in list1.Children) { if (l.Index != (int)e.EventData.parameters[1]._data) { foreach (MoveDefBoneIndexNode b in l.Children) { if (b.BoneNode == null) { continue; } foreach (MDL0PolygonNode p in b.BoneNode._manPolys) { p._render = false; } } } } foreach (MoveDefBoneIndexNode b in list2.Children) { if (b.BoneNode == null) { continue; } foreach (MDL0PolygonNode p in b.BoneNode._manPolys) { p._render = true; } } break; case 0x0B020100: if (Root.Model._polyList != null) { bool val = e.EventData.parameters[0]._data != 0; foreach (MDL0PolygonNode p in Root.Model._polyList) { p._render = val; } if (val) { _mainWindow.pnlMoveset.ResetModelVis(); } } break; case 0x00100200: //Switch _cases = new List <MoveDefEventParameterNode>(); _caseIndices = new List <int>(); _runEvents = false; _loopStartIndex = e.Index; break; case 0x00110100: //Case if (!_runEvents) { if (_cases != null && _caseIndices != null) { _cases.Add(e.Children[0] as MoveDefEventParameterNode); _caseIndices.Add(e.Index); } } else { _eventIndex = _loopEndIndex + 1; _loopEndIndex = -1; } break; case 0x00120000: //Default Case _defaultCaseIndex = e.Index; break; case 0x00130000: //End Switch _runEvents = true; _loopEndIndex = e.Index; //Apply cases int i = 0; MoveDefEventParameterNode Switch = Children[_loopStartIndex].Children[1] as MoveDefEventParameterNode; foreach (MoveDefEventParameterNode p in _cases) { if (Switch.Compare(p, 2)) { _eventIndex = _caseIndices[i] + 1; break; } i++; } if (i == _cases.Count && _defaultCaseIndex != -1) { _eventIndex = _defaultCaseIndex + 1; } _cases = null; _defaultCaseIndex = -1; _loopStartIndex = -1; break; case 0x00180000: //Break _eventIndex = _loopEndIndex + 1; _loopEndIndex = -1; break; } }
public void SetFrame(int index, ModelEditControl _mainWindow) { Reset(_mainWindow); if (actionReferencedBy != null && _delete) { index -= actionReferencedBy.subRoutineSetAt; } while (_totalFrames <= index) { //Progress frame by frame if (_eventIndex >= Children.Count) { _idling = true; if (_delete) { _mainWindow.pnlMoveset.selectedActionNodes.Remove(this); Reset(_mainWindow); } return; } string name = Parent.Name; string fillername = subRoutine == null ? "" : subRoutine.Parent.Name; if (subRoutine != null && _totalFrames >= subRoutineSetAt) { if (subRoutine == this || subRoutine == actionReferencedBy || name == fillername) { _return = true; _eventIndex = Children.Count; } else { subRoutine.SetFrame(_totalFrames - subRoutineSetAt, _mainWindow); _totalFrames++; if (subRoutine._return || subRoutine._eventIndex == subRoutine.Children.Count) { subRoutine.Reset(_mainWindow); subRoutine = null; subRoutineSetAt = 0; } continue; } } if (_waitFrames > 0) { _waitFrames--; if (_waitFrames > 0) { _totalFrames++; if (_looping) { _loopTime++; } continue; } } //Progress until the next wait event while (_waitFrames == 0 && _eventIndex < Children.Count) { if (_looping && _loopEndIndex == _eventIndex) { _loopCount--; _eventIndex = _loopStartIndex; } if (_looping && _loopCount == 0) { _looping = false; _eventIndex = _loopEndIndex + 1; _loopTime = 0; } Advance(_eventIndex++, _mainWindow); } //scriptEditor1.EventList.SelectedIndices.Clear(); //if (_eventIndex - 1 < scriptEditor1.EventList.Items.Count) // scriptEditor1.EventList.SelectedIndex = _eventIndex - 1; if (_looping) { _loopTime++; } _totalFrames++; _mainWindow.modelPanel1.Invalidate(); } }
public int _waitFrames = 0, _totalFrames = 0; //In frames public void FrameAdvance(ModelEditControl _mainWindow) { if (_eventIndex >= Children.Count) { _idling = true; if (_delete) { _mainWindow.pnlMoveset.selectedActionNodes.Remove(this); Reset(_mainWindow); } return; } string name = Parent.Name; string fillername = subRoutine == null ? "" : subRoutine.Parent.Name; if (subRoutine != null && _totalFrames >= subRoutineSetAt) { if (subRoutine == this || subRoutine == actionReferencedBy || name == fillername || (_subRoutine && _idling)) { _return = true; _eventIndex = Children.Count; } else { subRoutine.FrameAdvance(_mainWindow); _totalFrames++; if (subRoutine._return || subRoutine._eventIndex == subRoutine.Children.Count) { subRoutine.Reset(_mainWindow); subRoutine = null; subRoutineSetAt = 0; } return; } } if (_waitFrames > 0) { _waitFrames--; if (_waitFrames > 0) { _totalFrames++; if (_looping) { _loopTime++; } return; } } //Progress until the next wait event while (_waitFrames == 0 && _eventIndex < Children.Count && subRoutine == null) { if (_looping && _loopEndIndex == _eventIndex) { _loopCount--; _eventIndex = _loopStartIndex; } if (_looping && _loopCount == 0) { _looping = false; _eventIndex = _loopEndIndex + 1; _loopTime = 0; } Advance(_eventIndex++, _mainWindow); } if (_looping) { _loopTime++; } _totalFrames++; _mainWindow.modelPanel1.Invalidate(); }