Пример #1
0
		public BSP30map (string filename)
		{

				if (File.Exists ("Assets/Bsp/" + filename) == false)
				{
						Debug.LogError ("Bsp not found");


				}
				BSPfile = new BinaryReader (File.Open ("Assets/Bsp/" + filename, FileMode.Open));
				header = new BSPHeader (BSPfile);
		bspInfo = new BspInfo ();

				ReadEntities ();
				ReadFaces ();
				ReadEdges ();
				ReadVerts ();
				ReadTexinfo ();
				ReadLightLump ();
				ReadTextures (); 
				ReadMarkSurfaces ();
				ReadLeafs ();
				ReadPlanes ();
				ReadNodes ();
				ReadModels ();
				ReadVisData ();

        Debug.Log("data start ");
                Debug.Log("Entity char length " + entityLump.rawEntities.Length.ToString());
        Debug.Log("number of Faces " + bspInfo.mapNum_faces.ToString());
        //   Debug.Log("number of edges " + bspInfo.
        Debug.Log("lightmap length " + bspInfo.mapNum_lighting.ToString());
        Debug.Log("number of verts " + bspInfo.mapNum_verts.ToString());
        Debug.Log("number of Faces " + bspInfo.mapNum_faces.ToString());
        Debug.Log("textures " + bspInfo.mapNum_textures.ToString());
        Debug.Log("marksurf " + markSurfacesLump.markSurfaces.Length.ToString());
        Debug.Log("VisData Length: " + bspInfo.mapNum_visability.ToString());
        Debug.Log("leaf limp  Length: " + leafLump.numLeafs.ToString());
        Debug.Log("plane Length: " + planeLump.planes.Length.ToString());
        Debug.Log("node lump Length: " + nodeLump.nodes.Length.ToString());
        Debug.Log("models " + modelLump.models.Length.ToString());

        Debug.Log("data end ");
        bspInfo.mapNum_clipnodes = header.directory [9].length / 8;
		
				

				ReadPVS ();

				BSPfile.BaseStream.Dispose ();
				
				if (NumTexLoadFromWad > 0)
				{
						Debug.Log ("Reading in textures from wad");
						findNullTextures ();//number of textures we need to load  from the wad files
				}

		}
Пример #2
0
    public BSP30map(string filename)
    {
        if (File.Exists("Assets/Bsp/" + filename) == false)
        {
            Debug.LogError("Bsp not found");
        }
        BSPfile = new BinaryReader(File.Open("Assets/Bsp/" + filename, FileMode.Open));
        header  = new BSPHeader(BSPfile);
        bspInfo = new BspInfo();

        ReadEntities();
        ReadFaces();
        ReadEdges();
        ReadVerts();
        ReadTexinfo();
        ReadLightLump();
        ReadTextures();
        ReadMarkSurfaces();
        ReadLeafs();
        ReadPlanes();
        ReadNodes();
        ReadModels();
        ReadVisData();

        Debug.Log("data start ");
        Debug.Log("Entity char length " + entityLump.rawEntities.Length.ToString());
        Debug.Log("number of Faces " + bspInfo.mapNum_faces.ToString());
        //   Debug.Log("number of edges " + bspInfo.
        Debug.Log("lightmap length " + bspInfo.mapNum_lighting.ToString());
        Debug.Log("number of verts " + bspInfo.mapNum_verts.ToString());
        Debug.Log("number of Faces " + bspInfo.mapNum_faces.ToString());
        Debug.Log("textures " + bspInfo.mapNum_textures.ToString());
        Debug.Log("marksurf " + markSurfacesLump.markSurfaces.Length.ToString());
        Debug.Log("VisData Length: " + bspInfo.mapNum_visability.ToString());
        Debug.Log("leaf limp  Length: " + leafLump.numLeafs.ToString());
        Debug.Log("plane Length: " + planeLump.planes.Length.ToString());
        Debug.Log("node lump Length: " + nodeLump.nodes.Length.ToString());
        Debug.Log("models " + modelLump.models.Length.ToString());

        Debug.Log("data end ");
        bspInfo.mapNum_clipnodes = header.directory [9].length / 8;



        ReadPVS();

        BSPfile.BaseStream.Dispose();

        if (NumTexLoadFromWad > 0)
        {
            Debug.Log("Reading in textures from wad");
            findNullTextures();                                     //number of textures we need to load  from the wad files
        }
    }
Пример #3
0
        public void Init()
        {
            //Prepare files for tests
            if (File.Exists(TEMP_FILENAME))
            {
                File.Delete(TEMP_FILENAME);
            }

            File.Copy(MAP_FILENAME, TEMP_FILENAME);

            //Prepare variables
            exampleInfo = new BspInfo()
            {
                Identifier  = 0x50534256,
                Version     = 0,
                MapRevision = 0,
                Lumps       = new BspLumpInfo[64]
            };

            for (int i = 0; i < 64; i++)
            {
                exampleInfo.Lumps[i] = new BspLumpInfo()
                {
                    FileLength = i,
                    FileOffset = i,
                    Version    = i,
                    fourCC     = i
                };
            }

            exampleLump = new BspLumpInfo()
            {
                FileLength = 1,
                FileOffset = 2,
                fourCC     = 3,
                Version    = 4
            };

            try
            {
                throw new ObjectDisposedException(nameof(BspInfoWriter));
            }
            catch (Exception ex)
            {
                exceptionMessage = ex.Message;
            }
        }
Пример #4
0
        public void DifferentComparison()
        {
            var info = new BspInfo();

            info.Version    = 1;
            info.Identifier = 1;
            info.Lumps      = new BspLumpInfo[1]
            {
                new BspLumpInfo()
                {
                    Version    = 1,
                    FileLength = 1,
                    FileOffset = 1,
                    fourCC     = 1
                }
            };
            info.MapRevision = 1;

            var info2 = new BspInfo();

            info2.Version    = 1;
            info2.Identifier = 1;
            info2.Lumps      = new BspLumpInfo[1]
            {
                new BspLumpInfo()
                {
                    Version    = 1,
                    FileLength = 1,
                    FileOffset = 1,
                    fourCC     = 1
                }
            };
            info2.MapRevision = 1;

            Assert.AreEqual(info, info2);

            info2.MapRevision = 37;
            Assert.AreNotEqual(info, info2);
        }
Пример #5
0
        public void BothNullComparison()
        {
            BspInfo info1 = null;

            Assert.AreEqual(info1, null);
        }