public void ExportDemoMap()
        {
            //var inputWad = @"C:\Games\Doom\IWADS\doom.wad";
            var inputWad = @"C:\Games\Doom\levels\10sector.wad";
            //var inputWad = @"C:\Users\aramant\Desktop\Doom\freedoom1-udmf.wad";
            //var inputWad = @"C:\Users\aramant\Desktop\Doom\10sector-udmf.wad";

            var baseOutputPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Doom", "SVGs");

            if (!Directory.Exists(baseOutputPath))
            {
                Directory.CreateDirectory(baseOutputPath);
            }

            var wadName = Path.GetFileNameWithoutExtension(inputWad);

            foreach (var(name, map) in WadLoader.Load(inputWad))
            {
                try
                {
                    SvgExporter.Export(map,
                                       Path.Combine(baseOutputPath, $"{wadName}.{name}.svg"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(name + ": " + e);
                }
            }
        }
示例#2
0
        public void TestExportTextureToBitmap()
        {
            // Given
            var fileName     = @"C:\Sierra\Half-Life\valve\maps\hldemo1.bsp";
            var wadFileNames = new string[] { @"C:\Sierra\Half-Life\valve\halflife.wad" };

            var loader = new BspLoader(fileName);
            var map    = loader.Load();

            var wadLoader = new WadLoader(map, fileName, wadFileNames);
            var textures  = wadLoader.Load();

            if (!Directory.Exists("Textures"))
            {
                Directory.CreateDirectory("Textures");
            }

            // When
            foreach (var texture in textures)
            {
                using (var bitmap = TexUtil.PixelsToTexture(texture.TextureData, texture.Width, texture.Height, 4))
                {
                    bitmap.Save("Textures\\" + texture.Name + ".bmp");
                }
            }

            // Then
            foreach (var texture in textures)
            {
                var isExisting = File.Exists("Textures\\" + texture.Name + ".bmp");

                Assert.IsTrue(isExisting);
            }
        }
 public static IEnumerable <MapData> LoadAllFreedoomMaps()
 {
     Console.WriteLine("Loading all Freedoom maps...");
     using (new Timed())
     {
         return(WadLoader.Load("freedoom2-udmf.wad").Select(pair => pair.Map));
     }
 }
示例#4
0
 static void Main(string[] args)
 {
     WadLoader.AddWadFile(@"Champions/Anivia.wad");
     while (true)
     {
         System.Threading.Thread.Sleep(1);
     }
 }
        public void A_Wad_Has_The_Correct_Number_Of_Things()
        {
            WadLoader            loader = new WadLoader();
            WadFile              wad    = loader.Load(@"TestData\testmap.wad");
            DoomFormatMapElement map    = (DoomFormatMapElement)wad.Elements[0];

            Assert.AreEqual(28, map.Things.Count);
        }
        public void The_Wad_Has_A_Map()
        {
            WadLoader loader = new WadLoader();
            WadFile   wad    = loader.Load(@"TestData\testmap.wad");

            Assert.AreEqual(1, wad.Elements.Count);
            Assert.AreEqual(typeof(DoomFormatMapElement), wad.Elements[0].Type);
        }
 public void LoadTestMaps()
 {
     // Test Maps:
     // MAP01:
     // - Sector 0 - a 256x256 box with the bottom left at (0,0)
     // - Sector 1 - a jagged concave sector in the middle
     ConcaveMaps =
         WadLoader.Load(Path.Combine(TestContext.CurrentContext.TestDirectory, "ConcaveSectors.wad")).
         Select(m => new MapGeometry(m.Map)).
         ToImmutableList();
 }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _outputTexture = new Texture2D(_graphics.GraphicsDevice, width: CurrentScreenSize.X, height: CurrentScreenSize.Y);
            _screenBuffer  = new ScreenBuffer(CurrentScreenSize);

            _messageFont = Content.Load <SpriteFont>("Fonts/ScreenMessage");
            _maps        = WadLoader.Load("testmaps.wad").Select(pair => pair.Map).ToList();

            SwitchToMap(0);
        }
    void Start()
    {
        if (!string.IsNullOrEmpty(autoloadWad))
        {
            if (!WadLoader.LoadWad(autoloadWad))
            {
                return;
            }
        }

        TextureLoader.Instance.LoadAndBuildAll();

        if (!string.IsNullOrEmpty(autoloadMap))
        {
            ChangeMap = autoloadMap;
        }
    }
示例#10
0
 void Awake()
 {
     Instance = this;
 }
示例#11
0
 public static Wad FromFile(string fileName)
 {
     using var fileStream = File.OpenRead(fileName);
     return(WadLoader.Load(fileStream));
 }
 public List <MapData> Superpower()
 {
     return(WadLoader.LoadUsingSuperpower("freedoom2-udmf.wad"));
 }
 public List <MapData> TotallyCustom()
 {
     return(WadLoader.LoadUsingTotallyCustom("freedoom2-udmf.wad"));
 }
 public List <MapData> CustomLexerWithPidginParser()
 {
     return(WadLoader.LoadUsingCustomWithPidgin("freedoom2-udmf.wad"));
 }
 public List <MapData> Pidgin()
 {
     return(WadLoader.LoadUsingPidgin("freedoom2-udmf.wad"));
 }