コード例 #1
0
ファイル: GumpsLoader.cs プロジェクト: plugtopus/WisQuas2
        //private readonly List<uint> _usedIndex = new List<uint>();

        public override void Load()
        {
            string path = Path.Combine(FileManager.UoFolderPath, "gumpartLegacyMUL.uop");

            if (File.Exists(path))
            {
                _file = new UOFileUop(path, ".tga", Constants.MAX_GUMP_DATA_INDEX_COUNT, true);
                FileManager.UseUOPGumps = true;
            }
            else
            {
                path = Path.Combine(FileManager.UoFolderPath, "Gumpart.mul");
                string pathidx = Path.Combine(FileManager.UoFolderPath, "Gumpidx.mul");
                if (File.Exists(path) && File.Exists(pathidx))
                {
                    _file = new UOFileMul(path, pathidx, Constants.MAX_GUMP_DATA_INDEX_COUNT, 12);
                }
                FileManager.UseUOPGumps = false;
            }

            string pathdef = Path.Combine(FileManager.UoFolderPath, "gump.def");

            if (!File.Exists(pathdef))
            {
                return;
            }

            using (DefReader defReader = new DefReader(pathdef, 3))
            {
                while (defReader.Next())
                {
                    int ingump = defReader.ReadInt();

                    //if (ingump >= 50000)
                    //{
                    //    if (ingump >= 60000)
                    //        ingump -= 60000;
                    //    else
                    //        ingump -= 50000;
                    //}

                    if (ingump < 0 || ingump >= Constants.MAX_GUMP_DATA_INDEX_COUNT /*|| _file.Entries[ingump].DecompressedLength != 0*/)
                    {
                        continue;
                    }

                    int outgump = defReader.ReadGroupInt();

                    //if (outgump >= 50000)
                    //{
                    //    if (outgump >= 60000)
                    //        outgump -= 60000;
                    //    else
                    //        outgump -= 50000;
                    //}

                    if (outgump < 0 || outgump >= Constants.MAX_GUMP_DATA_INDEX_COUNT /*|| _file.Entries[outgump].DecompressedLength != 0*/)
                    {
                        continue;
                    }

                    _file.Entries[ingump] = _file.Entries[outgump];
                }
            }
        }