// ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            ushort numAnimParam = loader.ReadUInt16();
            ushort numCurve     = loader.ReadUInt16();
            ushort numConstant  = loader.ReadUInt16();

            loader.Seek(2);
            BeginCurve     = loader.ReadInt32();
            BeginParamAnim = loader.ReadInt32();
            Name           = loader.LoadString();
            ParamAnimInfos = loader.LoadList <ParamAnimInfo>(numAnimParam);
            Curves         = loader.LoadList <AnimCurve>(numCurve);
            Constants      = loader.LoadCustom(() => loader.ReadAnimConstants(numConstant));
        }
Example #2
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        internal void Load(ResFileLoader loader, string signature)
        {
            ParamAnimInfos   = new List <ParamAnimInfo>();
            PatternAnimInfos = new List <PatternAnimInfo>();
            Constants        = new List <AnimConstant>();
            Curves           = new List <AnimCurve>();

            if (signature == "FSHU")
            {
                ushort numAnimParam = loader.ReadUInt16();
                ushort numCurve     = loader.ReadUInt16();
                ushort numConstant  = loader.ReadUInt16();
                loader.Seek(2);
                ShaderParamCurveIndex = loader.ReadInt32();
                InfoIndex             = loader.ReadInt32();
                Name           = loader.LoadString();
                ParamAnimInfos = loader.LoadList <ParamAnimInfo>(numAnimParam);
                Curves         = loader.LoadList <AnimCurve>(numCurve);
                Constants      = loader.LoadCustom(() => loader.ReadAnimConstants(numConstant));
            }
            else if (signature == "FTXP")
            {
                ushort numPatAnim = loader.ReadUInt16();
                ushort numCurve   = loader.ReadUInt16();
                TexturePatternCurveIndex = loader.ReadInt32();
                InfoIndex        = loader.ReadInt32();
                Name             = loader.LoadString();
                PatternAnimInfos = loader.LoadList <PatternAnimInfo>(numPatAnim);
                Curves           = loader.LoadList <AnimCurve>(numCurve);
                BaseDataList     = loader.LoadCustom(() => loader.ReadUInt16s(numPatAnim));
            }
            else if (signature == "FMAA")
            {
                Name = loader.LoadString();
                uint ShaderParamAnimOffset    = loader.ReadOffset();
                uint TexturePatternAnimOffset = loader.ReadOffset();
                uint CurveOffset             = loader.ReadOffset();
                uint ConstantAnimArrayOffset = loader.ReadOffset();
                ShaderParamCurveIndex    = loader.ReadUInt16();
                TexturePatternCurveIndex = loader.ReadUInt16();
                VisualConstantIndex      = loader.ReadUInt16();
                VisalCurveIndex          = loader.ReadUInt16();
                BeginVisalConstantIndex  = loader.ReadUInt16();
                ushort ShaderParamAnimCount    = loader.ReadUInt16();
                ushort TexutrePatternAnimCount = loader.ReadUInt16();
                ushort ConstantAnimCount       = loader.ReadUInt16();
                ushort CurveCount = loader.ReadUInt16();
                loader.Seek(6);

                Curves           = loader.LoadList <AnimCurve>(CurveCount, CurveOffset);
                ParamAnimInfos   = loader.LoadList <ParamAnimInfo>(ShaderParamAnimCount, ShaderParamAnimOffset);
                PatternAnimInfos = loader.LoadList <PatternAnimInfo>(TexutrePatternAnimCount, TexturePatternAnimOffset);
                Constants        = loader.LoadCustom(() => loader.ReadAnimConstants(ConstantAnimCount), ConstantAnimArrayOffset);

                //Set base data list for texture patterns
                //Get the first value from either constants or curves
                BaseDataList = new ushort[PatternAnimInfos.Count];
                for (int i = 0; i < PatternAnimInfos.Count; i++)
                {
                    if (PatternAnimInfos[i].BeginConstant != ushort.MaxValue)
                    {
                        BaseDataList[i] = (ushort)((int)Constants[PatternAnimInfos[i].BeginConstant].Value);
                    }
                    else if (PatternAnimInfos[i].CurveIndex != ushort.MaxValue)
                    {
                        BaseDataList[i] = (ushort)Curves[PatternAnimInfos[i].CurveIndex].Keys[0, 0];
                    }
                }
            }
        }