Пример #1
0
        public void GetData(Action <object, Exception> callback)
        {
            var uodataManager = UODataManager.GetInstance(new Uri(@"C:\Ultima\Client\Ultima Online 2D Client"), UODataType.ClassicAdventuresOnHighSeas,
                                                          Language.English, null, false);

            callback(uodataManager, null);
        }
Пример #2
0
        public SceneBuffer(UODataManager manager)
        {
            dataManager = manager;
            if (dataManager.DataFactory == null)
            {
                throw new NullReferenceException("DataFactory wasn't initialized.");
            }

            tileComparer = new TilesComparer(dataManager);
        }
Пример #3
0
        public void TestMethod1()
        {
            var _manager = UODataManager.GetInstance(new Uri(@"C:\The Miracle"), UODataType.ClassicMondainsLegacy, Language.English);
            UltimaMapDataProvider provider = new UltimaMapDataProvider();
            var map = _manager.GetMapFacet(4);

            provider.mapIndex(4, _manager.GetMapFacet(4));
            var bmp = EssenceUDK.MapMaker.MapMaking.BitmapReader.ExportAltitude(provider, (int)map.Width, (int)map.Height, null);

            bmp.Save(Path.Combine(@"C:\Users\Fabio\Desktop\map", "test.bmp"), ImageFormat.Bmp);
        }
        public ViewModelOptionWindow()
        {
            AppMessages.DialogAnwer.Register(this, DialogResultHandler);
            CommandSelectDirectory = new RelayCommand(
                () => AppMessages.DialogRequest.Send(new MessageDialogRequest("OpenOptionFolder")));

            CommandApply = new RelayCommand(() =>
            {
                try
                {
                    if (ApplicationController.manager != null)
                    {
                        ApplicationController.manager.Dispose();
                        ApplicationController.manager = null;
                    }
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    ApplicationController.manager =
                        UODataManager.GetInstance(new Uri(SelectedFolder),
                                                  _data, Language.English);
                    AppMessages.OptionAnswer.Send(new OptionMessage()
                    {
                        Success = true
                    });
                }
                catch (Exception e)
                {
                    AppMessages.DialogRequest.Send(new MessageDialogRequest(e.Message));
                }
                var serializer = new XmlSerializer(GetType());
                using (var File = new FileStream("options.xml", FileMode.Create))
                {
                    serializer.Serialize(File, this);
                }
            }, () => !string.IsNullOrEmpty(SelectedFolder));

            CommandCancel = new RelayCommand(() => AppMessages.OptionAnswer.Send(new OptionMessage()
            {
                Success = false
            }));


            if (!ClientInfoSources.Any() || ClientInfoSources[0] == null)
            {
                return;
            }
            SelectedFolder        = ClientInfoSources[0].DirectoryPath;
            SelectedDataTypeIndex = (int)DataSelector(ClientInfoSources[0].ProductVersion);
        }
Пример #5
0
 public TilesCategorySDKModule(UODataManager install)
 {
     DataManager = install;
     Factories   = new List <Factory>();
     Supp        = new SuppInfo(install);
     Supp.Populate();
     Walls  = new Walls(install);
     Misc   = new Misc(install);
     Roofs  = new Roofs(install);
     Floors = new Floors(install);
     Factories.Add(Walls);
     Factories.Add(Misc);
     Factories.Add(Roofs);
     Factories.Add(Floors);
     Categories    = new ObservableCollection <ObservableCollection <TileCategory> >();
     CheckFromTxt  = true;
     _listTmpStyle = new ObservableCollection <TileStyle>();
     _listTmpTile  = new ObservableCollection <Tile>();
 }
Пример #6
0
        private void btnLoadMuls_Click(object sender, RoutedEventArgs e)
        {
            try {
                UOManager = null;
                var datauri = new Uri(tbPath.Text);
                var dataopt = new UODataOptions();
                dataopt.majorFacet[0] = new FacetDesc("FacetMap-0", (ushort)nudM0W.Value, (ushort)nudM0H.Value, (ushort)nudM0W.Value, (ushort)nudM0H.Value);
                dataopt.majorFacet[1] = new FacetDesc("FacetMap-1", (ushort)nudM1W.Value, (ushort)nudM1H.Value, (ushort)nudM1W.Value, (ushort)nudM1H.Value);
                dataopt.majorFacet[2] = new FacetDesc("FacetMap-2", (ushort)nudM2W.Value, (ushort)nudM2H.Value, (ushort)nudM2W.Value, (ushort)nudM2H.Value);
                dataopt.majorFacet[3] = new FacetDesc("FacetMap-3", (ushort)nudM3W.Value, (ushort)nudM3H.Value, (ushort)nudM3W.Value, (ushort)nudM3H.Value);
                dataopt.majorFacet[4] = new FacetDesc("FacetMap-4", (ushort)nudM4W.Value, (ushort)nudM4H.Value, (ushort)nudM4W.Value, (ushort)nudM4H.Value);
                dataopt.majorFacet[5] = new FacetDesc("FacetMap-5", (ushort)nudM5W.Value, (ushort)nudM5H.Value, (ushort)nudM5W.Value, (ushort)nudM5H.Value);
                var _manager = UODataManager.GetInstance(datauri,

                                                         UODataType.ClassicMondainsLegacy, UOLang.English, dataopt, true);
                UOManager = _manager;
            } catch (Exception ex) {
                UOManager = null;
                MessageBox.Show("While loading data exception was raised.\nCheck path, map sizes and make sure that all data muls are present.");
            }
        }
Пример #7
0
        public MainWindow()
        {
            InitializeComponent();

            // test - lets switch to our tab at startup
            tabControl1.SelectedIndex = 2;

            // Lets try to find clients at system
            var clients = ClientInfo.Get();

            if (clients.Length != 0)   // we must remember that we have no warinties that client is cirtanly valid

            // now we need create base uo data storage class, it base class we will use to do any work with uo data, so generally we need to store it as static.
            // but just now for testing we dont do it. (Remember shilw we will write controls in EsseceUDK.Add-ins we need to get manager at EsseceUDK assembly)
            {
                var manager = new UODataManager(new Uri(clients[0].DirectoryPath), UODataType.ClassicAdventuresOnHighSeas, UOLang.Russian, false);

                // ok, we get manager just now let get tiles and set them as sourse to our list. Yeh, it's really simple)
                tileItemView1.ItemsSource = manager.GetItemTile(TileFlag.Wall); // lets get all walls to look throw

                // just now we use same souce for binding to differen controls. So we represent different data viewer for same data.
                var lands = manager.GetLandTile(TileFlag.None).Where(t => t.TileId < 1000); // just now we get first 1000 valid lands for testing (we dont take care what is this)
                tileLandView1.ItemsSource = lands;
                tileTexmView1.ItemsSource = lands;

                // PS xaml is good, but lets devide all properties of controls in two types: visual-style and visual-logic.
                // The first one is part of theme or control design. The second are user customizable or controll changeble,
                // for example - sizes of tiles in tileItemView1 (we just add some Properties to it later). The idea is that if
                // we decide ti rewrite control in future to own we can easily change it without any problems.
            }
            else
            {
                // it's seems we cant find clients so we just throw Exception
                throw new Exception("No one \"Ultima Online\" client was founded.");
            }
        }
Пример #8
0
 public TxtFile(string location,UODataManager data)
 {
     _location = location;
     _multi = new MultiCollection(data);
 }
Пример #9
0
 protected Factory(UODataManager location)
 {
     DataManager = location;
     _categories = new ObservableCollection<TileCategory>();
 }
Пример #10
0
 public Tile1024(UODataManager location) : base(location)
 {
 }
Пример #11
0
 public SuppInfo(UODataManager location)
 {
     _dataManager = location;
     Positions    = new Dictionary <uint, PositionTiles>();
 }
Пример #12
0
 public Walls(UODataManager location) : base(location)
 {
 }
Пример #13
0
 /// <summary>
 /// Cleans up all the resources.
 /// </summary>
 public void Cleanup()
 {
     UODataManager.Cleanup();
 }
        public TilesCategorySDKModule(UODataManager install)
        {
            
            DataManager = install;
            Factories = new List<Factory>();
            Supp = new SuppInfo(install);
            Supp.Populate();
            Walls = new Walls(install);
            Misc = new Misc(install);
            Roofs = new Roofs(install);
            Floors = new Floors(install);
            Factories.Add(Walls);
            Factories.Add(Misc);
            Factories.Add(Roofs);
            Factories.Add(Floors);
            Categories = new ObservableCollection<ObservableCollection<TileCategory>>();
            CheckFromTxt = true;
            _listTmpStyle = new ObservableCollection<TileStyle>();
            _listTmpTile = new ObservableCollection<Tile>();


        }
Пример #15
0
        public MainWindow()
        {
            InitializeComponent();
            Application.Current.ApplyTheme("ExpressionDark");
            // ThemeManager.GetThemes()[0];

            // test - lets switch to our tab at startup
            tabControl1.SelectedIndex = 6;

            // Lets try to find clients at system
            var clients = ClientInfo.GetInSystem();

            if (clients.Length != 0)   // we must remember that we have no warinties that client is cirtanly valid

            // now we need create base uo data storage class, it base class we will use to do any work with uo data, so generally we need to store it as static.
            // but just now for testing we dont do it. (Remember shilw we will write controls in EsseceUDK.Add-ins we need to get manager at EsseceUDK assembly)
            {
                var manager = new UODataManager(new Uri(clients[0].DirectoryPath), UODataType.ClassicAdventuresOnHighSeas, UOLang.Russian, new UODataOptions(), true);// false);
                userControlTileMerger.UODataManager = manager;

                // ok, we get manager just now let get tiles and set them as sourse to our list. Yeh, it's really simple)
                var items = manager.GetItemTile(TileFlag.None, true);//TileFlag.Wall); // lets get all walls to look throw
                //foreach (var item in items)
                //    item.Surface.GetSurface().GetHammingDistanceForAvrHash(null);
                tileItemView1.ItemsSource = items;


                // just now we use same souce for binding to differen controls. So we represent different data viewer for same data.
                var lands = manager.GetLandTile(TileFlag.None).Where(t => t.EntryId < 1000); // just now we get first 1000 valid lands for testing (we dont take care what is this)
                tileLandView1.ItemsSource = lands;
                tileTexmView1.ItemsSource = lands;

                //manager.GetLandTile(0x0001).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x002A.bmp");
                //manager.GetLandTile(0x0002).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x0089.bmp");
                //manager.GetLandTile(0x0003).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x321D.bmp");
                //manager.GetLandTile(0x0004).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x3472.bmp");
                //manager.GetLandTile(0x0005).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x346E.bmp");
                //manager.GetLandTile(0x0006).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x3475.bmp");

                //manager.GetLandTile(0x0001).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x002A.bmp");
                //manager.GetLandTile(0x0002).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x0089.bmp");
                //manager.GetLandTile(0x0003).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x321D.bmp");
                //manager.GetLandTile(0x0004).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x3472.bmp");
                //manager.GetLandTile(0x0005).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x346E.bmp");
                //manager.GetLandTile(0x0006).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x3475.bmp");

                //manager.GetItemTile(0x0001).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0xF6C2.bmp");
                //manager.GetItemTile(0x0002).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0xF6FC.bmp");
                //manager.GetItemTile(0x0003).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0xF6BA.bmp");
                //manager.GetItemTile(0x0004).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0x3BB4.bmp");
                //manager.GetItemTile(0x0005).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0xF6A2.bmp");
                //manager.GetItemTile(0x0006).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0x248B.bmp");

                // PS xaml is good, but lets devide all properties of controls in two types: visual-style and visual-logic.
                // The first one is part of theme or control design. The second are user customizable or controll changeble,
                // for example - sizes of tiles in tileItemView1 (we just add some Properties to it later). The idea is that if
                // we decide ti rewrite control in future to own we can easily change it without any problems.
            }
            else
            {
                // it's seems we cant find clients so we just throw Exception
                throw new Exception("No one \"Ultima Online\" client was founded.");
            }
        }
Пример #16
0
 public Misc(UODataManager location) : base(location)
 {
 }
Пример #17
0
 public TxtFile(string location, UODataManager data)
 {
     _location = location;
     _multi    = new MultiCollection(data);
 }
Пример #18
0
 public Walls(UODataManager location) : base(location)
 {
 }
Пример #19
0
 public Teleprts(UODataManager location) : base(location)
 {
 }
Пример #20
0
 public Roofs(UODataManager location) : base(location)
 {
 }
Пример #21
0
 public Doors(UODataManager location) : base(location)
 {
 }
Пример #22
0
 public Doors(UODataManager location) : base(location)
 {
 }
Пример #23
0
 public SuppInfo(UODataManager location)
 {
     _dataManager = location;
     Positions = new Dictionary<uint, PositionTiles>();
 }
Пример #24
0
        // art.mul convertors    ---------------------------------------------------------------

        private static unsafe void ConvertLandSurface(UODataManager datamanager, byte[] rawdata, out ISurface surface)
        {
            if (rawdata == null || rawdata.Length == 0) {
                surface = null;
                return;
            }

            fixed (byte* data = rawdata)
            {
                ushort* bdata = (ushort*)data;
                int xOffset = 21;
                int xRun = 2;

                surface = datamanager.CreateSurface(44, 44, EssenceUDK.Platform.DataTypes.PixelFormat.Bpp16A1R5G5B5);
                lock (surface) {
                    ushort*  line = surface.ImageWordPtr;
                    uint    delta = surface.Stride >> 1;

                    for (int y = 0; y < 22; ++y, --xOffset, xRun += 2, line += delta) {
                        ushort* cur = line + xOffset;
                        ushort* end = cur + xRun;

                        while (cur < end)
                            *cur++ = (ushort)(*bdata++ | 0x8000);
                    }

                    xOffset = 0;
                    xRun = 44;

                    for (int y = 0; y < 22; ++y, ++xOffset, xRun -= 2, line += delta) {
                        ushort* cur = line + xOffset;
                        ushort* end = cur + xRun;

                        while (cur < end)
                            *cur++ = (ushort)(*bdata++ | 0x8000);
                    }
                }
            }
        }
Пример #25
0
 public Tile1024(UODataManager location) : base(location)
 {
 }
Пример #26
0
        // texmaps.mul convertors --------------------------------------------------------------

        private static unsafe void ConvertTexmSurface(UODataManager datamanager, uint extra, byte[] rawdata, out ISurface surface)
        {
            if (rawdata == null || rawdata.Length == 0) {
                surface = null;
                return;
            }

            // TODO: its greate loooose, we need to view at osi data model
            ushort size = (ushort)(rawdata.Length == 8192 ? 64 : 128);
            //int size = extra == 0 ? 64 : 128;

            surface = datamanager.CreateSurface(size, size, EssenceUDK.Platform.DataTypes.PixelFormat.Bpp16A1R5G5B5);
            lock (surface) {
                ushort*  line = surface.ImageWordPtr;
                uint    delta = surface.Stride >> 1;

                fixed (byte* data = rawdata)
                {
                    ushort* bindat = (ushort*)data;
                    for (int y = 0; y < size; ++y, line += delta) {
                        ushort* cur = line;
                        ushort* end = cur + size;

                        while (cur < end)
                            *cur++ = (ushort)(*bindat++ ^ 0x8000);
                    }
                }
            }
        }
Пример #27
0
 public MultiCollection(UODataManager tileData)
 {
     this._tileData = tileData;
     _multiTiles = new ObservableCollection<MultiTile>();
     _categories = new ObservableCollection<TileCategory>();
 }
Пример #28
0
 protected Factory(UODataManager location)
 {
     DataManager = location;
     _categories = new ObservableCollection <TileCategory>();
 }
Пример #29
0
        internal ClassicFactory(UODataManager data)
        {
            Data = data;
            if (data.DataType.HasFlag(UODataType.UseUopFiles))
                throw new NotImplementedException();


            //IDataContainer uop = new UopContainer(GetPath("AnimationSequence.uop"), data.RealTime);
            //var sequence = new byte[uop.EntryLength][];
            //for (var i = 0U; i < uop.EntryLength; ++i)
            //    sequence[i] = uop[i];

            MulContainer virtualcontainer = null;
            virtualcontainer   = MulContainer.GetVirtual(null, GetPath("tiledata.mul"), data.RealTime);
            container_LandData = new MulContainer(virtualcontainer, 0, (_LandLength>>5), (uint)(data.DataType.HasFlag(UODataType.UseNewDatas) ?  964 :  836));
            container_ItemData = new MulContainer(virtualcontainer,    (_LandLength>>5)* (uint)(data.DataType.HasFlag(UODataType.UseNewDatas) ?  964 :  836), 
                                                                                      0, (uint)(data.DataType.HasFlag(UODataType.UseNewDatas) ? 1316 : 1188));

            if (!String.IsNullOrEmpty(GetPath("artidx.mul")) && !String.IsNullOrEmpty(GetPath("art.mul"))) {
                virtualcontainer   = MulContainer.GetVirtual(GetPath("artidx.mul"), GetPath("art.mul"), data.RealTime);
                container_LandTile = new MulContainer(virtualcontainer, 0, _LandLength);
                container_ItemTile = new MulContainer(virtualcontainer, _LandLength, 0);
             }

            if (!String.IsNullOrEmpty(GetPath("texidx.mul")) && !String.IsNullOrEmpty(GetPath("texmaps.mul"))) 
                container_LandTexm = new MulContainer(GetPath("texidx.mul"),  GetPath("texmaps.mul"), data.RealTime);

            if (!String.IsNullOrEmpty(GetPath("gumpidx.mul")) && !String.IsNullOrEmpty(GetPath("gumpart.mul"))) 
                container_GumpData = new MulContainer(GetPath("gumpidx.mul"), GetPath("gumpart.mul"), data.RealTime);

            //container_ItemAnim = new MulContainer(0, GetPath("animdata.mul"), realtime);

            var animationcontainer = new List<IDataContainer>(16);
            if (!String.IsNullOrEmpty(GetPath("anim.idx")) && !String.IsNullOrEmpty(GetPath("anim.mul")))
                animationcontainer.Add(new MulContainer(GetPath("anim.idx"), GetPath("anim.mul"), data.RealTime));
            if (!String.IsNullOrEmpty(GetPath("anim2.idx")) && !String.IsNullOrEmpty(GetPath("anim2.mul")))
                animationcontainer.Add(new MulContainer(GetPath("anim2.idx"), GetPath("anim2.mul"), data.RealTime));
            if (!String.IsNullOrEmpty(GetPath("anim3.idx")) && !String.IsNullOrEmpty(GetPath("anim3.mul")))
                animationcontainer.Add(new MulContainer(GetPath("anim3.idx"), GetPath("anim3.mul"), data.RealTime));
            if (!String.IsNullOrEmpty(GetPath("anim4.idx")) && !String.IsNullOrEmpty(GetPath("anim4.mul")))
                animationcontainer.Add(new MulContainer(GetPath("anim4.idx"), GetPath("anim4.mul"), data.RealTime));
            if (!String.IsNullOrEmpty(GetPath("anim5.idx")) && !String.IsNullOrEmpty(GetPath("anim5.mul")))
                animationcontainer.Add(new MulContainer(GetPath("anim5.idx"), GetPath("anim5.mul"), data.RealTime));
            if (!String.IsNullOrEmpty(GetPath("animationframe1.uop")))
                animationcontainer.Add(new UopContainer(GetPath("animationframe1.uop"), data.RealTime));
            if (!String.IsNullOrEmpty(GetPath("animationframe2.uop")))
                animationcontainer.Add(new UopContainer(GetPath("animationframe2.uop"), data.RealTime));
            if (!String.IsNullOrEmpty(GetPath("animationframe3.uop")))
                animationcontainer.Add(new UopContainer(GetPath("animationframe3.uop"), data.RealTime));
            if (!String.IsNullOrEmpty(GetPath("animationframe4.uop")))
                animationcontainer.Add(new UopContainer(GetPath("animationframe4.uop"), data.RealTime));
            container_Animation = animationcontainer.ToArray();

            var maps = data.DataOptions.majorFacet.Length;
            container_Map    = new IDataContainer[maps];
            container_Sta    = new IDataContainer[maps];
            //container_MapDif = new IDataContainer[maps];
            //container_StaDif = new IDataContainer[maps];
            //container_Facet  = new IDataContainer[maps];
            for (int m = 0; m < maps; ++m) {
                string path1, path2, x = data.DataType.HasFlag(UODataType.UseExtFacet) ? "x" : String.Empty;
                container_Map[m] =  !String.IsNullOrEmpty(path2=GetPath("map{0}{1}.mul",m,x)) ? new MulContainer(196, path2, data.RealTime) : null;
                container_Sta[m] = (!String.IsNullOrEmpty(path1=GetPath("staidx{0}{1}.mul",m,x)) && !String.IsNullOrEmpty(path2=GetPath("statics{0}{1}.mul",m,x)))
                                 ? new MulContainer(path1, path2, data.RealTime) : null;


                //container_Facet[m] = !String.IsNullOrEmpty(path2 = GetPath("facet0{0}.mul", m)) ? new MulContainer(1, path2, data.RealTime) : null;
            }

            /*
            container_Map    = new IDataContainer[6];
            container_Sta    = new IDataContainer[6];
            container_MapDif = new IDataContainer[6];
            container_StaDif = new IDataContainer[6];
            container_Facet  = new IDataContainer[6];

            for (var i = 0; i < container_UniFont.Length; ++i)
                container_Map[i] = new MulContainer(0, Path.Combine(folder, String.Format("unifont{0}.mul", i), true));
            */
            //container_UniFont = new IDataContainer[13];
            //for (var i = 0; i < container_UniFont.Length; ++i)
            //    container_UniFont[i] = new MulContainer(0, Path.Combine(folder, String.Format("unifont{0}.mul", i), true));

        }
Пример #30
0
 public Misc(UODataManager location) : base(location)
 {
 }
Пример #31
0
        private static unsafe void ConvertItemSurface(UODataManager datamanager, byte[] rawdata, out ISurface surface)
        {
            fixed (byte* data = rawdata)
            {
                ushort* bindata = (ushort*)data;

                int count = 2;
                ushort width = bindata[count++];
                ushort height = bindata[count++];

                if (width >= 0x0400 || height >= 0x0400) {
                    surface = null;
                    return;
                }

                int[] lookups = new int[height];
                int start = (height + 4);
                for (int i = 0; i < height; ++i)
                    lookups[i] = (int)(start + (bindata[count++]));

                surface = datamanager.CreateSurface(width, height, EssenceUDK.Platform.DataTypes.PixelFormat.Bpp16A1R5G5B5);
                lock (surface) {
                    ushort*  line = surface.ImageWordPtr;
                    uint    delta = surface.Stride >> 1;

                    for (int y = 0; y < height; ++y, line += delta)
                    {
                        count = lookups[y];
                        ushort* cur = line;
                        ushort* end;
                        int xOffset, xRun;

                        while (((xOffset = bindata[count++]) + (xRun = bindata[count++])) != 0) {
                            if (cur >= surface.ImageWordPtr + delta * height)
                                break;

                            if (2 * count >= rawdata.Length)
                                break;

                            if (xOffset + xRun > delta)
                                break;

                            cur += xOffset;
                            end = cur + xRun;

                            while (cur < end)
                                *cur++ = (ushort)(bindata[count++] ^ 0x8000);
                        }
                    }
                }
            }
        }
Пример #32
0
 public TilesComparer(UODataManager manager)
 {
     dataManager = manager;
 }
Пример #33
0
        // gumps convertors       --------------------------------------------------------------

        private static unsafe void ConvertGumpSurface(UODataManager datamanager, uint extra, byte[] rawdata, out ISurface surface)
        {
            uint width = (extra >> 16) & 0xFFFF;
            uint height = extra & 0xFFFF;
            if (rawdata == null || /* extra == 0xFFFFFFFF || */ (extra & 0x80008000) != 0 || width == 0 || height == 0) {
                surface = null;
                return;
            }

            surface = datamanager.CreateSurface((ushort)width, (ushort)height, EssenceUDK.Platform.DataTypes.PixelFormat.Bpp16A1R5G5B5);
            lock (surface) {
                ushort*  line = surface.ImageWordPtr;
                uint    delta = surface.Stride >> 1;

                fixed (byte* data = rawdata) {
                    uint* lookup = (uint*)data;
                    ushort* dat = (ushort*)data;

                    for (uint count = 0, y = 0; y < height; ++y, line += delta)
                    {
                        count = (*lookup++ << 1);

                        ushort* cur = line;
                        ushort* end = line + width;

                        while (cur < end) {
                            ushort color = dat[count++];
                            ushort* next = cur + dat[count++];

                            if (color == 0)
                                cur = next;
                            else {
                                color ^= 0x8000;
                                while (cur < next)
                                    *cur++ = color;
                            }
                        }
                    }

                }
            }
        }
Пример #34
0
 public Teleprts(UODataManager location) : base(location)
 {
 }
Пример #35
0
 public Roofs(UODataManager location) : base(location)
 {
 }
Пример #36
0
 public MultiCollection(UODataManager tileData)
 {
     this._tileData = tileData;
     _multiTiles    = new ObservableCollection <MultiTile>();
     _categories    = new ObservableCollection <TileCategory>();
 }
Пример #37
0
 public Tile256(UODataManager location) : base(location)
 {
 }
Пример #38
0
 public Tile256(UODataManager location) : base(location)
 {
 }