Example #1
0
 public void LumpNumberDoom2()
 {
     using (var wad = new Wad(WadPath.Doom2))
     {
         Assert.AreEqual(0, wad.GetLumpNumber("PLAYPAL"));
         Assert.AreEqual(1, wad.GetLumpNumber("COLORMAP"));
         Assert.AreEqual(6, wad.GetLumpNumber("MAP01"));
         Assert.AreEqual(2918, wad.GetLumpNumber("F_END"));
         Assert.AreEqual(2919, wad.LumpInfos.Count);
     }
 }
Example #2
0
 public void LumpNumberDoom1()
 {
     using (var wad = new Wad(WadPath.Doom1))
     {
         Assert.AreEqual(0, wad.GetLumpNumber("PLAYPAL"));
         Assert.AreEqual(1, wad.GetLumpNumber("COLORMAP"));
         Assert.AreEqual(7, wad.GetLumpNumber("E1M1"));
         Assert.AreEqual(2305, wad.GetLumpNumber("F_END"));
         Assert.AreEqual(2306, wad.LumpInfos.Count);
     }
 }
Example #3
0
 public void FlatSizeDoom2()
 {
     using (var wad = new Wad(WadPath.Doom2))
     {
         var start = wad.GetLumpNumber("F_START") + 1;
         var end   = wad.GetLumpNumber("F_END");
         for (var lump = start; lump < end; lump++)
         {
             var size = wad.GetLumpSize(lump);
             Assert.IsTrue(size == 0 || size == 4096);
         }
     }
 }
Example #4
0
        public void LoadMap01()
        {
            using (var wad = new Wad(WadPath.Doom2))
            {
                var flats      = new FlatLookup(wad, true);
                var textures   = new TextureLookup(wad, true);
                var map        = wad.GetLumpNumber("MAP01");
                var vertices   = Vertex.FromWad(wad, map + 4);
                var sectors    = Sector.FromWad(wad, map + 8, flats);
                var sides      = SideDef.FromWad(wad, map + 3, textures, sectors);
                var lines      = LineDef.FromWad(wad, map + 2, vertices, sides);
                var segs       = Seg.FromWad(wad, map + 5, vertices, lines);
                var subsectors = Subsector.FromWad(wad, map + 6, segs);

                Assert.AreEqual(194, subsectors.Length);

                Assert.AreEqual(4, subsectors[0].SegCount);
                for (var i = 0; i < 4; i++)
                {
                    Assert.IsTrue(segs[subsectors[0].FirstSeg + i] == segs[i]);
                }

                Assert.AreEqual(4, subsectors[57].SegCount);
                for (var i = 0; i < 4; i++)
                {
                    Assert.IsTrue(segs[subsectors[57].FirstSeg + i] == segs[179 + i]);
                }

                Assert.AreEqual(4, subsectors[193].SegCount);
                for (var i = 0; i < 4; i++)
                {
                    Assert.IsTrue(segs[subsectors[193].FirstSeg + i] == segs[597 + i]);
                }
            }
        }
Example #5
0
        public void LoadMap01()
        {
            using (var wad = new Wad(WadPath.Doom2))
            {
                var map     = wad.GetLumpNumber("MAP01");
                var flats   = new FlatLookup(wad, false);
                var sectors = Sector.FromWad(wad, map + 8, flats);

                Assert.AreEqual(59, sectors.Length);

                Assert.AreEqual(8, sectors[0].FloorHeight.ToDouble(), delta);
                Assert.AreEqual(264, sectors[0].CeilingHeight.ToDouble(), delta);
                Assert.AreEqual("FLOOR0_1", flats[sectors[0].FloorFlat].Name);
                Assert.AreEqual("FLOOR4_1", flats[sectors[0].CeilingFlat].Name);
                Assert.AreEqual(128, sectors[0].LightLevel);
                Assert.AreEqual(SectorSpecial.Normal, sectors[0].Special);
                Assert.AreEqual(0, sectors[0].Tag);

                Assert.AreEqual(56, sectors[57].FloorHeight.ToDouble(), delta);
                Assert.AreEqual(184, sectors[57].CeilingHeight.ToDouble(), delta);
                Assert.AreEqual("FLOOR3_3", flats[sectors[57].FloorFlat].Name);
                Assert.AreEqual("CEIL3_3", flats[sectors[57].CeilingFlat].Name);
                Assert.AreEqual(144, sectors[57].LightLevel);
                Assert.AreEqual((SectorSpecial)9, sectors[57].Special);
                Assert.AreEqual(0, sectors[57].Tag);

                Assert.AreEqual(56, sectors[58].FloorHeight.ToDouble(), delta);
                Assert.AreEqual(56, sectors[58].CeilingHeight.ToDouble(), delta);
                Assert.AreEqual("FLOOR3_3", flats[sectors[58].FloorFlat].Name);
                Assert.AreEqual("FLAT20", flats[sectors[58].CeilingFlat].Name);
                Assert.AreEqual(144, sectors[58].LightLevel);
                Assert.AreEqual(SectorSpecial.Normal, sectors[58].Special);
                Assert.AreEqual(6, sectors[58].Tag);
            }
        }
Example #6
0
        public void LoadE1M1()
        {
            using (var wad = new Wad(WadPath.Doom1))
            {
                var map     = wad.GetLumpNumber("E1M1");
                var flats   = new FlatLookup(wad, false);
                var sectors = Sector.FromWad(wad, map + 8, flats);

                Assert.AreEqual(88, sectors.Length);

                Assert.AreEqual(-80, sectors[0].FloorHeight.ToDouble(), delta);
                Assert.AreEqual(216, sectors[0].CeilingHeight.ToDouble(), delta);
                Assert.AreEqual("NUKAGE3", flats[sectors[0].FloorFlat].Name);
                Assert.AreEqual("F_SKY1", flats[sectors[0].CeilingFlat].Name);
                Assert.AreEqual(255, sectors[0].LightLevel);
                Assert.AreEqual((SectorSpecial)7, sectors[0].Special);
                Assert.AreEqual(0, sectors[0].Tag);

                Assert.AreEqual(0, sectors[42].FloorHeight.ToDouble(), delta);
                Assert.AreEqual(264, sectors[42].CeilingHeight.ToDouble(), delta);
                Assert.AreEqual("FLOOR7_1", flats[sectors[42].FloorFlat].Name);
                Assert.AreEqual("F_SKY1", flats[sectors[42].CeilingFlat].Name);
                Assert.AreEqual(255, sectors[42].LightLevel);
                Assert.AreEqual((SectorSpecial)0, sectors[42].Special);
                Assert.AreEqual(0, sectors[42].Tag);

                Assert.AreEqual(104, sectors[87].FloorHeight.ToDouble(), delta);
                Assert.AreEqual(184, sectors[87].CeilingHeight.ToDouble(), delta);
                Assert.AreEqual("FLOOR4_8", flats[sectors[87].FloorFlat].Name);
                Assert.AreEqual("FLOOR6_2", flats[sectors[87].CeilingFlat].Name);
                Assert.AreEqual(128, sectors[87].LightLevel);
                Assert.AreEqual((SectorSpecial)9, sectors[87].Special);
                Assert.AreEqual(2, sectors[87].Tag);
            }
        }
Example #7
0
        public void LoadE1M1()
        {
            using (var wad = new Wad(WadPath.Doom1))
            {
                var map    = wad.GetLumpNumber("E1M1");
                var things = MapThing.FromWad(wad, map + 1);

                Assert.AreEqual(143, things.Length);

                Assert.AreEqual(1056, things[0].X.ToDouble(), delta);
                Assert.AreEqual(-3616, things[0].Y.ToDouble(), delta);
                Assert.AreEqual(90, things[0].Angle.ToDegree(), delta);
                Assert.AreEqual(1, things[0].Type);
                Assert.AreEqual(7, (int)things[0].Flags);

                Assert.AreEqual(3072, things[57].X.ToDouble(), delta);
                Assert.AreEqual(-4832, things[57].Y.ToDouble(), delta);
                Assert.AreEqual(180, things[57].Angle.ToDegree(), delta);
                Assert.AreEqual(2015, things[57].Type);
                Assert.AreEqual(7, (int)things[57].Flags);

                Assert.AreEqual(736, things[142].X.ToDouble(), delta);
                Assert.AreEqual(-2976, things[142].Y.ToDouble(), delta);
                Assert.AreEqual(90, things[142].Angle.ToDegree(), delta);
                Assert.AreEqual(2001, things[142].Type);
                Assert.AreEqual(23, (int)things[142].Flags);
            }
        }
Example #8
0
        public void LoadMap01()
        {
            using (var wad = new Wad(WadPath.Doom2))
            {
                var map    = wad.GetLumpNumber("MAP01");
                var things = MapThing.FromWad(wad, map + 1);

                Assert.AreEqual(69, things.Length);

                Assert.AreEqual(-96, things[0].X.ToDouble(), delta);
                Assert.AreEqual(784, things[0].Y.ToDouble(), delta);
                Assert.AreEqual(90, things[0].Angle.ToDegree(), delta);
                Assert.AreEqual(1, things[0].Type);
                Assert.AreEqual(7, (int)things[0].Flags);

                Assert.AreEqual(-288, things[57].X.ToDouble(), delta);
                Assert.AreEqual(976, things[57].Y.ToDouble(), delta);
                Assert.AreEqual(270, things[57].Angle.ToDegree(), delta);
                Assert.AreEqual(2006, things[57].Type);
                Assert.AreEqual(23, (int)things[57].Flags);

                Assert.AreEqual(-480, things[68].X.ToDouble(), delta);
                Assert.AreEqual(848, things[68].Y.ToDouble(), delta);
                Assert.AreEqual(0, things[68].Angle.ToDegree(), delta);
                Assert.AreEqual(2005, things[68].Type);
                Assert.AreEqual(7, (int)things[68].Flags);
            }
        }
Example #9
0
        public void LoadE1M1()
        {
            using (var wad = new Wad(WadPath.Doom1))
            {
                var flats      = new FlatLookup(wad, true);
                var textures   = new TextureLookup(wad, true);
                var map        = wad.GetLumpNumber("E1M1");
                var vertices   = Vertex.FromWad(wad, map + 4);
                var sectors    = Sector.FromWad(wad, map + 8, flats);
                var sides      = SideDef.FromWad(wad, map + 3, textures, sectors);
                var lines      = LineDef.FromWad(wad, map + 2, vertices, sides);
                var segs       = Seg.FromWad(wad, map + 5, vertices, lines);
                var subsectors = Subsector.FromWad(wad, map + 6, segs);

                Assert.AreEqual(239, subsectors.Length);

                Assert.AreEqual(8, subsectors[0].SegCount);
                for (var i = 0; i < 8; i++)
                {
                    Assert.IsTrue(segs[subsectors[0].FirstSeg + i] == segs[0 + i]);
                }

                Assert.AreEqual(1, subsectors[54].SegCount);
                for (var i = 0; i < 1; i++)
                {
                    Assert.IsTrue(segs[subsectors[54].FirstSeg + i] == segs[181 + i]);
                }

                Assert.AreEqual(2, subsectors[238].SegCount);
                for (var i = 0; i < 2; i++)
                {
                    Assert.IsTrue(segs[subsectors[238].FirstSeg + i] == segs[745 + i]);
                }
            }
        }
Example #10
0
        public SfmlSound(Config config, Wad wad)
        {
            try
            {
                Console.Write("Initialize sound: ");

                this.config = config;

                config.audio_soundvolume = Math.Clamp(config.audio_soundvolume, 0, MaxVolume);

                buffers    = new SoundBuffer[DoomInfo.SfxNames.Length];
                amplitudes = new float[DoomInfo.SfxNames.Length];

                for (var i = 0; i < DoomInfo.SfxNames.Length; i++)
                {
                    var name = "DS" + DoomInfo.SfxNames[i];
                    var lump = wad.GetLumpNumber(name);
                    if (lump == -1)
                    {
                        continue;
                    }

                    int sampleRate;
                    int sampleCount;
                    var samples = GetSamples(wad, name, out sampleRate, out sampleCount);
                    if (samples != null)
                    {
                        buffers[i]    = new SoundBuffer(samples, 1, (uint)sampleRate);
                        amplitudes[i] = GetAmplitude(samples, sampleRate, sampleCount);
                    }
                }

                channels = new Sound[channelCount];
                infos    = new ChannelInfo[channelCount];
                for (var i = 0; i < channels.Length; i++)
                {
                    channels[i] = new Sound();
                    infos[i]    = new ChannelInfo();
                }

                uiChannel  = new Sound();
                uiReserved = Sfx.NONE;

                masterVolumeDecay = (float)config.audio_soundvolume / MaxVolume;

                lastUpdate = DateTime.MinValue;

                Console.WriteLine("OK");
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed");
                Dispose();
                ExceptionDispatchInfo.Throw(e);
            }
        }
Example #11
0
        public void LoadE1M1()
        {
            using (var wad = new Wad(WadPath.Doom1))
            {
                var flats    = new DummyFlatLookup(wad);
                var textures = new DummyTextureLookup(wad);
                var map      = wad.GetLumpNumber("E1M1");
                var vertices = Vertex.FromWad(wad, map + 4);
                var sectors  = Sector.FromWad(wad, map + 8, flats);
                var sides    = SideDef.FromWad(wad, map + 3, textures, sectors);
                var lines    = LineDef.FromWad(wad, map + 2, vertices, sides);
                var segs     = Seg.FromWad(wad, map + 5, vertices, lines);

                Assert.AreEqual(747, segs.Length);

                Assert.IsTrue(segs[0].Vertex1 == vertices[132]);
                Assert.IsTrue(segs[0].Vertex2 == vertices[133]);
                Assert.AreEqual(ToRadian(4156), segs[0].Angle.ToRadian(), delta);
                Assert.IsTrue(segs[0].LineDef == lines[160]);
                Assert.IsTrue((segs[0].LineDef.Flags & LineFlags.TwoSided) != 0);
                Assert.IsTrue(segs[0].FrontSector == segs[0].LineDef.FrontSide.Sector);
                Assert.IsTrue(segs[0].BackSector == segs[0].LineDef.BackSide.Sector);
                Assert.AreEqual(0, segs[0].Offset.ToDouble(), delta);

                Assert.IsTrue(segs[28].Vertex1 == vertices[390]);
                Assert.IsTrue(segs[28].Vertex2 == vertices[131]);
                Assert.AreEqual(ToRadian(-32768), segs[28].Angle.ToRadian(), delta);
                Assert.IsTrue(segs[28].LineDef == lines[480]);
                Assert.IsTrue((segs[0].LineDef.Flags & LineFlags.TwoSided) != 0);
                Assert.IsTrue(segs[28].FrontSector == segs[28].LineDef.BackSide.Sector);
                Assert.IsTrue(segs[28].BackSector == segs[28].LineDef.FrontSide.Sector);
                Assert.AreEqual(0, segs[28].Offset.ToDouble(), delta);

                Assert.IsTrue(segs[744].Vertex1 == vertices[446]);
                Assert.IsTrue(segs[744].Vertex2 == vertices[374]);
                Assert.AreEqual(ToRadian(-16384), segs[744].Angle.ToRadian(), delta);
                Assert.IsTrue(segs[744].LineDef == lines[452]);
                Assert.IsTrue((segs[744].LineDef.Flags & LineFlags.TwoSided) == 0);
                Assert.IsTrue(segs[744].FrontSector == segs[744].LineDef.FrontSide.Sector);
                Assert.IsTrue(segs[744].BackSector == null);
                Assert.AreEqual(154, segs[744].Offset.ToDouble(), delta);

                Assert.IsTrue(segs[746].Vertex1 == vertices[374]);
                Assert.IsTrue(segs[746].Vertex2 == vertices[368]);
                Assert.AreEqual(ToRadian(-13828), segs[746].Angle.ToRadian(), delta);
                Assert.IsTrue(segs[746].LineDef == lines[451]);
                Assert.IsTrue((segs[746].LineDef.Flags & LineFlags.TwoSided) == 0);
                Assert.IsTrue(segs[746].FrontSector == segs[746].LineDef.FrontSide.Sector);
                Assert.IsTrue(segs[746].BackSector == null);
                Assert.AreEqual(0, segs[746].Offset.ToDouble(), delta);
            }
        }
Example #12
0
        public void LoadMap01()
        {
            using (var wad = new Wad(WadPath.Doom2))
            {
                var flats    = new DummyFlatLookup(wad);
                var textures = new DummyTextureLookup(wad);
                var map      = wad.GetLumpNumber("MAP01");
                var vertices = Vertex.FromWad(wad, map + 4);
                var sectors  = Sector.FromWad(wad, map + 8, flats);
                var sides    = SideDef.FromWad(wad, map + 3, textures, sectors);
                var lines    = LineDef.FromWad(wad, map + 2, vertices, sides);
                var segs     = Seg.FromWad(wad, map + 5, vertices, lines);

                Assert.AreEqual(601, segs.Length);

                Assert.IsTrue(segs[0].Vertex1 == vertices[9]);
                Assert.IsTrue(segs[0].Vertex2 == vertices[316]);
                Assert.AreEqual(ToRadian(-32768), segs[0].Angle.ToRadian(), delta);
                Assert.IsTrue(segs[0].LineDef == lines[8]);
                Assert.IsTrue((segs[0].LineDef.Flags & LineFlags.TwoSided) != 0);
                Assert.IsTrue(segs[0].FrontSector == segs[0].LineDef.FrontSide.Sector);
                Assert.IsTrue(segs[0].BackSector == segs[0].LineDef.BackSide.Sector);
                Assert.AreEqual(0, segs[0].Offset.ToDouble(), delta);

                Assert.IsTrue(segs[42].Vertex1 == vertices[26]);
                Assert.IsTrue(segs[42].Vertex2 == vertices[320]);
                Assert.AreEqual(ToRadian(-22209), segs[42].Angle.ToRadian(), delta);
                Assert.IsTrue(segs[42].LineDef == lines[33]);
                Assert.IsTrue((segs[42].LineDef.Flags & LineFlags.TwoSided) != 0);
                Assert.IsTrue(segs[42].FrontSector == segs[42].LineDef.BackSide.Sector);
                Assert.IsTrue(segs[42].BackSector == segs[42].LineDef.FrontSide.Sector);
                Assert.AreEqual(0, segs[42].Offset.ToDouble(), delta);

                Assert.IsTrue(segs[103].Vertex1 == vertices[331]);
                Assert.IsTrue(segs[103].Vertex2 == vertices[329]);
                Assert.AreEqual(ToRadian(16384), segs[103].Angle.ToRadian(), delta);
                Assert.IsTrue(segs[103].LineDef == lines[347]);
                Assert.IsTrue((segs[103].LineDef.Flags & LineFlags.TwoSided) == 0);
                Assert.IsTrue(segs[103].FrontSector == segs[103].LineDef.FrontSide.Sector);
                Assert.IsTrue(segs[103].BackSector == null);
                Assert.AreEqual(64, segs[103].Offset.ToDouble(), delta);

                Assert.IsTrue(segs[600].Vertex1 == vertices[231]);
                Assert.IsTrue(segs[600].Vertex2 == vertices[237]);
                Assert.AreEqual(ToRadian(-16384), segs[600].Angle.ToRadian(), delta);
                Assert.IsTrue(segs[600].LineDef == lines[271]);
                Assert.IsTrue((segs[600].LineDef.Flags & LineFlags.TwoSided) != 0);
                Assert.IsTrue(segs[600].FrontSector == segs[600].LineDef.BackSide.Sector);
                Assert.IsTrue(segs[600].BackSector == segs[600].LineDef.FrontSide.Sector);
                Assert.AreEqual(0, segs[600].Offset.ToDouble(), delta);
            }
        }
Example #13
0
        public DrawScreen(Wad wad, int width, int height)
        {
            this.width  = width;
            this.height = height;
            data        = new byte[width * height];

            chars = new Patch[128];
            for (var i = 0; i < chars.Length; i++)
            {
                var name = "STCFN" + i.ToString("000");
                var lump = wad.GetLumpNumber(name);
                if (lump != -1)
                {
                    chars[i] = Patch.FromData(name, wad.ReadLump(lump));
                }
            }
        }
Example #14
0
        public void LoadMap01()
        {
            using (var wad = new Wad(WadPath.Doom2))
            {
                var flats    = new DummyFlatLookup(wad);
                var textures = new DummyTextureLookup(wad);
                var map      = wad.GetLumpNumber("MAP01");
                var vertices = Vertex.FromWad(wad, map + 4);
                var sectors  = Sector.FromWad(wad, map + 8, flats);
                var sides    = SideDef.FromWad(wad, map + 3, textures, sectors);
                var lines    = LineDef.FromWad(wad, map + 2, vertices, sides);

                Assert.AreEqual(370, lines.Length);

                Assert.IsTrue(lines[0].Vertex1 == vertices[0]);
                Assert.IsTrue(lines[0].Vertex2 == vertices[1]);
                Assert.IsTrue((int)lines[0].Flags == 1);
                Assert.IsTrue((int)lines[0].Special == 0);
                Assert.IsTrue(lines[0].Tag == 0);
                Assert.IsTrue(lines[0].FrontSide == sides[0]);
                Assert.IsTrue(lines[0].BackSide == null);
                Assert.IsTrue(lines[0].FrontSector == sides[0].Sector);
                Assert.IsTrue(lines[0].BackSector == null);

                Assert.IsTrue(lines[75].Vertex1 == vertices[73]);
                Assert.IsTrue(lines[75].Vertex2 == vertices[74]);
                Assert.IsTrue((int)lines[75].Flags == 4);
                Assert.IsTrue((int)lines[75].Special == 103);
                Assert.IsTrue(lines[75].Tag == 4);
                Assert.IsTrue(lines[75].FrontSide == sides[97]);
                Assert.IsTrue(lines[75].BackSide == sides[98]);
                Assert.IsTrue(lines[75].FrontSector == sides[97].Sector);
                Assert.IsTrue(lines[75].BackSector == sides[98].Sector);

                Assert.IsTrue(lines[369].Vertex1 == vertices[293]);
                Assert.IsTrue(lines[369].Vertex2 == vertices[299]);
                Assert.IsTrue((int)lines[369].Flags == 21);
                Assert.IsTrue((int)lines[369].Special == 0);
                Assert.IsTrue(lines[369].Tag == 0);
                Assert.IsTrue(lines[369].FrontSide == sides[527]);
                Assert.IsTrue(lines[369].BackSide == sides[528]);
                Assert.IsTrue(lines[369].FrontSector == sides[527].Sector);
                Assert.IsTrue(lines[369].BackSector == sides[528].Sector);
            }
        }
Example #15
0
        public void LoadE1M1()
        {
            using (var wad = new Wad(WadPath.Doom1))
            {
                var flats    = new DummyFlatLookup(wad);
                var textures = new DummyTextureLookup(wad);
                var map      = wad.GetLumpNumber("E1M1");
                var vertices = Vertex.FromWad(wad, map + 4);
                var sectors  = Sector.FromWad(wad, map + 8, flats);
                var sides    = SideDef.FromWad(wad, map + 3, textures, sectors);
                var lines    = LineDef.FromWad(wad, map + 2, vertices, sides);

                Assert.AreEqual(486, lines.Length);

                Assert.IsTrue(lines[0].Vertex1 == vertices[0]);
                Assert.IsTrue(lines[0].Vertex2 == vertices[1]);
                Assert.IsTrue((int)lines[0].Flags == 1);
                Assert.IsTrue((int)lines[0].Special == 0);
                Assert.IsTrue(lines[0].Tag == 0);
                Assert.IsTrue(lines[0].FrontSide == sides[0]);
                Assert.IsTrue(lines[0].BackSide == null);
                Assert.IsTrue(lines[0].FrontSector == sides[0].Sector);
                Assert.IsTrue(lines[0].BackSector == null);

                Assert.IsTrue(lines[136].Vertex1 == vertices[110]);
                Assert.IsTrue(lines[136].Vertex2 == vertices[111]);
                Assert.IsTrue((int)lines[136].Flags == 28);
                Assert.IsTrue((int)lines[136].Special == 63);
                Assert.IsTrue(lines[136].Tag == 3);
                Assert.IsTrue(lines[136].FrontSide == sides[184]);
                Assert.IsTrue(lines[136].BackSide == sides[185]);
                Assert.IsTrue(lines[136].FrontSector == sides[184].Sector);
                Assert.IsTrue(lines[136].BackSector == sides[185].Sector);

                Assert.IsTrue(lines[485].Vertex1 == vertices[309]);
                Assert.IsTrue(lines[485].Vertex2 == vertices[294]);
                Assert.IsTrue((int)lines[485].Flags == 12);
                Assert.IsTrue((int)lines[485].Special == 0);
                Assert.IsTrue(lines[485].Tag == 0);
                Assert.IsTrue(lines[485].FrontSide == sides[664]);
                Assert.IsTrue(lines[485].BackSide == sides[665]);
                Assert.IsTrue(lines[485].FrontSector == sides[664].Sector);
                Assert.IsTrue(lines[485].BackSector == sides[665].Sector);
            }
        }
Example #16
0
        public void LoadE1M1()
        {
            using (var wad = new Wad(WadPath.Doom1))
            {
                var map      = wad.GetLumpNumber("E1M1");
                var vertices = Vertex.FromWad(wad, map + 4);

                Assert.AreEqual(470, vertices.Length);

                Assert.AreEqual(1088, vertices[0].X.ToDouble(), delta);
                Assert.AreEqual(-3680, vertices[0].Y.ToDouble(), delta);

                Assert.AreEqual(128, vertices[57].X.ToDouble(), delta);
                Assert.AreEqual(-3008, vertices[57].Y.ToDouble(), delta);

                Assert.AreEqual(2435, vertices[469].X.ToDouble(), delta);
                Assert.AreEqual(-3920, vertices[469].Y.ToDouble(), delta);
            }
        }
Example #17
0
        public void LoadMap01()
        {
            using (var wad = new Wad(WadPath.Doom2))
            {
                var map      = wad.GetLumpNumber("MAP01");
                var vertices = Vertex.FromWad(wad, map + 4);

                Assert.AreEqual(383, vertices.Length);

                Assert.AreEqual(-448, vertices[0].X.ToDouble(), delta);
                Assert.AreEqual(768, vertices[0].Y.ToDouble(), delta);

                Assert.AreEqual(128, vertices[57].X.ToDouble(), delta);
                Assert.AreEqual(1808, vertices[57].Y.ToDouble(), delta);

                Assert.AreEqual(-64, vertices[382].X.ToDouble(), delta);
                Assert.AreEqual(2240, vertices[382].Y.ToDouble(), delta);
            }
        }
Example #18
0
        public void LoadE1M1()
        {
            using (var wad = new Wad(WadPath.Doom1))
            {
                var flats    = new FlatLookup(wad, true);
                var textures = new TextureLookup(wad, false);
                var map      = wad.GetLumpNumber("E1M1");
                var vertices = Vertex.FromWad(wad, map + 4);
                var sectors  = Sector.FromWad(wad, map + 8, flats);
                var sides    = SideDef.FromWad(wad, map + 3, textures, sectors);

                Assert.AreEqual(666, sides.Length);

                Assert.AreEqual(0, sides[0].TextureOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[0].RowOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[0].TopTexture);
                Assert.AreEqual(0, sides[0].BottomTexture);
                Assert.AreEqual("DOOR3", textures[sides[0].MiddleTexture].Name);
                Assert.IsTrue(sides[0].Sector == sectors[30]);

                Assert.AreEqual(32, sides[480].TextureOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[480].RowOffset.ToDouble(), delta);
                Assert.AreEqual("EXITSIGN", textures[sides[480].TopTexture].Name);
                Assert.AreEqual(0, sides[480].BottomTexture);
                Assert.AreEqual(0, sides[480].MiddleTexture);
                Assert.IsTrue(sides[480].Sector == sectors[70]);

                Assert.AreEqual(0, sides[650].TextureOffset.ToDouble(), delta);
                Assert.AreEqual(88, sides[650].RowOffset.ToDouble(), delta);
                Assert.AreEqual("STARTAN3", textures[sides[650].TopTexture].Name);
                Assert.AreEqual("STARTAN3", textures[sides[650].BottomTexture].Name);
                Assert.AreEqual(0, sides[650].MiddleTexture);
                Assert.IsTrue(sides[650].Sector == sectors[1]);

                Assert.AreEqual(0, sides[665].TextureOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[665].RowOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[665].TopTexture);
                Assert.AreEqual(0, sides[665].BottomTexture);
                Assert.AreEqual(0, sides[665].MiddleTexture);
                Assert.IsTrue(sides[665].Sector == sectors[23]);
            }
        }
Example #19
0
        public void LoadMap01()
        {
            using (var wad = new Wad(WadPath.Doom2))
            {
                var flats    = new FlatLookup(wad, true);
                var textures = new TextureLookup(wad, false);
                var map      = wad.GetLumpNumber("MAP01");
                var vertices = Vertex.FromWad(wad, map + 4);
                var sectors  = Sector.FromWad(wad, map + 8, flats);
                var sides    = SideDef.FromWad(wad, map + 3, textures, sectors);

                Assert.AreEqual(529, sides.Length);

                Assert.AreEqual(0, sides[0].TextureOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[0].RowOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[0].TopTexture);
                Assert.AreEqual(0, sides[0].BottomTexture);
                Assert.AreEqual("BRONZE1", textures[sides[0].MiddleTexture].Name);
                Assert.IsTrue(sides[0].Sector == sectors[9]);

                Assert.AreEqual(0, sides[312].TextureOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[312].RowOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[312].TopTexture);
                Assert.AreEqual(0, sides[312].BottomTexture);
                Assert.AreEqual("DOORTRAK", textures[sides[312].MiddleTexture].Name);
                Assert.IsTrue(sides[312].Sector == sectors[31]);

                Assert.AreEqual(24, sides[512].TextureOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[512].RowOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[512].TopTexture);
                Assert.AreEqual(0, sides[512].BottomTexture);
                Assert.AreEqual("SUPPORT2", textures[sides[512].MiddleTexture].Name);
                Assert.IsTrue(sides[512].Sector == sectors[52]);

                Assert.AreEqual(0, sides[528].TextureOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[528].RowOffset.ToDouble(), delta);
                Assert.AreEqual(0, sides[528].TopTexture);
                Assert.AreEqual(0, sides[528].BottomTexture);
                Assert.AreEqual(0, sides[528].MiddleTexture);
                Assert.IsTrue(sides[528].Sector == sectors[11]);
            }
        }
Example #20
0
        public void LoadMap01()
        {
            using (var wad = new Wad(WadPath.Doom2))
            {
                var flats    = new FlatLookup(wad, true);
                var textures = new TextureLookup(wad, true);
                var map      = wad.GetLumpNumber("MAP01");
                var vertices = Vertex.FromWad(wad, map + 4);
                var sectors  = Sector.FromWad(wad, map + 8, flats);
                var sides    = SideDef.FromWad(wad, map + 3, textures, sectors);
                var lines    = LineDef.FromWad(wad, map + 2, vertices, sides);
                var reject   = Reject.FromWad(wad, map + 9, sectors);

                foreach (var sector in sectors)
                {
                    Assert.IsFalse(reject.Check(sector, sector));
                }

                foreach (var line in lines)
                {
                    if (line.BackSector != null)
                    {
                        Assert.IsFalse(reject.Check(line.FrontSector, line.BackSector));
                    }
                }

                foreach (var s1 in sectors)
                {
                    foreach (var s2 in sectors)
                    {
                        var result1 = reject.Check(s1, s2);
                        var result2 = reject.Check(s2, s1);
                        Assert.AreEqual(result1, result2);
                    }
                }

                Assert.IsTrue(reject.Check(sectors[10], sectors[49]));
                Assert.IsTrue(reject.Check(sectors[7], sectors[36]));
                Assert.IsTrue(reject.Check(sectors[17], sectors[57]));
            }
        }
Example #21
0
        public DrawScreen(Wad wad, int width, int height)
        {
            this.width  = width;
            this.height = height;
            data        = new byte[width * height];
            var fontAStart = wad.GetLumpNumber("FONTA_S") + 1;
            var fontAEnd   = wad.GetLumpNumber("FONTA_E") - 1;
            var count      = fontAEnd - fontAStart + 1;

            charsFontA = new Patch[count];
            for (var i = 1; i < charsFontA.Length; i++)
            {
                var name = "FONTA" + i.ToString("00");
                var lump = wad.GetLumpNumber(name);
                if (lump != -1)
                {
                    charsFontA[i] = Patch.FromData(name, wad.ReadLump(lump));
                }
            }

            var fontBStart = wad.GetLumpNumber("FONTB_S") + 1;
            var fontBEnd   = wad.GetLumpNumber("FONTB_E") - 1;

            count = fontAEnd - fontAStart + 1;

            charsFontB = new Patch[count];
            for (var i = 1; i < charsFontB.Length; i++)
            {
                var name = "FONTB" + i.ToString("00");
                var lump = wad.GetLumpNumber(name);
                if (lump != -1)
                {
                    charsFontB[i] = Patch.FromData(name, wad.ReadLump(lump));
                }
            }
        }
Example #22
0
            public Patches(Wad wad)
            {
                if (wad.GameMode == GameMode.Commercial)
                {
                    background = Patch.FromWad("INTERPIC", wad);
                }
                else
                {
                    mapPictures = new Patch[3];
                    for (var e = 0; e < 3; e++)
                    {
                        var patchName = "WIMAP" + e;
                        if (wad.GetLumpNumber(patchName) != -1)
                        {
                            mapPictures[e] = Patch.FromWad(patchName, wad);
                        }
                    }
                    if (wad.GetLumpNumber("INTERPIC") != -1)
                    {
                        background = Patch.FromWad("INTERPIC", wad);
                    }
                }

                kills     = Patch.FromWad("WIOSTK", wad);
                secret    = Patch.FromWad("WIOSTS", wad);
                sp_secret = Patch.FromWad("WISCRT2", wad);
                items     = Patch.FromWad("WIOSTI", wad);
                frags     = Patch.FromWad("WIFRGS", wad);

                time  = Patch.FromWad("WITIME", wad);
                par   = Patch.FromWad("WIPAR", wad);
                sucks = Patch.FromWad("WISUCKS", wad);

                wiminus = Patch.FromWad("WIMINUS", wad);

                numbers = new Patch[10];
                for (var i = 0; i < 10; i++)
                {
                    numbers[i] = Patch.FromWad("WINUM" + i, wad);
                }

                percent = Patch.FromWad("WIPCNT", wad);
                colon   = Patch.FromWad("WICOLON", wad);

                finished = Patch.FromWad("WIF", wad);

                entering = Patch.FromWad("WIENTER", wad);

                killers = Patch.FromWad("WIKILRS", wad);
                victims = Patch.FromWad("WIVCTMS", wad);

                total = Patch.FromWad("WIMSTT", wad);
                star  = Patch.FromWad("STFST01", wad);
                bstar = Patch.FromWad("STFDEAD0", wad);


                if (wad.GameMode == GameMode.Commercial)
                {
                    var numMaps = 32;
                    lnames    = new Patch[1][];
                    lnames[0] = new Patch[numMaps];
                    for (var i = 0; i < numMaps; i++)
                    {
                        lnames[0][i] = Patch.FromWad("CWILV" + i.ToString("00"), wad);
                    }
                }
                else
                {
                    var numEpisodes = 4;
                    var numMaps     = 9;
                    lnames = new Patch[numEpisodes][];
                    for (var e = 0; e < numEpisodes; e++)
                    {
                        lnames[e] = new Patch[numMaps];
                        for (var m = 0; m < numMaps; m++)
                        {
                            var patchName = "WILV" + e + m;
                            if (wad.GetLumpNumber(patchName) != -1)
                            {
                                lnames[e][m] = Patch.FromWad(patchName, wad);
                            }
                        }
                    }

                    youAreHere1 = Patch.FromWad("WIURH0", wad);
                    youAreHere2 = Patch.FromWad("WIURH1", wad);
                    splat       = Patch.FromWad("WISPLAT", wad);
                }

                Console.WriteLine("All intermission patches are OK.");
            }
Example #23
0
        public void LoadMap01()
        {
            using (var wad = new Wad(WadPath.Doom2))
            {
                var flats      = new FlatLookup(wad, true);
                var textures   = new TextureLookup(wad, true);
                var map        = wad.GetLumpNumber("MAP01");
                var vertices   = Vertex.FromWad(wad, map + 4);
                var sectors    = Sector.FromWad(wad, map + 8, flats);
                var sides      = SideDef.FromWad(wad, map + 3, textures, sectors);
                var lines      = LineDef.FromWad(wad, map + 2, vertices, sides);
                var segs       = Seg.FromWad(wad, map + 5, vertices, lines);
                var subsectors = Subsector.FromWad(wad, map + 6, segs);
                var nodes      = Node.FromWad(wad, map + 7, subsectors);

                Assert.AreEqual(193, nodes.Length);

                Assert.AreEqual(64, nodes[0].X.ToDouble(), delta);
                Assert.AreEqual(1024, nodes[0].Y.ToDouble(), delta);
                Assert.AreEqual(0, nodes[0].Dx.ToDouble(), delta);
                Assert.AreEqual(-64, nodes[0].Dy.ToDouble(), delta);
                Assert.AreEqual(1173, nodes[0].Bbox[0][Box.Top].ToDouble(), delta);
                Assert.AreEqual(960, nodes[0].Bbox[0][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(-64, nodes[0].Bbox[0][Box.Left].ToDouble(), delta);
                Assert.AreEqual(64, nodes[0].Bbox[0][Box.Right].ToDouble(), delta);
                Assert.AreEqual(1280, nodes[0].Bbox[1][Box.Top].ToDouble(), delta);
                Assert.AreEqual(1024, nodes[0].Bbox[1][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(64, nodes[0].Bbox[1][Box.Left].ToDouble(), delta);
                Assert.AreEqual(128, nodes[0].Bbox[1][Box.Right].ToDouble(), delta);
                Assert.AreEqual(32770, nodes[0].Children[0] + 0x10000);
                Assert.AreEqual(32771, nodes[0].Children[1] + 0x10000);

                Assert.AreEqual(640, nodes[57].X.ToDouble(), delta);
                Assert.AreEqual(856, nodes[57].Y.ToDouble(), delta);
                Assert.AreEqual(-88, nodes[57].Dx.ToDouble(), delta);
                Assert.AreEqual(-16, nodes[57].Dy.ToDouble(), delta);
                Assert.AreEqual(856, nodes[57].Bbox[0][Box.Top].ToDouble(), delta);
                Assert.AreEqual(840, nodes[57].Bbox[0][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(552, nodes[57].Bbox[0][Box.Left].ToDouble(), delta);
                Assert.AreEqual(640, nodes[57].Bbox[0][Box.Right].ToDouble(), delta);
                Assert.AreEqual(856, nodes[57].Bbox[1][Box.Top].ToDouble(), delta);
                Assert.AreEqual(760, nodes[57].Bbox[1][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(536, nodes[57].Bbox[1][Box.Left].ToDouble(), delta);
                Assert.AreEqual(704, nodes[57].Bbox[1][Box.Right].ToDouble(), delta);
                Assert.AreEqual(32829, nodes[57].Children[0] + 0x10000);
                Assert.AreEqual(56, nodes[57].Children[1]);

                Assert.AreEqual(96, nodes[192].X.ToDouble(), delta);
                Assert.AreEqual(1280, nodes[192].Y.ToDouble(), delta);
                Assert.AreEqual(32, nodes[192].Dx.ToDouble(), delta);
                Assert.AreEqual(0, nodes[192].Dy.ToDouble(), delta);
                Assert.AreEqual(1280, nodes[192].Bbox[0][Box.Top].ToDouble(), delta);
                Assert.AreEqual(-960, nodes[192].Bbox[0][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(-1304, nodes[192].Bbox[0][Box.Left].ToDouble(), delta);
                Assert.AreEqual(2072, nodes[192].Bbox[0][Box.Right].ToDouble(), delta);
                Assert.AreEqual(2688, nodes[192].Bbox[1][Box.Top].ToDouble(), delta);
                Assert.AreEqual(1280, nodes[192].Bbox[1][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(-1304, nodes[192].Bbox[1][Box.Left].ToDouble(), delta);
                Assert.AreEqual(2072, nodes[192].Bbox[1][Box.Right].ToDouble(), delta);
                Assert.AreEqual(147, nodes[192].Children[0]);
                Assert.AreEqual(191, nodes[192].Children[1]);
            }
        }
Example #24
0
        public void LoadE1M1()
        {
            using (var wad = new Wad(WadPath.Doom1))
            {
                var flats      = new FlatLookup(wad, true);
                var textures   = new TextureLookup(wad, true);
                var map        = wad.GetLumpNumber("E1M1");
                var vertices   = Vertex.FromWad(wad, map + 4);
                var sectors    = Sector.FromWad(wad, map + 8, flats);
                var sides      = SideDef.FromWad(wad, map + 3, textures, sectors);
                var lines      = LineDef.FromWad(wad, map + 2, vertices, sides);
                var segs       = Seg.FromWad(wad, map + 5, vertices, lines);
                var subsectors = Subsector.FromWad(wad, map + 6, segs);
                var nodes      = Node.FromWad(wad, map + 7, subsectors);

                Assert.AreEqual(238, nodes.Length);

                Assert.AreEqual(1784, nodes[0].X.ToDouble(), delta);
                Assert.AreEqual(-3448, nodes[0].Y.ToDouble(), delta);
                Assert.AreEqual(-240, nodes[0].Dx.ToDouble(), delta);
                Assert.AreEqual(64, nodes[0].Dy.ToDouble(), delta);
                Assert.AreEqual(-3104, nodes[0].Bbox[0][Box.Top].ToDouble(), delta);
                Assert.AreEqual(-3448, nodes[0].Bbox[0][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(1520, nodes[0].Bbox[0][Box.Left].ToDouble(), delta);
                Assert.AreEqual(2128, nodes[0].Bbox[0][Box.Right].ToDouble(), delta);
                Assert.AreEqual(-3384, nodes[0].Bbox[1][Box.Top].ToDouble(), delta);
                Assert.AreEqual(-3448, nodes[0].Bbox[1][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(1544, nodes[0].Bbox[1][Box.Left].ToDouble(), delta);
                Assert.AreEqual(1784, nodes[0].Bbox[1][Box.Right].ToDouble(), delta);
                Assert.AreEqual(32768, nodes[0].Children[0] + 0x10000);
                Assert.AreEqual(32769, nodes[0].Children[1] + 0x10000);

                Assert.AreEqual(928, nodes[57].X.ToDouble(), delta);
                Assert.AreEqual(-3360, nodes[57].Y.ToDouble(), delta);
                Assert.AreEqual(0, nodes[57].Dx.ToDouble(), delta);
                Assert.AreEqual(256, nodes[57].Dy.ToDouble(), delta);
                Assert.AreEqual(-3104, nodes[57].Bbox[0][Box.Top].ToDouble(), delta);
                Assert.AreEqual(-3360, nodes[57].Bbox[0][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(928, nodes[57].Bbox[0][Box.Left].ToDouble(), delta);
                Assert.AreEqual(1344, nodes[57].Bbox[0][Box.Right].ToDouble(), delta);
                Assert.AreEqual(-3104, nodes[57].Bbox[1][Box.Top].ToDouble(), delta);
                Assert.AreEqual(-3360, nodes[57].Bbox[1][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(704, nodes[57].Bbox[1][Box.Left].ToDouble(), delta);
                Assert.AreEqual(928, nodes[57].Bbox[1][Box.Right].ToDouble(), delta);
                Assert.AreEqual(32825, nodes[57].Children[0] + 0x10000);
                Assert.AreEqual(56, nodes[57].Children[1]);

                Assert.AreEqual(2176, nodes[237].X.ToDouble(), delta);
                Assert.AreEqual(-2304, nodes[237].Y.ToDouble(), delta);
                Assert.AreEqual(0, nodes[237].Dx.ToDouble(), delta);
                Assert.AreEqual(-256, nodes[237].Dy.ToDouble(), delta);
                Assert.AreEqual(-2048, nodes[237].Bbox[0][Box.Top].ToDouble(), delta);
                Assert.AreEqual(-4064, nodes[237].Bbox[0][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(-768, nodes[237].Bbox[0][Box.Left].ToDouble(), delta);
                Assert.AreEqual(2176, nodes[237].Bbox[0][Box.Right].ToDouble(), delta);
                Assert.AreEqual(-2048, nodes[237].Bbox[1][Box.Top].ToDouble(), delta);
                Assert.AreEqual(-4864, nodes[237].Bbox[1][Box.Bottom].ToDouble(), delta);
                Assert.AreEqual(2176, nodes[237].Bbox[1][Box.Left].ToDouble(), delta);
                Assert.AreEqual(3808, nodes[237].Bbox[1][Box.Right].ToDouble(), delta);
                Assert.AreEqual(131, nodes[237].Children[0]);
                Assert.AreEqual(236, nodes[237].Children[1]);
            }
        }
Example #25
0
        public void LoadMap01()
        {
            using (var wad = new Wad(WadPath.Doom2))
            {
                var flats    = new FlatLookup(wad, true);
                var textures = new TextureLookup(wad, true);
                var map      = wad.GetLumpNumber("MAP01");
                var vertices = Vertex.FromWad(wad, map + 4);
                var sectors  = Sector.FromWad(wad, map + 8, flats);
                var sides    = SideDef.FromWad(wad, map + 3, textures, sectors);
                var lines    = LineDef.FromWad(wad, map + 2, vertices, sides);
                var blockMap = BlockMap.FromWad(wad, map + 10, lines);

                {
                    var minX = vertices.Select(v => v.X.ToDouble()).Min();
                    var maxX = vertices.Select(v => v.X.ToDouble()).Max();
                    var minY = vertices.Select(v => v.Y.ToDouble()).Min();
                    var maxY = vertices.Select(v => v.Y.ToDouble()).Max();

                    Assert.AreEqual(blockMap.OriginX.ToDouble(), minX, 64);
                    Assert.AreEqual(blockMap.OriginY.ToDouble(), minY, 64);
                    Assert.AreEqual((blockMap.OriginX + BlockMap.MapBlockSize * blockMap.Width).ToDouble(), maxX, 128);
                    Assert.AreEqual((blockMap.OriginY + BlockMap.MapBlockSize * blockMap.Height).ToDouble(), maxY, 128);
                }

                var spots = new List <Tuple <int, int> >();
                for (var blockY = -2; blockY < blockMap.Height + 2; blockY++)
                {
                    for (var blockX = -2; blockX < blockMap.Width + 2; blockX++)
                    {
                        spots.Add(Tuple.Create(blockX, blockY));
                    }
                }

                var random = new Random(666);

                for (var i = 0; i < 50; i++)
                {
                    var ordered = spots.OrderBy(spot => random.NextDouble()).ToArray();

                    var total = 0;

                    foreach (var spot in ordered)
                    {
                        var blockX = spot.Item1;
                        var blockY = spot.Item2;

                        var minX  = double.MaxValue;
                        var maxX  = double.MinValue;
                        var minY  = double.MaxValue;
                        var maxY  = double.MinValue;
                        var count = 0;

                        blockMap.IterateLines(
                            blockX,
                            blockY,
                            line =>
                        {
                            if (count != 0)
                            {
                                minX = Math.Min(Math.Min(line.Vertex1.X.ToDouble(), line.Vertex2.X.ToDouble()), minX);
                                maxX = Math.Max(Math.Max(line.Vertex1.X.ToDouble(), line.Vertex2.X.ToDouble()), maxX);
                                minY = Math.Min(Math.Min(line.Vertex1.Y.ToDouble(), line.Vertex2.Y.ToDouble()), minY);
                                maxY = Math.Max(Math.Max(line.Vertex1.Y.ToDouble(), line.Vertex2.Y.ToDouble()), maxY);
                            }
                            count++;
                            return(true);
                        },
                            i + 1);

                        if (count > 1)
                        {
                            Assert.IsTrue(minX <= (blockMap.OriginX + BlockMap.MapBlockSize * (blockX + 1)).ToDouble());
                            Assert.IsTrue(maxX >= (blockMap.OriginX + BlockMap.MapBlockSize * blockX).ToDouble());
                            Assert.IsTrue(minY <= (blockMap.OriginY + BlockMap.MapBlockSize * (blockY + 1)).ToDouble());
                            Assert.IsTrue(maxY >= (blockMap.OriginY + BlockMap.MapBlockSize * blockY).ToDouble());
                        }

                        total += count;
                    }

                    Assert.AreEqual(lines.Length, total);
                }
            }
        }