Beispiel #1
0
        public static void DrawMapItem(RendererDestinationData destData, Map map, Enums.MapID targetMapID, int itemSlot)
        {
            Item item = ItemHelper.Items[map.MapItems[itemSlot].Num];

            Rectangle cropRect = new Rectangle((item.Pic - (item.Pic / 6) * 6) * Constants.TILE_WIDTH,
                                               (item.Pic / 6) * Constants.TILE_HEIGHT, Constants.TILE_WIDTH, Constants.TILE_HEIGHT);

            int itemX= map.MapItems[itemSlot].X;
            int itemY = map.MapItems[itemSlot].Y;

            Renderers.Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(map, targetMapID, ref itemX, ref itemY);
            Point dstPoint = new Point(ScreenRenderer.ToScreenX(itemX * Constants.TILE_WIDTH),
                                       ScreenRenderer.ToScreenY(itemY * Constants.TILE_HEIGHT));

            //Surface itemSurface = new Surface(32,32);
            //itemSurface.Blit(Graphics.GraphicsManager.Items, cropRect);

            //if (darkness != null && !darkness.Disposed) {
            //    Point darknessPoint = new Point(darkness.Buffer.Width / 2 + dstPoint.X - darkness.Focus.X, darkness.Buffer.Height / 2 + dstPoint.Y - darkness.Focus.Y);
            //    Surface darknessSurface = new Surface(32, 32);
            //    darknessSurface.Blit(darkness.Buffer, new Point(0, 0), new Rectangle(darknessPoint, new Size(Constants.TILE_WIDTH, Constants.TILE_HEIGHT)));

            //}
            //destData.Blit(itemSurface, dstPoint);
            destData.Blit(Graphics.GraphicsManager.Items, dstPoint, cropRect);
        }
        public static void DrawStatus(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, ISprite sprite, int emoteIndex, int emoteFrame, Point offset)
        {
            int x, y;
            int width  = Constants.TILE_WIDTH;
            int height = Constants.TILE_HEIGHT;


            Rectangle rec      = new Rectangle();
            Point     dstPoint = new Point();

            rec.X      = emoteFrame * width;
            rec.Width  = width;
            rec.Y      = 0;
            rec.Height = height;

            x = sprite.Location.X; // * Const.PIC_X + sx + player.XOffset;
            y = sprite.Location.Y; // * Const.PIC_Y + sx + player.YOffset;

            Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(activeMap, targetMapID, ref x, ref y);

            dstPoint.X = ScreenRenderer.ToTileX(x) + sprite.Offset.X + offset.X;
            dstPoint.Y = ScreenRenderer.ToTileY(y) + sprite.Offset.Y + offset.Y; // - (Constants.TILE_HEIGHT / 2);



            destData.Blit(Graphics.GraphicsManager.GetEmoteSheet(emoteIndex).Sheet, dstPoint, rec);
        }
Beispiel #3
0
        public static void DrawSpriteName(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, ISprite sprite, Color color, string name)
        {
            int textX;
            int textY;

            //gets location of sprite to draw on top of (name will be on top of these coords)
            int x = sprite.Location.X;
            int y = sprite.Location.Y;

            Renderers.Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(activeMap, targetMapID, ref x, ref y);

            //if (sprite.Size == Enums.Size.Normal) {
            textX = ScreenRenderer.ToTileX(x) + sprite.Offset.X + (Constants.TILE_WIDTH / 2) - (name.Length * 7 / 2);
            textY = ScreenRenderer.ToTileY(y) + sprite.Offset.Y - (Constants.TILE_HEIGHT / 2) - /*4*/ 32;
            TextRenderer.DrawText(destData, name, color, Color.Black, textX, textY);


            //TEST CODE
            Bitmap  bitmap       = (Bitmap)Image.FromFile(@"C:\Users\Frosty\Desktop\PJOFiles\Client\build\Skins\Main Theme\General\Badges\Moderator.png");
            Surface sheetSurface = new Surface(bitmap);

            sheetSurface.Transparent = true;

            int emblemX = ScreenRenderer.ToTileX(x) + sprite.Offset.X + (Constants.TILE_WIDTH / 2) + (name.Length * 7 / 2) + 5;

            Point point = new Point(emblemX, textY + 3);

            destData.Blit(sheetSurface, point);
        }
        private static void DrawStaffIcon(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, IPlayer player)
        {
            if (player.Rank != Enums.Rank.Normal && player.Rank != Enums.Rank.Owner)
            {
                int x = player.Location.X;
                int y = player.Location.Y;
                Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(activeMap, targetMapID, ref x, ref y);
                Bitmap bitmap;
                try
                {
                    bitmap = (Bitmap)Image.FromFile(@".\Skins\Main Theme\General\Badges\" + player.Rank + ".png");
                }
                catch (System.IO.FileNotFoundException e)
                {
                    bitmap = null;
                }


                int badgeX = ScreenRenderer.ToTileX(x) + player.Offset.X + 3
                             + (Constants.TILE_WIDTH / 2)
                             - (player.Name.Length * 7 / 2)
                             - (bitmap.Width);
                int badgeY = ScreenRenderer.ToTileY(y) + player.Offset.Y - (Constants.TILE_HEIGHT / 2) - 31;

                if (bitmap != null)
                {
                    Surface sheetSurface = new Surface(bitmap);
                    sheetSurface.Transparent = true;

                    Point point = new Point(badgeX, badgeY + 3);
                    destData.Blit(sheetSurface, point);
                }
            }
        }
Beispiel #5
0
        public static void DrawMapItem(RendererDestinationData destData, Map map, Enums.MapID targetMapID, int itemSlot)
        {
            Item item = ItemHelper.Items[map.MapItems[itemSlot].Num];

            Rectangle cropRect = new Rectangle((item.Pic - (item.Pic / 6) * 6) * Constants.TILE_WIDTH,
                                               (item.Pic / 6) * Constants.TILE_HEIGHT, Constants.TILE_WIDTH, Constants.TILE_HEIGHT);

            int itemX = map.MapItems[itemSlot].X;
            int itemY = map.MapItems[itemSlot].Y;

            Renderers.Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(map, targetMapID, ref itemX, ref itemY);
            Point dstPoint = new Point(ScreenRenderer.ToScreenX(itemX * Constants.TILE_WIDTH),
                                       ScreenRenderer.ToScreenY(itemY * Constants.TILE_HEIGHT));

            //Surface itemSurface = new Surface(32,32);
            //itemSurface.Blit(Graphics.GraphicsManager.Items, cropRect);

            //if (darkness != null && !darkness.Disposed) {
            //    Point darknessPoint = new Point(darkness.Buffer.Width / 2 + dstPoint.X - darkness.Focus.X, darkness.Buffer.Height / 2 + dstPoint.Y - darkness.Focus.Y);
            //    Surface darknessSurface = new Surface(32, 32);
            //    darknessSurface.Blit(darkness.Buffer, new Point(0, 0), new Rectangle(darknessPoint, new Size(Constants.TILE_WIDTH, Constants.TILE_HEIGHT)));

            //}
            //destData.Blit(itemSurface, dstPoint);
            destData.Blit(Graphics.GraphicsManager.Items, dstPoint, cropRect);
        }
 public static void DrawSpeechBubble(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, ISprite sprite, int tick)
 {
     if (sprite.CurrentSpeech != null) {
         if (sprite.CurrentSpeech.MarkedForRemoval == false) {
             sprite.CurrentSpeech.Process(tick);
             if (sprite.CurrentSpeech.RedrawRequested) {
                 sprite.CurrentSpeech.DrawBuffer();
             }
             int startX = (sprite.X * Constants.TILE_WIDTH) + sprite.Offset.X - (sprite.CurrentSpeech.Buffer.Width / 2) + 16;
             int startY = ((sprite.Y + 1) * Constants.TILE_HEIGHT) + sprite.Offset.Y;
             destData.Blit(sprite.CurrentSpeech.Buffer, new Point(ScreenRenderer.ToScreenX(startX), ScreenRenderer.ToScreenY(startY)));
         } else {
             sprite.CurrentSpeech.FreeResources();
             sprite.CurrentSpeech = null;
         }
     }
 }
Beispiel #7
0
 public static void DrawSpeechBubble(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, ISprite sprite, int tick)
 {
     if (sprite.CurrentSpeech != null)
     {
         if (sprite.CurrentSpeech.MarkedForRemoval == false)
         {
             sprite.CurrentSpeech.Process(tick);
             if (sprite.CurrentSpeech.RedrawRequested)
             {
                 sprite.CurrentSpeech.DrawBuffer();
             }
             int startX = (sprite.X * Constants.TILE_WIDTH) + sprite.Offset.X - (sprite.CurrentSpeech.Buffer.Width / 2) + 16;
             int startY = ((sprite.Y + 1) * Constants.TILE_HEIGHT) + sprite.Offset.Y;
             destData.Blit(sprite.CurrentSpeech.Buffer, new Point(ScreenRenderer.ToScreenX(startX), ScreenRenderer.ToScreenY(startY)));
         }
         else
         {
             sprite.CurrentSpeech.FreeResources();
             sprite.CurrentSpeech = null;
         }
     }
 }
        public static void DrawStatus(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, ISprite sprite, int emoteIndex, int emoteFrame, Point offset)
        {
            int x, y;
            int width = Constants.TILE_WIDTH;
            int height = Constants.TILE_HEIGHT;

            Rectangle rec = new Rectangle();
            Point dstPoint = new Point();

            rec.X = emoteFrame * width;
            rec.Width = width;
            rec.Y = 0;
            rec.Height = height;

            x = sprite.Location.X;// * Const.PIC_X + sx + player.XOffset;
            y = sprite.Location.Y;// * Const.PIC_Y + sx + player.YOffset;

            Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(activeMap, targetMapID, ref x, ref y);

            dstPoint.X = ScreenRenderer.ToTileX(x) + sprite.Offset.X + offset.X;
            dstPoint.Y = ScreenRenderer.ToTileY(y) + sprite.Offset.Y + offset.Y; // - (Constants.TILE_HEIGHT / 2);

            destData.Blit(Graphics.GraphicsManager.GetEmoteSheet(emoteIndex).Sheet, dstPoint, rec);
        }
Beispiel #9
0
        public static void DrawSprite(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, ISprite sprite)
        {
            int x, y;

            int spriteNum = sprite.Sprite;

            if (Globals.FoolsMode)
            {
                if (spriteNum == 420)
                {
                    spriteNum = 867;
                }
                else if (spriteNum == 582 || spriteNum == 583 || spriteNum == 584)
                {
                    spriteNum = 787;
                }
            }

            SpriteSheet spriteSheet = sprite.SpriteSheet;

            if (spriteSheet == null || !(spriteSheet.Num == sprite.Sprite && spriteSheet.Form == GetSpriteFormString(sprite)))
            {
                spriteSheet = GraphicsManager.GetSpriteSheet(spriteNum, sprite.Form, (int)sprite.Shiny, (int)sprite.Sex);

                sprite.SpriteSheet = spriteSheet;
            }

            Surface spriteToBlit = null;

            if (spriteSheet == null)
            {
                return;
            }

            Rectangle rec    = Rectangle.Empty;
            bool      moving = false;


            if (sprite.Attacking == false && sprite.WalkingFrame != -1)
            {
                int currentOffset = 0;
                switch (sprite.Direction)
                {
                case Enums.Direction.Up: {
                    currentOffset = sprite.Offset.Y;
                }
                break;

                case Enums.Direction.Down: {
                    currentOffset = sprite.Offset.Y * -1;
                }
                break;

                case Enums.Direction.Left: {
                    currentOffset = sprite.Offset.X;
                }
                break;

                case Enums.Direction.Right: {
                    currentOffset = sprite.Offset.X * -1;
                }
                break;
                }
                int frameCount = spriteSheet.FrameData.GetFrameCount(FrameType.Walk, sprite.Direction);
                while (sprite.MovementSpeed != Enums.MovementSpeed.Standing && Globals.Tick - sprite.LastWalkTime > 512 / GameProcessor.DetermineSpeed(sprite.MovementSpeed))
                {
                    sprite.LastWalkTime += (512 / GameProcessor.DetermineSpeed(sprite.MovementSpeed));
                    sprite.WalkingFrame  = (sprite.WalkingFrame + 1) % frameCount;
                }
                spriteToBlit = spriteSheet.GetSheet(FrameType.Walk, sprite.Direction);
                rec          = spriteSheet.GetFrameBounds(FrameType.Walk, sprite.Direction, sprite.WalkingFrame);
            }

            if (sprite.Attacking && sprite.TotalAttackTime > 0)
            {
                //if there's more than one attack frame, we have a fluid motion
                if (spriteSheet.FrameData.GetFrameCount(FrameType.Attack, sprite.Direction) > 1 && (sprite.TotalAttackTime - sprite.AttackTimer + Globals.Tick) / sprite.TotalAttackTime < 1)
                {
                    spriteToBlit = spriteSheet.GetSheet(FrameType.Attack, sprite.Direction);
                    rec          = spriteSheet.GetFrameBounds(FrameType.Attack, sprite.Direction,
                                                              (sprite.TotalAttackTime - sprite.AttackTimer + Globals.Tick) * spriteSheet.FrameData.GetFrameCount(FrameType.Attack, sprite.Direction) / sprite.TotalAttackTime);
                }
                else if (sprite.AttackTimer - Globals.Tick > sprite.TotalAttackTime / 2)
                {
                    spriteToBlit = spriteSheet.GetSheet(FrameType.Attack, sprite.Direction);
                    rec          = spriteSheet.GetFrameBounds(FrameType.Attack, sprite.Direction, 0);
                }
            }

            // Check to see if we want to stop making him attack
            if (sprite.AttackTimer < Globals.Tick)
            {
                sprite.Attacking   = false;
                sprite.AttackTimer = 0;
            }

            Point dstPoint = new Point();

            x = sprite.Location.X; // * Const.PIC_X + sx + player.XOffset;
            y = sprite.Location.Y; // * Const.PIC_Y + sx + player.YOffset;

            if (y < 0)
            {
                y = 0;
                //rec.Y = rec.Y + (y * -1);
            }

            Renderers.Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(activeMap, targetMapID, ref x, ref y);

            dstPoint.X = ScreenRenderer.ToTileX(x) + sprite.Offset.X - (spriteSheet.FrameData.FrameWidth / 2 - 16);
            dstPoint.Y = ScreenRenderer.ToTileY(y) + sprite.Offset.Y - (spriteSheet.FrameData.FrameHeight - 32); // - (Constants.TILE_HEIGHT / 2);

            switch (sprite.StatusAilment)
            {
            case Enums.StatusAilment.Paralyze: {
                dstPoint.X -= (2 + System.Math.Abs(Globals.Tick % 8 - 4));
                break;
            }

            default: {
                //dstPoint.X = ScreenRenderer.ToTileX(x) + sprite.Offset.X;
                break;
            }
            }
            if (sprite.StatusAilment == Enums.StatusAilment.Sleep)
            {
                if (Globals.Tick > sprite.SleepTimer + 500)
                {
                    sprite.SleepTimer = Globals.Tick;
                    sprite.SleepFrame = (sprite.SleepFrame + 1) % spriteSheet.FrameData.GetFrameCount(FrameType.Sleep, Enums.Direction.Down);
                }
                spriteToBlit = spriteSheet.GetSheet(FrameType.Sleep, Enums.Direction.Down);
                rec          = spriteSheet.GetFrameBounds(FrameType.Sleep, Enums.Direction.Down, sprite.SleepFrame);
            }

            if (!sprite.ScreenActive)
            {
                spriteToBlit = spriteSheet.GetSheet(FrameType.Sleep, Enums.Direction.Down);
                rec          = spriteSheet.GetFrameBounds(FrameType.Sleep, Enums.Direction.Down, 0);
            }

            if ((sprite is Logic.Players.GenericPlayer || sprite is Logic.Players.MyPlayer))
            {
                if (((Logic.Players.IPlayer)sprite).Dead)
                {
                    spriteToBlit = spriteSheet.GetSheet(FrameType.Sleep, Enums.Direction.Down);
                    rec          = spriteSheet.GetFrameBounds(FrameType.Sleep, Enums.Direction.Down, 0);
                }
            }

            if (rec == Rectangle.Empty && sprite.StatusAilment == Enums.StatusAilment.OK)
            {
                if (sprite.Offset == Point.Empty && spriteSheet.FrameData.GetFrameCount(FrameType.Idle, sprite.Direction) > 0)
                {
                    if (sprite.IdleTimer == -1)
                    {
                        sprite.IdleTimer = Globals.Tick + 2000;
                    }
                    else if (Globals.Tick > sprite.IdleTimer + 100)
                    {
                        sprite.IdleTimer = Globals.Tick;

                        sprite.IdleFrame++;
                        if (sprite.IdleFrame >= spriteSheet.FrameData.GetFrameCount(FrameType.Idle, sprite.Direction))
                        {
                            sprite.IdleFrame = 0;
                        }
                        spriteToBlit = spriteSheet.GetSheet(FrameType.Idle, sprite.Direction);
                        rec          = spriteSheet.GetFrameBounds(FrameType.Idle, sprite.Direction, sprite.IdleFrame);
                    }
                }
                else
                {
                    sprite.IdleTimer = -1;
                    sprite.IdleFrame = 0;
                }
            }
            else
            {
                sprite.IdleTimer = -1;
                sprite.IdleFrame = 0;
            }

            if (sprite.IdleTimer != -1)
            {
                spriteToBlit = spriteSheet.GetSheet(FrameType.Idle, sprite.Direction);
                rec          = spriteSheet.GetFrameBounds(FrameType.Idle, sprite.Direction, sprite.IdleFrame);
            }

            if ((rec == Rectangle.Empty || (moving == true && sprite.Offset == Point.Empty)) && sprite.StatusAilment != Enums.StatusAilment.Sleep && sprite.IdleTimer == -1)
            {
                spriteToBlit = spriteSheet.GetSheet(FrameType.Walk, sprite.Direction);
                rec          = spriteSheet.GetFrameBounds(FrameType.Walk, sprite.Direction, 0);
            }



            //if (sprite.Size == Enums.Size.Normal) {
            if (Globals.FoolsMode)
            {
                dstPoint.X = ScreenRenderer.ToTileX(x) + sprite.Offset.X;
                dstPoint.Y = ScreenRenderer.ToTileY(y) + sprite.Offset.Y;

                spriteNum = spriteNum % 872;
                rec       = new Rectangle((spriteNum - (spriteNum / 6) * 6) * Constants.TILE_WIDTH,
                                          (spriteNum / 6) * Constants.TILE_HEIGHT, Constants.TILE_WIDTH, Constants.TILE_HEIGHT);
                spriteToBlit = Graphics.GraphicsManager.Items;
            }

            destData.Blit(spriteToBlit, dstPoint, rec);


            //spriteToBlit.AlphaBlending = false;
        }
Beispiel #10
0
        public static void DrawMissionGoalTileSeamless(RendererDestinationData destData, Map activeMap, int cameraX, int cameraY)
        {
            MyPlayer player = Logic.Players.PlayerManager.MyPlayer;
            if (player != null) {
                foreach (Missions.MissionGoal goal in player.MapGoals) {
                    if (goal.GoalX >= 0 && goal.GoalX <= activeMap.MaxX && goal.GoalY >= 0 && goal.GoalY <= activeMap.MaxY) {
                        DrawTile(destData, 10, 20, goal.GoalX - cameraX, goal.GoalY - cameraY);

                        int species = PlayerManager.MyPlayer.JobList.Jobs[goal.JobListSlot].ClientSpecies;
                        int form = PlayerManager.MyPlayer.JobList.Jobs[goal.JobListSlot].ClientForm;
                        if (PlayerManager.MyPlayer.JobList.Jobs[goal.JobListSlot].MissionType == Enums.MissionType.Escort) {
                            species = PlayerManager.MyPlayer.JobList.Jobs[goal.JobListSlot].Data1;
                            form = PlayerManager.MyPlayer.JobList.Jobs[goal.JobListSlot].Data2;
                        }

                        SpriteSheet spriteToBlit = GraphicsManager.GetSpriteSheet(species);

                        //rec.Height = spriteToBlit.Height;
                        //rec.Width = spriteToBlit.Width / 14;

                        //rec.X = rec.Width * 3;
                        //rec.Y = 0;

                        Point loc = new Point(ScreenRenderer.ToTileX(goal.GoalX), ScreenRenderer.ToTileY(goal.GoalY));
                        loc.X -= (spriteToBlit.FrameData.FrameWidth / 2 - 16);
                        loc.Y -= (spriteToBlit.FrameData.FrameHeight - 32);
                        destData.Blit(spriteToBlit.GetSheet(FrameType.Idle, Enums.Direction.Down), loc, spriteToBlit.GetFrameBounds(FrameType.Walk, Enums.Direction.Down, 0));

                    }
                }
            }
        }
Beispiel #11
0
        public static void RenderMoveTargettingDisplay(RendererDestinationData destData, Sprites.ISprite attacker, Logic.Moves.Move move)
        {
            switch (move.RangeType) {
                case Enums.MoveRange.FrontOfUserUntil:
                case Enums.MoveRange.LineUntilHit:
                    {
                        #region Front of user Until
                        switch (attacker.Direction)
                        {
                            case Enums.Direction.Up:
                                {
                                    int y = attacker.Y;
                                    for (int i = 1; i <= move.Range; i++)
                                    {
                                        y = attacker.Y - i;
                                        //if (!ShouldContinueRenderingTargettingDisplay(Logic.Maps.MapHelper.ActiveMap,
                                        //    attacker.X, y)) {
                                        //    break;
                                        //}
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X, y), Enums.MapID.Active))
                                        {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X, y))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                            break;
                                        }
                                    }
                                }
                                break;
                            case Enums.Direction.Down:
                                {
                                    int y = attacker.Y;
                                    for (int i = 1; i <= move.Range; i++)
                                    {
                                        y = attacker.Y + i;
                                        //if (!ShouldContinueRenderingTargettingDisplay(Logic.Maps.MapHelper.ActiveMap,
                                        //    attacker.X, y)) {
                                        //    break;
                                        //}
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X, y), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X, y))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                            break;
                                        }
                                    }
                                }
                                break;
                            case Enums.Direction.Left:
                                {
                                    int x = attacker.X;
                                    for (int i = 1; i <= move.Range; i++)
                                    {
                                        x = attacker.X - i;
                                        //if (!ShouldContinueRenderingTargettingDisplay(Logic.Maps.MapHelper.ActiveMap,
                                        //     x, attacker.Y)) {
                                        //    break;
                                        //}
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(x, attacker.Y), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            x, attacker.Y))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                            break;
                                        }
                                    }
                                }
                                break;
                            case Enums.Direction.Right:
                                {
                                    int x = attacker.X;
                                    for (int i = 1; i <= move.Range; i++)
                                    {
                                        x = attacker.X + i;
                                        //if (!ShouldContinueRenderingTargettingDisplay(Logic.Maps.MapHelper.ActiveMap,
                                        //    x, attacker.Y)) {
                                        //    break;
                                        //}
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(x, attacker.Y), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            x, attacker.Y))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                            break;
                                        }
                                    }
                                }
                                break;
                        }
                        #endregion
                    }
                    break;
                case Enums.MoveRange.StraightLine:
                case Enums.MoveRange.FrontOfUser: {
                        #region Front of user
                        switch (attacker.Direction) {
                            case Enums.Direction.Up: {
                                    int y = attacker.Y;
                                    for (int i = 1; i <= move.Range; i++) {
                                        y = attacker.Y - i;
                                        //if (!ShouldContinueRenderingTargettingDisplay(Logic.Maps.MapHelper.ActiveMap,
                                        //    attacker.X, y)) {
                                        //    break;
                                        //}
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X, y), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X, y)) {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                        } else {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                        }
                                    }
                                }
                                break;
                            case Enums.Direction.Down: {
                                    int y = attacker.Y;
                                    for (int i = 1; i <= move.Range; i++) {
                                        y = attacker.Y + i;
                                        //if (!ShouldContinueRenderingTargettingDisplay(Logic.Maps.MapHelper.ActiveMap,
                                        //    attacker.X, y)) {
                                        //    break;
                                        //}
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X, y), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X, y)) {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                        } else {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X), Screen.ScreenRenderer.ToTileY(y) + Logic.Players.PlayerManager.MyPlayer.Offset.Y));
                                        }
                                    }
                                }
                                break;
                            case Enums.Direction.Left: {
                                    int x = attacker.X;
                                    for (int i = 1; i <= move.Range; i++) {
                                        x = attacker.X - i;
                                        //if (!ShouldContinueRenderingTargettingDisplay(Logic.Maps.MapHelper.ActiveMap,
                                        //     x, attacker.Y)) {
                                        //    break;
                                        //}
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(x, attacker.Y), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            x, attacker.Y)) {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                        } else {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                        }
                                    }
                                }
                                break;
                            case Enums.Direction.Right: {
                                    int x = attacker.X;
                                    for (int i = 1; i <= move.Range; i++) {
                                        x = attacker.X + i;
                                        //if (!ShouldContinueRenderingTargettingDisplay(Logic.Maps.MapHelper.ActiveMap,
                                        //    x, attacker.Y)) {
                                        //    break;
                                        //}
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(x, attacker.Y), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            x, attacker.Y)) {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                        } else {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(x) + Logic.Players.PlayerManager.MyPlayer.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y)));
                                        }
                                    }
                                }
                                break;
                        }
                        #endregion
                    }
                    break;
                case Enums.MoveRange.User: {
                        #region user
                        destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                        #endregion
                    }
                    break;
                case Enums.MoveRange.Special:
                    {
                        #region Special
                        destData.Blit(srfcMoveTargetUnknown, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - 1) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - 1) + attacker.Offset.Y));
                        #endregion
                    }
                    break;
                case Enums.MoveRange.Floor:
                    {
                        #region Floor
                        int startX = Screen.ScreenRenderer.GetScreenLeft() - 1;
                        int startY = Screen.ScreenRenderer.GetScreenTop();
                        if (startX < 0)
                        {
                            startX = 0;
                        }
                        else if (startX + 19 > Screen.ScreenRenderer.RenderOptions.Map.MaxX)
                        {
                            startX = Screen.ScreenRenderer.RenderOptions.Map.MaxX - 19;
                        }
                        if (startY < 0)
                        {
                            startY = 0;
                        }
                        else if (startY + 14 > Screen.ScreenRenderer.RenderOptions.Map.MaxY)
                        {
                            startY = Screen.ScreenRenderer.RenderOptions.Map.MaxY - 14;
                        }

                        for (int x = startX; x < startX + 20; x++)
                        {
                            for (int y = startY; y < startY + 15; y++)
                            {
                                if (!Screen.ScreenRenderer.CanBeSeen(new Point(x, y), Enums.MapID.Active)) {
                                    destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(x), Screen.ScreenRenderer.ToTileY(y)));
                                } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                    x, y))
                                {
                                    destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(x), Screen.ScreenRenderer.ToTileY(y)));
                                }
                                else
                                {
                                    destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(x), Screen.ScreenRenderer.ToTileY(y)));
                                }
                            }
                        }
                        #endregion
                    }
                    break;
                case Enums.MoveRange.Room:
                    {
                        #region Room
                        for (int x = attacker.X - move.Range; x <= attacker.X + move.Range; x++)
                        {
                            for (int y = attacker.Y - move.Range; y <= attacker.Y + move.Range; y++)
                            {
                                if (!Screen.ScreenRenderer.CanBeSeen(new Point(x, y), Enums.MapID.Active)) {
                                    destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(x), Screen.ScreenRenderer.ToTileY(y)));
                                } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                    x, y))
                                {
                                    destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(x) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(y) + attacker.Offset.Y));
                                }
                                else
                                {
                                    destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(x) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(y) + attacker.Offset.Y));
                                }
                            }
                        }
                        #endregion
                    }
                    break;
                case Enums.MoveRange.FrontAndSides:
                    {
                        #region Front and Sides
                        for (int r = 0; r <= move.Range; r++)
                        {

                            //check adjacent tiles
                            switch (attacker.Direction)
                            {
                                case Enums.Direction.Down:
                                    {
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X, attacker.Y + r), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X, attacker.Y + r))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                        }

                                        for (int s = 1; s <= r; s++)
                                        {

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X - s, attacker.Y + r), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X - s, attacker.Y + r))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                            }

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X + s, attacker.Y + r), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X + s, attacker.Y + r))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                            }

                                        }

                                    }
                                    break;
                                case Enums.Direction.Up:
                                    {
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X, attacker.Y - r), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X, attacker.Y - r))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                        }

                                        for (int s = 1; s <= r; s++)
                                        {

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X - s, attacker.Y - r), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X - s, attacker.Y - r))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                            }

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X + s, attacker.Y - r), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X + s, attacker.Y - r))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                            }

                                        }

                                    }
                                    break;
                                case Enums.Direction.Left:
                                    {
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X - r, attacker.Y), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X - r, attacker.Y))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                        }

                                        for (int s = 1; s <= r; s++)
                                        {

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X - r, attacker.Y - s), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X - r, attacker.Y - s))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                            }

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X - r, attacker.Y + s), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X - r, attacker.Y + s))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                            }

                                        }
                                    }
                                    break;
                                case Enums.Direction.Right:
                                    {
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X + r, attacker.Y), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X + r, attacker.Y))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                        }

                                        for (int s = 1; s <= r; s++)
                                        {

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X + r, attacker.Y - s), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X + r, attacker.Y - s))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                            }

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X + r, attacker.Y + s), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X + r, attacker.Y + s))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                            }

                                        }
                                    }
                                    break;
                            }

                        }
                        #endregion
                    }
                    break;
                case Enums.MoveRange.ArcThrow:
                    {
                        #region Arc Throw
                        bool stopattile = false;
                        for (int r = 0; r <= move.Range; r++)
                        {

                            //check adjacent tiles
                            switch (attacker.Direction)
                            {
                                case Enums.Direction.Down:
                                    {
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X, attacker.Y + r), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X, attacker.Y + r))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                            stopattile = true;
                                        }

                                        if (stopattile)
                                        {
                                            break;
                                        }

                                        for (int s = 1; s <= r; s++)
                                        {

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X - s, attacker.Y + r), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X - s, attacker.Y + r))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                                stopattile = true;
                                            }

                                            if (stopattile)
                                            {
                                                break;
                                            }

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X + s, attacker.Y + r), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X + s, attacker.Y + r))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + r) + attacker.Offset.Y));
                                                stopattile = true;
                                            }

                                            if (stopattile)
                                            {
                                                break;
                                            }

                                        }

                                    }
                                    break;
                                case Enums.Direction.Up:
                                    {
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X, attacker.Y - r), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X, attacker.Y - r))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                            stopattile = true;
                                        }

                                        if (stopattile)
                                        {
                                            break;
                                        }

                                        for (int s = 1; s <= r; s++)
                                        {

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X - s, attacker.Y - r), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X - s, attacker.Y - r))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                                stopattile = true;
                                            }

                                            if (stopattile)
                                            {
                                                break;
                                            }

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X + s, attacker.Y - r), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X + s, attacker.Y - r))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + s) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - r) + attacker.Offset.Y));
                                                stopattile = true;
                                            }

                                            if (stopattile)
                                            {
                                                break;
                                            }

                                        }

                                    }
                                    break;
                                case Enums.Direction.Left:
                                    {
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X - r, attacker.Y), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X - r, attacker.Y))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                            stopattile = true;
                                        }

                                        if (stopattile)
                                        {
                                            break;
                                        }

                                        for (int s = 1; s <= r; s++)
                                        {

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X - r, attacker.Y - s), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X - r, attacker.Y - s))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                                stopattile = true;
                                            }

                                            if (stopattile)
                                            {
                                                break;
                                            }

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X - r, attacker.Y + s), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X - r, attacker.Y + s))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X - r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                                stopattile = true;
                                            }

                                            if (stopattile)
                                            {
                                                break;
                                            }

                                        }
                                    }
                                    break;
                                case Enums.Direction.Right:
                                    {
                                        if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X + r, attacker.Y), Enums.MapID.Active)) {
                                            destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                        } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X + r, attacker.Y))
                                        {
                                            destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                        }
                                        else
                                        {
                                            destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y) + attacker.Offset.Y));
                                            stopattile = true;
                                        }

                                        if (stopattile)
                                        {
                                            break;
                                        }

                                        for (int s = 1; s <= r; s++)
                                        {

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X + r, attacker.Y - s), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X + r, attacker.Y - s))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y - s) + attacker.Offset.Y));
                                                stopattile = true;
                                            }

                                            if (stopattile)
                                            {
                                                break;
                                            }

                                            if (!Screen.ScreenRenderer.CanBeSeen(new Point(attacker.X + r, attacker.Y + s), Enums.MapID.Active)) {
                                                destData.Blit(srfcMoveTargetTileDark, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                            } else if (!IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                            attacker.X + r, attacker.Y + s))
                                            {
                                                destData.Blit(srfcMoveTargetTile, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                            }
                                            else
                                            {
                                                destData.Blit(srfcMoveTargetTileHit, new Point(Screen.ScreenRenderer.ToTileX(attacker.X + r) + attacker.Offset.X, Screen.ScreenRenderer.ToTileY(attacker.Y + s) + attacker.Offset.Y));
                                                stopattile = true;
                                            }

                                            if (stopattile)
                                            {
                                                break;
                                            }

                                        }
                                    }
                                    break;
                            }

                            if (stopattile)
                            {
                                break;
                            }

                        }
                        #endregion
                    }
                    break;
            }
        }
Beispiel #12
0
        public static void RenderMoveAnimation(RendererDestinationData destData, Moves.IMoveAnimation animation, Point pinnedPoint)
        {
            int animTime = 400;
            switch (animation.AnimType) {
                case Enums.MoveAnimationType.Normal: {
                        #region Normal
                        NormalMoveAnimation specifiedAnim = animation as NormalMoveAnimation;
                        if (specifiedAnim.CompletedLoops < specifiedAnim.RenderLoops) {
                            SpellSheet spriteSheet = GraphicsManager.GetSpellSheet(Enums.StationaryAnimType.Spell, specifiedAnim.AnimationIndex, false);
                            Surface spriteToBlit = null;
                            if (spriteSheet != null) {
                                spriteToBlit = spriteSheet.Sheet;
                            } else {
                                specifiedAnim.Active = false;
                                return;
                            }

                            Rectangle sourceRec = new Rectangle(specifiedAnim.Frame * spriteToBlit.Height,
                                0, spriteToBlit.Height, spriteToBlit.Height);

                            pinnedPoint.X = pinnedPoint.X + Constants.TILE_WIDTH / 2 - spriteToBlit.Height / 2;
                            pinnedPoint.Y = pinnedPoint.Y + Constants.TILE_HEIGHT / 2 - spriteToBlit.Height / 2;

                            //blit
                            destData.Blit(spriteToBlit, pinnedPoint, sourceRec);

                            if (Globals.Tick > specifiedAnim.MoveTime + specifiedAnim.FrameLength) {
                                specifiedAnim.MoveTime = Globals.Tick;
                                specifiedAnim.Frame++;
                            }

                            if (specifiedAnim.Frame >= spriteToBlit.Width / spriteToBlit.Height) {
                                specifiedAnim.CompletedLoops++;
                                specifiedAnim.Frame = 0;
                            }

                        } else {
                            specifiedAnim.Active = false;
                        }
                        #endregion
                    }
                    break;
                case Enums.MoveAnimationType.Arrow: {
                        #region Arrow
                        ArrowMoveAnimation specifiedAnim = animation as ArrowMoveAnimation;
                        int time = Globals.Tick - specifiedAnim.TotalMoveTime;
                        if (time < animTime) {

                            SpellSheet spriteSheet = GraphicsManager.GetSpellSheet(Enums.StationaryAnimType.Arrow, specifiedAnim.AnimationIndex, false);
                            Surface spriteToBlit = null;
                            if (spriteSheet != null) {
                                spriteToBlit = spriteSheet.Sheet;
                            } else {
                                specifiedAnim.Active = false;
                                return;
                            }

                            Rectangle sourceRec = new Rectangle(specifiedAnim.Frame * spriteToBlit.Height / 8,
                                GraphicsManager.GetAnimDirInt(specifiedAnim.Direction) * spriteToBlit.Height / 8, spriteToBlit.Height / 8, spriteToBlit.Height / 8);

                            pinnedPoint.X = pinnedPoint.X + Constants.TILE_WIDTH / 2 - spriteToBlit.Height / 2 / 8;
                            pinnedPoint.Y = pinnedPoint.Y + Constants.TILE_HEIGHT / 2 - spriteToBlit.Height / 2 / 8;

                            switch (specifiedAnim.Direction) {
                                case Enums.Direction.Up: {
                                        pinnedPoint.Y -= specifiedAnim.Distance * Constants.TILE_HEIGHT * time / animTime;
                                    }
                                    break;
                                case Enums.Direction.Down: {
                                        pinnedPoint.Y += specifiedAnim.Distance * Constants.TILE_HEIGHT * time / animTime;
                                    }
                                    break;
                                case Enums.Direction.Left: {
                                        pinnedPoint.X -= specifiedAnim.Distance * Constants.TILE_WIDTH * time / animTime;
                                    }
                                    break;
                                case Enums.Direction.Right: {
                                        pinnedPoint.X += specifiedAnim.Distance * Constants.TILE_WIDTH * time / animTime;
                                    }
                                    break;
                                case Enums.Direction.UpRight:
                                case Enums.Direction.DownRight:
                                case Enums.Direction.DownLeft:
                                case Enums.Direction.UpLeft:
                                    break;
                            }

                            //blit
                            destData.Blit(spriteToBlit, pinnedPoint, sourceRec);

                            if (Globals.Tick > specifiedAnim.MoveTime + specifiedAnim.FrameLength) {
                                specifiedAnim.MoveTime = Globals.Tick;
                                specifiedAnim.Frame++;
                            }

                            if (specifiedAnim.Frame >= spriteToBlit.Width / (spriteToBlit.Height / 8)) {
                                specifiedAnim.CompletedLoops++;
                                specifiedAnim.Frame = 0;
                            }

                        } else {
                            specifiedAnim.Active = false;
                        }
            #endregion
                    }
                    break;
                case Enums.MoveAnimationType.Throw: {
                        #region Throw
                        ThrowMoveAnimation specifiedAnim = animation as ThrowMoveAnimation;
                        int time = Globals.Tick - specifiedAnim.TotalMoveTime;
                        if (time < animTime) {

                            SpellSheet spriteSheet = GraphicsManager.GetSpellSheet(Enums.StationaryAnimType.Spell, specifiedAnim.AnimationIndex, false);
                            Surface spriteToBlit = null;
                            if (spriteSheet != null) {
                                spriteToBlit = spriteSheet.Sheet;
                            } else {
                                specifiedAnim.Active = false;
                                return;
                            }

                            Rectangle sourceRec = new Rectangle(specifiedAnim.Frame * spriteToBlit.Height,
                                0, spriteToBlit.Height, spriteToBlit.Height);

                            double distance = Math.Sqrt(Math.Pow(specifiedAnim.XChange * Constants.TILE_WIDTH, 2) + Math.Pow(specifiedAnim.YChange * Constants.TILE_HEIGHT, 2));

                            int x = pinnedPoint.X + specifiedAnim.XChange * Constants.TILE_WIDTH * time / animTime;
                            int y = (int)(pinnedPoint.Y + specifiedAnim.YChange * Constants.TILE_HEIGHT * time / animTime - ((-4) * distance * Math.Pow(time, 2) / animTime + 4 * distance * time) / animTime);

                            x = x + Constants.TILE_WIDTH / 2 - spriteToBlit.Height / 2;
                            y = y + Constants.TILE_HEIGHT / 2 - spriteToBlit.Height / 2;

                            //blit
                            destData.Blit(spriteToBlit, new Point(x, y), sourceRec);

                            if (Globals.Tick > specifiedAnim.MoveTime + specifiedAnim.FrameLength) {
                                specifiedAnim.MoveTime = Globals.Tick;
                                specifiedAnim.Frame++;
                            }

                            if (specifiedAnim.Frame >= spriteToBlit.Width / spriteToBlit.Height) {
                                specifiedAnim.CompletedLoops++;
                                specifiedAnim.Frame = 0;
                            }

                        } else {
                            specifiedAnim.Active = false;
                        }
            #endregion
                    }
                    break;
                case Enums.MoveAnimationType.Beam: {
                        #region Beam
                        BeamMoveAnimation specifiedAnim = animation as BeamMoveAnimation;
                        if (specifiedAnim.CompletedLoops < specifiedAnim.RenderLoops + specifiedAnim.Distance) {
                            SpellSheet spriteSheet = GraphicsManager.GetSpellSheet(Enums.StationaryAnimType.Beam, specifiedAnim.AnimationIndex, false);
                            Surface spriteToBlit = null;
                            if (spriteSheet != null) {
                                spriteToBlit = spriteSheet.Sheet;
                            } else {
                                specifiedAnim.Active = false;
                                return;
                            }

                            int curDistance = specifiedAnim.Distance;
                            Rectangle sourceRec = new Rectangle();
                            if (specifiedAnim.CompletedLoops < specifiedAnim.Distance) curDistance = specifiedAnim.CompletedLoops;
                            for (int i = 0; i <= curDistance; i++) {
                                if (i == 0) {
                                    //draw beginning
                                    sourceRec = new Rectangle(specifiedAnim.Frame * spriteToBlit.Height / 32,
                                GraphicsManager.GetAnimDirInt(specifiedAnim.Direction) * 4 * spriteToBlit.Height / 32, spriteToBlit.Height / 32, spriteToBlit.Height / 32);
                                } else if (i == curDistance) {
                                    if (curDistance == specifiedAnim.Distance) {
                                        sourceRec = new Rectangle(specifiedAnim.Frame * spriteToBlit.Height / 32,
                                (GraphicsManager.GetAnimDirInt(specifiedAnim.Direction) * 4 + 3) * spriteToBlit.Height / 32, spriteToBlit.Height / 32, spriteToBlit.Height / 32);
                                    } else {
                                        sourceRec = new Rectangle(specifiedAnim.Frame * spriteToBlit.Height / 32,
                                (GraphicsManager.GetAnimDirInt(specifiedAnim.Direction) * 4 + 2) * spriteToBlit.Height / 32, spriteToBlit.Height / 32, spriteToBlit.Height / 32);
                                    }
                                } else {
                                    //draw body
                                    sourceRec = new Rectangle(specifiedAnim.Frame * spriteToBlit.Height / 32,
                                (GraphicsManager.GetAnimDirInt(specifiedAnim.Direction) * 4 + 1) * spriteToBlit.Height / 32, spriteToBlit.Height / 32, spriteToBlit.Height / 32);
                                }

                                Point blitPoint = new Point();

                                switch (specifiedAnim.Direction) {
                                    case Enums.Direction.Up: {
                                        blitPoint = new Point(pinnedPoint.X, pinnedPoint.Y - i * Constants.TILE_HEIGHT);
                                        }
                                        break;
                                    case Enums.Direction.Down: {
                                        blitPoint = new Point(pinnedPoint.X, pinnedPoint.Y + i * Constants.TILE_HEIGHT);
                                        }
                                        break;
                                    case Enums.Direction.Left: {
                                        blitPoint = new Point(pinnedPoint.X - i * Constants.TILE_WIDTH, pinnedPoint.Y);
                                        }
                                        break;
                                    case Enums.Direction.Right: {
                                        blitPoint = new Point(pinnedPoint.X + i * Constants.TILE_WIDTH, pinnedPoint.Y);
                                        }
                                        break;
                                    case Enums.Direction.UpRight:
                                    case Enums.Direction.DownRight:
                                    case Enums.Direction.DownLeft:
                                    case Enums.Direction.UpLeft:
                                        break;
                                }

                                blitPoint.X = blitPoint.X + Constants.TILE_WIDTH / 2 - spriteToBlit.Height / 2 / 32;
                                blitPoint.Y = blitPoint.Y + Constants.TILE_HEIGHT / 2 - spriteToBlit.Height / 2 / 32;

                                //blit
                                destData.Blit(spriteToBlit, blitPoint, sourceRec);
                            }

                            if (Globals.Tick > specifiedAnim.MoveTime + specifiedAnim.FrameLength) {
                                specifiedAnim.MoveTime = Globals.Tick;
                                specifiedAnim.Frame++;
                            }

                            if (specifiedAnim.Frame >= spriteToBlit.Width / (spriteToBlit.Height / 32)) {
                                specifiedAnim.CompletedLoops++;
                                specifiedAnim.Frame = 0;
                            }

                        } else {
                            specifiedAnim.Active = false;
                        }
            #endregion
                    }
                    break;
                case Enums.MoveAnimationType.Overlay: {
                        #region Overlay
                        OverlayMoveAnimation specifiedAnim = animation as OverlayMoveAnimation;
                        if (specifiedAnim.CompletedLoops < specifiedAnim.RenderLoops) {
                            SpellSheet spriteSheet = GraphicsManager.GetSpellSheet(Enums.StationaryAnimType.Spell, specifiedAnim.AnimationIndex, true);
                            Surface spriteToBlit = null;
                            if (spriteSheet != null) {
                                spriteToBlit = spriteSheet.Sheet;
                            } else {
                                specifiedAnim.Active = false;
                                return;
                            }

                            Rectangle sourceRec = new Rectangle(specifiedAnim.Frame * spriteToBlit.Height,
                                0, spriteToBlit.Height, spriteToBlit.Height);

                            //blit
                            for (int y = 0; y < Constants.TILE_HEIGHT * 15; y += spriteToBlit.Height) {
                                for (int x = 0; x < Constants.TILE_WIDTH * 20; x += spriteToBlit.Height) {
                                    destData.Blit(spriteToBlit, new Point(x, y), sourceRec);
                                }
                            }

                            if (Globals.Tick > specifiedAnim.MoveTime + specifiedAnim.FrameLength) {
                                specifiedAnim.MoveTime = Globals.Tick;
                                specifiedAnim.Frame++;
                            }

                            if (specifiedAnim.Frame >= spriteToBlit.Width / spriteToBlit.Height) {
                                specifiedAnim.CompletedLoops++;
                                specifiedAnim.Frame = 0;
                            }

                        } else {
                            specifiedAnim.Active = false;
                        }
            #endregion
                    }
                    break;
                case Enums.MoveAnimationType.Tile: {
                        #region Tile
                        TileMoveAnimation specifiedAnim = animation as TileMoveAnimation;
                        if (specifiedAnim.CompletedLoops < specifiedAnim.RenderLoops) {
                            SpellSheet spriteSheet = GraphicsManager.GetSpellSheet(Enums.StationaryAnimType.Spell, specifiedAnim.AnimationIndex, false);
                            Surface spriteToBlit = null;
                            if (spriteSheet != null) {
                                spriteToBlit = spriteSheet.Sheet;
                            } else {
                                specifiedAnim.Active = false;
                                return;
                            }

                            Rectangle sourceRec = new Rectangle(specifiedAnim.Frame * spriteToBlit.Height,
                                0, spriteToBlit.Height, spriteToBlit.Height);

                            Point blitPoint = new Point(pinnedPoint.X + Constants.TILE_WIDTH / 2 - spriteToBlit.Height / 2, pinnedPoint.Y + Constants.TILE_HEIGHT / 2 - spriteToBlit.Height / 2);

                            //blit
                            switch (specifiedAnim.RangeType) {
                                case Enums.MoveRange.FrontOfUserUntil:
                                case Enums.MoveRange.LineUntilHit: {
                                        #region Front of user Until
                                        switch (specifiedAnim.Direction) {
                                            case Enums.Direction.Up: {
                                                    int y = specifiedAnim.StartY;
                                                    for (int i = 1; i <= specifiedAnim.Range; i++) {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X, blitPoint.Y - Constants.TILE_HEIGHT * i), sourceRec);

                                                        if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX, specifiedAnim.StartY - i)) {
                                                            break;
                                                        }
                                                    }
                                                }
                                                break;
                                            case Enums.Direction.Down: {
                                                    int y = specifiedAnim.StartY;
                                                    for (int i = 1; i <= specifiedAnim.Range; i++) {
                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X, blitPoint.Y + Constants.TILE_HEIGHT * i), sourceRec);

                                                        if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX, specifiedAnim.StartY + i)) {
                                                            break;
                                                        }
                                                    }
                                                }
                                                break;
                                            case Enums.Direction.Left: {
                                                    int x = specifiedAnim.StartX;
                                                    for (int i = 1; i <= specifiedAnim.Range; i++) {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X - Constants.TILE_WIDTH * i, blitPoint.Y), sourceRec);

                                                        if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX - i, specifiedAnim.StartY)) {
                                                            break;
                                                        }

                                                    }
                                                }
                                                break;
                                            case Enums.Direction.Right: {
                                                    int x = specifiedAnim.StartX;
                                                    for (int i = 1; i <= specifiedAnim.Range; i++) {
                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X + Constants.TILE_WIDTH * i, blitPoint.Y), sourceRec);

                                                        if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX + i, specifiedAnim.StartY)) {
                                                            break;
                                                        }
                                                    }
                                                }
                                                break;
                                        }
                                        #endregion
                                    }
                                    break;
                                case Enums.MoveRange.StraightLine:
                                case Enums.MoveRange.FrontOfUser: {
                                        #region Front of user
                                        switch (specifiedAnim.Direction) {
                                            case Enums.Direction.Up: {
                                                    int y = specifiedAnim.StartY;
                                                    for (int i = 1; i <= specifiedAnim.Range; i++) {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X, blitPoint.Y - Constants.TILE_HEIGHT * i), sourceRec);

                                                    }
                                                }
                                                break;
                                            case Enums.Direction.Down: {
                                                    int y = specifiedAnim.StartY;
                                                    for (int i = 1; i <= specifiedAnim.Range; i++) {
                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X, blitPoint.Y + Constants.TILE_HEIGHT * i), sourceRec);

                                                    }
                                                }
                                                break;
                                            case Enums.Direction.Left: {
                                                    int x = specifiedAnim.StartX;
                                                    for (int i = 1; i <= specifiedAnim.Range; i++) {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X - Constants.TILE_WIDTH * i, blitPoint.Y), sourceRec);

                                                    }
                                                }
                                                break;
                                            case Enums.Direction.Right: {
                                                    int x = specifiedAnim.StartX;
                                                    for (int i = 1; i <= specifiedAnim.Range; i++) {
                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X + Constants.TILE_WIDTH * i, blitPoint.Y), sourceRec);

                                                    }
                                                }
                                                break;
                                        }
                                        #endregion
                                    }
                                    break;
                                case Enums.MoveRange.User:
                                case Enums.MoveRange.Special: {
                                        #region user
                                        destData.Blit(spriteToBlit, blitPoint, sourceRec);
                                        #endregion
                                    }
                                    break;
                                case Enums.MoveRange.Floor: {
                                        #region Floor

                                        for (int x = 0; x < 20; x++) {
                                            for (int y = 0; y < 15; y++) {

                                                destData.Blit(spriteToBlit, new Point(x * Constants.TILE_WIDTH + Constants.TILE_WIDTH / 2 - spriteToBlit.Height / 2, y * Constants.TILE_HEIGHT + Constants.TILE_HEIGHT / 2 - spriteToBlit.Height / 2), sourceRec);
                                            }
                                        }
                                        #endregion
                                    }
                                    break;
                                case Enums.MoveRange.Room: {
                                        #region Room
                                        for (int x = (-specifiedAnim.Range); x <= specifiedAnim.Range; x++) {
                                            for (int y = (-specifiedAnim.Range); y <= specifiedAnim.Range; y++) {
                                                destData.Blit(spriteToBlit, new Point(blitPoint.X + x * Constants.TILE_WIDTH, blitPoint.Y + y * Constants.TILE_HEIGHT), sourceRec);
                                            }
                                        }
                                        #endregion
                                    }
                                    break;
                                case Enums.MoveRange.FrontAndSides: {
                                        #region Front and Sides
                                        for (int r = 0; r <= specifiedAnim.Range; r++) {

                                            //check adjacent tiles
                                            switch (specifiedAnim.Direction) {
                                                case Enums.Direction.Down: {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X, blitPoint.Y + r * Constants.TILE_HEIGHT), sourceRec);

                                                        for (int s = 1; s <= r; s++) {

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X - s * Constants.TILE_WIDTH, blitPoint.Y + r * Constants.TILE_HEIGHT), sourceRec);

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X + s * Constants.TILE_WIDTH, blitPoint.Y + r * Constants.TILE_HEIGHT), sourceRec);

                                                        }

                                                    }
                                                    break;
                                                case Enums.Direction.Up: {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X, blitPoint.Y - r * Constants.TILE_HEIGHT), sourceRec);

                                                        for (int s = 1; s <= r; s++) {

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X - s * Constants.TILE_WIDTH, blitPoint.Y - r * Constants.TILE_HEIGHT), sourceRec);

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X + s * Constants.TILE_WIDTH, blitPoint.Y - r * Constants.TILE_HEIGHT), sourceRec);

                                                        }

                                                    }
                                                    break;
                                                case Enums.Direction.Left: {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X - r * Constants.TILE_WIDTH, blitPoint.Y), sourceRec);

                                                        for (int s = 1; s <= r; s++) {

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X - r * Constants.TILE_WIDTH, blitPoint.Y - s * Constants.TILE_HEIGHT), sourceRec);

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X - r * Constants.TILE_WIDTH, blitPoint.Y + s * Constants.TILE_HEIGHT), sourceRec);

                                                        }
                                                    }
                                                    break;
                                                case Enums.Direction.Right: {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X + r * Constants.TILE_WIDTH, blitPoint.Y), sourceRec);

                                                        for (int s = 1; s <= r; s++) {

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X + r * Constants.TILE_WIDTH, blitPoint.Y - s * Constants.TILE_HEIGHT), sourceRec);

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X + r * Constants.TILE_WIDTH, blitPoint.Y + s * Constants.TILE_HEIGHT), sourceRec);

                                                        }
                                                    }
                                                    break;
                                            }

                                        }
                                        #endregion
                                    }
                                    break;
                                case Enums.MoveRange.ArcThrow: {
                                        #region Arc Throw
                                        bool stopattile = false;

                                        for (int r = 0; r <= specifiedAnim.Range; r++) {

                                            //check adjacent tiles
                                            switch (specifiedAnim.Direction) {
                                                case Enums.Direction.Down: {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X, blitPoint.Y + r * Constants.TILE_HEIGHT), sourceRec);

                                                        if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX, specifiedAnim.StartY + r)) {
                                                                stopattile = true;
                                                        }

                                                        if (stopattile) {
                                                            break;
                                                        }

                                                        for (int s = 1; s <= r; s++) {

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X - s * Constants.TILE_WIDTH, blitPoint.Y + r * Constants.TILE_HEIGHT), sourceRec);

                                                            if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX - s, specifiedAnim.StartY + r)) {
                                                                stopattile = true;
                                                            }

                                                            if (stopattile) {
                                                                break;
                                                            }

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X + s * Constants.TILE_WIDTH, blitPoint.Y + r * Constants.TILE_HEIGHT), sourceRec);

                                                            if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX + s, specifiedAnim.StartY + r)) {
                                                                stopattile = true;
                                                            }

                                                            if (stopattile) {
                                                                break;
                                                            }
                                                        }

                                                        if (stopattile) {
                                                            break;
                                                        }

                                                    }
                                                    break;
                                                case Enums.Direction.Up: {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X, blitPoint.Y - r * Constants.TILE_HEIGHT), sourceRec);

                                                        if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX, specifiedAnim.StartY - r)) {
                                                            stopattile = true;
                                                        }

                                                        if (stopattile) {
                                                            break;
                                                        }

                                                        for (int s = 1; s <= r; s++) {

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X - s * Constants.TILE_WIDTH, blitPoint.Y - r * Constants.TILE_HEIGHT), sourceRec);

                                                            if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX - s, specifiedAnim.StartY - r)) {
                                                                stopattile = true;
                                                            }

                                                            if (stopattile) {
                                                                break;
                                                            }

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X + s * Constants.TILE_WIDTH, blitPoint.Y - r * Constants.TILE_HEIGHT), sourceRec);

                                                            if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX + s, specifiedAnim.StartY - r)) {
                                                                stopattile = true;
                                                            }

                                                            if (stopattile) {
                                                                break;
                                                            }

                                                        }

                                                    }
                                                    break;
                                                case Enums.Direction.Left: {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X - r * Constants.TILE_WIDTH, blitPoint.Y), sourceRec);

                                                        if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX - r, specifiedAnim.StartY)) {
                                                            stopattile = true;
                                                        }

                                                        if (stopattile) {
                                                            break;
                                                        }

                                                        for (int s = 1; s <= r; s++) {

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X - r * Constants.TILE_WIDTH, blitPoint.Y - s * Constants.TILE_HEIGHT), sourceRec);

                                                            if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX - r, specifiedAnim.StartY - s)) {
                                                                stopattile = true;
                                                            }

                                                            if (stopattile) {
                                                                break;
                                                            }

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X - r * Constants.TILE_WIDTH, blitPoint.Y + s * Constants.TILE_HEIGHT), sourceRec);

                                                            if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                            specifiedAnim.StartX - r, specifiedAnim.StartY + s)) {
                                                                stopattile = true;
                                                            }

                                                            if (stopattile) {
                                                                break;
                                                            }

                                                        }
                                                    }
                                                    break;
                                                case Enums.Direction.Right: {

                                                        destData.Blit(spriteToBlit, new Point(blitPoint.X + r * Constants.TILE_WIDTH, blitPoint.Y), sourceRec);

                                                        if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                                specifiedAnim.StartX + r, specifiedAnim.StartY)) {
                                                            stopattile = true;
                                                        }

                                                        if (stopattile) {
                                                            break;
                                                        }

                                                        for (int s = 1; s <= r; s++) {

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X + r * Constants.TILE_WIDTH, blitPoint.Y - s * Constants.TILE_HEIGHT), sourceRec);

                                                            if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                                specifiedAnim.StartX + r, specifiedAnim.StartY - s)) {
                                                                stopattile = true;
                                                            }

                                                            if (stopattile) {
                                                                break;
                                                            }

                                                            destData.Blit(spriteToBlit, new Point(blitPoint.X + r * Constants.TILE_WIDTH, blitPoint.Y + s * Constants.TILE_HEIGHT), sourceRec);

                                                            if (IsRenderingTargetOnSprite(Logic.Maps.MapHelper.ActiveMap,
                                                                specifiedAnim.StartX + r, specifiedAnim.StartY + s)) {
                                                                stopattile = true;
                                                            }

                                                            if (stopattile) {
                                                                break;
                                                            }

                                                        }
                                                    }
                                                    break;
                                            }

                                            if (stopattile) {
                                                break;
                                            }
                                        }

                                        #endregion
                                    }
                                    break;
                            }

                            //for (int y = specifiedAnim.StartY; y <= specifiedAnim.EndY; y++) {
                            //    for (int x = specifiedAnim.StartX; x <= specifiedAnim.EndX; x++) {

                            //        Point blitPoint = Screen.ScreenRenderer.ToTilePoint(new Point(x, y), useScrolling);
                            //        blitPoint.X = blitPoint.X + Constants.TILE_WIDTH / 2 - spriteToBlit.Height / 2;
                            //        blitPoint.Y = blitPoint.Y + Constants.TILE_HEIGHT / 2 - spriteToBlit.Height / 2;

                            //        destData.Blit(spriteToBlit, blitPoint, sourceRec);
                            //    }
                            //}

                            if (Globals.Tick > specifiedAnim.MoveTime + specifiedAnim.FrameLength) {
                                specifiedAnim.MoveTime = Globals.Tick;
                                specifiedAnim.Frame++;
                            }

                            if (specifiedAnim.Frame >= spriteToBlit.Width / spriteToBlit.Height) {
                                specifiedAnim.CompletedLoops++;
                                specifiedAnim.Frame = 0;
                            }

                        } else {
                            specifiedAnim.Active = false;
                        }
            #endregion
                    }
                    break;
                case Enums.MoveAnimationType.ItemArrow: {
                        #region ItemArrow
                        ItemArrowMoveAnimation specifiedAnim = animation as ItemArrowMoveAnimation;
                        int time = Globals.Tick - specifiedAnim.TotalMoveTime;
                        if (time < animTime) {

                            if (specifiedAnim.AnimationIndex < 0) {
                                specifiedAnim.Active = false;
                                return;
                            }

                            Rectangle sourceRec = new Rectangle((specifiedAnim.AnimationIndex - (specifiedAnim.AnimationIndex / 6) * 6) * Constants.TILE_WIDTH,
                                               (specifiedAnim.AnimationIndex / 6) * Constants.TILE_HEIGHT, Constants.TILE_WIDTH, Constants.TILE_HEIGHT);

                            switch (specifiedAnim.Direction) {
                                case Enums.Direction.Up: {
                                        pinnedPoint.Y -= specifiedAnim.Distance * Constants.TILE_HEIGHT * time / animTime;
                                    }
                                    break;
                                case Enums.Direction.Down: {
                                        pinnedPoint.Y += specifiedAnim.Distance * Constants.TILE_HEIGHT * time / animTime;
                                    }
                                    break;
                                case Enums.Direction.Left: {
                                        pinnedPoint.X -= specifiedAnim.Distance * Constants.TILE_WIDTH * time / animTime;
                                    }
                                    break;
                                case Enums.Direction.Right: {
                                        pinnedPoint.X += specifiedAnim.Distance * Constants.TILE_WIDTH * time / animTime;
                                    }
                                    break;
                                case Enums.Direction.UpRight:
                                case Enums.Direction.DownRight:
                                case Enums.Direction.DownLeft:
                                case Enums.Direction.UpLeft:
                                    break;
                            }

                            //blit
                            destData.Blit(GraphicsManager.Items, pinnedPoint, sourceRec);

                            //if (Globals.Tick > specifiedAnim.MoveTime + specifiedAnim.FrameLength) {
                            //    specifiedAnim.MoveTime = Globals.Tick;
                            //    specifiedAnim.Frame++;
                            //}

                            //if (specifiedAnim.Frame >= spriteToBlit.Width / spriteToBlit.Height) {
                            //    specifiedAnim.CompletedLoops++;
                            //    specifiedAnim.Frame = 0;
                            //}

                        } else {
                            specifiedAnim.Active = false;
                        }
                        #endregion
                    }
                    break;
                case Enums.MoveAnimationType.ItemThrow: {
                        #region ItemThrow
                        ItemThrowMoveAnimation specifiedAnim = animation as ItemThrowMoveAnimation;
                        int time = Globals.Tick - specifiedAnim.TotalMoveTime;
                        if (time < animTime) {

                            if (specifiedAnim.AnimationIndex < 0) {
                                specifiedAnim.Active = false;
                                return;
                            }

                            Rectangle sourceRec = new Rectangle((specifiedAnim.AnimationIndex - (specifiedAnim.AnimationIndex / 6) * 6) * Constants.TILE_WIDTH,
                                               (specifiedAnim.AnimationIndex / 6) * Constants.TILE_HEIGHT, Constants.TILE_WIDTH, Constants.TILE_HEIGHT);

                            double distance = Math.Sqrt(Math.Pow(specifiedAnim.XChange * Constants.TILE_WIDTH, 2) + Math.Pow(specifiedAnim.YChange * Constants.TILE_HEIGHT, 2));

                            int x = pinnedPoint.X + specifiedAnim.XChange * Constants.TILE_WIDTH * time / animTime;
                            int y = (int)(pinnedPoint.Y + specifiedAnim.YChange * Constants.TILE_HEIGHT * time / animTime - ((-4) * distance * Math.Pow(time, 2) / animTime + 4 * distance * time) / animTime);

                            //blit
                            destData.Blit(GraphicsManager.Items, new Point(x, y), sourceRec);

                            //if (Globals.Tick > specifiedAnim.MoveTime + specifiedAnim.FrameLength) {
                            //    specifiedAnim.MoveTime = Globals.Tick;
                            //    specifiedAnim.Frame++;
                            //}

                            //if (specifiedAnim.Frame >= spriteToBlit.Width / spriteToBlit.Height) {
                            //    specifiedAnim.CompletedLoops++;
                            //    specifiedAnim.Frame = 0;
                            //}

                        } else {
                            specifiedAnim.Active = false;
                        }
                        #endregion
                    }
                    break;
            }
        }
Beispiel #13
0
 public static void DrawTile(RendererDestinationData destData, TileGraphic tileGraphic, int tileX, int tileY, bool useGlobalCamera)
 {
     useGlobalCamera = false;
     if (useGlobalCamera) {
         destData.Blit(tileGraphic.Tile, new Point(ScreenRenderer.ToTileX(tileX), ScreenRenderer.ToTileY(tileY)));//new Point((tileX * Constants.TILE_WIDTH) /*- (NewPlayerX * Constants.TILE_WIDTH) */- ScreenRenderer.MapXOffset, (tileY * Constants.TILE_HEIGHT) /*- (NewPlayerY * Constants.TILE_HEIGHT)*/ - ScreenRenderer.MapYOffset));
     } else {
         destData.Blit(tileGraphic.Tile, new Point((tileX * Constants.TILE_WIDTH) /*- (NewPlayerX * Constants.TILE_WIDTH) */- ScreenRenderer.MapXOffset, (tileY * Constants.TILE_HEIGHT) /*- (NewPlayerY * Constants.TILE_HEIGHT)*/ - ScreenRenderer.MapYOffset));
     }
 }
Beispiel #14
0
        public static void DrawSpriteChangeTile(RendererDestinationData destData, Map activeMap, int x, int y)
        {
            if (x >= 0 && x <= activeMap.MaxX && y >= 0 && y <= activeMap.MaxY) {
                if (activeMap.Tile[x, y].Type == Enums.TileType.SpriteChange) {

                    SpriteSheet spriteToBlit = GraphicsManager.GetSpriteSheet(activeMap.Tile[x, y].Data1);

                    //rec.Height = spriteToBlit.Height;
                    //rec.Width = spriteToBlit.Width / 14;

                    //rec.X = rec.Width * 3;
                    //rec.Y = 0;

                    Point loc = new Point(ScreenRenderer.ToTileX(x), ScreenRenderer.ToTileY(y));
                    loc.X -= (spriteToBlit.FrameData.FrameWidth / 2 - 16);
                    loc.Y -= (spriteToBlit.FrameData.FrameHeight - 32);
                    destData.Blit(spriteToBlit.GetSheet(FrameType.Idle, Enums.Direction.Down), loc, spriteToBlit.GetFrameBounds(FrameType.Walk, Enums.Direction.Down, 0));

                }
            }
        }
        public static void RenderScreen(RendererDestinationData destData)
        {
            try {
                //System.Diagnostics.Debug.WriteLine("Elapsed " + (SdlDotNet.Core.Timer.TicksElapsed - Globals.Tick));
                Globals.Tick = SdlDotNet.Core.Timer.TicksElapsed;
                //dstSurf.Fill(Color.Blue);

                //Maps.Map renderOptions.Map = Maps.MapHelper.renderOptions.Map;

                //Windows.WindowSwitcher.GameWindow.mInput.VerifyKeys();

                if (renderOptions.Map != null && renderOptions.Map.Loaded) {
                    //Players.Player player = Players.PlayerHelper.Players.GetMyPlayer();
                    if (camera.FocusObject == null) {
                        camera.FocusOnSprite(PlayerManager.MyPlayer);
                    } else {
                        camera.FocusObject.Process(Globals.Tick);

                        camera.FocusOnFocusObject(camera.FocusObject);
                    }

                    // Get the camera coordinates
                    camera.X = GetScreenLeft() - 1;
                    camera.Y = GetScreenTop();
                    camera.X2 = GetScreenRight();
                    camera.Y2 = GetScreenBottom() + 1;
                    // Verify that the coordinates aren't outside the map bounds
                    if (camera.X < 0 && !SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Left)) {
                        camera.X = 0;
                        camera.X2 = 20;
                    } else if (camera.X2 > renderOptions.Map.MaxX + 1 && !SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Right)) {
                        camera.X = renderOptions.Map.MaxX - 19;
                        camera.X2 = renderOptions.Map.MaxX + 1;
                    }
                    if (camera.Y < 0 && !SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Up)) {
                        camera.Y = 0;
                        camera.Y2 = 15;
                    } else if (camera.Y2 > renderOptions.Map.MaxY + 1 && !SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Down)) {
                        camera.Y = renderOptions.Map.MaxY - 14;
                        camera.Y2 = renderOptions.Map.MaxY + 1;
                    }

                    MapXOffset = camera.FocusedXOffset;
                    MapYOffset = camera.FocusedYOffset;

                    if (camera.FocusedY - 6 <= 1 && !SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Up)) {
                        int subAmount = 6;
                        if (camera.FocusedDirection == Enums.Direction.Up) {
                            subAmount--;
                        }
                        if (camera.FocusedY - subAmount <= 1 || renderOptions.Map.MaxY == 14) {
                            MapYOffset = 0;
                        }
                    } else if (camera.FocusedY + 10 > renderOptions.Map.MaxY + 1 && !SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Down)) {
                        int plusAmount = 9;
                        if (camera.FocusedDirection == Enums.Direction.Down) {
                            plusAmount--;
                        }
                        if (camera.FocusedY + plusAmount > renderOptions.Map.MaxY + 1 || renderOptions.Map.MaxY == 14) {
                            MapYOffset = 0;
                        }
                    }

                    if (camera.FocusedX - 9 <= 1 && !SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Left)) {
                        int subAmount = 9;
                        if (camera.FocusedDirection == Enums.Direction.Left) {
                            subAmount--;
                        }
                        if (camera.FocusedX - subAmount <= 1 || renderOptions.Map.MaxX == 19) {
                            MapXOffset = 0;
                        }
                    } else if (camera.FocusedX + 11 > renderOptions.Map.MaxX + 1 && !SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Right)) {
                        int plusAmount = 10;
                        if (camera.FocusedDirection == Enums.Direction.Left) {
                            plusAmount++;
                        }
                        if (camera.FocusedX + plusAmount > renderOptions.Map.MaxX + 1 || renderOptions.Map.MaxX == 19) {
                            MapXOffset = 0;
                        }
                    }

                    //MapRenderer.DrawGroundTiles(destData, renderOptions.Map, renderOptions.DisplayAnimation, camera.X, camera.X2, camera.Y, camera.Y2);
                    MapRenderer.DrawGroundTilesSeamless(destData, renderOptions.Map, renderOptions.DisplayAnimation, camera.X, camera.X2, camera.Y, camera.Y2);

                    //prepare focus for relative cutoff of items
                    if (renderOptions.Darkness != null && !renderOptions.Darkness.Disposed) {
                        renderOptions.Darkness.Focus = new Point(ToTileX(PlayerManager.MyPlayer.X) + PlayerManager.MyPlayer.Offset.X + Constants.TILE_WIDTH / 2, ToTileY(PlayerManager.MyPlayer.Y) + PlayerManager.MyPlayer.Offset.Y + Constants.TILE_HEIGHT / 2);
                    }

                    #region Map Items/Npcs/Players
                    // Draw the items on the map
                    for (int mapCounter = 0; mapCounter < 9; mapCounter++) {
                        Logic.Maps.Map testMap = Logic.Maps.MapHelper.Maps[(Enums.MapID)mapCounter];

                        if (testMap != null && testMap.Loaded) {
                            for (int i = 0; i < MaxInfo.MaxMapItems; i++) {
                                if (testMap.MapItems[i] != null && testMap.MapItems[i].Num > 0 && CanBeSeen(testMap.MapItems[i].X, testMap.MapItems[i].Y, (Enums.MapID)mapCounter)) {
                                    ItemRenderer.DrawMapItem(destData, testMap, (Enums.MapID)mapCounter, i);
                                }
                            }
                        }
                    }

                    if (Input.InputProcessor.SelectedMove > -1) {
                        switch (Input.InputProcessor.SelectedMove) {
                            case 0: {
                                    if (SdlDotNet.Input.Keyboard.IsKeyPressed(SdlDotNet.Input.Key.W)) {
                                        if (PlayerManager.MyPlayer.Moves[0].MoveNum > 0) {
                                            Moves.MoveRenderer.RenderMoveTargettingDisplay(destData, PlayerManager.MyPlayer,
                                                Logic.Moves.MoveHelper.Moves[PlayerManager.MyPlayer.Moves[0].MoveNum]);
                                        }
                                    } else {
                                        Input.InputProcessor.SelectedMove = -1;
                                    }
                                }
                                break;
                            case 1: {
                                    if (SdlDotNet.Input.Keyboard.IsKeyPressed(SdlDotNet.Input.Key.A)) {
                                        if (PlayerManager.MyPlayer.Moves[1].MoveNum > 0) {
                                            Moves.MoveRenderer.RenderMoveTargettingDisplay(destData, PlayerManager.MyPlayer,
                                                Logic.Moves.MoveHelper.Moves[PlayerManager.MyPlayer.Moves[1].MoveNum]);
                                        }
                                    } else {
                                        Input.InputProcessor.SelectedMove = -1;
                                    }
                                }
                                break;
                            case 2: {
                                    if (SdlDotNet.Input.Keyboard.IsKeyPressed(SdlDotNet.Input.Key.S)) {
                                        if (PlayerManager.MyPlayer.Moves[2].MoveNum > 0) {
                                            Moves.MoveRenderer.RenderMoveTargettingDisplay(destData, PlayerManager.MyPlayer,
                                                Logic.Moves.MoveHelper.Moves[PlayerManager.MyPlayer.Moves[2].MoveNum]);
                                        }
                                    } else {
                                        Input.InputProcessor.SelectedMove = -1;
                                    }
                                }
                                break;
                            case 3: {
                                    if (SdlDotNet.Input.Keyboard.IsKeyPressed(SdlDotNet.Input.Key.D)) {
                                        if (PlayerManager.MyPlayer.Moves[3].MoveNum > 0) {
                                            Moves.MoveRenderer.RenderMoveTargettingDisplay(destData, PlayerManager.MyPlayer,
                                                Logic.Moves.MoveHelper.Moves[PlayerManager.MyPlayer.Moves[3].MoveNum]);
                                        }
                                    } else {
                                        Input.InputProcessor.SelectedMove = -1;
                                    }
                                }
                                break;
                        }
                    }

                    if (Stories.Globals.NpcsHidden == false) {
                        // Blit out the npcs
                        for (int mapCounter = 0; mapCounter < 9; mapCounter++) {
                            Logic.Maps.Map testMap = Logic.Maps.MapHelper.Maps[(Enums.MapID)mapCounter];

                            if (testMap != null && testMap.Loaded) {
                                for (int i = 0; i < MaxInfo.MAX_MAP_NPCS; i++) {

                                    if ((CanBeSeen(testMap.MapNpcs[i].Location, (Enums.MapID)mapCounter) || testMap.MapNpcs[i].Leaving) && testMap.MapNpcs[i].Num > 0 && testMap.MapNpcs[i].ScreenActive) {

                                        NpcRenderer.DrawNpc(destData, testMap, (Enums.MapID)mapCounter, i);

                                        if (testMap.MapNpcs[i].StatusAilment != Enums.StatusAilment.OK) {
                                            NpcRenderer.DrawNpcStatus(destData, testMap, (Enums.MapID)mapCounter, i, (int)testMap.MapNpcs[i].StatusAilment);

                                        }

                                        //if (testMap.MapNpcs[i].Confused) {
                                        //    NpcRenderer.DrawNpcStatus(destData, testMap, (Enums.MapID)mapCounter, i, 6);
                                        //}
                                        if (testMap.MapNpcs[i].VolatileStatus.Count > 0) {
                                            NpcRenderer.DrawNpcVolatileStatus(destData, testMap, (Enums.MapID)mapCounter, i, testMap.MapNpcs[i].VolatileStatus);
                                        }

                                        // TODO: DrawNpcEmotion
                                    }

                                }
                            }
                        }
                    }

                    if (Stories.StoryProcessor.ActiveStory != null) {
                        if (Stories.StoryProcessor.ActiveStory.State != null) {

                            // Process MoveFNPC segment
                            for (int i = 0; i < Stories.StoryProcessor.ActiveStory.State.FNPCs.Count; i++) {
                                if (Stories.StoryProcessor.ActiveStory.State.FNPCs[i].MapID == renderOptions.Map.MapID ||
                                    Stories.StoryProcessor.ActiveStory.State.FNPCs[i].MapID == "-2" && renderOptions.Map.MapID.StartsWith("i")) {

                                    Stories.FNPCs.FNPC fNPC = Stories.StoryProcessor.ActiveStory.State.FNPCs[i];

                                    if (fNPC.TargetX > -1 || fNPC.TargetY > -1) {
                                        if (fNPC.Offset.X == 0 && fNPC.Offset.Y == 0) {
                                            if (fNPC.PathfinderResult == null) {
                                                fNPC.PathfinderResult = Logic.Maps.MapHelper.ActiveMap.Pathfinder.FindPath(fNPC.X, fNPC.Y, fNPC.TargetX, fNPC.TargetY);
                                            }
                                            PathfinderResult result = fNPC.PathfinderResult;
                                            if (result.IsPath) {
                                                fNPC.Direction = result.GetNextItem();
                                                fNPC.Offset = new Point(0, 0);
                                                fNPC.MovementSpeed = Enums.MovementSpeed.Walking;

                                                switch (fNPC.Direction) {
                                                    case Enums.Direction.Up:
                                                        fNPC.Y--;
                                                        fNPC.Offset = new Point(fNPC.Offset.X, Constants.TILE_HEIGHT);
                                                        break;
                                                    case Enums.Direction.Down:
                                                        fNPC.Y++;
                                                        fNPC.Offset = new Point(fNPC.Offset.X, Constants.TILE_HEIGHT * -1);
                                                        break;
                                                    case Enums.Direction.Left:
                                                        fNPC.X--;
                                                        fNPC.Offset = new Point(Constants.TILE_WIDTH, fNPC.Offset.Y);
                                                        break;
                                                    case Enums.Direction.Right:
                                                        fNPC.X++;
                                                        fNPC.Offset = new Point(Constants.TILE_WIDTH * -1, fNPC.Offset.Y);
                                                        break;
                                                }

                                                fNPC.LastMovement = Globals.Tick;

                                                if (fNPC.X == fNPC.TargetX && fNPC.Y == fNPC.TargetY) {
                                                    fNPC.TargetX = -2;
                                                    fNPC.TargetY = -2;
                                                    fNPC.PathfinderResult = null;
                                                }
                                            }
                                        }
                                    } else if (fNPC.TargetX == -2 && fNPC.TargetY == -2) {
                                        if (fNPC.Offset.X == 0 && fNPC.Offset.Y == 0) {
                                            fNPC.TargetX = -1;
                                            fNPC.TargetY = -1;
                                            if (Stories.StoryProcessor.ActiveStory.State.StoryPaused) {
                                                Stories.StoryProcessor.ActiveStory.State.Unpause();
                                            }
                                        }
                                    }

                                    GameProcessor.ProcessSpriteMovement(Stories.StoryProcessor.ActiveStory.State.FNPCs[i]);
                                    Sprites.SpriteRenderer.DrawSprite(destData, renderOptions.Map, Enums.MapID.Active, Stories.StoryProcessor.ActiveStory.State.FNPCs[i]);
                                }
                            }

                            // Process MovePlayer segment
                            MyPlayer myPlayer = PlayerManager.MyPlayer;
                            if (myPlayer.TargetX > -1 || myPlayer.TargetY > -1) {
                                // We still need to move the player
                                if (myPlayer.Offset.X == 0 && myPlayer.Offset.Y == 0) {
                                    if (myPlayer.StoryPathfinderResult == null) {
                                        myPlayer.StoryPathfinderResult = Logic.Maps.MapHelper.ActiveMap.Pathfinder.FindPath(myPlayer.X, myPlayer.Y, myPlayer.TargetX, myPlayer.TargetY);
                                    }
                                    PathfinderResult result = myPlayer.StoryPathfinderResult;
                                    if (result.IsPath) {
                                        myPlayer.Direction = result.GetNextItem();
                                        myPlayer.Offset = new Point(0, 0);
                                        myPlayer.MovementSpeed = myPlayer.StoryMovementSpeed;

                                        Network.Messenger.SendPlayerMove();
                                        switch (myPlayer.Direction) {
                                            case Enums.Direction.Up:
                                                myPlayer.Y--;
                                                myPlayer.Offset = new Point(myPlayer.Offset.X, Constants.TILE_HEIGHT);
                                                break;
                                            case Enums.Direction.Down:
                                                myPlayer.Y++;
                                                myPlayer.Offset = new Point(myPlayer.Offset.X, Constants.TILE_HEIGHT * -1);
                                                break;
                                            case Enums.Direction.Left:
                                                myPlayer.X--;
                                                myPlayer.Offset = new Point(Constants.TILE_WIDTH, myPlayer.Offset.Y);
                                                break;
                                            case Enums.Direction.Right:
                                                myPlayer.X++;
                                                myPlayer.Offset = new Point(Constants.TILE_WIDTH * -1, myPlayer.Offset.Y);
                                                break;
                                        }

                                        myPlayer.LastMovement = Globals.Tick;

                                        if (myPlayer.X == myPlayer.TargetX && myPlayer.Y == myPlayer.TargetY) {
                                            myPlayer.TargetX = -2;
                                            myPlayer.TargetY = -2;
                                            myPlayer.StoryPathfinderResult = null;
                                        }
                                    }
                                }
                            } else if (myPlayer.TargetX == -2 && myPlayer.TargetY == -2) {
                                if (myPlayer.Offset.X == 0 && myPlayer.Offset.Y == 0) {
                                    myPlayer.TargetX = -1;
                                    myPlayer.TargetY = -1;
                                    if (Stories.StoryProcessor.ActiveStory.State.StoryPaused) {
                                        Stories.StoryProcessor.ActiveStory.State.Unpause();
                                    }
                                }
                            }
                        }
                    }

                    // Draw the arrows and players
                    if (Stories.Globals.PlayersHidden == false) {
                        foreach (IPlayer player in PlayerManager.Players.GetAllPlayers()) {

                            for (int mapCounter = 0; mapCounter < 9; mapCounter++) {
                                Logic.Maps.Map testMap = Logic.Maps.MapHelper.Maps[(Enums.MapID)mapCounter];

                                if (testMap != null && testMap.Loaded) {

                                    if (player.MapID == testMap.MapID) {
                                        if ((CanBeSeen(player.Location, (Enums.MapID)mapCounter) || player.Leaving) && player.ScreenActive || player == PlayerManager.MyPlayer) {
                                            PlayerRenderer.DrawPlayer(destData, player, testMap, (Enums.MapID)mapCounter);
            #if DEBUG
                                            // TODO: Pet system is a WIP
                                            //for (int n = 1; n < MaxInfo.MAX_ACTIVETEAM; n++) {
                                            //    if (player.Pets[n] != null) {
                                            //        player.Pets[n].Update();
                                            //        GameProcessor.ProcessSpriteMovement(player.Pets[n]);
                                            //        Sprites.SpriteRenderer.DrawSprite(destData, player.Pets[n]);
                                            //    }
                                            //}
            #endif
                                            if (!player.Dead) {
                                                if (player.StatusAilment != Enums.StatusAilment.OK) {
                                                    PlayerRenderer.DrawPlayerStatus(destData, testMap, (Enums.MapID)mapCounter, player, (int)player.StatusAilment);

                                                }
                                                //if (player.Confused) {
                                                //    PlayerRenderer.DrawPlayerStatus(destData, testMap, (Enums.MapID)mapCounter, player, 6);
                                                //}
                                                if (player.VolatileStatus.Count > 0 && player.CurrentEmote == null) {
                                                    PlayerRenderer.DrawPlayerVolatileStatus(destData, testMap, (Enums.MapID)mapCounter, player, player.VolatileStatus);
                                                }
                                            } else {
                                                PlayerRenderer.DrawPlayerStatus(destData, testMap, (Enums.MapID)mapCounter, player, 6);
                                            }

                                            if (player.CurrentEmote != null) {
                                                player.CurrentEmote.EmoteTime++;
                                                if (player.CurrentEmote.EmoteTime > player.CurrentEmote.EmoteSpeed) {
                                                    player.CurrentEmote.EmoteFrame++;
                                                    player.CurrentEmote.EmoteTime = 0;
                                                }

                                                if (player.CurrentEmote.EmoteFrame >= 12) {
                                                    player.CurrentEmote.CurrentCycle++;
                                                    player.CurrentEmote.EmoteFrame = 0;
                                                }
                                                if (player.CurrentEmote.CurrentCycle >= player.CurrentEmote.EmoteCycles) {
                                                    player.CurrentEmote = null;
                                                } else {
                                                    PlayerRenderer.DrawPlayerEmote(destData, testMap, (Enums.MapID)mapCounter, player);
                                                }
                                            }
                                        }
                                    }

                                }
                            }
                        }
                    } else {
                        PlayerRenderer.DrawPlayer(destData, PlayerManager.MyPlayer, renderOptions.Map, Enums.MapID.Active);
                    }
                    //draw confusion
                    //if (Stories.Globals.PlayersHidden == false) {
                    //    for (int i = 0; i < PlayerManager.Players.Count; i++) {
                    //        if (PlayerManager.Players.GetPlayerFromIndex(i).MapID == renderOptions.Map.MapID) {
                    //            if (IsInSight(PlayerManager.Players.GetPlayerFromIndex(i).Location)) {
                    //                PlayerRenderer.DrawPlayer(destSurf, PlayerManager.Players.GetPlayerFromIndex(i), renderOptions.Map);
                    //            }

                    //        }
                    //    }
                    //} else {
                    //    //PlayerRenderer.DrawPlayer(destSurf, PlayerManager.MyPlayer, renderOptions.Map);
                    //
                    //}

                    // Render all active move animations
                    for (int i = Renderers.Moves.MoveRenderer.ActiveAnimations.Count - 1; i >= 0; i--) {
                        Renderers.Moves.IMoveAnimation animation = Renderers.Moves.MoveRenderer.ActiveAnimations[i];
                        if (animation.Active) {
                            Renderers.Moves.MoveRenderer.RenderMoveAnimation(destData, animation, Screen.ScreenRenderer.ToTilePoint(new Point(animation.StartX, animation.StartY)));
                        } else {
                            // Remove the animation if it is finished
                            Renderers.Moves.MoveRenderer.ActiveAnimations.RemoveAt(i);
                        }
                    }

                    #endregion

                    MapRenderer.DrawFringeTilesSeamless(destData, renderOptions.Map, renderOptions.DisplayAnimation, camera.X, camera.X2, camera.Y, camera.Y2);

                    if (renderOptions.DisplayMapGrid) {
                        MapRenderer.DrawMapGrid(destData, renderOptions.Map, camera.X, camera.X2, camera.Y, camera.Y2);
                    }

                    if (renderOptions.DisplayAttributes) {
                        MapRenderer.DrawAttributes(destData, renderOptions.Map, camera.X, camera.X2, camera.Y, camera.Y2);
                    }

                    if (renderOptions.DisplayDungeonValues) {
                        MapRenderer.DrawDungeonValues(destData, renderOptions.Map, camera.X, camera.X2, camera.Y, camera.Y2);
                    }

                    #region Player/Npc Names
                    // Draw the player names
                    if (Stories.Globals.PlayersHidden == false) {
                        if (IO.Options.PlayerName) {
                            foreach (IPlayer player in PlayerManager.Players.GetAllPlayers()) {

                                for (int mapCounter = 0; mapCounter < 9; mapCounter++) {
                                    Logic.Maps.Map testMap = Logic.Maps.MapHelper.Maps[(Enums.MapID)mapCounter];

                                    if (testMap != null && testMap.Loaded) {

                                        if (player.MapID == testMap.MapID && player.ScreenActive || player == PlayerManager.MyPlayer) {
                                            if (CanBeIdentified(player.Location, (Enums.MapID)mapCounter)) {
                                                PlayerRenderer.DrawPlayerGuild(destData, testMap, (Enums.MapID)mapCounter, player);
                                                PlayerRenderer.DrawPlayerName(destData, testMap, (Enums.MapID)mapCounter, player);
                                            }
                                        }

                                    }
                                }
                            }
                        }
                    } else {
                        PlayerRenderer.DrawPlayerName(destData, renderOptions.Map, Enums.MapID.Active, PlayerManager.MyPlayer);
                        PlayerRenderer.DrawPlayerGuild(destData, renderOptions.Map, Enums.MapID.Active, PlayerManager.MyPlayer);
                    }
                    if (Stories.Globals.NpcsHidden == false) {
                        // Draw npc names
                        if (IO.Options.NpcName) {
                            for (int mapCounter = 0; mapCounter < 9; mapCounter++) {
                                Logic.Maps.Map testMap = Logic.Maps.MapHelper.Maps[(Enums.MapID)mapCounter];

                                if (testMap != null && testMap.Loaded) {
                                    for (int i = 0; i < MaxInfo.MAX_MAP_NPCS; i++) {
                                        if (testMap.MapNpcs[i].Num > 0 && testMap.MapNpcs[i].ScreenActive) {
                                            if (CanBeIdentified(testMap.MapNpcs[i].Location, (Enums.MapID)mapCounter)) {
                                                NpcRenderer.DrawMapNpcName(destData, testMap, (Enums.MapID)mapCounter, i);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion

                    #region Player/Npc bars
                    // Draw the NPC HP Bars
                    if (IO.Options.NpcBar) {
                        for (int mapCounter = 0; mapCounter < 9; mapCounter++) {
                            Logic.Maps.Map testMap = Logic.Maps.MapHelper.Maps[(Enums.MapID)mapCounter];

                            if (testMap != null && testMap.Loaded) {
                                for (int i = 0; i < MaxInfo.MAX_MAP_NPCS; i++) {
                                    if (CanBeIdentified(renderOptions.Map.MapNpcs[i].Location, (Enums.MapID)mapCounter)) {
                                        NpcRenderer.DrawNpcBars(destData, renderOptions.Map, (Enums.MapID)mapCounter, i);
                                    }
                                }
                            }
                        }
                    }

                    // Draw the player bar
                    if (IO.Options.PlayerBar) {
                        PlayerRenderer.DrawPlayerBar(destData);
                    }

                    #endregion

                    if (Stories.Globals.PlayersHidden == false) {
                        foreach (IPlayer player in PlayerManager.Players.GetAllPlayers()) {

                            for (int mapCounter = 0; mapCounter < 9; mapCounter++) {
                                Logic.Maps.Map testMap = Logic.Maps.MapHelper.Maps[(Enums.MapID)mapCounter];

                                if (testMap != null && testMap.Loaded) {

                                    if (player.MapID == testMap.MapID) {
                                        if ((CanBeSeen(player.Location, (Enums.MapID)mapCounter) || player.Leaving) && player.ScreenActive || player == PlayerManager.MyPlayer) {
                                            Sprites.SpriteRenderer.DrawSpeechBubble(destData, testMap, (Enums.MapID)mapCounter, player, Globals.Tick);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    //Sprites.SpriteRenderer.ProcessSpeechBubbles(destData, Globals.Tick);

                    #region Movement Processing
                    //if (PlayerManager.MyPlayer.TempMuteTimer < Globals.Tick) {
                    //    PlayerManager.MyPlayer.TempMuteTimer = Globals.Tick + 3000;
                    //    Network.Messenger.SendPacket(PMU.Sockets.TcpPacket.CreatePacket("checkcommands", "/rstart 22 2"));
                    //}
                    // Process player movements (actually move them)
                    foreach (IPlayer player in PlayerManager.Players.GetAllPlayers()) {

                        for (int mapCounter = 0; mapCounter < 9; mapCounter++) {
                            Logic.Maps.Map testMap = Logic.Maps.MapHelper.Maps[(Enums.MapID)mapCounter];

                            if (testMap != null && testMap.Loaded) {

                                if (player.MapID == testMap.MapID) {
                                    if ((CanBeSeen(player.Location, (Enums.MapID)mapCounter) || player.Leaving) && player.ScreenActive || player == PlayerManager.MyPlayer) {
                                        GameProcessor.ProcessSpriteMovement(player);
                                        break;
                                    }
                                }

                            }
                        }
                    }

                    for (int mapCounter = 0; mapCounter < 9; mapCounter++) {
                        Logic.Maps.Map testMap = Logic.Maps.MapHelper.Maps[(Enums.MapID)mapCounter];

                        if (testMap != null && testMap.Loaded) {

                            for (int i = 0; i < MaxInfo.MAX_MAP_NPCS; i++) {
                                if (testMap.MapNpcs[i].Num > 0 && testMap.MapNpcs[i].ScreenActive) {
                                    if (CanBeSeen(testMap.MapNpcs[i].Location, (Enums.MapID)mapCounter) || testMap.MapNpcs[i].Leaving) {
                                        GameProcessor.ProcessSpriteMovement(testMap.MapNpcs[i]);
                                    }
                                }
                            }
                        }
                    }

                    #endregion

                    if (renderOptions.Weather != null && !renderOptions.Weather.Disposed) {
                        renderOptions.Weather.Render(destData, Globals.Tick);
                    }

                    if (renderOptions.Overlay != null && !renderOptions.Overlay.Disposed) {
                        renderOptions.Overlay.Render(destData, Globals.Tick);
                    }

                    if (renderOptions.Darkness != null && !renderOptions.Darkness.Disposed) {
                        /*if (PlayerManager.MyPlayer.MovementSpeed != Enums.MovementSpeed.Standing) {
                            switch (PlayerManager.MyPlayer.Direction) {
                                case Enums.Direction.Up:
                                    spot = new System.Drawing.Point(spot.X, spot.Y + GameProcessor.DetermineSpeed(PlayerManager.MyPlayer.MovementSpeed));
                                    break;
                                case Enums.Direction.Down:
                                    spot = new System.Drawing.Point(spot.X, spot.Y - GameProcessor.DetermineSpeed(PlayerManager.MyPlayer.MovementSpeed));
                                    break;
                                case Enums.Direction.Left:
                                    spot = new System.Drawing.Point(spot.X + GameProcessor.DetermineSpeed(PlayerManager.MyPlayer.MovementSpeed), spot.Y);
                                    break;
                                case Enums.Direction.Right:
                                    spot = new System.Drawing.Point(spot.X - GameProcessor.DetermineSpeed(PlayerManager.MyPlayer.MovementSpeed), spot.Y);
                                    break;
                            }
                        }*/
                        renderOptions.Darkness.Render(destData, Globals.Tick, renderOptions.Darkness.Focus);
                    }

                    if (renderOptions.DisplayLocation && Windows.WindowSwitcher.GameWindow.inMapEditor == false) {
                        TextRenderer.DrawText(destData, "Char Loc: X: " + PlayerManager.MyPlayer.Location.X + " Y: " + PlayerManager.MyPlayer.Location.Y, Color.Yellow, Color.Black, 12, 30);
                        // TODO: Draw Cursor Location
                        TextRenderer.DrawText(destData, "Map: " + PlayerManager.MyPlayer.MapID, Color.Yellow, Color.Black, 12, 48);
                    }

                    if (IO.Options.Ping && Windows.WindowSwitcher.GameWindow.inMapEditor == false) {
                        TextRenderer.DrawText(destData, "Ping: " + renderOptions.RecentPing + "ms", Color.Yellow, Color.Black, 12, 66);
                    }

                    if (IO.Options.FPS && Windows.WindowSwitcher.GameWindow.inMapEditor == false) {
                        TextRenderer.DrawText(destData, "FPS: " + renderOptions.RecentFPS, Color.Yellow, Color.Black, 12, 84);
                    }

                    if (Windows.WindowSwitcher.GameWindow.inMapEditor) {
                        TextRenderer.DrawText(destData, "Char Loc: X: " + PlayerManager.MyPlayer.Location.X + " Y: " + PlayerManager.MyPlayer.Location.Y, Color.Yellow, Color.Black, 12, 12);
                        // TODO: Draw Cursor Location
                        TextRenderer.DrawText(destData, "Map: " + PlayerManager.MyPlayer.MapID, Color.Yellow, Color.Black, 12, 30);
                        TextRenderer.DrawText(destData, "Selected Tile: " + Windows.WindowSwitcher.GameWindow.GetSelectedTileNumber(), Color.Yellow, Color.Black, 12, 58);
                    }

                    if (!Network.NetworkManager.TcpClient.Socket.Connected) {
                        Globals.ServerStatus = "You have been disconnected from the server!";
                    }

                    if (!string.IsNullOrEmpty(Globals.ServerStatus)) {
                        TextRenderer.DrawText(destData, Globals.ServerStatus, Color.Red, Color.Black, 12, 48);
                    }
                    MapRenderer.DrawMapName(destData, renderOptions.Map);

                    if (!Windows.WindowSwitcher.GameWindow.inMapEditor) {
                        //PlayerRenderer.DrawMiniBars(destData);
                    }

                    if (Input.InputProcessor.SelectedMove > -1) {
                        bool canDisplay = false;
                        switch (Input.InputProcessor.SelectedMove) {
                            case 0: {
                                    if (SdlDotNet.Input.Keyboard.IsKeyPressed(SdlDotNet.Input.Key.W)) {
                                        canDisplay = true;
                                    }
                                }
                                break;
                            case 1: {
                                    if (SdlDotNet.Input.Keyboard.IsKeyPressed(SdlDotNet.Input.Key.A)) {
                                        canDisplay = true;
                                    }
                                }
                                break;
                            case 2: {
                                    if (SdlDotNet.Input.Keyboard.IsKeyPressed(SdlDotNet.Input.Key.S)) {
                                        canDisplay = true;
                                    }
                                }
                                break;
                            case 3: {
                                    if (SdlDotNet.Input.Keyboard.IsKeyPressed(SdlDotNet.Input.Key.D)) {
                                        canDisplay = true;
                                    }
                                }
                                break;
                        }
                        if (canDisplay) {
                            RecruitMove move = Logic.Players.PlayerManager.MyPlayer.Moves[Input.InputProcessor.SelectedMove];
                            string displayString = Logic.Moves.MoveHelper.Moves[move.MoveNum].Name + "   " + move.CurrentPP + "/" + move.MaxPP;
                            Color textColor;
                            if (move.CurrentPP == 0 || move.Sealed) {
                                textColor = Color.Red;
                            } else {
                                textColor = Color.WhiteSmoke;
                            }
                            TextRenderer.DrawText(destData, displayString, textColor, Color.Black, new Point(10, 30));
                        }
                    }

                    if (Globals.GettingMap) {
                        TextRenderer.DrawText(destData, "Loading Map...", Color.Blue, Color.Black, 5, 5);
                    }

                    if (Globals.SavingMap) {
                        TextRenderer.DrawText(destData, "Saving Map...", Color.Blue, Color.Black, 5, 5);
                    }

                    if (Stories.StoryProcessor.loadingStory) {
                        TextRenderer.DrawText(destData, "Loading story...", Color.Blue, Color.Black, 5, 5);
                    }

                    if (renderOptions.ScreenVisible == false) {
                        destData.Surface.Fill(Color.Black);
                    }
                }

                if (renderOptions.ScreenOverlay != null) {
                    renderOptions.ScreenOverlay.Render(destData, Globals.Tick);
                }

                if (renderOptions.StoryBackground != null) {
                    destData.Blit(renderOptions.StoryBackground, new Point(0, 0));
                }

                if (renderOptions.ScreenImageOverlays.Count > 0) {
                    for (int i = 0; i < renderOptions.ScreenImageOverlays.Count; i++) {
                        destData.Blit(renderOptions.ScreenImageOverlays[i].Surface, new Point(renderOptions.ScreenImageOverlays[i].X, renderOptions.ScreenImageOverlays[i].Y));
                    }
                }
                //if (e.Tick > mLastAnim + 250) {
                //    mMapAnim = !mMapAnim;
                //    mLastAnim = e.Tick;
                //}

                if (IO.Options.FPS) {
                    renderOptions.RecentRenders++;
                    if (renderOptions.RecentRenders >= 10) {
                        RenderStopwatch.Stop();
                        if (RenderStopwatch.Elapsed.TotalSeconds > 0) {
                            renderOptions.RecentFPS = (int)(1 / (RenderStopwatch.Elapsed.TotalSeconds / 10));
                        }
                        RenderStopwatch.Reset();
                        RenderStopwatch.Start();
                        renderOptions.RecentRenders = 0;
                    }
                }
            } catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Inner Rendering:");
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                System.Diagnostics.Debug.WriteLine(ex.StackTrace);
            }
        }
        public static void DrawSprite(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, ISprite sprite)
        {
            int x, y;

            int spriteNum = sprite.Sprite;

            if (Globals.FoolsMode) {
                if (spriteNum == 420) {
                    spriteNum = 867;
                } else if (spriteNum == 582 || spriteNum == 583 || spriteNum == 584) {
                    spriteNum = 787;
                }
            }

            SpriteSheet spriteSheet = sprite.SpriteSheet;
            if (spriteSheet == null || !(spriteSheet.Num == sprite.Sprite && spriteSheet.Form == GetSpriteFormString(sprite))) {
                spriteSheet = GraphicsManager.GetSpriteSheet(spriteNum, sprite.Form, (int)sprite.Shiny, (int)sprite.Sex);

                sprite.SpriteSheet = spriteSheet;
            }

            Surface spriteToBlit = null;
            if (spriteSheet == null) {
                return;
            }

            Rectangle rec = Rectangle.Empty;
            bool moving = false;

            if (sprite.Attacking == false && sprite.WalkingFrame != -1) {
                int currentOffset = 0;
                switch (sprite.Direction) {
                    case Enums.Direction.Up: {
                            currentOffset = sprite.Offset.Y;
                        }
                        break;
                    case Enums.Direction.Down: {
                            currentOffset = sprite.Offset.Y * -1;
                        }
                        break;
                    case Enums.Direction.Left: {
                            currentOffset = sprite.Offset.X;
                        }
                        break;
                    case Enums.Direction.Right: {
                            currentOffset = sprite.Offset.X * -1;
                        }
                        break;
                }
                int frameCount = spriteSheet.FrameData.GetFrameCount(FrameType.Walk, sprite.Direction);
                while (sprite.MovementSpeed != Enums.MovementSpeed.Standing && Globals.Tick - sprite.LastWalkTime > 512 / GameProcessor.DetermineSpeed(sprite.MovementSpeed)) {
                    sprite.LastWalkTime += (512 / GameProcessor.DetermineSpeed(sprite.MovementSpeed));
                    sprite.WalkingFrame = (sprite.WalkingFrame + 1) % frameCount;
                }
                spriteToBlit = spriteSheet.GetSheet(FrameType.Walk, sprite.Direction);
                rec = spriteSheet.GetFrameBounds(FrameType.Walk, sprite.Direction, sprite.WalkingFrame);
            }

            if (sprite.Attacking && sprite.TotalAttackTime > 0) {
                //if there's more than one attack frame, we have a fluid motion
                if (spriteSheet.FrameData.GetFrameCount(FrameType.Attack, sprite.Direction) > 1 && (sprite.TotalAttackTime - sprite.AttackTimer + Globals.Tick) / sprite.TotalAttackTime < 1) {
                    spriteToBlit = spriteSheet.GetSheet(FrameType.Attack, sprite.Direction);
                    rec = spriteSheet.GetFrameBounds(FrameType.Attack, sprite.Direction,
                        (sprite.TotalAttackTime - sprite.AttackTimer + Globals.Tick) * spriteSheet.FrameData.GetFrameCount(FrameType.Attack, sprite.Direction) / sprite.TotalAttackTime);
                } else if (sprite.AttackTimer - Globals.Tick > sprite.TotalAttackTime / 2) {
                    spriteToBlit = spriteSheet.GetSheet(FrameType.Attack, sprite.Direction);
                    rec = spriteSheet.GetFrameBounds(FrameType.Attack, sprite.Direction, 0);
                }
            }

            // Check to see if we want to stop making him attack
            if (sprite.AttackTimer < Globals.Tick) {
                sprite.Attacking = false;
                sprite.AttackTimer = 0;
            }

            Point dstPoint = new Point();

            x = sprite.Location.X;// * Const.PIC_X + sx + player.XOffset;
            y = sprite.Location.Y;// * Const.PIC_Y + sx + player.YOffset;

            if (y < 0) {
                y = 0;
                //rec.Y = rec.Y + (y * -1);
            }

            Renderers.Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(activeMap, targetMapID, ref x, ref y);

            dstPoint.X = ScreenRenderer.ToTileX(x) + sprite.Offset.X - (spriteSheet.FrameData.FrameWidth / 2 - 16);
            dstPoint.Y = ScreenRenderer.ToTileY(y) + sprite.Offset.Y - (spriteSheet.FrameData.FrameHeight - 32); // - (Constants.TILE_HEIGHT / 2);

            switch (sprite.StatusAilment) {
                case Enums.StatusAilment.Paralyze: {
                        dstPoint.X -= (2 + System.Math.Abs(Globals.Tick % 8 - 4));
                        break;
                    }
                default: {
                        //dstPoint.X = ScreenRenderer.ToTileX(x) + sprite.Offset.X;
                        break;
                    }
            }
            if (sprite.StatusAilment == Enums.StatusAilment.Sleep) {
                if (Globals.Tick > sprite.SleepTimer + 500) {
                    sprite.SleepTimer = Globals.Tick;
                    sprite.SleepFrame = (sprite.SleepFrame + 1) % spriteSheet.FrameData.GetFrameCount(FrameType.Sleep, Enums.Direction.Down);
                }
                spriteToBlit = spriteSheet.GetSheet(FrameType.Sleep, Enums.Direction.Down);
                rec = spriteSheet.GetFrameBounds(FrameType.Sleep, Enums.Direction.Down, sprite.SleepFrame);
            }

            if (!sprite.ScreenActive)
            {
                spriteToBlit = spriteSheet.GetSheet(FrameType.Sleep, Enums.Direction.Down);
                rec = spriteSheet.GetFrameBounds(FrameType.Sleep, Enums.Direction.Down, 0);
            }

            if ((sprite is Logic.Players.GenericPlayer || sprite is Logic.Players.MyPlayer))
            {
                if (((Logic.Players.IPlayer)sprite).Dead)
                {
                    spriteToBlit = spriteSheet.GetSheet(FrameType.Sleep, Enums.Direction.Down);
                    rec = spriteSheet.GetFrameBounds(FrameType.Sleep, Enums.Direction.Down, 0);
                }
            }

            if (rec == Rectangle.Empty && sprite.StatusAilment == Enums.StatusAilment.OK) {
                if (sprite.Offset == Point.Empty && spriteSheet.FrameData.GetFrameCount(FrameType.Idle, sprite.Direction) > 0) {
                    if (sprite.IdleTimer == -1) {
                        sprite.IdleTimer = Globals.Tick + 2000;
                    } else if (Globals.Tick > sprite.IdleTimer + 100) {
                        sprite.IdleTimer = Globals.Tick;

                        sprite.IdleFrame++;
                        if (sprite.IdleFrame >= spriteSheet.FrameData.GetFrameCount(FrameType.Idle, sprite.Direction)) {
                            sprite.IdleFrame = 0;
                        }
                        spriteToBlit = spriteSheet.GetSheet(FrameType.Idle, sprite.Direction);
                        rec = spriteSheet.GetFrameBounds(FrameType.Idle, sprite.Direction, sprite.IdleFrame);

                    }
                } else {
                    sprite.IdleTimer = -1;
                    sprite.IdleFrame = 0;
                }
            } else {
                sprite.IdleTimer = -1;
                sprite.IdleFrame = 0;
            }

            if (sprite.IdleTimer != -1) {
                spriteToBlit = spriteSheet.GetSheet(FrameType.Idle, sprite.Direction);
                rec = spriteSheet.GetFrameBounds(FrameType.Idle, sprite.Direction, sprite.IdleFrame);
            }

            if ((rec == Rectangle.Empty || (moving == true && sprite.Offset == Point.Empty)) && sprite.StatusAilment != Enums.StatusAilment.Sleep && sprite.IdleTimer == -1) {
                spriteToBlit = spriteSheet.GetSheet(FrameType.Walk, sprite.Direction);
                rec = spriteSheet.GetFrameBounds(FrameType.Walk, sprite.Direction, 0);
            }

            //if (sprite.Size == Enums.Size.Normal) {
            if (Globals.FoolsMode) {
                dstPoint.X = ScreenRenderer.ToTileX(x) + sprite.Offset.X;
                dstPoint.Y = ScreenRenderer.ToTileY(y) + sprite.Offset.Y;

                spriteNum = spriteNum % 872;
                rec = new Rectangle((spriteNum - (spriteNum / 6) * 6) * Constants.TILE_WIDTH,
                                               (spriteNum / 6) * Constants.TILE_HEIGHT, Constants.TILE_WIDTH, Constants.TILE_HEIGHT);
                spriteToBlit = Graphics.GraphicsManager.Items;
            }

            destData.Blit(spriteToBlit, dstPoint, rec);

            //spriteToBlit.AlphaBlending = false;
        }
Beispiel #17
0
        public static void DrawMiniMap(RendererDestinationData destData, Map activeMap)
        {
            int tileRatio = 3;
            int mapPadding = 20;

            int mapWidth = tileRatio * activeMap.Tile.GetLength(0);
            int mapHeight = tileRatio * activeMap.Tile.GetLength(1);

            int startX = destData.Location.X + destData.Size.Width - mapWidth - mapPadding;
            int startY = destData.Location.Y + mapPadding;

            Surface miniMapSurface = new Surface(mapWidth, mapHeight);
            miniMapSurface.Alpha = 155;
            miniMapSurface.AlphaBlending = true;

            miniMapSurface.Fill(Color.Gray);

            for (int x = 0; x < activeMap.Tile.GetLength(0); x++)
            {
                for (int y = 0; y < activeMap.Tile.GetLength(1); y++)
                {

                    Tile tile = activeMap.Tile[x, y];

                    if (PlayerManager.MyPlayer.X == x && PlayerManager.MyPlayer.Y == y)
                    {
                        miniMapSurface.Fill(new Rectangle(x * tileRatio, y * tileRatio, tileRatio, tileRatio), Color.LightCyan);
                        continue;
                    }

                    if (tile.SeenBySelf)
                    {

                        switch (tile.Type)
                        {
                            case Enums.TileType.Blocked:
                            case Enums.TileType.MobileBlock:
                                miniMapSurface.Fill(new Rectangle(x * tileRatio, y * tileRatio, tileRatio, tileRatio), Color.Black);
                                break;
                            case Enums.TileType.RDungeonGoal:
                                miniMapSurface.Fill(new Rectangle(x * tileRatio, y * tileRatio, tileRatio, tileRatio), Color.Cyan);
                                break;
                            default:
                                break;
                        }

                    }

                }
            }

            foreach (MapItem item in activeMap.MapItems)
            {
                if (item.Num != -1 && activeMap.Tile[item.X, item.Y].SeenBySelf)
                {
                    miniMapSurface.Fill(new Rectangle(item.X * tileRatio, item.Y * tileRatio, tileRatio, tileRatio), Color.Yellow);
                }
            }

            foreach (MapNpc npc in activeMap.MapNpcs)
            {
                if (npc.X >= 0 && npc.X < activeMap.Tile.GetLength(0) && npc.Y >= 0 && npc.Y < activeMap.Tile.GetLength(1))
                {
                    if (npc.Sprite != 0 && (npc.ScreenActive) && activeMap.Tile[npc.X, npc.Y].SeenBySelf)
                    {
                        miniMapSurface.Fill(new Rectangle(npc.X * tileRatio, npc.Y * tileRatio, tileRatio, tileRatio), Color.Red);
                    }
                }
            }

            destData.Blit(miniMapSurface, new Point(startX, startY));
        }