Exemplo n.º 1
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            Item item = World.Items.Get(LocalSerial);

            if (item == null)
            {
                Dispose();
            }

            if (IsDisposed)
            {
                return(false);
            }

            ResetHueVector();
            ShaderHuesTraslator.GetHueVector(ref _hueVector, MouseIsOver && HighlightOnMouseOver ? 0x0035 : item.Hue, item.ItemData.IsPartialHue, 0, true);

            batcher.Draw2D(Texture, x, y, Width, Height, ref _hueVector);

            if (item.Amount > 1 && item.ItemData.IsStackable && item.DisplayedGraphic == item.Graphic)
            {
                batcher.Draw2D(Texture, x + 5, y + 5, Width, Height, ref _hueVector);
            }

            return(base.Draw(batcher, x, y));
        }
Exemplo n.º 2
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            Vector3 vec = ShaderHuesTraslator.GetHueVector(Hue, IsPartial, Alpha, false);

            if (ScaleTexture)
            {
                if (Texture is ArtTexture artTexture)
                {
                    //var rect = new Rectangle(position.X, position.Y, Width, Height);

                    int w = Width;
                    int h = Height;

                    if (artTexture.ImageRectangle.Width < Width)
                    {
                        w = artTexture.ImageRectangle.Width;
                    }
                    if (artTexture.ImageRectangle.Height < Height)
                    {
                        h = artTexture.ImageRectangle.Height;
                    }

                    var r = artTexture.ImageRectangle;

                    return(batcher.Draw2D(Texture, x, y, w, h, r.X, r.Y, r.Width, r.Height, vec));
                }
                return(batcher.Draw2D(Texture, x, y, Width, Height, 0, 0, Texture.Width, Texture.Height, vec));
            }
            return(batcher.Draw2D(Texture, x, y, vec));
        }
Exemplo n.º 3
0
        public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null)
        {
            //int offsetTop = Math.Max(_gumpTexture[0].Height, _gumpTexture[2].Height) - _gumpTexture[1].Height;
            //int offsetBottom = Math.Max(_gumpTexture[5].Height, _gumpTexture[7].Height) - _gumpTexture[6].Height;
            //int offsetLeft = Math.Max(_gumpTexture[0].Width, _gumpTexture[5].Width) - _gumpTexture[3].Width;
            //int offsetRight = Math.Max(_gumpTexture[2].Width, _gumpTexture[7].Width) - _gumpTexture[4].Width;

            Vector3 color = IsTransparent ? ShaderHuesTraslator.GetHueVector(0, false, Alpha, true) : Vector3.Zero;

            //if (IsTransparent)
            //{
            //    batcher.SetBlendState(_checkerBlend.Value);
            //    DrawInternal(batcher, position, color);
            //    batcher.SetBlendState(null);

            //    batcher.SetStencil(_checkerStencil.Value);
            //    DrawInternal(batcher, position, color);
            //    batcher.SetStencil(null);
            //}
            //else
            //{
            //    DrawInternal(batcher, position, color);
            //}
            DrawInternal(batcher, position, color);
            return(base.Draw(batcher, position, hue));
        }
Exemplo n.º 4
0
            public override bool Draw(Batcher2D batcher, int x, int y)
            {
                Vector3 hue = Vector3.Zero;

                ShaderHuesTraslator.GetHueVector(ref hue, 0, false, 1.0f - (_alpha / 255f));
                return(batcher.Draw2D(Texture, x, y, hue));
            }
Exemplo n.º 5
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList list)
        {
            if (IsDisposed)
            {
                return(false);
            }

            if (AnimationGraphic != _displayedGraphic || Texture == null || Texture.IsDisposed)
            {
                _displayedGraphic = AnimationGraphic;
                Texture           = FileManager.Art.GetTexture(AnimationGraphic);
                Bounds            = new Rectangle(0, 0, Texture.Width, Texture.Height);
            }

            Bounds.X = (int)-Offset.X;
            Bounds.Y = (int)(Offset.Z - Offset.Y);
            Rotation = AngleToTarget;

            if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange)
            {
                HueVector = new Vector3(Constants.OUT_RANGE_COLOR, 1, HueVector.Z);
            }
            else if (World.Player.IsDead && Engine.Profile.Current.EnableBlackWhiteEffect)
            {
                HueVector = new Vector3(Constants.DEAD_RANGE_COLOR, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(Hue);
            }

            Engine.DebugInfo.EffectsRendered++;
            base.Draw(batcher, position, list);

            ref readonly StaticTiles data = ref FileManager.TileData.StaticData[_displayedGraphic];
Exemplo n.º 6
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList list)
        {
            LightningEffect effect = (LightningEffect)GameObject;

            if (effect.AnimationGraphic != _displayed || Texture == null || Texture.IsDisposed)
            {
                _displayed = effect.AnimationGraphic;

                if (_displayed > 0x4E29)
                {
                    return(false);
                }
                Texture = FileManager.Gumps.GetTexture(_displayed);
                Point offset = _offsets[_displayed - 20000];
                Bounds = new Rectangle(offset.X, Texture.Height - 33 + offset.Y, Texture.Width, Texture.Height);
            }

            if (Engine.Profile.Current.NoColorObjectsOutOfRange && GameObject.Distance > World.ViewRange)
            {
                HueVector = new Vector3(0x038E, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(effect.Hue);
            }
            Engine.DebugInfo.EffectsRendered++;
            return(base.Draw(batcher, position, list));
        }
Exemplo n.º 7
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (IsDestroyed)
            {
                return(false);
            }

            ResetHueVector();


            if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                HueVector.X = Constants.OUT_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect)
            {
                HueVector.X = Constants.DEAD_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else
            {
                ShaderHuesTraslator.GetHueVector(ref HueVector, Hue);
            }

            //Engine.DebugInfo.EffectsRendered++;

            DrawStatic(batcher, AnimationGraphic, posX - ((int)Offset.X + 22), posY - ((int)-Offset.Y + 22), ref HueVector);

            ref StaticTiles data = ref TileDataLoader.Instance.StaticData[_displayedGraphic];
Exemplo n.º 8
0
            public override bool Draw(UltimaBatcher2D batcher, int x, int y)
            {
                ResetHueVector();
                ShaderHuesTraslator.GetHueVector(ref _hueVector, MouseIsOver && HighlightOnMouseOver ? 0x0035 : Item.Hue, Item.ItemData.IsPartialHue, 0, true);

                return(batcher.Draw2D(Texture, x, y, Width, Height, _point.X, _point.Y, _originalSize.X, _originalSize.Y, ref _hueVector));
            }
Exemplo n.º 9
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();
            ShaderHuesTraslator.GetHueVector(ref _hueVector, 0, false, IsTransparent ? Alpha : 0);

            return(batcher.Draw2D(_texture, x, y, Width, Height, ref _hueVector));
        }
Exemplo n.º 10
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList list)
        {
            if (IsDisposed)
            {
                return(false);
            }

            if (AnimationGraphic != _displayedGraphic || Texture == null || Texture.IsDisposed)
            {
                _displayedGraphic = AnimationGraphic;
                Texture           = FileManager.Art.GetTexture(AnimationGraphic);
                Bounds            = new Rectangle(0, 0, Texture.Width, Texture.Height);
            }

            Bounds.X = (int)-Offset.X;
            Bounds.Y = (int)(Offset.Z - Offset.Y);
            Rotation = AngleToTarget;
            if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange)
            {
                HueVector = new Vector3(0x038E, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(Hue);
            }
            Engine.DebugInfo.EffectsRendered++;
            return(base.Draw(batcher, position, list));
        }
Exemplo n.º 11
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();
            ShaderHuesTraslator.GetHueVector(ref _hueVector, Hue);

            return(batcher.Draw2DTiled(Texture, x, y, Percent, Height, ref _hueVector));
        }
Exemplo n.º 12
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();
            ShaderHuesTraslator.GetHueVector(ref _hueVector, Hue, IsPartial, Alpha);

            if (ScaleTexture)
            {
                if (Texture is ArtTexture artTexture)
                {
                    int w = Width;
                    int h = Height;

                    if (artTexture.ImageRectangle.Width < Width)
                    {
                        w  = artTexture.ImageRectangle.Width;
                        x += (Width >> 1) - (w >> 1);
                    }

                    if (artTexture.ImageRectangle.Height < Height)
                    {
                        h  = artTexture.ImageRectangle.Height;
                        y += (Height >> 1) - (h >> 1);
                    }


                    var r = artTexture.ImageRectangle;

                    return(batcher.Draw2D(Texture, x, y, w, h, r.X, r.Y, r.Width, r.Height, ref _hueVector));
                }

                return(batcher.Draw2D(Texture, x, y, Width, Height, 0, 0, Texture.Width, Texture.Height, ref _hueVector));
            }

            return(batcher.Draw2D(Texture, x, y, ref _hueVector));
        }
Exemplo n.º 13
0
        public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null)
        {
            Vector3 color = IsTransparent ? ShaderHuesTraslator.GetHueVector(0, false, Alpha, true) : Vector3.Zero;

            DrawInternal(batcher, position, color);
            return(base.Draw(batcher, position, hue));
        }
Exemplo n.º 14
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || GameObject.IsDisposed)
            {
                return(false);
            }
            Item item = (Item)GameObject;

            if (item.IsCorpse)
            {
                return(DrawCorpse(batcher, position, objectList));
            }


            if (_originalGraphic != item.DisplayedGraphic || Texture == null || Texture.IsDisposed)
            {
                _originalGraphic = item.DisplayedGraphic;
                Texture          = Art.GetStaticTexture(_originalGraphic);
                Bounds           = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);
            }

            HueVector = ShaderHuesTraslator.GetHueVector(GameObject.Hue, TileData.IsPartialHue(item.ItemData.Flags), TileData.IsTranslucent(item.ItemData.Flags) ? .5f : 0, false);

            if (item.Amount > 1 && TileData.IsStackable(item.ItemData.Flags) && item.DisplayedGraphic == GameObject.Graphic)
            {
                Vector3 offsetDrawPosition = new Vector3(position.X - 5, position.Y - 5, 0);
                base.Draw(batcher, offsetDrawPosition, objectList);
            }

            bool ok = base.Draw(batcher, position, objectList);

            MessageOverHead(batcher, position, Bounds.Y);

            return(ok);
        }
Exemplo n.º 15
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            ResetHueVector();

            ushort hue = Hue;

            if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                hue = Constants.OUT_RANGE_COLOR;
            }
            else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect)
            {
                hue = Constants.DEAD_RANGE_COLOR;
            }
            else
            {
                hue = 1150;
            }

            ShaderHuesTraslator.GetHueVector(ref HueVector, hue, false, 0);
            HueVector.Y = ShaderHuesTraslator.SHADER_LIGHTS;

            //Engine.DebugInfo.EffectsRendered++;

            ref var index = ref GumpsLoader.Instance.GetValidRefEntry(AnimationGraphic);
Exemplo n.º 16
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList list)
        {
            if (AnimationGraphic != _displayed || Texture == null || Texture.IsDisposed)
            {
                _displayed = AnimationGraphic;

                if (_displayed > 0x4E29)
                {
                    return(false);
                }
                Texture = FileManager.Gumps.GetTexture(_displayed);
                Point offset = _offsets[_displayed - 20000];
                Bounds = new Rectangle(offset.X, Texture.Height - 33 + offset.Y, Texture.Width, Texture.Height);
            }

            if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange)
            {
                HueVector = new Vector3(Constants.OUT_RANGE_COLOR, 1, HueVector.Z);
            }
            else if (World.Player.IsDead && Engine.Profile.Current.EnableBlackWhiteEffect)
            {
                HueVector = new Vector3(Constants.DEAD_RANGE_COLOR, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(Hue);
            }

            Engine.DebugInfo.EffectsRendered++;
            return(base.Draw(batcher, position, list));
        }
Exemplo n.º 17
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            Vector3 color = IsTransparent ? ShaderHuesTraslator.GetHueVector(0, false, Alpha, true) : Vector3.Zero;

            DrawInternal(batcher, x, y, color);
            return(base.Draw(batcher, x, y));
        }
Exemplo n.º 18
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (IsDisposed || ((ItemHold.Enabled || ItemHold.Dropped) && ItemHold.Serial == LocalSerial))
            {
                return(false);
            }

            base.Draw(batcher, x, y);

            ResetHueVector();
            ShaderHuesTraslator.GetHueVector(ref _hueVector, HighlightOnMouseOver && MouseIsOver ? 0x0035 : Hue, IsPartialHue, 0, false);

            var texture = ArtLoader.Instance.GetTexture(Graphic);

            if (texture != null)
            {
                batcher.Draw2D(texture, x, y, Width, Height, ref _hueVector);

                Item item = World.Items.Get(LocalSerial);

                if (item != null && !item.IsMulti && !item.IsCoin && item.Amount > 1 && item.ItemData.IsStackable)
                {
                    batcher.Draw2D(texture, x + 5, y + 5, Width, Height, ref _hueVector);
                }
            }

            return(true);
        }
Exemplo n.º 19
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            Vector3 hue = Vector3.Zero;

            ShaderHuesTraslator.GetHueVector(ref hue, Hue, IsPartial, Alpha);

            if (ScaleTexture)
            {
                if (Texture is ArtTexture artTexture)
                {
                    int w = Width;
                    int h = Height;

                    if (artTexture.ImageRectangle.Width < Width)
                    {
                        w  = artTexture.ImageRectangle.Width;
                        x += Width / 2 - w / 2;
                    }

                    if (artTexture.ImageRectangle.Height < Height)
                    {
                        h  = artTexture.ImageRectangle.Height;
                        y += Height / 2 - h / 2;
                    }


                    var r = artTexture.ImageRectangle;

                    return(batcher.Draw2D(Texture, x, y, w, h, r.X, r.Y, r.Width, r.Height, hue));
                }
                return(batcher.Draw2D(Texture, x, y, Width, Height, 0, 0, Texture.Width, Texture.Height, hue));
            }
            return(batcher.Draw2D(Texture, x, y, hue));
        }
Exemplo n.º 20
0
            public override bool Draw(UltimaBatcher2D batcher, int x, int y)
            {
                ResetHueVector();
                ShaderHuesTraslator.GetHueVector(ref _hueVector, 0, false, 1.0f - _alpha / 255f, true);

                return(batcher.Draw2D(Texture, x, y, ref _hueVector));
            }
Exemplo n.º 21
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            Vector3 hue = Vector3.Zero;

            ShaderHuesTraslator.GetHueVector(ref hue, 0, false, Alpha);
            return(batcher.Draw2D(CheckerTrans.TransparentTexture, x, y, Width, Height, hue));
        }
Exemplo n.º 22
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();

            ShaderHuesTraslator.GetHueVector(ref _hueVector, Hue, false, Alpha);

            return(batcher.Draw2D(Texture2DCache.GetTexture(Color.Black), x, y, Width, Height, ref _hueVector));
        }
Exemplo n.º 23
0
            public override bool Draw(Batcher2D batcher, int x, int y)
            {
                Vector3 hue = Vector3.Zero;

                ShaderHuesTraslator.GetHueVector(ref hue, MouseIsOver && HighlightOnMouseOver ? 0x0035 : Item.Hue, Item.ItemData.IsPartialHue, 0);

                return(batcher.Draw2D(Texture, x, y, Width, Height, _point.X, _point.Y, _originalSize.X, _originalSize.Y, hue));
            }
Exemplo n.º 24
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            Vector3 hue = Vector3.Zero;

            ShaderHuesTraslator.GetHueVector(ref hue, Hue);

            return(batcher.Draw2DTiled(Texture, x, y, Percent, Height, ref hue));
        }
Exemplo n.º 25
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            Vector3 hue = Vector3.Zero;

            ShaderHuesTraslator.GetHueVector(ref hue, Hue, false, Alpha);

            return(batcher.Draw2D(Textures.GetTexture(Color.Black), x, y, Width, Height, ref hue));
        }
Exemplo n.º 26
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (IsDestroyed)
            {
                return(false);
            }

            ResetHueVector();

            if (AnimationGraphic != _displayedGraphic || Texture == null || Texture.IsDisposed)
            {
                _displayedGraphic = AnimationGraphic;
                Texture           = ArtLoader.Instance.GetTexture(AnimationGraphic);
                Bounds.X          = -((Texture.Width >> 1) - 22);
                Bounds.Y          = -(Texture.Height - 44);
                Bounds.Width      = Texture.Width;
                Bounds.Height     = Texture.Height;
            }


            posX += (int)Offset.X;
            posY += (int)(Offset.Y + Offset.Z);

            //posX += 22;
            //posY += 22;



            if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                HueVector.X = Constants.OUT_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect)
            {
                HueVector.X = Constants.DEAD_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else
            {
                ShaderHuesTraslator.GetHueVector(ref HueVector, Hue);
            }

            //Engine.DebugInfo.EffectsRendered++;

            if (FixedDir)
            {
                batcher.DrawSprite(Texture, posX, posY, false, ref HueVector);
            }
            else
            {
                batcher.DrawSpriteRotated(Texture, posX, posY, Bounds.X, Bounds.Y, ref HueVector, AngleToTarget);
            }

            //Select(posX, posY);
            Texture.Ticks = Time.Ticks;

            ref readonly StaticTiles data = ref TileDataLoader.Instance.StaticData[_displayedGraphic];
Exemplo n.º 27
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (_gumpTexture == null || _gumpTexture.IsDisposed || IsDisposed)
            {
                return(false);
            }

            ResetHueVector();

            batcher.Draw2D(_gumpTexture, x, y, ref _hueVector);
            CreateMiniMapTexture();
            batcher.Draw2D(_mapTexture, x, y, ref _hueVector);

            if (_draw)
            {
                if (_playerIndicator == null)
                {
                    _playerIndicator = new Texture2D(batcher.GraphicsDevice, 1, 1);

                    _playerIndicator.SetData(new uint[1]
                    {
                        0xFFFFFFFF
                    });

                    _mobilesIndicator = new Texture2D(batcher.GraphicsDevice, 1, 1);
                    _mobilesIndicator.SetData(new[] { Color.White });
                }

                int w = Width >> 1;
                int h = Height >> 1;

                foreach (Mobile mob in World.Mobiles)
                {
                    if (mob == World.Player)
                    {
                        continue;
                    }

                    int xx = mob.X - World.Player.X;
                    int yy = mob.Y - World.Player.Y;

                    int gx = xx - yy;
                    int gy = xx + yy;

                    _hueVector.Z = 0;

                    ShaderHuesTraslator.GetHueVector(ref _hueVector, Notoriety.GetHue(mob.NotorietyFlag));

                    batcher.Draw2D(_mobilesIndicator, x + w + gx, y + h + gy, 2, 2, ref _hueVector);
                }

                //DRAW DOT OF PLAYER
                ResetHueVector();
                batcher.Draw2D(_playerIndicator, x + w, y + h, 2, 2, ref _hueVector);
            }

            return(base.Draw(batcher, x, y));
        }
Exemplo n.º 28
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            if (IsDisposed)
            {
                return(false);
            }

            return(batcher.Draw2D(Texture, x, y, ShaderHuesTraslator.GetHueVector(Item.Hue & 0x3FFF, _isPartialHue, Alpha, false)));
        }
Exemplo n.º 29
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();
            ShaderHuesTraslator.GetHueVector(ref _hueVector, Hue, _isPartial, 0);

            batcher.Draw2D(Texture, x, y, /*Width, Height,*/ ref _hueVector);

            return(base.Draw(batcher, x, y));
        }
Exemplo n.º 30
0
        public override bool Draw(SpriteBatchUI spriteBatch, Point position, Vector3?hue = null)
        {
            if (IsDisposed)
            {
                return(false);
            }

            return(spriteBatch.Draw2D(Texture, position, ShaderHuesTraslator.GetHueVector(Item.Hue & 0x3FFF, TileData.IsPartialHue(Item.ItemData.Flags), _isTransparent ? .5f : 0, false)));
        }