public override bool OnInitialize() { if (_name == null) _name = (_indirect ? "Ind" : "") + "Texture" + _textureIndex; _flags = Header->Code; _keyframes = null; if (Parent is SRT0EntryNode && Parent.Parent is SRT0Node) _numFrames = ((SRT0Node)Parent.Parent).FrameCount; return false; }
private static int EvaluateSRT0Group(ref SRT0Code code, KeyframeCollection kf, int group, ref int entrySize) { //SRT0s always use I12 //group //0 = scale //1 = rot //2 = trans int index = group * 3; int numFrames = kf.FrameCount; int dataLen = 0; KeyframeEntry[] roots = new KeyframeEntry[2]; bool exist = false; bool isotropic = group == 0; int* count = stackalloc int[2]; bool* isExist = stackalloc bool[2]; bool* isFixed = stackalloc bool[2]; for (int i = 0; i < (group == 1 ? 1 : 2); i++) { roots[i] = kf._keyRoots[index + i]; count[i] = kf._keyCounts[index + i]; isExist[i] = count[i] > 0; isFixed[i] = count[i] <= 1; } if (exist = isExist[0] || isExist[1]) { if (group == 0) { if (isFixed[0] != isFixed[1]) isotropic = false; else if (count[0] != count[1]) isotropic = false; else { KeyframeEntry e1 = roots[0], e2 = roots[1]; for (int i = count[0]; i-- > 0; ) { e1 = e1._next; e2 = e2._next; if ((e1._index != e2._index) || (e1._value != e2._value)) { isotropic = false; break; } } } } } if (group == 0 && !isotropic) code.ScaleIsotropic = false; for (int i = 0; i < (group == 1 ? 1 : 2); i++) { if (exist) { switch (group) { case 0: code.NoScale = false; break; case 1: code.NoRotation = false; break; case 2: code.NoTranslation = false; break; } if (!(group == 0 && i == 1 && code.ScaleIsotropic)) entrySize += 4; if (!isFixed[i]) { switch (group) { case 0: switch (i) { case 0: code.FixedScaleX = false; break; case 1: code.FixedScaleY = false; break; } break; case 1: code.FixedRotation = false; break; case 2: switch (i) { case 0: code.FixedX = false; break; case 1: code.FixedY = false; break; } break; } if (!(group == 0 && i == 1 && code.ScaleIsotropic)) dataLen += 8 + (count[i] * 12); } } } return dataLen; }