Example #1
0
        private ResourceManager()
        {
            zsc_body_male = (ZSC)loadResource("3DDATA/AVATAR/LIST_MBODY.ZSC");
            zsc_arms_male = (ZSC)loadResource("3DData/Avatar/LIST_MARMS.zsc");
            zsc_foot_male = (ZSC)loadResource("3DData/Avatar/LIST_MFOOT.zsc");
            zsc_face_male = (ZSC)loadResource("3DData/Avatar/LIST_MFACE.zsc");
            zsc_hair_male = (ZSC)loadResource("3DData/Avatar/LIST_MHAIR.zsc");
            zsc_cap_male  = (ZSC)loadResource("3DData/Avatar/LIST_MCAP.zsc");

            zsc_body_female = (ZSC)loadResource("3DData/Avatar/LIST_WBODY.zsc");
            zsc_arms_female = (ZSC)loadResource("3DData/Avatar/LIST_WARMS.zsc");
            zsc_foot_female = (ZSC)loadResource("3DData/Avatar/LIST_WFOOT.zsc");
            zsc_face_female = (ZSC)loadResource("3DData/Avatar/LIST_WFACE.zsc");
            zsc_hair_female = (ZSC)loadResource("3DData/Avatar/LIST_WHAIR.zsc");
            zsc_cap_female  = (ZSC)loadResource("3DData/Avatar/LIST_WCAP.zsc");

            zsc_back     = (ZSC)loadResource("3DData/Avatar/LIST_BACK.zsc");
            zsc_faceItem = (ZSC)loadResource("3DData/Avatar/LIST_FACEIEM.zsc");

            zsc_weapon    = (ZSC)loadResource("3DDATA/WEAPON/LIST_WEAPON.zsc");
            zsc_subweapon = (ZSC)loadResource("3DDATA/WEAPON/LIST_SUBWPN.zsc");

            stb_animation_list = (STB)loadResource("3Ddata/STB/FILE_MOTION.STB");
            stb_animation_type = (STB)loadResource("3DDATA/STB/TYPE_MOTION.STB");

            stb_weapon_list = (STB)loadResource("3DDATA/STB/LIST_WEAPON.STB");
            stb_cap_list    = (STB)loadResource("3DDATA/STB/LIST_CAP.STB");
            stb_hair_list   = (STB)loadResource("3DDATA/STB/LIST_HAIR.STB");

            cache = new Cache(this, CACHE_SIZE);
        }
Example #2
0
        public ZscImporter(string path)
        {
            path = Utils.NormalizePath(path);

            var mapMatches = mapZsc.Match(path);
            var npcMatches = npcZsc.Match(path);

            if (npcMatches.Success)
            {
                targetPath = Utils.NormalizePath("Assets/NpcParts");
            }
            else if (mapMatches.Success)
            {
                var baseName = mapMatches.Groups[1].Value;
                var dbName   = mapMatches.Groups[2].Value;
                if (baseName == "AVATAR")
                {
                    targetPath = Utils.CombinePath("Assets/CharParts", dbName);
                }
                else
                {
                    targetPath = Utils.CombinePath("Assets/MapObjects", baseName, dbName);
                }
            }
            else
            {
                throw new System.Exception("Unexpected ZSC name...");
            }

            zsc = new ZSC(Utils.CombinePath(dataPath, path));
        }
Example #3
0
 public void Load(string ifoName, string mapFolder, ZSC dec, ZSC build, Vector2 mapPosition)
 {
     this.ifo           = new IFO();
     this.ifo           = ContentManager.Instance().GetIFO(ifoName, mapFolder);
     this.decorationZSC = dec;
     this.buildingZSC   = build;
     for (int i = 0; i < this.ifo.listDecorationBlock.Count; i++)
     {
         for (int j = 0; j < this.ifo.listDecorationBlock[i].listDecoration.Count; j++)
         {
             int    objectID = this.ifo.listDecorationBlock[i].listDecoration[j].objectID;
             Entity entity   = new Entity();
             for (int k = 0; k < dec.listObject[objectID].list_mesh.Count; k++)
             {
                 ZMS zMS = new ZMS(this.graphics);
                 zMS.Load(ContentManager.GetRootPath() + dec.listMesh[(int)dec.listObject[objectID].list_mesh[k].mesh_id].path, ClientType.IROSE);
                 zMS.LoadTexture(ContentManager.GetRootPath(), this.graphics, dec.listMateriel[(int)dec.listObject[objectID].list_mesh[k].material_id]);
                 zMS.ApplyZSCData(dec.listObject[objectID], k);
                 entity.AddPart(zMS);
             }
             Vector3 position = default(Vector3);
             position.X = this.ifo.listDecorationBlock[i].listDecoration[j].position.X / 100f + 5200f;
             position.Y = this.ifo.listDecorationBlock[i].listDecoration[j].position.Y / 100f + 5200f;
             position.Z = this.ifo.listDecorationBlock[i].listDecoration[j].position.Z / 100f;
             Matrix matrix = Matrix.Identity;
             matrix *= Matrix.CreateScale(this.ifo.listDecorationBlock[i].listDecoration[j].scale);
             matrix *= Matrix.CreateFromQuaternion(new Quaternion(this.ifo.listDecorationBlock[i].listDecoration[j].rotation.W, this.ifo.listDecorationBlock[i].listDecoration[j].rotation.X, this.ifo.listDecorationBlock[i].listDecoration[j].rotation.Y, this.ifo.listDecorationBlock[i].listDecoration[j].rotation.Z));
             matrix *= Matrix.CreateTranslation(position);
             entity.ApplyTransformation(matrix);
             this.listEntity.Add(entity);
         }
     }
     for (int j = 0; j < this.ifo.listBuildingBlock[0].listBuilding.Count; j++)
     {
         int    objectID = this.ifo.listBuildingBlock[0].listBuilding[j].objectID;
         Entity entity   = new Entity();
         for (int k = 0; k < build.listObject[objectID].list_mesh.Count; k++)
         {
             ZMS zMS = new ZMS(this.graphics);
             zMS.Load(ContentManager.GetRootPath() + build.listMesh[(int)build.listObject[objectID].list_mesh[k].mesh_id].path, ClientType.IROSE);
             zMS.LoadTexture(ContentManager.GetRootPath(), this.graphics, build.listMateriel[(int)build.listObject[objectID].list_mesh[k].material_id]);
             zMS.ApplyZSCData(build.listObject[objectID], k);
             entity.AddPart(zMS);
         }
         Vector3 position = default(Vector3);
         position.X = this.ifo.listBuildingBlock[0].listBuilding[j].position.X / 100f + 5200f;
         position.Y = this.ifo.listBuildingBlock[0].listBuilding[j].position.Y / 100f + 5200f;
         position.Z = this.ifo.listBuildingBlock[0].listBuilding[j].position.Z / 100f;
         Matrix matrix = Matrix.Identity;
         matrix *= Matrix.CreateScale(this.ifo.listBuildingBlock[0].listBuilding[j].scale);
         matrix *= Matrix.CreateFromQuaternion(new Quaternion(this.ifo.listBuildingBlock[0].listBuilding[j].rotation.W, this.ifo.listBuildingBlock[0].listBuilding[j].rotation.X, this.ifo.listBuildingBlock[0].listBuilding[j].rotation.Y, this.ifo.listBuildingBlock[0].listBuilding[j].rotation.Z));
         matrix *= Matrix.CreateTranslation(position);
         entity.ApplyTransformation(matrix);
         this.listEntity.Add(entity);
     }
 }
Example #4
0
    private Bounds LoadObject(BodyPartType bodyPart, int id)
    {
        Bounds objectBounds = new Bounds(skeleton.transform.position, Vector3.zero);
        ZSC    zsc          = rm.getZSC(charModel.gender, bodyPart);

        for (int i = 0; i < zsc.Objects[id].Models.Count; i++)
        {
            int ModelID   = zsc.Objects[id].Models[i].ModelID;
            int TextureID = zsc.Objects[id].Models[i].TextureID;

            Bounds partBounds = LoadPart(bodyPart, zsc.Objects[id].Models[i].DummyIndex, zsc.Models[ModelID], zsc.Textures[TextureID].Path);
            objectBounds.Encapsulate(partBounds);
        }
        return(objectBounds);
    }
        public ZSC GetZSC(string name)
        {
            ZSC result;

            if (!this.ZSCs.Contains(name))
            {
                ZSC zSC = new ZSC();
                zSC.Load(ContentManager.rootPath + name, ClientType.IROSE);
                this.ZSCs.Add(name, zSC);
                result = zSC;
            }
            else
            {
                result = (ZSC)this.ZSCs[name];
            }
            return(result);
        }
Example #6
0
        public bool Load()
        {
            if (!m_isValid)
            {
                Debug.LogError("Cannot load patch at path " + this.m_assetDir);
                return(false);
            }

            // TODO: add error handling for failure to load the following files
            this.m_HIM = new HIM(this.m_assetDir.Parent.FullName + "/" + this.m_name + ".HIM");
            this.m_TIL = new TIL(this.m_assetDir.Parent.FullName + "/" + this.m_name + ".TIL");
            if (this.m_ZON == null)  // load ZON if it was never passed to the patch constructor
            {
                this.m_ZON = new ZON(this.m_assetDir.Parent.FullName + "/" + this.m_assetDir.Parent.Name + ".ZON");
            }
            this.m_IFO = new IFO(this.m_assetDir.Parent.FullName + "/" + this.m_name + ".IFO");

            //	parent x   :        4	  3		2	  1	   0
            // original dir: .../3ddata/maps/junon/jpt01/30_30
            // desired dir: .../3ddata/junon/LIST_CNST_JPT.ZSC
            char[] trimChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '_' };

            // TODO: use stl's to avoid this mess and be able to load luna/eldeon/oro maps
            string zscPath = m_assetDir.Parent.Name.ToLower().Trim(trimChars);

            if (zscPath.Contains("jd") || zscPath.Contains("jdt") || zscPath.Contains("jg"))
            {
                zscPath = Utils.FixPath(m_3dDataDir + "/" + m_assetDir.Parent.Parent.Name.ToUpper() + "/LIST_CNST_" + zscPath + ".ZSC");                // + m_assetDir.Parent.Name.Trim(trimChars).ToUpper() + ".ZSC");
            }
            else
            {
                zscPath = Utils.FixPath(m_3dDataDir + "/" + m_assetDir.Parent.Parent.Name.ToUpper() + "/LIST_" + "CNST_JPT.ZSC");                // + m_assetDir.Parent.Name.Trim(trimChars).ToUpper() + ".ZSC");
            }
            string litPath = Utils.FixPath(this.m_assetDir.Parent.FullName + "\\" + this.m_name + "\\LIGHTMAP\\BUILDINGLIGHTMAPDATA.LIT");

            groundLight = Utils.FixPath(this.m_assetDir.Parent.FullName + "\\" + this.m_name + "\\" + this.m_name + "_PLANELIGHTINGMAP.DDS");
            m_ZSC_Cnst  = new ZSC(zscPath);
            m_ZSC_Deco  = new ZSC(zscPath.ToLower().Replace("cnst", "deco"));
            m_LIT_Cnst  = new LIT(litPath);
            m_LIT_Deco  = new LIT(litPath.Replace("building", "object"));
            // TODO: add any new file loads here

            edgeVertexLookup = new Dictionary <string, List <int> >();

            return(true);
        }
Example #7
0
        public void Load(string zonPath, string zscBuildingPath, string zscDecorationPath, string mapFolder, int minSizeX, int minSizeY, int maxSizeX, int maxSizeY)
        {
            ZON zON  = ContentManager.Instance().GetZON(zonPath);
            ZSC zSC  = ContentManager.Instance().GetZSC(zscBuildingPath);
            ZSC zSC2 = ContentManager.Instance().GetZSC(zscDecorationPath);

            this.decorationBlocks = new DecorationBlock[maxSizeX - minSizeX + 1, maxSizeY - minSizeY + 1];
            this.mapBlocks        = new MapBlock[maxSizeX - minSizeX + 1, maxSizeY - minSizeY + 1];
            this.isView           = new bool[maxSizeX - minSizeX + 1, maxSizeY - minSizeY + 1];
            for (int i = minSizeX; i <= maxSizeX; i++)
            {
                for (int j = minSizeY; j <= maxSizeY; j++)
                {
                    string himName = string.Concat(new object[]
                    {
                        i,
                        "_",
                        j,
                        ".HIM"
                    });
                    string tilName = string.Concat(new object[]
                    {
                        i,
                        "_",
                        j,
                        ".TIL"
                    });
                    MapBlock mapBlock = new MapBlock(this.graphics);
                    mapBlock.Load(zON, mapFolder, himName, tilName, new Vector2((float)i, (float)j));
                    this.mapBlocks[i - minSizeX, j - minSizeY] = mapBlock;
                    string ifoName = string.Concat(new object[]
                    {
                        i,
                        "_",
                        j,
                        ".IFO"
                    });
                    DecorationBlock decorationBlock = new DecorationBlock(this.graphics);
                    decorationBlock.Load(ifoName, mapFolder, zSC2, zSC, new Vector2((float)i, (float)j));
                    this.decorationBlocks[i - minSizeX, j - minSizeY] = decorationBlock;
                }
            }
            this.GenerateIndice();
        }
 public void SetZSC(ZSC MZSC, ZSC WZSC)
 {
     this.previewControl.ClearZMS();
     this.MZSC = MZSC;
     this.WZSC = WZSC;
 }