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]); } } }
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]); } } }
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); } }
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); } }
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]); } }
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]); } }