Пример #1
0
        private bool loadSub <T>(BinStore s, List <T> tgt) where T : IBinLoadable, new()
        {
            T    entry = new T();
            bool ok    = entry.loadFrom(s);

            tgt.Add(entry);
            return(ok);
        }
Пример #2
0
        public bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out name);
            ok &= s.read(out src_name);
            ok &= s.read(out LodFar);
            ok &= s.read(out LodFarFade);
            ok &= s.read(out LodNear);
            ok &= s.read(out LodNearFade);
            uint tflag;

            ok &= s.read(out tflag);
            node._TrickFlags = (TrickFlags)tflag;
            ok &= s.read(out ObjFlags);
            ok &= s.read(out GfxFlags);
            ok &= s.read(out GroupFlags);
            ok &= s.read(out Sway);
            ok &= s.read(out Sway_Rotate);
            ok &= s.read(out AlphaRef);
            ok &= s.read(out FogDist);
            ok &= s.read(out node.SortBias);
            ok &= s.read(out node.ScrollST0);
            ok &= s.read(out node.ScrollST1);
            ok &= s.read(out ShadowDist);
            ok &= s.read(out NightGlow);
            ok &= s.read(out node.TintColor0);
            ok &= s.read(out node.TintColor1);
            ok &= s.read(out ObjTexBias);
            ok &= s.prepare_nested(); // will update the file size left
            if (s.end_encountered())
            {
                return(ok);
            }
            string _name;

            while (s.nesting_name(out _name))
            {
                s.nest_in();
                if ("StAnim" == _name)
                {
                    TextureAnim_Dat entry = new TextureAnim_Dat();
                    ok &= entry.loadFrom(s);
                    StAnim.Add(entry);
                }
                else
                {
                    Debug.Assert(false, "unknown field referenced.");
                }

                s.nest_out();
            }

            Debug.Assert(s.end_encountered());
            return(ok);
        }
Пример #3
0
        public bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out clr);
            ok &= s.prepare_nested();
            Debug.Assert(ok);
            Debug.Assert(s.end_encountered());
            return(ok);
        }
Пример #4
0
        public bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out texIdxToReplace);
            ok &= s.read(out repl_with);
            ok &= s.prepare_nested();
            Debug.Assert(ok);
            Debug.Assert(s.end_encountered());
            return(ok);
        }
Пример #5
0
        public bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out speed);
            ok &= s.read(out stScale);
            ok &= s.read(out scrollType);
            ok &= s.read(out flags);
            ok &= s.prepare_nested(); // will update the file size left
            Debug.Assert(s.end_encountered());
            return(ok);
        }
Пример #6
0
        public bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out name);
            ok &= s.read(out pos);
            ok &= s.read(out rot);
            ok &= s.prepare_nested(); // will update the file size left
            Debug.Assert(ok);
            Debug.Assert(s.end_encountered());
            return(ok);
        }
Пример #7
0
        public bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out name);
            ok &= s.read(out volRel1);
            ok &= s.read(out sndRadius);
            ok &= s.read(out snd_ramp_feet);
            ok &= s.read(out sndFlags);
            ok &= s.prepare_nested();
            Debug.Assert(ok);
            Debug.Assert(s.end_encountered());
            return(ok);
        }
Пример #8
0
        public bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            uint color_data;

            ok &= s.read(out color_data);
            ok &= s.read(out Size);
            ok &= s.read(out isNegative);
            ok &= s.prepare_nested();
            Debug.Assert(ok);
            Debug.Assert(s.end_encountered());
            omniColor = Tools.RGBAToColor32(color_data);
            return(ok);
        }
Пример #9
0
        public bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out name);
            ok &= s.read(out src_file);
            ok &= s.read(out Gloss);
            ok &= s.read(out Surface);
            ok &= s.read(out Fade);
            ok &= s.read(out ScaleST0);
            ok &= s.read(out ScaleST1);
            ok &= s.read(out Blend);
            ok &= s.read(out BumpMap);
            ok &= s.read(out BlendType);
            ok &= s.read(out Flags);
            ok &= s.prepare_nested(); // will update the file size left
            Debug.Assert(s.end_encountered());
            return(ok);
        }
Пример #10
0
        public bool LoadSceneData(string fname)
        {
            BinStore binfile    = new BinStore();
            string   fixed_path = Tools.getFilepathCaseInsensitive(fname);

            if (!binfile.open(fixed_path, scenegraph_i0_2_requiredCrc))
            {
                Debug.LogError("Failed to open original bin:" + fixed_path);
                return(false);
            }

            if (!loadFrom(binfile))
            {
                Debug.LogError("Failed to load data from original bin:" + fixed_path);
                binfile.close();
                return(false);
            }

            binfile.close();
            return(true);
        }
Пример #11
0
        private bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out Version);
            ok &= s.read(out Scenefile);
            ok &= s.prepare_nested(); // will update the file size left
            Debug.Assert(ok);
            if (s.end_encountered())
            {
                return(ok);
            }
            string _name;

            while (s.nesting_name(out _name))
            {
                s.nest_in();
                if ("Def" == _name || "RootMod" == _name)
                {
                    var entry = new SceneGraphNode_Data();
                    ok &= entry.loadFrom(s);
                    Def.Add(entry);
                }
                else if ("Ref" == _name)
                {
                    var entry = new SceneRootNode_Data();
                    ok &= entry.loadFrom(s);
                    Ref.Add(entry);
                }
                else
                {
                    Debug.Assert(false, "unknown field referenced.");
                }

                s.nest_out();
            }

            return(ok);
        }
Пример #12
0
        public bool loadFrom(BinStore s)
        {
            s.prepare();
            bool ok = s.prepare_nested(); // will update the file size left

            if (s.end_encountered())
            {
                return(ok);
            }
            string _name;

            while (s.nesting_name(out _name))
            {
                s.nest_in();
                if ("Trick" == _name)
                {
                    GeometryModifiers entry = new GeometryModifiers();
                    geometry_mods.Add(entry);
                    ok &= entry.loadFrom(s);
                }
                else if ("Texture" == _name)
                {
                    var entry = new TextureModifiers();
                    texture_mods.Add(entry);
                    ok &= entry.loadFrom(s);
                }
                else
                {
                    Debug.Assert(false, "unknown field referenced.");
                }

                s.nest_out();
            }
            Debug.LogFormat("Loaded {0} GeomMods and {1} TexMods", geometry_mods.Count, texture_mods.Count);
            Debug.Assert(ok);
            return(ok);
        }
Пример #13
0
        bool read_data_to(string directory_path, string storage, SceneModifiers target, uint CRC)
        {
            BinStore bin_store = new BinStore();

            if (!bin_store.open(directory_path + storage, CRC))
            {
                Debug.Log("failure");
                Debug.LogWarning("Couldn't load " + storage + " from " + directory_path);
                Debug.LogWarning("Using piggtool, ensure that bin.pigg has been extracted to ./data/");
                return(false);
            }

            bool res = target.loadFrom(bin_store);

            bin_store.close();

            if (!res)
            {
                Debug.Log("Reading " + directory_path + " " + storage + " ... failure");
                Debug.LogWarning("Couldn't load " + directory_path + " " + storage + ": wrong file format?");
            }

            return(res);
        }
Пример #14
0
        public bool loadFrom(BinStore s)
        {
            bool ok = true;

            s.prepare();
            ok &= s.read(out name);
            ok &= s.read(out type);
            ok &= s.read(out flags);
            ok &= s.read(out p_Obj);
            ok &= s.prepare_nested(); // will update the file size left
            Debug.Assert(ok);
            if (s.end_encountered())
            {
                return(ok);
            }
            string _name;

            while (s.nesting_name(out _name))
            {
                s.nest_in();
                if ("Group" == _name)
                {
                    ok &= loadSub(s, p_Grp);
                }
                else if ("Property" == _name)
                {
                    ok &= loadSub(s, p_Property);
                }
                else if ("TintColor" == _name)
                {
                    ok &= loadSub(s, p_TintColor);
                }
                else if ("Ambient" == _name)
                {
                    ok &= loadSub(s, p_Ambient);
                }
                else if ("Omni" == _name)
                {
                    ok &= loadSub(s, p_Omni);
                }
                else if ("Sound" == _name)
                {
                    ok &= loadSub(s, p_Sound);
                }
                else if ("ReplaceTex" == _name)
                {
                    ok &= loadSub(s, p_ReplaceTex);
                }
                else if ("Beacon" == _name)
                {
                    ok &= loadSub(s, p_Beacon);
                }
                else if ("Fog" == _name)
                {
                    ok &= loadSub(s, p_Fog);
                }
                else if ("Lod" == _name)
                {
                    ok &= loadSub(s, p_Lod);
                }
                else
                {
                    Debug.Assert(false, "unknown field referenced.");
                }

                s.nest_out();
            }

            return(ok);
        }