Exemple #1
0
 public Texture GetItem(IHue hue, short itemID)
 {
     if (this.m_LastImageHue != hue || (int)this.m_LastImageID != (int)itemID)
     {
         this.m_LastImageHue = hue;
         this.m_LastImageID  = itemID;
         this.m_LastImage    = hue.GetItem((int)itemID);
     }
     return(this.m_LastImage);
 }
Exemple #2
0
 public Texture GetItem(IHue hue, short itemID)
 {
     if ((this.m_LastImageHue != hue) || (this.m_LastImageID != itemID))
     {
         this.m_LastImageHue = hue;
         this.m_LastImageID  = itemID;
         this.m_LastImage    = hue.GetItem(itemID);
     }
     return(this.m_LastImage);
 }
Exemple #3
0
 public GItemArt(int x, int y, int itemID, IHue hue) : base(x, y)
 {
     this.m_vCache = new VertexCache();
     this.m_Hue    = hue;
     this.m_ItemID = itemID;
     this.m_Image  = hue.GetItem(itemID);
     if ((this.m_Image != null) && !this.m_Image.IsEmpty())
     {
         this.m_Width  = this.m_Image.Width;
         this.m_Height = this.m_Image.Height;
         this.m_Draw   = true;
     }
 }
Exemple #4
0
 public GItemArt(int x, int y, int itemID, IHue hue)
     : base(x, y)
 {
     this.m_vCache = new VertexCache();
     this.m_Hue = hue;
     this.m_ItemID = itemID;
     this.m_Image = hue.GetItem(itemID);
     if ((this.m_Image != null) && !this.m_Image.IsEmpty())
     {
         this.m_Width = this.m_Image.Width;
         this.m_Height = this.m_Image.Height;
         this.m_Draw = true;
     }
 }
Exemple #5
0
        public override bool Slice()
        {
            double normalized = this.m_Sync.Normalized;

            if (normalized >= 1.0)
            {
                return(false);
            }
            int xSource;
            int ySource;
            int xTarget;
            int yTarget;
            int xPixel;
            int yPixel;

            this.GetRenderLocation(normalized, out xSource, out ySource, out xTarget, out yTarget, out xPixel, out yPixel);
            IHue hue  = Renderer.m_Dead ? Hues.Grayscale : this.m_Hue;
            int  num1 = this.m_ItemID;

            if (this.m_Animated)
            {
                num1 += (int)this.m_Animation[(Renderer.m_Frames - this.m_Start) / this.m_Delay % this.m_FrameCount];
            }
            Texture texture1 = hue.GetItem(num1);
            double  angle    = Math.Atan2((double)(ySource - yTarget), (double)(xSource - xTarget));
            double  xCenter  = (double)(texture1.xMin + texture1.xMax) * 0.5;
            double  yCenter  = (double)(texture1.yMin + texture1.yMax) * 0.5;

            Renderer.FilterEnable = true;
            if (num1 == 3853)
            {
                angle += normalized * Math.PI * 4.0;
            }
            else if (this._effectId == 9501)
            {
                xCenter = 12.0;
                yCenter = 10.0;
            }
            RenderEffect renderEffect = Effects.GetItemEffect(num1);

            if (renderEffect != null && renderEffect.Glow != null)
            {
                Texture texture2 = Hues.Shadow.GetItem(num1);
                if (texture2 != null && !texture2.IsEmpty())
                {
                    Renderer.PushAlpha(renderEffect.Glow.Alpha);
                    Renderer.SetBlendType(DrawBlendType.Additive);
                    int input = renderEffect.Glow.Color ?? texture2._averageColor;
                    if (this._effectId == 9501)
                    {
                        input = 16737792;
                    }
                    int color1 = hue.Pixel32(input);
                    texture2.DrawRotated(xPixel, yPixel, angle, color1, xCenter + 8.0, yCenter + 8.0);
                    int?color2 = renderEffect.Glow.Color;
                    if ((color2.GetValueOrDefault() != 9203350 ? 0 : (color2.HasValue ? 1 : 0)) != 0)
                    {
                        Renderer.SetAlpha(renderEffect.Glow.Alpha * 0.5f);
                        texture2.DrawRotated(xPixel, yPixel, angle, color1, xCenter + 8.0, yCenter + 8.0);
                    }
                    Renderer.SetBlendType(DrawBlendType.Normal);
                    Renderer.PopAlpha();
                }
            }
            float num2 = 1f;

            if (this._effectId == 9501)
            {
                Texture texture2 = hue.GetItem(4972);
                if (texture2 != null && !texture2.IsEmpty())
                {
                    Renderer.FilterEnable = true;
                    texture2.DrawRotated(xPixel, yPixel, angle + normalized * Math.PI * 4.0, 13395507);
                    Renderer.FilterEnable = false;
                    num2 = 0.5f;
                }
            }
            switch (this.m_RenderMode)
            {
            case 2:
            case 3:
                renderEffect = RenderEffects.Additive;
                break;

            case 4:
                renderEffect = RenderEffects.HalfAdditive;
                break;
            }
            if (renderEffect == null)
            {
                renderEffect = RenderEffects.Default;
            }
            Renderer.PushAlpha(renderEffect.Alpha * num2);
            Renderer.SetBlendType(renderEffect.BlendType);
            Renderer.FilterEnable = true;
            int color = 16777215;

            if (this._effectId == 9501)
            {
                color = 16737792;
            }
            texture1.DrawRotated(xPixel, yPixel, angle, color, xCenter, yCenter);
            Renderer.FilterEnable = false;
            Renderer.SetBlendType(DrawBlendType.Normal);
            Renderer.PopAlpha();
            return(true);
        }
Exemple #6
0
        public override bool Slice()
        {
            int xWorld  = Renderer.m_xWorld;
            int yWorld  = Renderer.m_yWorld;
            int zWorld  = Renderer.m_zWorld;
            int x       = 0;
            int y       = 0;
            int z       = 0;
            int xOffset = 0;
            int yOffset = 0;
            int fOffset = 0;

            base.GetSource(out x, out y, out z);
            x -= xWorld;
            y -= yWorld;
            z -= zWorld;
            int num10 = (Engine.GameWidth >> 1) + ((x - y) * 0x16);
            int num11 = (((Engine.GameHeight >> 1) + 0x16) + ((x + y) * 0x16)) - (z * 4);

            num10 += Engine.GameX;
            num11 += Engine.GameY;
            if ((base.m_Source != null) && (base.m_Source.GetType() == typeof(Mobile)))
            {
                Mobile source = (Mobile)base.m_Source;
                if (source.Walking.Count > 0)
                {
                    WalkAnimation animation = (WalkAnimation)source.Walking.Peek();
                    if (animation.Snapshot(ref xOffset, ref yOffset, ref fOffset))
                    {
                        num10 += xOffset;
                        num11 += yOffset;
                    }
                }
            }
            num10 -= Renderer.m_xScroll;
            num11 -= Renderer.m_yScroll;
            Texture t   = null;
            IHue    hue = Renderer.m_Dead ? Hues.Grayscale : this.m_Hue;

            if (this.m_Animated)
            {
                if ((Renderer.m_Frames - this.m_Start) >= this.m_Duration)
                {
                    return(false);
                }
                t = hue.GetItem(this.m_ItemID + this.m_Animation[((Renderer.m_Frames - this.m_Start) / this.m_Delay) % this.m_FrameCount]);
            }
            else
            {
                if ((Renderer.m_Frames - this.m_Start) >= this.m_Duration)
                {
                    return(false);
                }
                t = hue.GetItem(this.m_ItemID);
            }
            if (this.m_vCache == null)
            {
                this.m_vCache = base.VCPool.GetInstance();
            }
            switch (this.m_RenderMode)
            {
            case 2:
                Renderer.SetAlpha(1f);
                Renderer.SetAlphaEnable(true);
                Renderer.SetBlendType(DrawBlendType.Additive);
                break;

            case 3:
                Renderer.SetAlpha(1.5f);
                Renderer.SetAlphaEnable(true);
                Renderer.SetBlendType(DrawBlendType.Additive);
                break;

            case 4:
                Renderer.SetAlpha(0.5f);
                Renderer.SetAlphaEnable(true);
                Renderer.SetBlendType(DrawBlendType.Normal);
                break;
            }
            this.m_vCache.DrawGame(t, num10 - (t.Width / 2), num11 - t.Height);
            switch (this.m_RenderMode)
            {
            case 2:
            case 3:
            case 4:
                Renderer.SetAlphaEnable(false);
                Renderer.SetBlendType(DrawBlendType.Normal);
                break;
            }
            return(true);
        }
Exemple #7
0
 public Texture GetItem(IHue hue, short itemID)
 {
     if ((this.m_LastImageHue != hue) || (this.m_LastImageID != itemID))
     {
         this.m_LastImageHue = hue;
         this.m_LastImageID = itemID;
         this.m_LastImage = hue.GetItem(itemID);
     }
     return this.m_LastImage;
 }
Exemple #8
0
        public override bool Slice()
        {
            double normalized = this.m_Sync.Normalized;

            if (normalized >= 1.0)
            {
                return(false);
            }
            int xWorld  = Renderer.m_xWorld;
            int yWorld  = Renderer.m_yWorld;
            int zWorld  = Renderer.m_zWorld;
            int x       = 0;
            int y       = 0;
            int z       = 0;
            int xOffset = 0;
            int yOffset = 0;
            int fOffset = 0;

            base.GetSource(out x, out y, out z);
            x -= xWorld;
            y -= yWorld;
            z -= zWorld;
            int num11 = (Engine.GameWidth >> 1) + ((x - y) * 0x16);
            int num12 = ((Engine.GameHeight >> 1) + ((x + y) * 0x16)) - (z * 4);

            if (base.m_Source is Mobile)
            {
                num12 -= 30;
            }
            num11 += Engine.GameX;
            num12 += Engine.GameY;
            num11 -= Renderer.m_xScroll;
            num12 -= Renderer.m_yScroll;
            if ((base.m_Source != null) && (base.m_Source.GetType() == typeof(Mobile)))
            {
                Mobile source = (Mobile)base.m_Source;
                if (source.Walking.Count > 0)
                {
                    WalkAnimation animation = (WalkAnimation)source.Walking.Peek();
                    if (animation.Snapshot(ref xOffset, ref yOffset, ref fOffset))
                    {
                        num11 += xOffset;
                        num12 += yOffset;
                    }
                }
            }
            base.GetTarget(out x, out y, out z);
            x -= xWorld;
            y -= yWorld;
            z -= zWorld;
            int num13 = (Engine.GameWidth >> 1) + ((x - y) * 0x16);
            int num14 = ((Engine.GameHeight >> 1) + ((x + y) * 0x16)) - (z * 4);

            if (base.m_Target is Mobile)
            {
                num14 -= 50;
            }
            num13 += Engine.GameX;
            num14 += Engine.GameY;
            num13 -= Renderer.m_xScroll;
            num14 -= Renderer.m_yScroll;
            if ((base.m_Target != null) && (base.m_Target.GetType() == typeof(Mobile)))
            {
                Mobile target = (Mobile)base.m_Target;
                if (target.Walking.Count > 0)
                {
                    WalkAnimation animation2 = (WalkAnimation)target.Walking.Peek();
                    if (animation2.Snapshot(ref xOffset, ref yOffset, ref fOffset))
                    {
                        num13 += xOffset;
                        num14 += yOffset;
                    }
                }
            }
            Texture item = null;
            IHue    hue  = Renderer.m_Dead ? Hues.Grayscale : this.m_Hue;

            if (this.m_Animated)
            {
                item = hue.GetItem(this.m_ItemID + this.m_Animation[((Renderer.m_Frames - this.m_Start) / this.m_Delay) % this.m_FrameCount]);
            }
            else
            {
                item = hue.GetItem(this.m_ItemID);
            }
            switch (this.m_RenderMode)
            {
            case 2:
                Renderer.SetAlpha(1f);
                Renderer.SetAlphaEnable(true);
                Renderer.SetBlendType(DrawBlendType.Additive);
                break;

            case 3:
                Renderer.SetAlpha(1.5f);
                Renderer.SetAlphaEnable(true);
                Renderer.SetBlendType(DrawBlendType.Additive);
                break;

            case 4:
                Renderer.SetAlpha(0.5f);
                Renderer.SetAlphaEnable(true);
                Renderer.SetBlendType(DrawBlendType.Normal);
                break;
            }
            int num15 = num11 + ((int)((num13 - num11) * normalized));
            int num16 = num12 + ((int)((num14 - num12) * normalized));

            item.DrawRotated(num15, num16, Math.Atan2((double)(num12 - num14), (double)(num11 - num13)));
            switch (this.m_RenderMode)
            {
            case 2:
            case 3:
            case 4:
                Renderer.SetAlphaEnable(false);
                Renderer.SetBlendType(DrawBlendType.Normal);
                break;
            }
            return(true);
        }
Exemple #9
0
        public override bool Slice()
        {
            if (Renderer.m_Frames - this.m_Start >= this.m_Duration)
            {
                return(false);
            }
            int xPixel;
            int yPixel;

            this.GetRenderLocation(out xPixel, out yPixel);
            IHue hue  = Renderer.m_Dead ? Hues.Grayscale : this.m_Hue;
            int  num1 = this.m_ItemID;

            if (this.m_Animated)
            {
                num1 += (int)this.m_Animation[(Renderer.m_Frames - this.m_Start) / this.m_Delay % this.m_FrameCount];
            }
            Texture tex = hue.GetItem(num1);

            if (this.m_vCache == null)
            {
                this.m_vCache = this.VCPool.GetInstance();
            }
            int          num2         = (Renderer.m_Frames - this.m_Start) / this.m_Duration;
            RenderEffect renderEffect = Effects.GetItemEffect(num1);

            if (renderEffect != null && renderEffect.Glow != null)
            {
                Texture texture = Hues.Shadow.GetItem(num1);
                if (texture != null && !texture.IsEmpty())
                {
                    Renderer.PushAlpha(renderEffect.Glow.Alpha);
                    Renderer.SetBlendType(DrawBlendType.Additive);
                    int color1 = hue.Pixel32(renderEffect.Glow.Color ?? texture._averageColor);
                    texture.DrawGame(xPixel - tex.Width / 2 - 8, yPixel - tex.Height - 8, color1);
                    int?color2 = renderEffect.Glow.Color;
                    if ((color2.GetValueOrDefault() != 9203350 ? 0 : (color2.HasValue ? 1 : 0)) != 0)
                    {
                        Renderer.SetAlpha(renderEffect.Glow.Alpha * 0.5f);
                        texture.DrawGame(xPixel - tex.Width / 2 - 8, yPixel - tex.Height - 8, color1);
                    }
                    Renderer.SetBlendType(DrawBlendType.Normal);
                    Renderer.PopAlpha();
                }
            }
            switch (this.m_RenderMode)
            {
            case 2:
            case 3:
                renderEffect = RenderEffects.Additive;
                break;

            case 4:
                renderEffect = RenderEffects.HalfAdditive;
                break;
            }
            if (renderEffect == null)
            {
                renderEffect = RenderEffects.Default;
            }
            Renderer.PushAlpha(renderEffect.Alpha);
            Renderer.SetBlendType(renderEffect.BlendType);
            this.m_vCache.DrawGame(tex, xPixel - tex.Width / 2, yPixel - tex.Height);
            Renderer.SetBlendType(DrawBlendType.Normal);
            Renderer.PopAlpha();
            return(true);
        }