Пример #1
0
 public void ApplyVIS(VIS0Node _vis0, int _animFrame)
 {
     foreach (string n in VIS0Indices.Keys)
     {
         VIS0EntryNode node = null;
         List<int> indices = VIS0Indices[n];
         for (int i = 0; i < indices.Count; i++)
             if ((node = (VIS0EntryNode)_vis0.FindChild(((MDL0ObjectNode)_objList[indices[i]])._bone.Name, true)) != null)
                 if (node._entryCount != 0 && _animFrame != 0)
                     ((MDL0ObjectNode)_objList[indices[i]])._render = node.GetEntry(_animFrame - 1);
                 else
                     ((MDL0ObjectNode)_objList[indices[i]])._render = node._flags.HasFlag(VIS0Flags.Enabled);
     }
 }
Пример #2
0
        /// <summary>
        /// Adds an animation to the end of this one
        /// </summary>
        public void Append(VIS0Node external)
        {
            int origIntCount = FrameCount;
            FrameCount += external.FrameCount;

            foreach (VIS0EntryNode _extEntry in external.Children)
            {
                VIS0EntryNode _intEntry = null;
                if ((_intEntry = (VIS0EntryNode)FindChild(_extEntry.Name, false)) == null)
                {
                    VIS0EntryNode newIntEntry = new VIS0EntryNode() { Name = _extEntry.Name };

                    newIntEntry._entryCount = -1;
                    newIntEntry.EntryCount = _extEntry.EntryCount + origIntCount;
                    newIntEntry._flags = 0;

                    if (_extEntry.Constant)
                    {
                        if (_extEntry.Enabled)
                            for (int i = origIntCount.Align(8) / 8; i < newIntEntry.EntryCount; i++)
                                newIntEntry._data[i] = 0xFF;
                    }
                    else
                        Array.Copy(_extEntry._data, 0, newIntEntry._data, origIntCount.Align(8) / 8, _extEntry.EntryCount.Align(8) / 8);

                    AddChild(newIntEntry);
                }
                else
                {
                    if (!_extEntry.Constant && !_intEntry.Constant)
                        Array.Copy(_extEntry._data, 0, _intEntry._data, origIntCount.Align(8) / 8, _extEntry.EntryCount.Align(8) / 8);
                    else
                    {
                        byte[] d = new byte[_extEntry._data.Length];
                        if (_intEntry.Constant)
                        {
                            if (_intEntry.Enabled)
                                for (int i = 0; i < origIntCount.Align(8) / 8; i++)
                                    d[i] = 0xFF;
                        }
                        else
                            Array.Copy(_extEntry._data, 0, _intEntry._data, origIntCount.Align(8) / 8, _extEntry.EntryCount.Align(8) / 8);
                        _intEntry.Constant = false;
                        if (_extEntry.Constant)
                        {
                            if (_extEntry.Enabled)
                                for (int i = origIntCount.Align(8) / 8; i < _intEntry.EntryCount; i++)
                                    d[i] = 0xFF;
                        }
                        else
                            Array.Copy(_extEntry._data, 0, d, origIntCount.Align(8) / 8, _extEntry.EntryCount.Align(8) / 8);
                        _intEntry._data = d;
                    }
                }
            }
        }