Exemple #1
0
 public static string getGeoNameFromModelName(string modelName)
 {
     string[] refLines = System.IO.File.ReadAllLines(MISC.Game.gamePath + "/" + GeneralObjConsts.mdlRefFile);
     //todo change this with a sorta lut
     foreach (string line in refLines)
     {
         string[] cont = MISCUtils.ParseAsmbd(line);
         if (cont.Length > 0)
         {
             if (cont[0] == ".set")
             {
                 if (cont[1] == modelName)
                 {
                     if (cont.Length > 4)
                     {
                         return(cont[4]); //also todo do this better instead of reading comment lol
                     }
                     else
                     {
                         return("bubbly_tree_geo");
                     }
                 }
             }
         }
     }
     return(null);
 }
Exemple #2
0
        public List <GeoObject> GetGeoObjectsFromGeoElems(List <GeoElem> geoElems, string labelName, GeoObject prevObject = null)
        {
            List <GeoObject> geoObjects = new List <GeoObject>();
            GeoObject        curObject;

            if (prevObject == null)
            {
                curObject = new GeoObject(GeoObjectTypes.RenderObject);
            }
            else
            {
                curObject = prevObject;
            }

            foreach (GeoElem geoElem in geoElems)
            {
                if (labelName != null)
                {
                    string[] name = MISCUtils.ParseAsmbd(geoElem.geoName);
                    if (name[0] == "glabel")
                    {
                        if (name[1] != labelName)
                        {
                            continue;
                        }
                    }
                }
                if (geoElem.type == GeoType.ListCloser)
                {
                    geoObjects.Add(new GeoObject(GeoObjectTypes.PopMatrix));
                }
                GeoCMDs CMD = new GeoCMDs();
                CMD.elem  = geoElem;
                curObject = CMD.loadGeoObject(CMD.getRefObject(), curObject);
                if (curObject.f3d.fileName != null)
                {
                    geoObjects.Add(curObject);
                    curObject = new GeoObject(GeoObjectTypes.RenderObject);
                }
                if (geoElem.type == GeoType.ListOpener)
                {
                    geoObjects.Add(new GeoObject(GeoObjectTypes.PushMatrix));
                    geoObjects.AddRange(GetGeoObjectsFromGeoElems(geoElem.geoElems, labelName, curObject));
                }
            }

            return(geoObjects);
        }
Exemple #3
0
        public static OBJs.CubeData getCubeDataFromF3DFile(string[] lines) //yeah sorry i make it check the whole file, just did this for convenience and also cause objects should be more accurately represented
        {
            CubeData data = new CubeData();

            string[] vs;
            if (lines == null)
            {
                return(data);
            }
            foreach (string line in lines)
            {
                vs = MISCUtils.ParseAsmbd(line);
                if (vs[0] == "vertex")
                {
                    data.updateCubeData((short)(MISCUtils.ParseInt(vs[1]) >> 4), (short)(MISCUtils.ParseInt(vs[2]) >> 4), (short)(MISCUtils.ParseInt(vs[3]) >> 4));
                }
            }
            return(data);
        }