void LoadSplatMap(Map map, SlimDX.Direct3D9.Device device, ZipFile mapFile)
        {
#pragma warning disable 612,618
            if (!string.IsNullOrEmpty(map.Settings.StaticDataSourceMap))
            {
                mapFile = new ZipFile(Path.Combine(Path.GetDirectoryName(map.MapFileName), map.Settings.StaticDataSourceMap));
            }
#pragma warning restore 612,618

            if (!mapFile.ContainsEntry(GetSplatTexture1FileName()))
            {
                map.NewSplatMap1(device);
                if (!string.IsNullOrEmpty(map.Settings.StaticDataSourceMap))
                {
                    mapFile.Dispose();
                }
                return;
            }

            using (var splat1Stream = mapFile[GetSplatTexture1FileName()].OpenReader())
                map.Ground.SplatMap1 =
                    new Graphics.Content.UnmanagedResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>
                {
                    Resource9 = SlimDX.Direct3D9.Texture.FromStream(device, splat1Stream)
                };
            if (!string.IsNullOrEmpty(map.Settings.StaticDataSourceMap))
            {
                mapFile.Dispose();
            }
        }
Ejemplo n.º 2
0
        public static Map New(MapSettings settings, SlimDX.Direct3D9.Device device)
        {
            Map m = new Map
            {
                Settings = settings
            };

            m.Ground = new Ground();
            m.InitGround();
            m.NewSplatMap1(device);
            m.NewSplatMap2(device);
            m.Ground.ConstructPieces(m);
            m.Ground.Init();
            m.MainCharacter = new Units.MainCharacter
            {
                Translation = new Vector3(settings.Size.Width / 2f, settings.Size.Height / 2f, 0),
                Name        = "MainCharacter"
            };
            m.DynamicsRoot.AddChild(m.MainCharacter);

            return(m);
        }
        void LoadSplatMap(Map map, SlimDX.Direct3D9.Device device, ZipFile mapFile)
        {
            #pragma warning disable 612,618
            if (!string.IsNullOrEmpty(map.Settings.StaticDataSourceMap))
                mapFile = new ZipFile(Path.Combine(Path.GetDirectoryName(map.MapFileName), map.Settings.StaticDataSourceMap));
            #pragma warning restore 612,618

            if (!mapFile.ContainsEntry(GetSplatTexture1FileName()))
            {
                map.NewSplatMap1(device);
                if (!string.IsNullOrEmpty(map.Settings.StaticDataSourceMap))
                    mapFile.Dispose();
                return;
            }

            using(var splat1Stream = mapFile[GetSplatTexture1FileName()].OpenReader())
                map.Ground.SplatMap1 =
                    new Graphics.Content.UnmanagedResource<SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>
                    {
                        Resource9 = SlimDX.Direct3D9.Texture.FromStream(device, splat1Stream)
                    };
            if (!string.IsNullOrEmpty(map.Settings.StaticDataSourceMap))
                mapFile.Dispose();
        }
Ejemplo n.º 4
0
        public static Map New(MapSettings settings, SlimDX.Direct3D9.Device device)
        {
            Map m = new Map
            {
                Settings = settings
            };

            m.Ground = new Ground();
            m.InitGround();
            m.NewSplatMap1(device);
            m.NewSplatMap2(device);
            m.Ground.ConstructPieces(m);
            m.Ground.Init();
            m.MainCharacter = new Units.MainCharacter
            {
                Translation = new Vector3(settings.Size.Width / 2f, settings.Size.Height / 2f, 0),
                Name = "MainCharacter"
            };
            m.DynamicsRoot.AddChild(m.MainCharacter);

            return m;
        }