Exemplo n.º 1
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            // draw regular world
            batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, Vector3.Zero);

            // draw lights
            batcher.SetBlendState(_blend);
            batcher.Draw2D(_scene.Darkness, x, y, Width, Height, Vector3.Zero);
            batcher.SetBlendState(null);

            // draw overheads
            _scene.DrawOverheads(batcher, x, y);

            return(base.Draw(batcher, x, y));
        }
Exemplo n.º 2
0
        public void Draw(Batcher2D batcher, int x, int y)
        {
            if (_texture != null)
            {
                X = x - Width / 2;
                Y = y - Height / 2;

                batcher.SetBlendState(_checkerBlend.Value);
                batcher.SetStencil(_stencil.Value);

                batcher.Draw2D(_texture, X, Y, new Vector3(20, 1, 0));

                batcher.SetBlendState(null);
                batcher.SetStencil(null);
            }
        }
Exemplo n.º 3
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (IsDisposed)
            {
                return(false);
            }

            if (AnimationGraphic == Graphic.INVALID)
            {
                return(false);
            }

            Hue hue = Hue;

            if (Source is Item i)
            {
                if (Engine.Profile.Current.FieldsType == 1 && StaticFilters.IsField(AnimationGraphic))
                {
                    AnimIndex = 0;
                }
                else if (Engine.Profile.Current.FieldsType == 2)
                {
                    if (StaticFilters.IsFireField(Graphic))
                    {
                        AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC;
                        hue = 0x0020;
                    }
                    else if (StaticFilters.IsParalyzeField(Graphic))
                    {
                        AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC;
                        hue = 0x0058;
                    }
                    else if (StaticFilters.IsEnergyField(Graphic))
                    {
                        AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC;
                        hue = 0x0070;
                    }
                    else if (StaticFilters.IsPoisonField(Graphic))
                    {
                        AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC;
                        hue = 0x0044;
                    }
                    else if (StaticFilters.IsWallOfStone(Graphic))
                    {
                        AnimationGraphic = Constants.FIELD_REPLACE_GRAPHIC;
                        hue = 0x038A;
                    }
                }
                else if (i.IsHidden)
                {
                    hue = 0x038E;
                }
            }

            if ((AnimationGraphic != _displayedGraphic || Texture == null || Texture.IsDisposed) && AnimationGraphic != Graphic.INVALID)
            {
                _displayedGraphic = AnimationGraphic;
                Texture           = FileManager.Art.GetTexture(AnimationGraphic);
                Bounds            = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);
            }

            Bounds.X = (Texture.Width >> 1) - 22 - (int)Offset.X;
            Bounds.Y = Texture.Height - 44 + (int)(Offset.Z - Offset.Y);

            StaticTiles data = FileManager.TileData.StaticData[_displayedGraphic];

            bool isPartial     = data.IsPartialHue;
            bool isTransparent = data.IsTranslucent;

            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, isPartial, isTransparent ? .5f : 0, false);
            }

            switch (Blend)
            {
            case GraphicEffectBlendMode.Multiply:
                batcher.SetBlendState(_multiplyBlendState.Value);
                base.Draw(batcher, position, objectList);
                batcher.SetBlendState(null);
                break;

            case GraphicEffectBlendMode.Screen:
            case GraphicEffectBlendMode.ScreenMore:
                batcher.SetBlendState(_screenBlendState.Value);
                base.Draw(batcher, position, objectList);
                batcher.SetBlendState(null);
                break;

            case GraphicEffectBlendMode.ScreenLess:
                batcher.SetBlendState(_screenLessBlendState.Value);
                base.Draw(batcher, position, objectList);
                batcher.SetBlendState(null);
                break;

            case GraphicEffectBlendMode.NormalHalfTransparent:
                batcher.SetBlendState(_normalHalfBlendState.Value);
                base.Draw(batcher, position, objectList);
                batcher.SetBlendState(null);
                break;

            case GraphicEffectBlendMode.ShadowBlue:
                batcher.SetBlendState(_shadowBlueBlendState.Value);
                base.Draw(batcher, position, objectList);
                batcher.SetBlendState(null);
                break;

            default:
                base.Draw(batcher, position, objectList);
                break;
            }

            Engine.DebugInfo.EffectsRendered++;

            return(true);
        }
Exemplo n.º 4
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (GameObject.IsDisposed)
            {
                return(false);
            }
            AnimatedItemEffect effect = (AnimatedItemEffect)GameObject;

            if (effect.AnimationGraphic == Graphic.Invalid)
            {
                return(false);
            }

            if ((effect.AnimationGraphic != _displayedGraphic || Texture == null || Texture.IsDisposed) && effect.AnimationGraphic != Graphic.Invalid)
            {
                _displayedGraphic = effect.AnimationGraphic;
                Texture           = Art.GetStaticTexture(effect.AnimationGraphic);
                Bounds            = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);
            }

            Bounds.X = (Texture.Width >> 1) - 22 - (int)effect.Offset.X;
            Bounds.Y = Texture.Height - 44 + (int)(effect.Offset.Z - effect.Offset.Y);

            ulong flags = TileData.StaticData[_displayedGraphic].Flags;


            bool isPartial     = TileData.IsPartialHue(flags);
            bool isTransparent = TileData.IsTransparent(flags);

            HueVector = ShaderHuesTraslator.GetHueVector(effect.Hue, isPartial, isTransparent ? .5f : 0, false);

            switch (effect.Blend)
            {
            case GraphicEffectBlendMode.Multiply:
                batcher.SetBlendState(_multiplyBlendState.Value);
                base.Draw(batcher, position, objectList);
                batcher.SetBlendState(null);
                break;

            case GraphicEffectBlendMode.Screen:
            case GraphicEffectBlendMode.ScreenMore:
                batcher.SetBlendState(_screenBlendState.Value);
                base.Draw(batcher, position, objectList);
                batcher.SetBlendState(null);
                break;

            case GraphicEffectBlendMode.ScreenLess:
                batcher.SetBlendState(_screenLessBlendState.Value);
                base.Draw(batcher, position, objectList);
                batcher.SetBlendState(null);
                break;

            case GraphicEffectBlendMode.NormalHalfTransparent:
                batcher.SetBlendState(_normalHalfBlendState.Value);
                base.Draw(batcher, position, objectList);
                batcher.SetBlendState(null);
                break;

            case GraphicEffectBlendMode.ShadowBlue:
                batcher.SetBlendState(_shadowBlueBlendState.Value);
                base.Draw(batcher, position, objectList);
                batcher.SetBlendState(null);
                break;

            default:
                base.Draw(batcher, position, objectList);
                break;
            }


            return(true);
        }