예제 #1
0
파일: Exposer.cs 프로젝트: uotools/PlayUO
        public Bitmap GetLand(int LandID, int HueID)
        {
            Texture land = Hues.Load(HueID).GetLand(LandID);

            if ((land == null) || land.IsEmpty())
            {
                return(null);
            }
            return(land.ToBitmap());
        }
예제 #2
0
파일: Exposer.cs 프로젝트: uotools/PlayUO
        public Bitmap GetGump(int GumpID, int HueID)
        {
            Texture gump = Hues.Load(HueID).GetGump(GumpID);

            if ((gump == null) || gump.IsEmpty())
            {
                return(null);
            }
            return(gump.ToBitmap());
        }
예제 #3
0
파일: Exposer.cs 프로젝트: uotools/PlayUO
        public Bitmap GetItem(int ItemID, int HueID)
        {
            Texture item = Hues.Load(HueID).GetItem(ItemID);

            if ((item == null) || item.IsEmpty())
            {
                return(null);
            }
            return(item.ToBitmap());
        }
예제 #4
0
        protected unsafe Texture Construct(bool isReconstruct)
        {
            int num;
            int num2;

            if (!this.CoreLookup())
            {
                return(Texture.Empty);
            }
            this.CoreGetDimensions(out num, out num2);
            Texture tex = new Texture(num, num2, true, 0x19, 1, isReconstruct);

            if (tex.IsEmpty())
            {
                return(Texture.Empty);
            }
            LockData data = tex.Lock(LockFlags.WriteOnly);

            this.CoreProcessImage(data.Width, data.Height, data.Pitch, (ushort *)data.pvSrc, (ushort *)(data.pvSrc + (data.Width * 2)), (ushort *)(data.pvSrc + (data.Height * data.Pitch)), (data.Pitch >> 1) - data.Width, data.Pitch >> 1);
            tex.Unlock();
            this.CoreAssignArgs(tex);
            this.m_Textures.Add(tex);
            return(tex);
        }
예제 #5
0
 protected unsafe Texture Construct(bool isReconstruct)
 {
     int num;
     int num2;
     if (!this.CoreLookup())
     {
         return Texture.Empty;
     }
     this.CoreGetDimensions(out num, out num2);
     Texture tex = new Texture(num, num2, true, 0x19, 1, isReconstruct);
     if (tex.IsEmpty())
     {
         return Texture.Empty;
     }
     LockData data = tex.Lock(LockFlags.WriteOnly);
     this.CoreProcessImage(data.Width, data.Height, data.Pitch, (ushort*) data.pvSrc, (ushort*) (data.pvSrc + (data.Width * 2)), (ushort*) (data.pvSrc + (data.Height * data.Pitch)), (data.Pitch >> 1) - data.Width, data.Pitch >> 1);
     tex.Unlock();
     this.CoreAssignArgs(tex);
     this.m_Textures.Add(tex);
     return tex;
 }
예제 #6
0
파일: Font.cs 프로젝트: uotools/PlayUO
        unsafe Texture IFontFactory.CreateInstance(string text, IHue hue)
        {
            int       num;
            char      ch;
            FontImage image;

            if ((text == null) || (text.Length <= 0))
            {
                return(Texture.Empty);
            }
            int yHeight = 0;
            int num3    = 0;
            int width   = 0;
            int height  = 1;

            char[] chArray = text.ToCharArray();
            for (num = 0; num < chArray.Length; num++)
            {
                ch = chArray[num];
                if ((ch >= ' ') && (ch < 'Ā'))
                {
                    image = this.m_Images[ch - ' '];
                    num3 += image.xWidth;
                    if (num3 > width)
                    {
                        width = num3;
                    }
                    if (image.yHeight > yHeight)
                    {
                        yHeight = image.yHeight;
                    }
                }
                else if (ch == '\n')
                {
                    num3 = 0;
                    height++;
                }
            }
            height *= yHeight;
            if ((width <= 0) || (height <= 0))
            {
                return(Texture.Empty);
            }
            Texture texture = new Texture(width, height, false);

            if (texture.IsEmpty())
            {
                return(Texture.Empty);
            }
            short[] numArray = new short[this.m_Palette.Length];
            fixed(short *numRef = numArray)
            {
                fixed(short *numRef2 = this.m_Palette)
                {
                    hue.CopyPixels((void *)(numRef2 + 1), (void *)(numRef + 1), this.m_Palette.Length - 1);
                }

                LockData data    = texture.Lock(LockFlags.WriteOnly);
                short *  pvSrc   = (short *)data.pvSrc;
                short *  numPtr2 = pvSrc;
                int      num6    = data.Pitch >> 1;
                int      num7    = num6 * yHeight;

                for (num = 0; num < chArray.Length; num++)
                {
                    ch = chArray[num];
                    if ((ch >= ' ') && (ch < 'Ā'))
                    {
                        image = this.m_Images[ch - ' '];
                        int    xWidth  = image.xWidth;
                        int    num11   = image.yHeight;
                        short *numPtr3 = numPtr2;
                        numPtr3 += (yHeight - num11) * num6;
                        int num8 = num6 - xWidth;
                        int num9 = image.xDelta - xWidth;
                        fixed(byte *numRef3 = image.xyPixels)
                        {
                            byte *numPtr4 = numRef3;
                            int   num12   = 0;

                            while (num12 < num11)
                            {
                                int num13 = xWidth >> 2;
                                int num14 = xWidth & 3;
                                while (--num13 >= 0)
                                {
                                    numPtr3[0] = numRef[numPtr4[0]];
                                    numPtr3[1] = numRef[numPtr4[1]];
                                    numPtr3[2] = numRef[numPtr4[2]];
                                    numPtr3[3] = numRef[numPtr4[3]];
                                    numPtr3   += 4;
                                    numPtr4   += 4;
                                }
                                while (--num14 >= 0)
                                {
                                    numPtr3++;
                                    numPtr3[0] = numRef[*(numPtr4++)];
                                }
                                num12++;
                                numPtr3 += num8;
                                numPtr4 += num9;
                            }
                        }

                        numPtr2 += image.xWidth;
                    }
                    else if (ch == '\n')
                    {
                        pvSrc  += num7;
                        numPtr2 = pvSrc;
                    }
                }
                texture.Unlock();
                return(texture);
            }
        }
예제 #7
0
        public unsafe object Create(int realID, IHue hue)
        {
            int length;
            int lookup;
            int num3;
            Stream stream;
            switch (this.ConvertRealID(ref realID))
            {
                case 1:
                {
                    if (((realID < 0) || (realID >= this.m_Count)) || (realID >= this.m_Index.Length))
                    {
                        return Frames.Empty;
                    }
                    Entry3D entryd = this.m_Index[realID];
                    length = entryd.m_Length;
                    lookup = entryd.m_Lookup;
                    num3 = entryd.m_Extra & 0xff;
                    stream = m_Stream;
                    break;
                }
                case 2:
                {
                    if (((realID < 0) || (realID >= this.m_Count2)) || (realID >= this.m_Index2.Length))
                    {
                        return Frames.Empty;
                    }
                    Entry3D entryd2 = this.m_Index2[realID];
                    length = entryd2.m_Length;
                    lookup = entryd2.m_Lookup;
                    num3 = entryd2.m_Extra & 0xff;
                    stream = m_Stream2;
                    break;
                }
                case 3:
                {
                    if (((realID < 0) || (realID >= this.m_Count3)) || (realID >= this.m_Index3.Length))
                    {
                        return Frames.Empty;
                    }
                    Entry3D entryd3 = this.m_Index3[realID];
                    length = entryd3.m_Length;
                    lookup = entryd3.m_Lookup;
                    num3 = entryd3.m_Extra & 0xff;
                    stream = m_Stream3;
                    break;
                }
                default:
                {
                    if (((realID < 0) || (realID >= this.m_Count4)) || (realID >= this.m_Index4.Length))
                    {
                        return Frames.Empty;
                    }
                    Entry3D entryd4 = this.m_Index4[realID];
                    length = entryd4.m_Length;
                    lookup = entryd4.m_Lookup;
                    num3 = entryd4.m_Extra & 0xff;
                    stream = m_Stream4;
                    break;
                }
            }
            if (((lookup < 0) || (length <= 0)) || ((num3 <= 0) || (stream == null)))
            {
                return Frames.Empty;
            }
            if ((this.m_Data == null) || (length > this.m_Data.Length))
            {
                this.m_Data = new byte[length];
            }
            stream.Seek((long) lookup, SeekOrigin.Begin);
            stream.Read(this.m_Data, 0, length);
            fixed (short* numRef = this.m_Palette)
            {
                short* numPtr = numRef;
                fixed (byte* numRef2 = this.m_Data)
                {
                    if (hue.HueID() == 0)
                    {
                        numPtr = (short*) numRef2;
                        int* numPtr2 = (int*) numPtr;
                        int* numPtr3 = numPtr2 + 0x80;
                        while (numPtr2 < numPtr3)
                        {
                            numPtr2[0] |= -2147450880;
                            int* numPtr1 = numPtr2 + 1;
                            numPtr1[0] |= -2147450880;
                            int* numPtr9 = numPtr2 + 2;
                            numPtr9[0] |= -2147450880;
                            int* numPtr10 = numPtr2 + 3;
                            numPtr10[0] |= -2147450880;
                            numPtr2 += 4;
                        }
                    }
                    else
                    {
                        hue.CopyPixels((void*) numRef2, (void*) numPtr, 0x100);
                    }
                    Frames frames = new Frames {
                        FrameCount = num3,
                        FrameList = new Frame[num3]
                    };
                    for (int i = 0; i < num3; i++)
                    {
                        int num6 = (numRef2 + 0x204)[i << 2];
                        byte* numPtr4 = (numRef2 + 0x200) + num6;
                        short* numPtr5 = (short*) numPtr4;
                        int num7 = numPtr5[0];
                        int num8 = numPtr5[1];
                        int width = numPtr5[2];
                        int height = numPtr5[3];
                        numPtr4 += 8;
                        frames.FrameList[i] = new Frame();
                        frames.FrameList[i].CenterX = num7;
                        frames.FrameList[i].CenterY = num8;
                        if ((width <= 0) || (height <= 0))
                        {
                            frames.FrameList[i].Image = Texture.Empty;
                        }
                        else
                        {
                            Texture texture = new Texture(width, height, true);
                            if (texture.IsEmpty())
                            {
                                frames.FrameList[i].Image = Texture.Empty;
                            }
                            else
                            {
                                int num11 = 0;
                                short* numPtr6 = null;
                                int num12 = num7 - 0x200;
                                int num13 = (num8 + height) - 0x200;
                                LockData data = texture.Lock(LockFlags.WriteOnly);
                                short* pvSrc = (short*) data.pvSrc;
                                int num14 = data.Pitch >> 1;
                                pvSrc += num12;
                                pvSrc += num13 * num14;
                                while ((num11 = *((int*) numPtr4)) != 0x7fff7fff)
                                {
                                    numPtr4 += 4;
                                    num11 ^= -2145386496;
                                    numPtr6 = pvSrc + ((((num11 >> 12) & 0x3ff) * num14) + ((num11 >> 0x16) & 0x3ff));
                                    short* numPtr8 = numPtr6 + (num11 & 0xffc);
                                    while (numPtr6 < numPtr8)
                                    {
                                        numPtr6[0] = numPtr[numPtr4[0]];
                                        numPtr6[1] = numPtr[numPtr4[1]];
                                        numPtr6[2] = numPtr[numPtr4[2]];
                                        numPtr6[3] = numPtr[numPtr4[3]];
                                        numPtr6 += 4;
                                        numPtr4 += 4;
                                    }
                                    switch ((num11 & 3))
                                    {
                                        case 1:
                                            goto Label_04A6;

                                        case 2:
                                            break;

                                        case 3:
                                            numPtr6[2] = numPtr[numPtr4[2]];
                                            break;

                                        default:
                                            goto Label_04B5;
                                    }
                                    numPtr6[1] = numPtr[numPtr4[1]];
                                Label_04A6:
                                    numPtr6[0] = numPtr[numPtr4[0]];
                                Label_04B5:
                                    numPtr4 += num11 & 3;
                                }
                                texture.Unlock();
                                texture.SetPriority(0);
                                frames.FrameList[i].Image = texture;
                            }
                        }
                    }
                    this.m_Frames.Add(frames);
                    return frames;
                }
            }
        }
예제 #8
0
        private static unsafe CursorEntry LoadCursor(int idCursor, int idType)
        {
            int  num;
            IHue hue;

            switch (idType)
            {
            case 0:
                hue = Hues.Default;
                num = 0x606a + idCursor;
                break;

            case 1:
                hue = Hues.Default;
                num = 0x6053 + idCursor;
                break;

            case 2:
                hue = Hues.Load(0x896d);
                num = 0x606a + idCursor;
                break;

            default:
                return(null);
            }
            Texture item = hue.GetItem(num);

            if ((item == null) || item.IsEmpty())
            {
                return(new CursorEntry(0, 0, 0, 0, Texture.Empty));
            }
            if (item.m_Factory != null)
            {
                item.m_Factory.Remove(item);
                item.m_Factory     = null;
                item.m_FactoryArgs = null;
            }
            int xOffset = 0;
            int yOffset = 0;

            if (idType < 2)
            {
                LockData data    = item.Lock(LockFlags.ReadWrite);
                int      width   = data.Width;
                int      height  = data.Height;
                int      num6    = data.Pitch >> 1;
                short *  pvSrc   = (short *)data.pvSrc;
                short *  numPtr2 = (short *)(data.pvSrc + (((height - 1) * num6) * 2));
                for (int i = 0; i < width; i++)
                {
                    if ((pvSrc[0] & 0x7fff) == 0x3e0)
                    {
                        xOffset = i;
                    }
                    pvSrc++;
                    pvSrc[0] = 0;
                    numPtr2++;
                    numPtr2[0] = 0;
                }
                pvSrc   = (short *)data.pvSrc;
                numPtr2 = (short *)(data.pvSrc + ((width - 1) * 2));
                for (int j = 0; j < height; j++)
                {
                    if ((pvSrc[0] & 0x7fff) == 0x3e0)
                    {
                        yOffset = j;
                    }
                    pvSrc[0]   = 0;
                    numPtr2[0] = 0;
                    pvSrc     += num6;
                    numPtr2   += num6;
                }
                item.Unlock();
            }
            else
            {
                CursorEntry entry = m_Cursors[idCursor, 1];
                if (entry == null)
                {
                    entry = m_Cursors[idCursor, 0];
                    if (entry == null)
                    {
                        entry = m_Cursors[idCursor, 1] = LoadCursor(idCursor, 1);
                    }
                }
                xOffset = entry.m_xOffset;
                yOffset = entry.m_yOffset;
                LockData data2   = item.Lock(LockFlags.ReadWrite);
                int      num9    = data2.Width;
                int      num10   = data2.Height;
                int      num11   = data2.Pitch >> 1;
                short *  numPtr3 = (short *)data2.pvSrc;
                short *  numPtr4 = (short *)(data2.pvSrc + (((num10 - 1) * num11) * 2));
                for (int k = 0; k < num9; k++)
                {
                    numPtr3++;
                    numPtr3[0] = 0;
                    numPtr4++;
                    numPtr4[0] = 0;
                }
                numPtr3 = (short *)data2.pvSrc;
                numPtr4 = (short *)(data2.pvSrc + ((num9 - 1) * 2));
                for (int m = 0; m < num10; m++)
                {
                    numPtr3[0] = 0;
                    numPtr4[0] = 0;
                    numPtr3   += num11;
                    numPtr4   += num11;
                }
                item.Unlock();
            }
            return(new CursorEntry(idCursor, idType, xOffset, yOffset, item));
        }
예제 #9
0
파일: Font.cs 프로젝트: Skinny1001/PlayUO
 unsafe Texture IFontFactory.CreateInstance(string text, IHue hue)
 {
     int num;
     char ch;
     FontImage image;
     if ((text == null) || (text.Length <= 0))
     {
         return Texture.Empty;
     }
     int yHeight = 0;
     int num3 = 0;
     int width = 0;
     int height = 1;
     char[] chArray = text.ToCharArray();
     for (num = 0; num < chArray.Length; num++)
     {
         ch = chArray[num];
         if ((ch >= ' ') && (ch < 'Ā'))
         {
             image = this.m_Images[ch - ' '];
             num3 += image.xWidth;
             if (num3 > width)
             {
                 width = num3;
             }
             if (image.yHeight > yHeight)
             {
                 yHeight = image.yHeight;
             }
         }
         else if (ch == '\n')
         {
             num3 = 0;
             height++;
         }
     }
     height *= yHeight;
     if ((width <= 0) || (height <= 0))
     {
         return Texture.Empty;
     }
     Texture texture = new Texture(width, height, false);
     if (texture.IsEmpty())
     {
         return Texture.Empty;
     }
     short[] numArray = new short[this.m_Palette.Length];
     fixed (short* numRef = numArray)
     {
         fixed (short* numRef2 = this.m_Palette)
         {
             hue.CopyPixels((void*) (numRef2 + 1), (void*) (numRef + 1), this.m_Palette.Length - 1);
         }
         LockData data = texture.Lock(LockFlags.WriteOnly);
         short* pvSrc = (short*) data.pvSrc;
         short* numPtr2 = pvSrc;
         int num6 = data.Pitch >> 1;
         int num7 = num6 * yHeight;
         for (num = 0; num < chArray.Length; num++)
         {
             ch = chArray[num];
             if ((ch >= ' ') && (ch < 'Ā'))
             {
                 image = this.m_Images[ch - ' '];
                 int xWidth = image.xWidth;
                 int num11 = image.yHeight;
                 short* numPtr3 = numPtr2;
                 numPtr3 += (yHeight - num11) * num6;
                 int num8 = num6 - xWidth;
                 int num9 = image.xDelta - xWidth;
                 fixed (byte* numRef3 = image.xyPixels)
                 {
                     byte* numPtr4 = numRef3;
                     int num12 = 0;
                     while (num12 < num11)
                     {
                         int num13 = xWidth >> 2;
                         int num14 = xWidth & 3;
                         while (--num13 >= 0)
                         {
                             numPtr3[0] = numRef[numPtr4[0]];
                             numPtr3[1] = numRef[numPtr4[1]];
                             numPtr3[2] = numRef[numPtr4[2]];
                             numPtr3[3] = numRef[numPtr4[3]];
                             numPtr3 += 4;
                             numPtr4 += 4;
                         }
                         while (--num14 >= 0)
                         {
                             numPtr3++;
                             numPtr3[0] = numRef[*(numPtr4++)];
                         }
                         num12++;
                         numPtr3 += num8;
                         numPtr4 += num9;
                     }
                 }
                 numPtr2 += image.xWidth;
             }
             else if (ch == '\n')
             {
                 pvSrc += num7;
                 numPtr2 = pvSrc;
             }
         }
         texture.Unlock();
         return texture;
     }
 }
예제 #10
0
        public unsafe object Create(int realID, IHue hue)
        {
            int    length;
            int    lookup;
            int    num3;
            Stream stream;

            switch (this.ConvertRealID(ref realID))
            {
            case 1:
            {
                if (((realID < 0) || (realID >= this.m_Count)) || (realID >= this.m_Index.Length))
                {
                    return(Frames.Empty);
                }
                Entry3D entryd = this.m_Index[realID];
                length = entryd.m_Length;
                lookup = entryd.m_Lookup;
                num3   = entryd.m_Extra & 0xff;
                stream = m_Stream;
                break;
            }

            case 2:
            {
                if (((realID < 0) || (realID >= this.m_Count2)) || (realID >= this.m_Index2.Length))
                {
                    return(Frames.Empty);
                }
                Entry3D entryd2 = this.m_Index2[realID];
                length = entryd2.m_Length;
                lookup = entryd2.m_Lookup;
                num3   = entryd2.m_Extra & 0xff;
                stream = m_Stream2;
                break;
            }

            case 3:
            {
                if (((realID < 0) || (realID >= this.m_Count3)) || (realID >= this.m_Index3.Length))
                {
                    return(Frames.Empty);
                }
                Entry3D entryd3 = this.m_Index3[realID];
                length = entryd3.m_Length;
                lookup = entryd3.m_Lookup;
                num3   = entryd3.m_Extra & 0xff;
                stream = m_Stream3;
                break;
            }

            default:
            {
                if (((realID < 0) || (realID >= this.m_Count4)) || (realID >= this.m_Index4.Length))
                {
                    return(Frames.Empty);
                }
                Entry3D entryd4 = this.m_Index4[realID];
                length = entryd4.m_Length;
                lookup = entryd4.m_Lookup;
                num3   = entryd4.m_Extra & 0xff;
                stream = m_Stream4;
                break;
            }
            }
            if (((lookup < 0) || (length <= 0)) || ((num3 <= 0) || (stream == null)))
            {
                return(Frames.Empty);
            }
            if ((this.m_Data == null) || (length > this.m_Data.Length))
            {
                this.m_Data = new byte[length];
            }
            stream.Seek((long)lookup, SeekOrigin.Begin);
            stream.Read(this.m_Data, 0, length);
            fixed(short *numRef = this.m_Palette)
            {
                short *numPtr = numRef;

                fixed(byte *numRef2 = this.m_Data)
                {
                    if (hue.HueID() == 0)
                    {
                        numPtr = (short *)numRef2;
                        int *numPtr2 = (int *)numPtr;
                        int *numPtr3 = numPtr2 + 0x80;
                        while (numPtr2 < numPtr3)
                        {
                            numPtr2[0] |= -2147450880;
                            int *numPtr1 = numPtr2 + 1;
                            numPtr1[0] |= -2147450880;
                            int *numPtr9 = numPtr2 + 2;
                            numPtr9[0] |= -2147450880;
                            int *numPtr10 = numPtr2 + 3;
                            numPtr10[0] |= -2147450880;
                            numPtr2     += 4;
                        }
                    }
                    else
                    {
                        hue.CopyPixels((void *)numRef2, (void *)numPtr, 0x100);
                    }
                    Frames frames = new Frames {
                        FrameCount = num3,
                        FrameList  = new Frame[num3]
                    };

                    for (int i = 0; i < num3; i++)
                    {
                        int    num6    = (numRef2 + 0x204)[i << 2];
                        byte * numPtr4 = (numRef2 + 0x200) + num6;
                        short *numPtr5 = (short *)numPtr4;
                        int    num7    = numPtr5[0];
                        int    num8    = numPtr5[1];
                        int    width   = numPtr5[2];
                        int    height  = numPtr5[3];
                        numPtr4                    += 8;
                        frames.FrameList[i]         = new Frame();
                        frames.FrameList[i].CenterX = num7;
                        frames.FrameList[i].CenterY = num8;
                        if ((width <= 0) || (height <= 0))
                        {
                            frames.FrameList[i].Image = Texture.Empty;
                        }
                        else
                        {
                            Texture texture = new Texture(width, height, true);
                            if (texture.IsEmpty())
                            {
                                frames.FrameList[i].Image = Texture.Empty;
                            }
                            else
                            {
                                int      num11   = 0;
                                short *  numPtr6 = null;
                                int      num12   = num7 - 0x200;
                                int      num13   = (num8 + height) - 0x200;
                                LockData data    = texture.Lock(LockFlags.WriteOnly);
                                short *  pvSrc   = (short *)data.pvSrc;
                                int      num14   = data.Pitch >> 1;
                                pvSrc += num12;
                                pvSrc += num13 * num14;
                                while ((num11 = *((int *)numPtr4)) != 0x7fff7fff)
                                {
                                    numPtr4 += 4;
                                    num11   ^= -2145386496;
                                    numPtr6  = pvSrc + ((((num11 >> 12) & 0x3ff) * num14) + ((num11 >> 0x16) & 0x3ff));
                                    short *numPtr8 = numPtr6 + (num11 & 0xffc);
                                    while (numPtr6 < numPtr8)
                                    {
                                        numPtr6[0] = numPtr[numPtr4[0]];
                                        numPtr6[1] = numPtr[numPtr4[1]];
                                        numPtr6[2] = numPtr[numPtr4[2]];
                                        numPtr6[3] = numPtr[numPtr4[3]];
                                        numPtr6   += 4;
                                        numPtr4   += 4;
                                    }
                                    switch ((num11 & 3))
                                    {
                                    case 1:
                                        goto Label_04A6;

                                    case 2:
                                        break;

                                    case 3:
                                        numPtr6[2] = numPtr[numPtr4[2]];
                                        break;

                                    default:
                                        goto Label_04B5;
                                    }
                                    numPtr6[1] = numPtr[numPtr4[1]];
Label_04A6:
                                    numPtr6[0] = numPtr[numPtr4[0]];
Label_04B5:
                                    numPtr4 += num11 & 3;
                                }
                                texture.Unlock();
                                texture.SetPriority(0);
                                frames.FrameList[i].Image = texture;
                            }
                        }
                    }
                    this.m_Frames.Add(frames);
                    return(frames);
                }
            }
        }