示例#1
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            Rectangle rectangle = ScissorStack.CalculateScissors(Matrix.Identity, x, y, Width, Height);

            if (ScissorStack.PushScissors(rectangle))
            {
                batcher.EnableScissorTest(true);

                ResetHueVector();

                if (Engine.Profile.Current != null && Engine.Profile.Current.UseXBR)
                {
                    // draw regular world
                    _xBR.SetSize(_scene.ViewportTexture.Width, _scene.ViewportTexture.Height);

                    batcher.End();

                    batcher.Begin(_xBR);
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                    batcher.End();

                    batcher.Begin();
                }
                else
                {
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                }


                // draw lights
                if (_scene.UseLights)
                {
                    batcher.SetBlendState(_blend);
                    batcher.Draw2D(_scene.Darkness, x, y, Width, Height, ref _hueVector);
                    batcher.SetBlendState(null);
                }

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

                base.Draw(batcher, x, y);

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors();
            }

            return(true);
        }
示例#2
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (Engine.Profile.Current != null && Engine.Profile.Current.UseXBR)
            {
                // draw regular world

                if (_xBR == null || _xBR.IsDisposed)
                {
                    _xBR = new MatrixEffect(batcher.GraphicsDevice, Resources.xBREffect);
                }

                _xBR.Parameters["textureSize"].SetValue(new Vector2
                {
                    X = _scene.ViewportTexture.Width,
                    Y = _scene.ViewportTexture.Height
                });

                batcher.End();

                batcher.Begin(_xBR);
                batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _zero);
                batcher.End();

                batcher.Begin();
            }
            else
            {
                batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _zero);
            }


            // draw lights
            if (_scene.UseLights)
            {
                batcher.SetBlendState(_blend);
                batcher.Draw2D(_scene.Darkness, x, y, Width, Height, ref _zero);
                batcher.SetBlendState(null);
            }

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

            return(base.Draw(batcher, x, y));
        }
示例#3
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();

            if (Engine.Profile.Current != null && Engine.Profile.Current.UseXBR)
            {
                // draw regular world
                _xBR.SetSize(_scene.ViewportTexture.Width, _scene.ViewportTexture.Height);

                batcher.End();

                batcher.Begin(_xBR);
                batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                batcher.End();

                batcher.Begin();
            }
            else
            {
                batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
            }


            // draw lights
            if (_scene.UseLights)
            {
                batcher.SetBlendState(_blend);
                batcher.Draw2D(_scene.Darkness, x, y, Width, Height, ref _hueVector);
                batcher.SetBlendState(null);
            }

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

            return(base.Draw(batcher, x, y));
        }
示例#4
0
        //TEXTURES END
        public void Draw(UltimaBatcher2D batcher)
        {
            if (!IsEnabled)
            {
                return;
            }

            if (World.Player == null)
            {
                return;
            }

            foreach (Mobile mobile in World.Mobiles)
            {
                //SKIP FOR PLAYER
                if (mobile == World.Player)
                {
                    continue;
                }

                _hueVector.Z = 0f;

                //CALC WHERE MOBILE IS
                Point pm = mobile.RealScreenPosition;
                pm.X += (int)mobile.Offset.X + 22;
                pm.Y += (int)(mobile.Offset.Y - mobile.Offset.Z) + 22;
                Point p1 = pm;

                if (IsHalosEnabled && (HaloOrange != null || HaloGreen != null || HaloPurple != null || HaloRed != null))
                {
                    _hueVector.Y = ShaderHueTranslator.SHADER_LIGHTS;

                    //Move from center by texture width
                    pm.X = pm.X - HaloOrange.Width / 2;

                    batcher.SetBlendState(_blend);

                    //PURPLE HALO FOR: LAST ATTACK, LASTTARGET
                    if (TargetManager.LastAttack == mobile.Serial || TargetManager.LastTargetInfo.Serial == mobile.Serial)
                    {
                        batcher.Draw2D(HaloPurple, pm.X, pm.Y - 15, HaloPurple.Width, HaloPurple.Height, ref _hueVector);
                    }

                    //GREEN HALO FOR: ALLYS AND PARTY
                    else if ((mobile.NotorietyFlag == NotorietyFlag.Ally || World.Party.Contains(mobile.Serial)) && mobile != World.Player)
                    {
                        batcher.Draw2D(HaloGreen, pm.X, pm.Y - 15, HaloGreen.Width, HaloGreen.Height, ref _hueVector);
                    }

                    //RED HALO FOR: CRIMINALS, GRAY, MURDERER
                    else if (mobile.NotorietyFlag == NotorietyFlag.Criminal || mobile.NotorietyFlag == NotorietyFlag.Gray || mobile.NotorietyFlag == NotorietyFlag.Murderer)
                    {
                        batcher.Draw2D(HaloRed, pm.X, pm.Y - 15, HaloRed.Width, HaloRed.Height, ref _hueVector);
                    }

                    //ORANGE HALO FOR: ENEMY
                    else if (mobile.NotorietyFlag == NotorietyFlag.Enemy)
                    {
                        batcher.Draw2D(HaloOrange, pm.X, pm.Y - 15, HaloOrange.Width, HaloOrange.Height, ref _hueVector);
                    }

                    batcher.SetBlendState(null);
                }
                //HALO TEXTURE

                //ARROW TEXTURE
                if (!IsArrowEnabled)
                {
                    return;
                }

                //CALC MOBILE HEIGHT FROM ANIMATION
                AnimationsLoader.Instance.GetAnimationDimensions(mobile.AnimIndex,
                                                                 mobile.GetGraphicForAnimation(),
                                                                 /*(byte) m.GetDirectionForAnimation()*/ 0,
                                                                 /*Mobile.GetGroupForAnimation(m, isParent:true)*/ 0,
                                                                 mobile.IsMounted,
                                                                 /*(byte) m.AnimIndex*/ 0,
                                                                 out int centerX,
                                                                 out int centerY,
                                                                 out int width,
                                                                 out int height);

                p1.Y -= height + centerY + 8 + 22;

                if (mobile.IsGargoyle && mobile.IsFlying)
                {
                    p1.Y -= 22;
                }
                else if (!mobile.IsMounted)
                {
                    p1.Y += 22;
                }

                p1.X -= ArrowRed.Width / 2;
                p1.Y -= ArrowRed.Height / 1;

                if (mobile.ObjectHandlesOpened)
                {
                    p1.Y -= 22;
                }

                /* MAYBE USE THIS INCASE IT SHOWS OUTSIDE OF GAMESCREEN?
                 * if (!(p1.X < 0 || p1.X > screenW - mobile.HitsTexture.Width || p1.Y < 0 || p1.Y > screenH))
                 *          {
                 *              mobile.HitsTexture.Draw(batcher, p1.X, p1.Y);
                 *          }
                 */

                //ARROW TEXTURE
                if (IsArrowEnabled && (ArrowGreen != null || ArrowRed != null || ArrowPurple != null || ArrowOrange != null))
                {
                    _hueVector.Y = ShaderHueTranslator.SHADER_LIGHTS;

                    batcher.SetBlendState(_blend);

                    //PURPLE ARROW FOR: LAST ATTACK, LASTTARGET
                    if (TargetManager.LastAttack == mobile.Serial || TargetManager.LastTargetInfo.Serial == mobile.Serial)
                    {
                        batcher.Draw2D(ArrowPurple, p1.X, p1.Y, ArrowPurple.Width, ArrowPurple.Height, ref _hueVector);
                    }

                    //GREEN ARROW FOR: ALLYS AND PARTY
                    else if ((mobile.NotorietyFlag == NotorietyFlag.Ally || World.Party.Contains(mobile.Serial)) && mobile != World.Player)
                    {
                        batcher.Draw2D(ArrowGreen, p1.X, p1.Y, ArrowGreen.Width, ArrowGreen.Height, ref _hueVector);
                    }

                    //RED ARROW FOR: CRIMINALS, GRAY, MURDERER
                    else if (mobile.NotorietyFlag == NotorietyFlag.Criminal || mobile.NotorietyFlag == NotorietyFlag.Gray || mobile.NotorietyFlag == NotorietyFlag.Murderer)
                    {
                        batcher.Draw2D(ArrowRed, p1.X, p1.Y, ArrowRed.Width, ArrowRed.Height, ref _hueVector);
                    }

                    //ORANGE ARROW FOR: ENEMY
                    else if (mobile.NotorietyFlag == NotorietyFlag.Enemy)
                    {
                        batcher.Draw2D(ArrowOrange, p1.X, p1.Y, ArrowOrange.Width, ArrowOrange.Height, ref _hueVector);
                    }

                    batcher.SetBlendState(null);
                }
                //ARROW TEXTURE
            }
        }
示例#5
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (_scene.ViewportTexture == null)
            {
                return(false);
            }

            Rectangle rectangle = ScissorStack.CalculateScissors(Matrix.Identity, x, y, Width, Height);

            if (ScissorStack.PushScissors(batcher.GraphicsDevice, rectangle))
            {
                batcher.EnableScissorTest(true);

                ResetHueVector();

                if (ProfileManager.Current != null && ProfileManager.Current.UseXBR)
                {
                    // draw regular world
                    if (_xBR == null)
                    {
                        _xBR = new XBREffect(batcher.GraphicsDevice);
                    }

                    _xBR.SetSize(_scene.ViewportTexture.Width, _scene.ViewportTexture.Height);

                    batcher.End();

                    batcher.Begin(_xBR);
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                    batcher.End();

                    batcher.Begin();
                }
                else
                {
                    batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _hueVector);
                }


                // draw lights
                if (_scene.UseAltLights)
                {
                    batcher.SetBlendState(_altLightsBlend);
                    _hueVector.Z = 0.5f;
                    batcher.Draw2D(_scene.LightRenderTarget, x, y, Width, Height, ref _hueVector);
                    _hueVector.Z = 0;
                    batcher.SetBlendState(null);
                }
                else if (_scene.UseLights)
                {
                    batcher.SetBlendState(_darknessBlend);
                    batcher.Draw2D(_scene.LightRenderTarget, x, y, Width, Height, ref _hueVector);
                    batcher.SetBlendState(null);
                }

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

                base.Draw(batcher, x, y);

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors(batcher.GraphicsDevice);
            }

            return(true);
        }