public override void Convert(ResourceLocation source, ResourceLocation dest)
        {
            ContentBinaryReader br = new ContentBinaryReader(source);

            BinaryDataReader data      = br.ReadBinaryData();
            float            xllcorner = data.GetDataSingle("xllcorner");
            float            yllcorner = data.GetDataSingle("yllcorner");

            int width  = data.GetDataInt32("width");
            int height = data.GetDataInt32("height");

            float[] demData = new float[height * width];


            int bits = data.GetDataInt32("bits", 32);

            ContentBinaryReader br2 = data.GetData("data");

            for (int i = 0; i < height; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    demData[i * width + j] = br2.ReadSingle();
                }
            }

            br2.Close();

            data.Close();


            Half[] demData16 = Half.ConvertToHalf(demData);

            // =========================================================


            BinaryDataWriter result = new BinaryDataWriter();

            result.AddEntry("xllcorner", xllcorner);
            result.AddEntry("yllcorner", yllcorner);
            result.AddEntry("width", width);
            result.AddEntry("height", height);

            result.AddEntry("bits", 16);

            Stream dataStream = result.AddEntryStream("data");

            ContentBinaryWriter bw = new ContentBinaryWriter(dataStream);

            for (int i = 0; i < demData.Length; i++)
            {
                bw.Write(demData16[i].InternalValue);
            }

            bw.Close();

            bw = new ContentBinaryWriter(dest);
            bw.Write(result);
            bw.Close();
        }
Exemple #2
0
        public Map(BattleField region)
        {
            this.region = region;

            FileLocation fl = FileSystem.Instance.Locate("grad.bit", GameFileLocs.Nature);

            gradMap = new BitTable(32);
            gradMap.Load(fl);

            pathFinder = new PathFinderManager(gradMap);

            fl = FileSystem.Instance.Locate("mapheight.raw", GameFileLocs.Nature);

            heightData = new ushort[HeightMapHeight][];
            ContentBinaryReader br = new ContentBinaryReader(fl);

            for (int i = 0; i < HeightMapHeight; i++)
            {
                heightData[i] = new ushort[HeightMapWidth];
                for (int j = 0; j < HeightMapWidth; j++)
                {
                    heightData[i][j] = br.ReadUInt16();
                }
            }
            br.Close();
        }
Exemple #3
0
        public Map(BattleField region)
        {
            this.region = region;

            FileLocation fl = FileSystem.Instance.Locate("grad.bit", GameFileLocs.Nature);

            gradMap = new BitTable(32);
            gradMap.Load(fl);

            pathFinder = new PathFinderManager(gradMap);

            fl = FileSystem.Instance.Locate("mapheight.raw", GameFileLocs.Nature);

            heightData = new ushort[HeightMapHeight][];
            ContentBinaryReader br = new ContentBinaryReader(fl);
            for (int i = 0; i < HeightMapHeight; i++)
            {
                heightData[i] = new ushort[HeightMapWidth];
                for (int j = 0; j < HeightMapWidth; j++) 
                {
                    heightData[i][j] = br.ReadUInt16();
                }
            }
            br.Close();
        }
Exemple #4
0
        static void BuildBitMap()
        {
            FileLocation        fl = new FileLocation(@"E:\Desktop\terrain_l2副本.raw");
            ContentBinaryReader br = new ContentBinaryReader(fl);

            const int DW = 36 * 32;
            const int DH = 14 * 32;

            ushort[,] data = new ushort[DH, DW];

            for (int i = 0; i < DH; i++)
            {
                for (int j = 0; j < DW; j++)
                {
                    ushort v = br.ReadUInt16();
                    data[i, j] = Math.Max(v, (ushort)(1640 * 7));// br.ReadUInt16();
                }
            }

            br.Close();

            int[,] dir = new int[DH, DW];

            for (int i = 0; i < DH - 1; i++)
            {
                for (int j = 0; j < DW - 1; j++)
                {
                    int dx = data[i + 1, j] - data[i, j];
                    int dy = data[i, j + 1] - data[i, j];
                    dir[i, j] = Math.Abs(dx) + Math.Abs(dy);
                }
            }
            for (int i = 0; i < DH - 1; i++)
            {
                int j  = DW - 1;
                int dx = data[i + 1, j] - data[i, j];
                int dy = data[i, 0] - data[i, j];
                dir[i, j] = Math.Abs(dx) + Math.Abs(dy);
            }

            ContentBinaryWriter bw = new ContentBinaryWriter(File.Open(@"E:\Desktop\grad.raw", FileMode.OpenOrCreate));

            for (int i = 0; i < DH; i++)
            {
                for (int j = 0; j < DW; j++)
                {
                    if (dir[i, j] > ushort.MaxValue)
                    {
                        dir[i, j] = ushort.MaxValue;
                    }

                    bw.Write((ushort)dir[i, j]);
                }
            }
            bw.Close();
        }
Exemple #5
0
        private TerrainData()
        {
            //FileLocation fl = FileSystem.Instance.Locate("terrain_l0.tdmp", GameFileLocs.Terrain);
            //reader0 = new ContentBinaryReader(fl);

            FileLocation        fl      = FileSystem.Instance.Locate("terrain_l2.tdmp", GameFileLocs.Terrain);
            ContentBinaryReader reader1 = new ContentBinaryReader(fl);

            data0 = new ushort[DataWidth1 * DataHeight1];
            for (int i = 0; i < DataHeight1; i++)
            {
                for (int j = 0; j < DataWidth1; j++)
                {
                    data0[i * DataWidth1 + j] = reader1.ReadUInt16();
                }
            }
            reader1.Close();



            fl = FileSystem.Instance.Locate("terrain_l3.tdmp", GameFileLocs.Terrain);
            ContentBinaryReader reader2 = new ContentBinaryReader(fl);

            data1 = new ushort[DataHeight2 * DataWidth2];
            for (int i = 0; i < DataHeight2; i++)
            {
                for (int j = 0; j < DataWidth2; j++)
                {
                    data1[i * DataWidth2 + j] = reader2.ReadUInt16();
                }
            }
            reader2.Close();



            //fl = FileSystem.Instance.Locate("flags.dat", GameFileLocs.Terrain);

            //existData = new bool[36, 14];
            //ContentBinaryReader br = new ContentBinaryReader(fl);
            //for (int i = 0; i < 36; i++)
            //{
            //    for (int j = 0; j < 14; j++)
            //    {
            //        existData[i, j] = br.ReadBoolean();
            //    }
            //}
            //br.Close();
        }
Exemple #6
0
        private PlantDensity()
        {
            densityTable = new byte[TypeCount][];
            for (int i = 0; i < TypeCount; i++)
            {
                FileLocation fl = FileSystem.Instance.Locate(TableNames[i], GameFileLocs.Nature);

                ContentBinaryReader br = new ContentBinaryReader(fl);
                densityTable[i] = br.ReadBytes(Width * Height);

                br.Close();
            }

            //density = new byte[Width * Height];
            FileLocation        fl2 = FileSystem.Instance.Locate(DensityFile, GameFileLocs.Nature);
            ContentBinaryReader br2 = new ContentBinaryReader(fl2);

            density = br2.ReadBytes(Width * Height);
            br2.Close();
        }
Exemple #7
0
        private void MeasureCharWidth(string fontName)
        {
            FileLocation        fl = FileSystem.Instance.Locate(fontName + ".raw", GameFileLocs.GUI);
            ContentBinaryReader br = new ContentBinaryReader(fl);

            byte[] buffur = br.ReadBytes(fl.Size);
            //rowPitch = (int)fs.Length / font.Height;

            for (int row = 0; row < charsPerHeight; row++)
            {
                for (int col = 0; col < charsPerWidth; col++)
                {
                    byte ascii = Find(row, col);
                    if (ascii != 0)
                    {
                        CharWidthHelper(buffur, col * charWidth, row * charHeight, ascii);
                    }
                }
            }

            br.Close();
        }
Exemple #8
0
        static void Build3()
        {
            FileLocation        fl = new FileLocation(@"E:\Desktop\grad.raw");
            ContentBinaryReader br = new ContentBinaryReader(fl);

            const int DW = 36 * 32;
            const int DH = 14 * 32;


            Apoc3D.BitTable b = new Apoc3D.BitTable(DW * DH);
            for (int i = 0; i < DH; i++)
            {
                for (int j = 0; j < DW; j++)
                {
                    ushort v = br.ReadUInt16();

                    b.SetBit(i * DW + j, v > 32767);
                }
            }


            br.Close();
            b.Save(File.Open(@"E:\Desktop\grad.bit", FileMode.OpenOrCreate));
        }
Exemple #9
0
        static unsafe void Grid()
        {
            //const int CellSpan = 3;
            const string SrcDir = @"E:\Documents\ic10gd\Source\Code2015\bin\x86\Debug\terrain\terrain_l2.tdmp";

            ContentBinaryReader br = new ContentBinaryReader(new FileLocation(SrcDir));
            const int           DW = 33 * 36;
            const int           DH = 33 * 14;

            byte[] hgtData = new byte[DW * DH];
            for (int i = 0; i < DW * DH; i++)
            {
                float h = br.ReadUInt16() / (float)ushort.MaxValue;
                hgtData[i] = (byte)((byte)(h * 8) * 31);
            }
            br.Close();

            //ushort[] result = new ushort[DW * DH];
            //bool[] setFlag = new bool[DW * DH];
            //for (int i = 0; i < DH-2; i ++)
            //{
            //    int rem = i % 2;

            //    int st = rem == 0 ? 0 : 1;
            //    for (int j = st; j < DW - 2; j += 2)
            //    {
            //        int top = i * DW + j + 1;
            //        int left = (i + 1) * DW + j;
            //        int right = (i + 1) * DW + j + 2;
            //        int bottom = (i + 2) * DW + j + 1;

            //        ushort vtop = setFlag[top] ? result[top] : hgtData[top];
            //        ushort vleft = setFlag[left] ? result[left] : hgtData[left];
            //        ushort vright = setFlag[right] ? result[right] : hgtData[right];
            //        ushort vbottom = setFlag[bottom] ? result[bottom] : hgtData[bottom];

            //        ushort vcenter = (ushort)((vtop + vleft + vright + vbottom) / 4);

            //        int v = vcenter + vcenter - vtop;

            //        if (v < 0) v = 0;
            //        else if (v > ushort.MaxValue) v = ushort.MaxValue;
            //        vbottom = (ushort)v;

            //        //if (!setFlag[top])
            //        {
            //            result[top] = vcenter;// vtop;
            //            setFlag[top] = true;
            //        }

            //        //if (!setFlag[left])
            //        {
            //            result[left] = vcenter;//vleft;
            //            setFlag[left] = true;
            //        }

            //        //if (!setFlag[right])
            //        {
            //            result[right] = vcenter;//vright;
            //            setFlag[right] = true;
            //        }

            //        //if (!setFlag[bottom])
            //        {
            //            result[bottom] = vcenter;// vbottom;
            //            setFlag[bottom] = true;
            //        }

            //        int center = (i + 1) * DW + j + 1;
            //        result[center] = vcenter;
            //        setFlag[center] = true;



            //    }
            //}


            ContentBinaryWriter bw = new ContentBinaryWriter(File.Open(@"E:\Desktop\res.raw", FileMode.OpenOrCreate));

            for (int i = 0; i < DW * DH; i++)
            {
                bw.Write(hgtData[i]);
            }

            bw.Close();
        }
        public unsafe override void Convert(ResourceLocation source, ResourceLocation dest)
        {
            const int TL          = 513;
            const int DW          = TL * 36;
            const int DH          = TL * 14;
            const int NL          = TL - 1;
            const int HeightScale = 33;

            ContentBinaryReader br = new ContentBinaryReader(source);

            float[] data = new float[DH * DW];
            for (int i = 0; i < DH; i++)
            {
                for (int j = 0; j < DW; j++)
                {
                    data[i * DW + j] = (br.ReadUInt16() / 7.0f) / 7000f;
                    //data[i * DW + j] = br.ReadSingle();
                }
            }
            br.Close();

            // resample
            //data = Resize(data, DW, DH, DW, DH);

            //ContentBinaryWriter bw = new ContentBinaryWriter(File.Open(@"E:\Desktop\float.raw", FileMode.OpenOrCreate));
            //for (int i = 0; i < DH; i++)
            //    for (int j = 0; j < DW; j++)
            //        bw.Write(data[i * DW + j]);
            //bw.Close();

            //ContentBinaryWriter bw2 = new ContentBinaryWriter(File.Open(@"E:\Desktop\test.raw", FileMode.OpenOrCreate));
            //for (int i = 0; i < DH; i++)
            //    for (int j = 0; j < DW; j++)
            //        bw2.Write((ushort)(data[i * DW + j] * 7));
            //bw2.Close();

            for (int tx = 1; tx < 72; tx += 2)
            {
                for (int ty = 5; ty < 33; ty += 2)
                {
                    //string onm = @"E:\Documents\ic10gd\Source\Code2015\bin\x86\Debug\terrainNormal.lpk\tile_" + tx.ToString("D2") + "_" + ty.ToString("D2") + "_0.tex";

                    //if (!File.Exists(onm))
                    //    continue;

                    int baseI = TL * (ty - 5) / 2;
                    int baseJ = TL * ((tx - 1) / 2);

                    float[] result = new float[TL * TL];
                    for (int i = 0; i < TL; i++)
                    {
                        for (int j = 0; j < TL; j++)
                        {
                            result[i * TL + j] = data[(baseI + i) * DW + baseJ + j];
                        }
                    }

                    Vector3[] norm1 = new Vector3[NL * NL];

                    // TODO 不考虑海平面之下的
                    for (int i = 0; i < NL; i++)
                    {
                        for (int j = 0; j < NL; j++)
                        {
                            int idx = i * (TL) + j;

                            Vector3 u;
                            u.Y = HeightScale * (result[idx] - result[idx + 1]);
                            u.X = 1; u.Z = 0;

                            Vector3 v;
                            v.Y = HeightScale * (result[idx] - result[idx + TL]);
                            v.X = 0; v.Z = 1;


                            Vector3 n;
                            Vector3.Cross(ref v, ref u, out n);
                            n.Normalize();

                            float tmp = n.Z;
                            n.Z = n.Y;
                            n.Y = tmp;

                            norm1[i * NL + j] = n;
                        }
                    }

                    ColorValue[] nrmColor = new ColorValue[norm1.Length];
                    for (int i = 0; i < norm1.Length; i++)
                    {
                        nrmColor[i] = new ColorValue((uint)MathEx.Vector2ARGB(ref norm1[i]));
                    }
                    OutPng(nrmColor, NL, NL, @"E:\Desktop\out\tile_" + tx.ToString("D2") + "_" + ty.ToString("D2") + "_0.png");
                }
            }


            //return;
            //const int twid = 512;
            //const int thgt = 512;

            //const float HeightScale = 33;

            //TDMPIO src = new TDMPIO();
            //src.Load(source);

            //float[] data = src.Data;// TDmpLodGen.Resize(src.Data, src.Width, src.Height, twid + 1, thgt + 1);
            //int width = src.Width - 1;
            //int height = src.Height - 1;
            //Vector3[] norm1 = new Vector3[width * height];

            //for (int i = 0; i < height; i++)
            //{
            //    for (int j = 0; j < width; j++)
            //    {
            //        int idx = i * (src.Width) + j;

            //        Vector3 u;
            //        u.Y = HeightScale * (data[idx] - data[idx + 1]);
            //        u.X = 1; u.Z = 0;

            //        Vector3 v;
            //        v.Y = HeightScale * (data[idx] - data[idx + src.Width]);
            //        v.X = 0; v.Z = 1;


            //        Vector3 n;
            //        Vector3.Cross(ref v, ref u, out n);
            //        n.Normalize();

            //        norm1[i * width + j] = n;
            //    }
            //}

            //width = twid;
            //height = thgt;

            //int level = 0;
            //while (width > 16)
            //{
            //    Vector3[] norm2;
            //    if (src.Width - 1 == width && src.Height - 1 == height)
            //        norm2 = norm1;
            //    else
            //        norm2 = Resize(norm1, src.Width - 1, src.Height - 1, width, height);

            //    ColorValue[] nrmColor = new ColorValue[norm2.Length];
            //    for (int i = 0; i < norm2.Length; i++)
            //    {
            //        nrmColor[i] = new ColorValue((uint)MathEx.Vector2ARGB(ref norm2[i]));
            //    }

            //    TextureData nrmMap;
            //    nrmMap.LevelCount = 1;
            //    nrmMap.Format = ImagePixelFormat.A8R8G8B8;
            //    nrmMap.Type = TextureType.Texture2D;
            //    nrmMap.ContentSize = Apoc3D.Media.PixelFormat.GetMemorySize(width, height, 1, ImagePixelFormat.A8R8G8B8);
            //    nrmMap.Levels = new TextureLevelData[1];
            //    nrmMap.Levels[0].Depth = 1;
            //    nrmMap.Levels[0].Height = width;
            //    nrmMap.Levels[0].Width = height;
            //    nrmMap.Levels[0].LevelSize = nrmMap.ContentSize;
            //    nrmMap.Levels[0].Content = new byte[nrmMap.ContentSize];

            //    fixed (ColorValue* srcp = &nrmColor[0])
            //    {
            //        fixed (byte* dstp = &nrmMap.Levels[0].Content[0])
            //        {
            //            Memory.Copy(srcp, dstp, nrmMap.ContentSize);
            //        }
            //    }


            //    FileLocation fl = dest as FileLocation;
            //    if (fl != null)
            //    {
            //        string file = Path.Combine(Path.GetDirectoryName(fl.Path),
            //            Path.GetFileNameWithoutExtension(fl.Path) + "_" + level.ToString());

            //        nrmMap.Save(File.Open(file + TextureData.Extension, FileMode.OpenOrCreate, FileAccess.Write));

            //        OutPng(nrmColor, width, height, file + ".png");
            //    }

            //    width /= 4;
            //    height /= 4;
            //    level++;
            //}
        }
Exemple #11
0
        private TerrainData()
        {
            //FileLocation fl = FileSystem.Instance.Locate("terrain_l0.tdmp", GameFileLocs.Terrain);
            //reader0 = new ContentBinaryReader(fl);

            FileLocation fl = FileSystem.Instance.Locate("terrain_l2.tdmp", GameFileLocs.Terrain);
            ContentBinaryReader reader1 = new ContentBinaryReader(fl);

            data0 = new ushort[DataWidth1 * DataHeight1];
            for (int i = 0; i < DataHeight1; i++)
            {
                for (int j = 0; j < DataWidth1; j++)
                {
                    data0[i * DataWidth1 + j] = reader1.ReadUInt16();
                }
            }
            reader1.Close();



            fl = FileSystem.Instance.Locate("terrain_l3.tdmp", GameFileLocs.Terrain);
            ContentBinaryReader reader2 = new ContentBinaryReader(fl);

            data1 = new ushort[DataHeight2 * DataWidth2];
            for (int i = 0; i < DataHeight2; i++)
            {
                for (int j = 0; j < DataWidth2; j++)
                {
                    data1[i * DataWidth2 + j] = reader2.ReadUInt16();
                }
            }
            reader2.Close();



            //fl = FileSystem.Instance.Locate("flags.dat", GameFileLocs.Terrain);

            //existData = new bool[36, 14];
            //ContentBinaryReader br = new ContentBinaryReader(fl);
            //for (int i = 0; i < 36; i++)
            //{
            //    for (int j = 0; j < 14; j++)
            //    {
            //        existData[i, j] = br.ReadBoolean();
            //    }
            //}
            //br.Close();
        }
Exemple #12
0
        static unsafe void Grid()
        {
            //const int CellSpan = 3;
            const string SrcDir = @"E:\Documents\ic10gd\Source\Code2015\bin\x86\Debug\terrain\terrain_l2.tdmp";

            ContentBinaryReader br = new ContentBinaryReader(new FileLocation(SrcDir));
            const int DW = 33 * 36;
            const int DH = 33 * 14;

            byte[] hgtData = new byte[DW * DH];
            for (int i = 0; i < DW * DH; i++)
            {
                float h = br.ReadUInt16() / (float)ushort.MaxValue;
                hgtData[i] = (byte)((byte)(h * 8) * 31);

            }
            br.Close();

            //ushort[] result = new ushort[DW * DH];
            //bool[] setFlag = new bool[DW * DH];
            //for (int i = 0; i < DH-2; i ++)
            //{
            //    int rem = i % 2;

            //    int st = rem == 0 ? 0 : 1;
            //    for (int j = st; j < DW - 2; j += 2)
            //    {
            //        int top = i * DW + j + 1;
            //        int left = (i + 1) * DW + j;
            //        int right = (i + 1) * DW + j + 2;
            //        int bottom = (i + 2) * DW + j + 1;

            //        ushort vtop = setFlag[top] ? result[top] : hgtData[top];
            //        ushort vleft = setFlag[left] ? result[left] : hgtData[left];
            //        ushort vright = setFlag[right] ? result[right] : hgtData[right];
            //        ushort vbottom = setFlag[bottom] ? result[bottom] : hgtData[bottom];

            //        ushort vcenter = (ushort)((vtop + vleft + vright + vbottom) / 4);

            //        int v = vcenter + vcenter - vtop;

            //        if (v < 0) v = 0;
            //        else if (v > ushort.MaxValue) v = ushort.MaxValue;
            //        vbottom = (ushort)v;

            //        //if (!setFlag[top])
            //        {
            //            result[top] = vcenter;// vtop;
            //            setFlag[top] = true;
            //        }

            //        //if (!setFlag[left])
            //        {
            //            result[left] = vcenter;//vleft;
            //            setFlag[left] = true;
            //        }

            //        //if (!setFlag[right])
            //        {
            //            result[right] = vcenter;//vright;
            //            setFlag[right] = true;
            //        }

            //        //if (!setFlag[bottom])
            //        {
            //            result[bottom] = vcenter;// vbottom;
            //            setFlag[bottom] = true;
            //        }

            //        int center = (i + 1) * DW + j + 1;
            //        result[center] = vcenter;
            //        setFlag[center] = true;



            //    }
            //}


            ContentBinaryWriter bw = new ContentBinaryWriter(File.Open(@"E:\Desktop\res.raw", FileMode.OpenOrCreate));
            for (int i = 0; i < DW * DH; i++)
            {
                bw.Write(hgtData[i]);
            }

            bw.Close();
        }
Exemple #13
0
        static void Build3() 
        {
            FileLocation fl = new FileLocation(@"E:\Desktop\grad.raw");
            ContentBinaryReader br = new ContentBinaryReader(fl);

            const int DW = 36 * 32;
            const int DH = 14 * 32;


            Apoc3D.BitTable b = new Apoc3D.BitTable(DW * DH);
            for (int i = 0; i < DH; i++)
            {
                for (int j = 0; j < DW; j++)
                {
                    ushort v = br.ReadUInt16();

                    b.SetBit(i * DW + j, v > 32767);
                }
            }


            br.Close();
            b.Save(File.Open(@"E:\Desktop\grad.bit", FileMode.OpenOrCreate));
        }
Exemple #14
0
        static void BuildBitMap()
        {
            FileLocation fl = new FileLocation(@"E:\Desktop\terrain_l2副本.raw");
            ContentBinaryReader br = new ContentBinaryReader(fl);

            const int DW = 36 * 32;
            const int DH = 14 * 32;

            ushort[,] data = new ushort[DH, DW];

            for (int i = 0; i < DH; i++)
            {
                for (int j = 0; j < DW; j++)
                {
                    ushort v = br.ReadUInt16();
                    data[i, j] = Math.Max(v, (ushort)(1640*7));// br.ReadUInt16();
                }
            }

            br.Close();

            int[,] dir = new int[DH, DW];

            for (int i = 0; i < DH - 1; i++) 
            {
                for (int j = 0; j < DW - 1; j++) 
                {
                    int dx = data[i + 1, j] - data[i, j];
                    int dy = data[i, j + 1] - data[i, j];
                    dir[i, j] = Math.Abs(dx) + Math.Abs(dy);
                }
            }
            for (int i = 0; i < DH - 1; i++)
            {
                int j = DW - 1;
                int dx = data[i + 1, j] - data[i, j];
                int dy = data[i, 0] - data[i, j];
                dir[i, j] = Math.Abs(dx) + Math.Abs(dy);
            }

            ContentBinaryWriter bw = new ContentBinaryWriter(File.Open(@"E:\Desktop\grad.raw", FileMode.OpenOrCreate));
            for (int i = 0; i < DH; i++)
            {
                for (int j = 0; j < DW; j++)
                {
                    if (dir[i, j] > ushort.MaxValue)
                        dir[i, j] = ushort.MaxValue;

                    bw.Write((ushort)dir[i, j]);
                }
            }
            bw.Close();
        }
Exemple #15
0
        private void MeasureCharWidth(string fontName)
        {
            FileLocation fl = FileSystem.Instance.Locate(fontName + ".raw", GameFileLocs.GUI);
            ContentBinaryReader br = new ContentBinaryReader(fl);
            byte[] buffur = br.ReadBytes(fl.Size);
            //rowPitch = (int)fs.Length / font.Height;

            for (int row = 0; row < charsPerHeight; row++)
            {
                for (int col = 0; col < charsPerWidth; col++)
                {
                    byte ascii = Find(row, col);
                    if (ascii != 0)
                    {
                        CharWidthHelper(buffur, col * charWidth, row * charHeight, ascii);
                    }
                    
                }

            }

            br.Close();
        }
        private PlantDensity()
        {
            densityTable = new byte[TypeCount][];
            for (int i = 0; i < TypeCount; i++)
            {
                FileLocation fl = FileSystem.Instance.Locate(TableNames[i], GameFileLocs.Nature);

                ContentBinaryReader br = new ContentBinaryReader(fl);
                densityTable[i] = br.ReadBytes(Width * Height);

                br.Close();
            }

            //density = new byte[Width * Height];
            FileLocation fl2 = FileSystem.Instance.Locate(DensityFile, GameFileLocs.Nature);
            ContentBinaryReader br2 = new ContentBinaryReader(fl2);
            density = br2.ReadBytes(Width * Height);
            br2.Close();
        }