Ejemplo n.º 1
0
 public static void DrawNpc(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, int npcSlot)
 {
     MapNpc npc = activeMap.MapNpcs[npcSlot];
     if (npc != null && npc.Num > 0 && npc.ScreenActive) {
         SpriteRenderer.DrawSprite(destData, activeMap, targetMapID, npc);
     }
 }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public static void DrawPlayer(RendererDestinationData destData, IPlayer player, Map activeMap, Enums.MapID targetMapID)
        {
            if (!player.Hunted && !player.Dead && activeMap.Moral == Enums.MapMoral.None) {// && Ranks.IsDisallowed(player, Enums.Rank.Moniter)
                int flashIndex = Globals.Tick / 100 % 2;
                if (flashIndex == 0) {
                    SpriteRenderer.DrawSprite(destData, activeMap, targetMapID, player);
                }
            } else {

                SpriteRenderer.DrawSprite(destData, activeMap, targetMapID, player);
            }
        }
Ejemplo n.º 4
0
        public static bool IsBlocked(Maps.Map map, int x, int y)
        {
            switch (map.Tile[x, y].Type)
            {
            case Enums.TileType.Blocked:
            case Enums.TileType.Sign:
            case Enums.TileType.ScriptedSign:
            case Enums.TileType.LevelBlock:
            case Enums.TileType.SpriteBlock:
            case Enums.TileType.MobileBlock:
                return(true);

            default:
                return(false);
            }
        }
Ejemplo n.º 5
0
        public static void DrawMapNpcName(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, int npcSlot)
        {
            Color nameColor = Color.White;
            if (activeMap.MapNpcs[npcSlot].Enemy) {
                nameColor = Color.Red;
            }
            Npc.Npc npc = Npc.NpcHelper.Npcs[activeMap.MapNpcs[npcSlot].Num];

            string name = npc.Name;

            //if (Globals.FoolsMode) {
            //    name = "EBIL Zubat";
            //}

            SpriteRenderer.DrawSpriteName(destData, activeMap, targetMapID, activeMap.MapNpcs[npcSlot], nameColor, name);
        }
Ejemplo n.º 6
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;
         }
     }
 }
Ejemplo n.º 7
0
 public static void ConvertCoordinatesToBorderless(Map activeMap, Enums.MapID targetMapID, ref int x, ref int y)
 {
     switch (targetMapID) {
         case Enums.MapID.Right: {
                 x += activeMap.MaxX + 1;
             }
             break;
         case Enums.MapID.Left: {
                 x -= MapHelper.Maps[targetMapID].MaxX + 1;
             }
             break;
         case Enums.MapID.Down: {
                 y += activeMap.MaxY + 1;
             }
             break;
         case Enums.MapID.Up: {
                 y -= MapHelper.Maps[targetMapID].MaxY + 1;
             }
             break;
         case Enums.MapID.TopLeft: {
                 y -= MapHelper.Maps[targetMapID].MaxY + 1;
                 x -= MapHelper.Maps[targetMapID].MaxX + 1;
             }
             break;
         case Enums.MapID.TopRight: {
                 y -= MapHelper.Maps[targetMapID].MaxY + 1;
                 x += activeMap.MaxX + 1;
             }
             break;
         case Enums.MapID.BottomLeft: {
                 y += activeMap.MaxY + 1;
                 x -= MapHelper.Maps[targetMapID].MaxX + 1;
             }
             break;
         case Enums.MapID.BottomRight: {
                 y += activeMap.MaxY + 1;
                 x += activeMap.MaxX + 1;
             }
             break;
     }
 }
Ejemplo n.º 8
0
        public static void DrawNpcBars(RendererDestinationData destData, Map map, Enums.MapID targetMapID, int npcSlot)
        {
            MapNpc npc = map.MapNpcs[npcSlot];
            int x, y;

            if (npc != null && npc.HP > 0 && npc.Num > 0 && npc.ScreenActive) {
                if (npc.HP != npc.MaxHP) {
                    //if (Npc.NpcHelper.Npcs[npc.Num].Big) {
                    //    x = (npc.Location.X * Constants.TILE_WIDTH - 9 + npc.Offset.X) - (Globals.NewMapX * Constants.TILE_WIDTH) - Globals.NewMapXOffset;
                    //    y = (npc.Location.Y * Constants.TILE_HEIGHT + npc.Offset.Y) - (Globals.NewMapY * Constants.TILE_HEIGHT) - Globals.NewMapYOffset;

                    //    Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + 50, destData.Location.Y + y + 36));
                    //    destData.Draw(hpBox, Color.Black, false, true);
                    //    if (npc.MaxHP < 1) {
                    //        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + ((npc.HP / 100) / ((npc.MaxHP + 1) / 100) * 50), destData.Location.Y + y + 36));
                    //    } else {
                    //        double
                    //        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + ((npc.HP / 100) / (double)((double)npc.MaxHP / 100) * 50)), destData.Location.Y + y + 36));
                    //    }
                    //    destData.Draw(hpBox, Color.LightGreen, false, true);
                    //} else {
                    int npcX = npc.Location.X;
                    int npcY = npc.Location.Y;
                    Renderers.Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(map, targetMapID, ref npcX, ref npcY);

                    x = ScreenRenderer.ToTileX(npcX) + npc.Offset.X;//(npc.X * Constants.TILE_WIDTH + sx + npc.XOffset) - (Globals.NewMapX * Constants.TILE_WIDTH) - Globals.NewMapXOffset;
                    y = ScreenRenderer.ToTileY(npcY) + npc.Offset.Y;//(npc.Y * Constants.TILE_HEIGHT + sx + npc.YOffset) - (Globals.NewMapY * Constants.TILE_HEIGHT) - Globals.NewMapYOffset;

                    Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + 32, destData.Location.Y + y + 36));
                    destData.Draw(hpBox, Color.Black, false, true);
                    if (npc.MaxHP < 1) {
                        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + 32, destData.Location.Y + y + 36));
                    } else {
                        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x + 1, destData.Location.Y + y + 33), new Point(Convert.ToInt32(destData.Location.X + x + (Logic.MathFunctions.CalculatePercent(npc.HP, npc.MaxHP) * 0.01) * 31), destData.Location.Y + y + 35));
                    }
                    destData.Draw(hpBox, Color.LightGreen, false, true);
                    //}
                }
            }
        }
Ejemplo n.º 9
0
        public Map this[Enums.MapID id]
        {
            get { return GetMapFromID(id); }
            set {
                switch (id) {
                    case Enums.MapID.Active:
                        activeMap = value;
                        break;
                    case Enums.MapID.Down:
                        mapDown = value;
                        break;
                    case Enums.MapID.Left:
                        mapLeft = value;
                        break;
                    case Enums.MapID.Right:
                        mapRight = value;
                        break;
                    case Enums.MapID.Up:
                        mapUp = value;
                        break;

                    case Enums.MapID.TopLeft:
                        mapTopLeft = value;
                        break;
                    case Enums.MapID.BottomLeft:
                        mapBottomLeft = value;
                        break;
                    case Enums.MapID.TopRight:
                        mapTopRight = value;
                        break;
                    case Enums.MapID.BottomRight:
                        mapBottomRight = value;
                        break;

                    case Enums.MapID.TempActive:
                        tempActiveMap = value;
                        break;
                    case Enums.MapID.TempUp:
                        tempUpMap = value;
                        break;
                    case Enums.MapID.TempDown:
                        tempDownMap = value;
                        break;
                    case Enums.MapID.TempLeft:
                        tempLeftMap = value;
                        break;
                    case Enums.MapID.TempRight:
                        tempRightMap = value;
                        break;

                    case Enums.MapID.TempTopLeft:
                        tempTopLeft = value;
                        break;
                    case Enums.MapID.TempBottomLeft:
                        tempBottomLeft = value;
                        break;
                    case Enums.MapID.TempTopRight:
                        tempTopRight = value;
                        break;
                    case Enums.MapID.TempBottomRight:
                        tempBottomRight = value;
                        break;
                }
            }
        }
Ejemplo n.º 10
0
        public static void DrawMapGrid(RendererDestinationData destData, Map activeMap, int cameraX, int cameraX2, int cameraY, int cameraY2)
        {
            int startX = cameraX;
            int startY = cameraY;
            if (ScreenRenderer.MapXOffset < 0) {
                startX--;
            }
            if (ScreenRenderer.MapYOffset < 0) {
                startY--;
            } else if (ScreenRenderer.MapYOffset > 0) {
                startY--;
            }
            //if (locYSub) {
            //    cameraY--;
            //    cameraY2++;
            //}
            for (int x = startX; x < cameraX2; x++) {
                for (int y = startY; y < cameraY2; y++) {
                    if (x >= 0 && x <= activeMap.MaxX && y >= 0 && y <= activeMap.MaxY) {
                        DrawTile(destData, 10, 0, x - cameraX, y - cameraY, false);

                        if (x == 0) {
                            SdlDotNet.Graphics.Primitives.Line line = new SdlDotNet.Graphics.Primitives.Line((short)(((x - cameraX) * Constants.TILE_WIDTH) - ScreenRenderer.MapXOffset), (short)(((y - cameraY) * Constants.TILE_HEIGHT) - ScreenRenderer.MapYOffset), (short)(((x - cameraX) * Constants.TILE_WIDTH) - ScreenRenderer.MapXOffset), (short)((((y - cameraY) * Constants.TILE_HEIGHT) + Constants.TILE_HEIGHT) - ScreenRenderer.MapYOffset));
                            destData.Surface.Draw(line, Color.Red);
                        } else if (x == activeMap.MaxX) {
                            SdlDotNet.Graphics.Primitives.Line line = new SdlDotNet.Graphics.Primitives.Line((short)((((x - cameraX) * Constants.TILE_WIDTH) + Constants.TILE_WIDTH) - ScreenRenderer.MapXOffset), (short)(((y - cameraY) * Constants.TILE_HEIGHT) - ScreenRenderer.MapYOffset), (short)((((x - cameraX) * Constants.TILE_WIDTH) + Constants.TILE_WIDTH) - ScreenRenderer.MapXOffset), (short)((((y - cameraY) * Constants.TILE_HEIGHT) + Constants.TILE_HEIGHT) - ScreenRenderer.MapYOffset));
                            destData.Surface.Draw(line, Color.Red);
                        }

                        if (y == 0) {
                            SdlDotNet.Graphics.Primitives.Line line = new SdlDotNet.Graphics.Primitives.Line((short)(((x - cameraX) * Constants.TILE_WIDTH) - ScreenRenderer.MapXOffset), (short)(((y - cameraY) * Constants.TILE_HEIGHT) - ScreenRenderer.MapYOffset), (short)((((x - cameraX) * Constants.TILE_WIDTH) + Constants.TILE_WIDTH) - ScreenRenderer.MapXOffset), (short)(((y - cameraY) * Constants.TILE_HEIGHT) - ScreenRenderer.MapYOffset));
                            destData.Surface.Draw(line, Color.Red);
                        } else if (y == activeMap.MaxY) {
                            SdlDotNet.Graphics.Primitives.Line line = new SdlDotNet.Graphics.Primitives.Line((short)(((x - cameraX) * Constants.TILE_WIDTH) - ScreenRenderer.MapXOffset), (short)((((y - cameraY) * Constants.TILE_HEIGHT) + Constants.TILE_HEIGHT) - ScreenRenderer.MapYOffset), (short)((((x - cameraX) * Constants.TILE_WIDTH) + Constants.TILE_WIDTH) - ScreenRenderer.MapXOffset), (short)((((y - cameraY) * Constants.TILE_HEIGHT) + Constants.TILE_HEIGHT) - ScreenRenderer.MapYOffset));
                            destData.Surface.Draw(line, Color.Red);
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        public static void DrawSpriteName(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, ISprite sprite, Color color, string name)
        {
            int textX;
            int textY;

            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);
            //} else {
            //    textX = ScreenRenderer.ToTileX(sprite.Location.X) + sprite.Offset.X + (Constants.TILE_WIDTH / 2) - ((name.Length / 2) * 8);
            //    textY = ScreenRenderer.ToTileY(sprite.Location.Y) + sprite.Offset.Y - (Constants.TILE_HEIGHT / 2) - 48;
            //    TextRenderer.DrawText(destData, name, color, Color.Black, textX, textY);
            //}
        }
Ejemplo n.º 13
0
        public static void DrawPlayerName(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, IPlayer player)
        {
            Color playerColor = Color.DarkRed;

            //if (player.PK) {
            //    playerColor = Color.DarkRed;
            //} else {
                playerColor = Ranks.GetRankColor(player.Access);
            //}

            string name = player.Name;
            if (!string.IsNullOrEmpty(player.Status)) {

                string status = player.Status;

                if (Globals.FoolsMode) {
                    status = "Itemized";
                }

                name += " [" + status + "]";
            }
            SpriteRenderer.DrawSpriteName(destData, activeMap, targetMapID, player, playerColor, name);
        }
Ejemplo n.º 14
0
        public static void DrawTiles(RendererDestinationData destData, Map activeMap, bool mapAnim, int cameraX, int cameraX2, int cameraY, int cameraY2, bool displayAttributes, bool displayMapGrid)
        {
            int locX = 0;
            int locY = 0;
            for (int x = cameraX; x < cameraX2; x++) {
                for (int y = cameraY; y < cameraY2; y++) {
                    // Draw ground
                    if (!mapAnim || (activeMap.Tile[x, y].GroundAnim == 0 && mapAnim)) {
                        if (activeMap.Tile[x, y].Ground == 0) {
                            // Do Nothing
                        } else {
                            DrawTile(destData, activeMap.Tile[x, y].GroundSet, activeMap.Tile[x, y].Ground, locX, locY, false);
                        }
                    }

                    //Draw ground anim
                    if (mapAnim) {
                        if (activeMap.Tile[x, y].GroundAnim == 0) {
                            // Do Nothing
                        } else {
                            DrawTile(destData, activeMap.Tile[x, y].GroundAnimSet, activeMap.Tile[x, y].GroundAnim, locX, locY, false);

                        }
                    }

                    // Draw Mask
                    if (!mapAnim || (activeMap.Tile[x, y].Anim == 0 && mapAnim)) {
                        if (activeMap.Tile[x, y].Mask == 0) {
                            // Do Nothing
                        } else {
                            DrawTile(destData, activeMap.Tile[x, y].MaskSet, activeMap.Tile[x, y].Mask, locX, locY, false);
                        }
                    }

                    // Draw Mask Anim
                    if (mapAnim) {
                        if (activeMap.Tile[x, y].Anim == 0) {
                            // Do Nothing
                        } else {
                            DrawTile(destData, activeMap.Tile[x, y].AnimSet, activeMap.Tile[x, y].Anim, locX, locY, false);

                        }
                    }

                    // Draw Mask 2
                    if (!mapAnim || (activeMap.Tile[x, y].M2Anim == 0 && mapAnim)) {
                        if (activeMap.Tile[x, y].Mask2 == 0) {
                            // Do Nothing
                        } else {
                            DrawTile(destData, activeMap.Tile[x, y].Mask2Set, activeMap.Tile[x, y].Mask2, locX, locY, false);
                        }
                    }

                    // Draw Mask 2 Anim
                    if (mapAnim) {
                        if (activeMap.Tile[x, y].M2Anim == 0) {
                            // Do Nothing
                        } else {
                            DrawTile(destData, activeMap.Tile[x, y].M2AnimSet, activeMap.Tile[x, y].M2Anim, locX, locY, false);
                        }
                    }

                    // Draw Fringe
                    if (!mapAnim || (activeMap.Tile[x, y].FAnim == 0 && mapAnim)) {
                        if (activeMap.Tile[x, y].Fringe == 0) {
                            // Do Nothing
                        } else {
                            DrawTile(destData, activeMap.Tile[x, y].FringeSet, activeMap.Tile[x, y].Fringe, locX, locY, false);
                        }
                    }

                    // Draw Fringe Anim
                    if (mapAnim) {
                        if (activeMap.Tile[x, y].FAnim == 0) {
                            // Do Nothing
                        } else {
                            DrawTile(destData, activeMap.Tile[x, y].FAnimSet, activeMap.Tile[x, y].FAnim, locX, locY, false);
                        }
                    }

                    // Draw Fringe 2
                    if (!mapAnim || (activeMap.Tile[x, y].F2Anim == 0 && mapAnim)) {
                        if (activeMap.Tile[x, y].Fringe2 == 0) {
                            // Do Nothing
                        } else {
                            DrawTile(destData, activeMap.Tile[x, y].Fringe2Set, activeMap.Tile[x, y].Fringe2, locX, locY, false);
                        }
                    }

                    // Draw Fringe 2 Anim
                    if (mapAnim) {
                        if (activeMap.Tile[x, y].F2Anim == 0) {
                            // Do Nothing
                        } else {
                            DrawTile(destData, activeMap.Tile[x, y].F2AnimSet, activeMap.Tile[x, y].F2Anim, locX, locY, false);
                        }
                    }

                    if (displayAttributes) {
                        // Draw Attributes
                        switch (activeMap.Tile[x, y].Type) {
                            case Enums.TileType.Blocked:
                                TextRenderer.DrawText(destData, "B", Color.Red, locX * Constants.TILE_WIDTH + 8, locY * Constants.TILE_HEIGHT + 8);
                                break;
                            case Enums.TileType.NPCAvoid:
                                TextRenderer.DrawText(destData, "N", Color.Black, locX * Constants.TILE_WIDTH + 8, locY * Constants.TILE_HEIGHT + 8);
                                break;
                            case Enums.TileType.Heal:
                                TextRenderer.DrawText(destData, "H", Color.LightGreen, locX * Constants.TILE_WIDTH + 8, locY * Constants.TILE_HEIGHT + 8);
                                break;
                            case Enums.TileType.Kill:
                                TextRenderer.DrawText(destData, "K", Color.Red, locX * Constants.TILE_WIDTH + 8, locY * Constants.TILE_HEIGHT + 8);
                                break;
                            case Enums.TileType.Sign:
                                TextRenderer.DrawText(destData, "SI", Color.Yellow, locX * Constants.TILE_WIDTH + 8, locY * Constants.TILE_HEIGHT + 8);
                                break;
                            case Enums.TileType.Notice:
                                TextRenderer.DrawText(destData, "N", Color.LightGreen, locX * Constants.TILE_WIDTH + 8, locY * Constants.TILE_HEIGHT + 8);
                                break;
                            case Enums.TileType.Guild:
                                TextRenderer.DrawText(destData, "G", Color.Green, locX * Constants.TILE_WIDTH + 8, locY * Constants.TILE_HEIGHT + 8);
                                break;
                            case Enums.TileType.LevelBlock:
                                TextRenderer.DrawText(destData, "LB", Color.Red, locX * Constants.TILE_WIDTH + 8, locY * Constants.TILE_HEIGHT + 8);
                                break;
                            case Enums.TileType.Ambiguous:
                                TextRenderer.DrawText(destData, "?", Color.Green, locX * Constants.TILE_WIDTH + 8, locY * Constants.TILE_HEIGHT + 8);
                                break;
                            case Enums.TileType.Slippery:
                                TextRenderer.DrawText(destData, "S", Color.Cyan, locX * Constants.TILE_WIDTH + 8, locY * Constants.TILE_HEIGHT + 8);
                                break;
                            case Enums.TileType.Slow:
                                TextRenderer.DrawText(destData, "SLO", Color.Green, locX * Constants.TILE_WIDTH + 8, locY * Constants.TILE_HEIGHT + 8);
                                break;
                        }
                    }

                    if (displayMapGrid) {
                        DrawTile(destData, 10, 0, locX, locY, false);
                    }
                    locY++;
                }
                locY = 0;
                locX++;
            }
        }
Ejemplo n.º 15
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));

                }
            }
        }
Ejemplo n.º 16
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));

                    }
                }
            }
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 18
0
        public static void DrawMapName(RendererDestinationData destData, Map map)
        {
            Size textSize = TextRenderer.SizeText(map.Name);
            int textPosX = DrawingSupport.GetCenterX(destData.Size.Width, textSize.Width);
            //int mapNameLoc = Convert.ToInt32((20.5) * Constants.TILE_WIDTH / 2) - ((Convert.ToInt32(map.Name.Length) / 2) * 8);

            switch (map.Moral) {
                case Enums.MapMoral.None: {
                        TextRenderer.DrawText(destData, map.Name, Color.Black, Color.Black, new Point(textPosX, 25));
                    }
                    break;
                case Enums.MapMoral.House: {
                        TextRenderer.DrawText(destData, map.Name, Color.Yellow, Color.Black, new Point(textPosX, 25));
                    }
                    break;
                case Enums.MapMoral.Safe: {
                        TextRenderer.DrawText(destData, map.Name, Color.White, Color.Black, new Point(textPosX, 25));
                    }
                    break;
                case Enums.MapMoral.NoPenalty: {
                        TextRenderer.DrawText(destData, map.Name, Color.Red, Color.Black, new Point(textPosX, 25));
                    }
                    break;
            }
        }
Ejemplo n.º 19
0
 public static void DrawNpcStatus(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, int npcSlot, int statusNum)
 {
     MapNpc npc = activeMap.MapNpcs[npcSlot];
     switch (statusNum) {//Enums not used to account for confusion status
         case 1: {//Burn
                 SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, npc, 0, new Point(0, -32));
             }
             break;
         case 2: {//Freeze
                 SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, npc, 1, new Point(0, 0));
             }
             break;
         case 3: {//paralyze
                 //Nothing here
             }
             break;
         case 4: {//poison
                 SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, npc, 2, new Point(0, -32));
             }
             break;
         case 5: {//sleep
                 SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, npc, 3, new Point(0, -32));
             }
             break;
         case 6: {//confuse
                 SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, npc, 4, new Point(0, -24));
             }
             break;
     }
 }
Ejemplo n.º 20
0
        public static void DrawNpcVolatileStatus(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, int npcSlot, List<int> extraStatus)
        {
            MapNpc npc = activeMap.MapNpcs[npcSlot];
            List<int> visibleStatus = new List<int>();
            foreach (int i in extraStatus) {
                if (i >= 0) {
                    visibleStatus.Add(i);
                }
            }
            if (visibleStatus.Count == 0) return;
            int statusIndex = Globals.Tick / 600 % visibleStatus.Count;

            SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, npc, visibleStatus[statusIndex], new Point(24, -32));
        }
Ejemplo n.º 21
0
 public static void DrawPlayerStatus(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, IPlayer player, int statusNum)
 {
     switch (statusNum) {//Enums not used to account for confusion status
         case 1: {//Burn
                 SpriteRenderer.DrawStatus(destData,activeMap, targetMapID, player, 0, new Point(0, -32));
             }
             break;
         case 2: {//Freeze
             SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, player, 1, new Point(0, 0));
             }
             break;
         case 3: {//paralyze
                 //Nothing here
             }
             break;
         case 4: {//poison
             SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, player, 2, new Point(0, -32));
             }
             break;
         case 5: {//sleep
             SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, player, 3, new Point(0, -32));
             }
             break;
         //case 6: {//confuse
         //    SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, player, 4, new Point(0, -24));
         //    }
         //    break;
         case 6: {//KO
                 SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, player, 9, new Point(16, -24));
             }
             break;
     }
 }
Ejemplo n.º 22
0
        public static void DrawGroundTiles(RendererDestinationData destData, Map activeMap, bool mapAnim, int cameraX, int cameraX2, int cameraY, int cameraY2)
        {
            bool locYSub = (cameraY > 0 /*&& cameraY2 < activeMap.MaxY + 1*/ && ScreenRenderer.MapYOffset != 0);
            if (cameraX > 0 /*&& cameraX2 != activeMap.MaxX + 1*/ && ScreenRenderer.MapXOffset != 0) {
                cameraX--;
                cameraX2++;
            }
            if (locYSub) {
                cameraY--;
                cameraY2++;
            }
            if (cameraX2 > activeMap.Tile.GetUpperBound(0) + 1) {
                cameraX2 = activeMap.Tile.GetUpperBound(0) + 1;
            }
            if (cameraY2 > activeMap.Tile.GetUpperBound(1) + 1) {
                cameraY2 = activeMap.Tile.GetUpperBound(1) + 1;
            }
            for (int x = cameraX; x < cameraX2; x++) {
                for (int y = cameraY; y < cameraY2; y++) {
                    if (PlayerManager.MyPlayer.CurrentRoom != null && PlayerManager.MyPlayer.CurrentRoom.IsInRoom(x, y)) {

                        // Draw ground
                        if (!mapAnim || (activeMap.Tile[x, y].GroundAnim == 0 && mapAnim)) {
                            if (activeMap.Tile[x, y].Ground == 0) {
                                // Do Nothing
                            } else {
                                DrawTile(destData, activeMap.Tile[x, y].GroundSet, activeMap.Tile[x, y].Ground, x, y);
                            }
                        }

                        //Draw ground anim
                        if (mapAnim) {
                            if (activeMap.Tile[x, y].GroundAnim == 0) {
                                // Do Nothing
                            } else {
                                DrawTile(destData, activeMap.Tile[x, y].GroundAnimSet, activeMap.Tile[x, y].GroundAnim, x, y);

                            }
                        }

                        // Draw Mask
                        if (!mapAnim || (activeMap.Tile[x, y].Anim == 0 && mapAnim)) {
                            if (activeMap.Tile[x, y].Mask == 0 || (activeMap.Tile[x, y].Anim != 0 && mapAnim) || activeMap.Tile[x, y].DoorOpen) {
                                // Do Nothing
                            } else {
                                DrawTile(destData, activeMap.Tile[x, y].MaskSet, activeMap.Tile[x, y].Mask, x, y);
                            }
                        }

                        // Draw Mask Anim
                        if (mapAnim) {
                            if (activeMap.Tile[x, y].Anim == 0) {
                                // Do Nothing
                            } else {
                                DrawTile(destData, activeMap.Tile[x, y].AnimSet, activeMap.Tile[x, y].Anim, x, y);
                            }
                        }

                        // Draw Mask 2
                        if (!mapAnim || (activeMap.Tile[x, y].M2Anim == 0 && mapAnim)) {
                            if (activeMap.Tile[x, y].Mask2 == 0 || (activeMap.Tile[x, y].M2Anim != 0 && mapAnim)) {
                                // Do Nothing
                            } else {
                                DrawTile(destData, activeMap.Tile[x, y].Mask2Set, activeMap.Tile[x, y].Mask2, x, y);
                            }
                        }

                        // Draw Mask 2 Anim
                        if (mapAnim) {
                            if (activeMap.Tile[x, y].M2Anim == 0) {
                                // Do Nothing
                            } else {
                                DrawTile(destData, activeMap.Tile[x, y].M2AnimSet, activeMap.Tile[x, y].M2Anim, x, y);
                            }
                        }

                        DrawMissionGoalTile(destData, activeMap);
                        DrawSpriteChangeTile(destData, activeMap, x, y);
                    }
                }
            }
        }
Ejemplo n.º 23
0
        public static void DrawPlayerVolatileStatus(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, IPlayer player, List<int> extraStatus)
        {
            List<int> visibleStatus = new List<int>();
            foreach (int i in extraStatus) {
                if (i >= 0) {
                    visibleStatus.Add(i);
                }
            }
            if (visibleStatus.Count == 0) return;
            int statusIndex = Globals.Tick / 600 % visibleStatus.Count;

            SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, player, visibleStatus[statusIndex], new Point(16, -32));
        }
Ejemplo n.º 24
0
 public static void DrawAttributes(RendererDestinationData destData, Map activeMap, int cameraX, int cameraX2, int cameraY, int cameraY2)
 {
     //int (x - cameraX)  = 0;
     //int (y - cameraY)  = 0;
     //bool locYSub = (cameraY > 0 /*&& cameraY2 != activeMap.MaxY + 1*/ && ScreenRenderer.MapYOffset != 0);
     //if (cameraX > 0 /*&& cameraX2 != activeMap.MaxX + 1*/ && ScreenRenderer.MapXOffset != 0) {
     //    (x - cameraX)  = -1;
     //    cameraX--;
     //    cameraX2++;
     //}
     //if (locYSub) {
     //    (y - cameraY)  = -1;
     //    cameraY--;
     //    cameraY2++;
     //}
     //if (cameraX2 > activeMap.Tile.GetUpperBound(0) + 1) {
     //    cameraX2 = activeMap.Tile.GetUpperBound(0) + 1;
     //}
     //if (cameraY2 > activeMap.Tile.GetUpperBound(1) + 1) {
     //    cameraY2 = activeMap.Tile.GetUpperBound(1) + 1;
     //}
     //for (int x = cameraX; x < cameraX2; x++) {
     //    for (int y = cameraY; y < cameraY2; y++) {
     int startX = cameraX;
     int startY = cameraY;
     if (ScreenRenderer.MapXOffset < 0) {
         startX--;
     }
     if (ScreenRenderer.MapYOffset < 0) {
         startY--;
     } else if (ScreenRenderer.MapYOffset > 0) {
         startY--;
     }
     //if (locYSub) {
     //    cameraY--;
     //    cameraY2++;
     //}
     for (int x = startX; x < cameraX2; x++) {
         for (int y = startY; y < cameraY2; y++) {
             // Draw Attributes
             switch (SeamlessWorldHelper.GetVisibleTile(x, y).Type) {
                 case Enums.TileType.Blocked:
                     TextRenderer.DrawText(destData, "B", Color.Red, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.NPCAvoid:
                     TextRenderer.DrawText(destData, "N", Color.Black, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Heal:
                     TextRenderer.DrawText(destData, "H", Color.LightGreen, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Kill:
                     TextRenderer.DrawText(destData, "K", Color.Red, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Sign:
                     TextRenderer.DrawText(destData, "SI", Color.Yellow, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Notice:
                     TextRenderer.DrawText(destData, "N", Color.LightGreen, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Guild:
                     TextRenderer.DrawText(destData, "G", Color.Green, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.LevelBlock:
                     TextRenderer.DrawText(destData, "LB", Color.Red, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Warp:
                     TextRenderer.DrawText(destData, "W", Color.LightBlue, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Item:
                     TextRenderer.DrawText(destData, "I", Color.Black, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Key:
                     TextRenderer.DrawText(destData, "K", Color.Black, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.KeyOpen:
                     TextRenderer.DrawText(destData, "O", Color.Black, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Shop:
                     TextRenderer.DrawText(destData, "SH", Color.Yellow, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Arena:
                     TextRenderer.DrawText(destData, "A", Color.LightGreen, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Sound:
                     TextRenderer.DrawText(destData, "PS", Color.Yellow, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.SpriteChange:
                     TextRenderer.DrawText(destData, "SC", Color.Gray, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.ScriptedSign:
                     TextRenderer.DrawText(destData, "SS", Color.Yellow, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Door:
                     TextRenderer.DrawText(destData, "D", Color.Black, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Chest:
                     TextRenderer.DrawText(destData, "C", Color.Brown, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.LinkShop:
                     TextRenderer.DrawText(destData, "L", Color.Black, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Scripted:
                     TextRenderer.DrawText(destData, "SC", Color.Yellow, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.House:
                     TextRenderer.DrawText(destData, "PH", Color.Yellow, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Bank:
                     TextRenderer.DrawText(destData, "BANK", Color.LightPink, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.SpriteBlock:
                     TextRenderer.DrawText(destData, "SB", Color.Black, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.MobileBlock:
                     TextRenderer.DrawText(destData, "MB", Color.Gray, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Assembly:
                     TextRenderer.DrawText(destData, "ASSMBLY", Color.Black, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Evolution:
                     TextRenderer.DrawText(destData, "EVO", Color.Yellow, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Story:
                     TextRenderer.DrawText(destData, "STRY", Color.Yellow, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.MissionBoard:
                     TextRenderer.DrawText(destData, "MSN", Color.Purple, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Ambiguous:
                     TextRenderer.DrawText(destData, "?", Color.Green, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Slippery:
                     TextRenderer.DrawText(destData, "S", Color.Cyan, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.Slow:
                     TextRenderer.DrawText(destData, "SLO", Color.Green, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
                 case Enums.TileType.DropShop:
                     TextRenderer.DrawText(destData, "DS", Color.Black, ((x - cameraX) * Constants.TILE_WIDTH + 8) - ScreenRenderer.MapXOffset, ((y - cameraY) * Constants.TILE_HEIGHT + 8) - ScreenRenderer.MapYOffset);
                     break;
             }
         }
     }
 }
Ejemplo n.º 25
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;
        }
Ejemplo n.º 26
0
 public static void DrawStatus(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, ISprite sprite, int emoteIndex, Point offset)
 {
     DrawStatus(destData, activeMap, targetMapID, sprite, emoteIndex, Globals.Tick / 50 % 12, offset);
 }
Ejemplo n.º 27
0
        public static bool CanMove(Enums.Direction dirToTest)
        {
            Maps.Map         map    = Maps.MapHelper.ActiveMap;
            Players.MyPlayer player = Players.PlayerManager.MyPlayer;

            Enums.Direction dir = player.Direction;
            int             x, y;

            //Make sure they aren't asleep, or frozen
            if (player.StatusAilment == Enums.StatusAilment.Freeze || player.StatusAilment == Enums.StatusAilment.Sleep)
            {
                return(false);
            }

            // Make sure they aren't trying to move when they are already moving
            if (player.MovementSpeed != Enums.MovementSpeed.Standing || Globals.GettingMap)
            {
                return(false);
            }



            player.Direction = dirToTest;

            //make sure they aren't exceeding speed limit
            if (player.SpeedLimit == Enums.MovementSpeed.Standing && map.Tile[player.Location.X, player.Location.Y].Type != Enums.TileType.Slippery)
            {
                Messenger.SendPlayerDir();
                return(false);
            }



            //test against post-attack cooldown
            if (!(Players.PlayerManager.MyPlayer.PauseTimer < Globals.Tick))
            {
                Messenger.SendPlayerDir();
                return(false);
            }

            x = player.Location.X;
            y = player.Location.Y;



            switch (dirToTest)
            {
            case Enums.Direction.Up:
                x = player.Location.X;
                y = player.Location.Y - 1;

                player.Direction = Enums.Direction.Up;
                if (y < 0)
                {
                    if (map.Up > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false)
                    {
                        if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Up))
                        {
                            return(true);
                        }
                        else
                        {
                            Messenger.SendPlayerRequestNewMap(false);
                            Globals.GettingMap = true;
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                break;

            case Enums.Direction.Down:
                x = player.Location.X;
                y = player.Location.Y + 1;

                if (y > map.MaxY)
                {
                    if (map.Down > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false)
                    {
                        if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Down))
                        {
                            return(true);
                        }
                        else
                        {
                            Messenger.SendPlayerRequestNewMap(false);
                            Globals.GettingMap = true;
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                break;

            case Enums.Direction.Left:
                x = player.Location.X - 1;
                y = player.Location.Y;

                if (x < 0)
                {
                    if (map.Left > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false)
                    {
                        if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Left))
                        {
                            return(true);
                        }
                        else
                        {
                            Messenger.SendPlayerRequestNewMap(false);
                            Globals.GettingMap = true;
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                break;

            case Enums.Direction.Right:
                x = player.Location.X + 1;
                y = player.Location.Y;

                if (x > map.MaxX)
                {
                    if (map.Right > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false)
                    {
                        if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Right))
                        {
                            return(true);
                        }
                        else
                        {
                            Messenger.SendPlayerRequestNewMap(false);
                            Globals.GettingMap = true;
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                break;
            }

            if (x < 0 || x > map.MaxX || y < 0 || y > map.MaxY)
            {
                return(false);
            }

            Maps.Tile tile = map.Tile[x, y];

            switch (tile.Type)
            {
            case Enums.TileType.Blocked:
            case Enums.TileType.Sign:
            case Enums.TileType.ScriptedSign:
                if (dir != dirToTest)
                {
                    Messenger.SendPlayerDir();
                }
                return(false);

            case Enums.TileType.Warp: {
                if (Windows.WindowSwitcher.GameWindow.inMapEditor)
                {
                    if (dir != dirToTest)
                    {
                        Messenger.SendPlayerDir();
                    }
                    return(false);
                }
            }
            break;

            case Enums.TileType.LevelBlock:
                if (player.Level > tile.Data1)
                {
                    return(true);
                }
                else
                {
                    if (dir != dirToTest)
                    {
                        Messenger.SendPlayerDir();
                    }
                    return(false);
                }

            case Enums.TileType.Story:
                Messenger.SendPacket(TcpPacket.CreatePacket("isstory", x.ToString(), y.ToString()));
                if (dir != dirToTest)
                {
                    Messenger.SendPlayerDir();
                }
                return(true);

            case Enums.TileType.SpriteBlock:
                if (tile.Data1 == 1)
                {
                    if (player.Sprite == tile.Data2 || player.Sprite == tile.Data3)
                    {
                        return(true);
                    }
                    else
                    {
                        if (dir != dirToTest)
                        {
                            Messenger.SendPlayerDir();
                        }
                        return(false);
                    }
                }
                else if (tile.Data1 == 2)
                {
                    if (player.Sprite != tile.Data2 || player.Sprite != tile.Data3)
                    {
                        return(true);
                    }
                    else
                    {
                        if (dir != dirToTest)
                        {
                            Messenger.SendPlayerDir();
                        }
                        return(false);
                    }
                }
                else
                {
                    if (dir != dirToTest)
                    {
                        Messenger.SendPlayerDir();
                    }
                    return(false);
                }

            case Enums.TileType.MobileBlock: {
                int mobilityList = tile.Data1;
                for (int i = 0; i < 16; i++)
                {
                    if (mobilityList % 2 == 1 && !player.Mobility[i])
                    {
                        if (dir != dirToTest)
                        {
                            Messenger.SendPlayerDir();
                        }
                        return(false);
                    }
                    mobilityList /= 2;
                }
                // use mobility
                return(true);
            }

            //if (tile.Data1 == player.GetActiveRecruit().Class) {
            //    return true;
            //} else if (tile.Data2 == player.GetActiveRecruit().Class) {
            //    return true;
            //} else if (tile.Data3 == player.GetActiveRecruit().Class) {
            //    return true;
            //} else {
            //    if (dir != dirToTest) {
            //        Tcp.Messenger.SendPlayerDir();
            //    }
            //    return false;
            //}
            case Enums.TileType.Key:
            case Enums.TileType.Door:
                if (tile.DoorOpen == false)
                {
                    if (dir != dirToTest)
                    {
                        Messenger.SendPlayerDir();
                    }
                    return(false);
                }
                break;

            case Enums.TileType.LinkShop:
            case Enums.TileType.Assembly:
            case Enums.TileType.Guild:
            case Enums.TileType.Bank:
            case Enums.TileType.Shop:
                //player.MovementLocked = true;
                return(true);
            }

            foreach (IPlayer playerToTest in PlayerManager.Players.GetAllPlayers())
            {
                if (playerToTest.MapID == map.MapID && playerToTest.ScreenActive)
                {
                    if (playerToTest.Location.X == x && playerToTest.Location.Y == y)
                    {
                        if (player.Solid == true)
                        {
                            if (dir != dirToTest)
                            {
                                Messenger.SendPlayerDir();
                            }
                            return(false);
                        }
                    }
                }
            }

            for (int i = 0; i < MaxInfo.MAX_MAP_NPCS; i++)
            {
                if (map.MapNpcs[i].Num > 0 && map.MapNpcs[i].ScreenActive)
                {
                    if (map.MapNpcs[i].Location.X == x && map.MapNpcs[i].Location.Y == y)
                    {
                        if (dir != dirToTest)
                        {
                            Messenger.SendPlayerDir();
                        }
                        return(false);
                    }
                }
            }

            if (dir != dirToTest)
            {
                Messenger.SendPlayerDir();
            }
            return(true);
        }
Ejemplo n.º 28
0
        public static void DrawFringeTilesSeamless(RendererDestinationData destData, Map activeMap, bool mapAnim, int cameraX, int cameraX2, int cameraY, int cameraY2)
        {
            bool locYSub = (cameraY > 0 /*&& cameraY2 != activeMap.MaxY + 1*/ && ScreenRenderer.MapYOffset != 0);
            //if (cameraX > 0 /*&& cameraX2 != activeMap.MaxX + 1*/ && ScreenRenderer.MapXOffset != 0) {
            //    cameraX--;
            //    cameraX2++;
            //}
            int startX = cameraX;
            int startY = cameraY;
            if (ScreenRenderer.MapXOffset < 0) {
                startX--;
            }
            if (ScreenRenderer.MapYOffset < 0) {
                startY--;
            }
            //if (locYSub) {
            //    cameraY--;
            //    cameraY2++;
            //}
            for (int x = startX; x < cameraX2; x++) {
                for (int y = startY; y < cameraY2; y++) {
                    if (PlayerManager.MyPlayer.CurrentRoom != null && PlayerManager.MyPlayer.CurrentRoom.IsInRoom(x, y)) {

                        Tile currentTile = SeamlessWorldHelper.GetVisibleTile(x, y);

                        // Draw Fringe
                        if (!mapAnim || (currentTile.FAnim == 0 && mapAnim)) {
                            if (currentTile.Fringe == 0 || (currentTile.FAnim != 0 && mapAnim)) {
                                // Do Nothing
                            } else {
                                TileGraphic graphic = currentTile.FringeGraphic;
                                int tileNum = currentTile.Fringe;
                                int sheet = currentTile.FringeSet;
                                if (graphic == null || !(tileNum == graphic.TileNum && sheet == graphic.TileSet)) {
                                    graphic = Logic.Graphics.GraphicsManager.Tiles[sheet].GetTileGraphic(tileNum);

                                    currentTile.FringeGraphic = graphic;
                                }

                                DrawTile(destData, graphic, x - cameraX, y - cameraY, false);
                            }
                        }

                        // Draw Fringe Anim
                        if (mapAnim) {
                            if (currentTile.FAnim == 0) {
                                // Do Nothing
                            } else {
                                TileGraphic graphic = currentTile.FAnimGraphic;
                                int tileNum = currentTile.FAnim;
                                int sheet = currentTile.FAnimSet;
                                if (graphic == null || !(tileNum == graphic.TileNum && sheet == graphic.TileSet)) {
                                    graphic = Logic.Graphics.GraphicsManager.Tiles[sheet].GetTileGraphic(tileNum);

                                    currentTile.FAnimGraphic = graphic;
                                }

                                DrawTile(destData, graphic, x - cameraX, y - cameraY, false);
                            }
                        }

                        // Draw Fringe 2
                        if (!mapAnim || (currentTile.F2Anim == 0 && mapAnim)) {
                            if (currentTile.Fringe2 == 0 || (currentTile.F2Anim != 0 && mapAnim)) {
                                // Do Nothing
                            } else {
                                TileGraphic graphic = currentTile.Fringe2Graphic;
                                int tileNum = currentTile.Fringe2;
                                int sheet = currentTile.Fringe2Set;
                                if (graphic == null || !(tileNum == graphic.TileNum && sheet == graphic.TileSet)) {
                                    graphic = Logic.Graphics.GraphicsManager.Tiles[sheet].GetTileGraphic(tileNum);

                                    currentTile.Fringe2Graphic = graphic;
                                }

                                DrawTile(destData, graphic, x - cameraX, y - cameraY, false);
                            }
                        }

                        // Draw Fringe 2 Anim
                        if (mapAnim) {
                            if (currentTile.F2Anim == 0) {
                                // Do Nothing
                            } else {
                                TileGraphic graphic = currentTile.F2AnimGraphic;
                                int tileNum = currentTile.F2Anim;
                                int sheet = currentTile.F2AnimSet;
                                if (graphic == null || !(tileNum == graphic.TileNum && sheet == graphic.TileSet)) {
                                    graphic = Logic.Graphics.GraphicsManager.Tiles[sheet].GetTileGraphic(tileNum);

                                    currentTile.F2AnimGraphic = graphic;
                                }

                                DrawTile(destData, graphic, x - cameraX, y - cameraY, false);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 29
0
        public static void DrawGroundTilesSeamless(RendererDestinationData destData, Map activeMap, bool mapAnim, int cameraX, int cameraX2, int cameraY, int cameraY2)
        {
            bool locYSub = (cameraY > 0 /*&& cameraY2 < activeMap.MaxY + 1*/ && ScreenRenderer.MapYOffset != 0);
            //if (cameraX > 0 /*&& cameraX2 != activeMap.MaxX + 1*/ && ScreenRenderer.MapXOffset != 0) {
            //    cameraX--;
            //    cameraX2++;
            //}
            int startX = cameraX;
            int startY = cameraY;
            if (ScreenRenderer.MapXOffset < 0) {
                startX--;
            }
            if (ScreenRenderer.MapYOffset < 0) {
                startY--;
            } else if (ScreenRenderer.MapYOffset > 0) {
                startY--;
            }
            //if (locYSub) {
            //    cameraY--;
            //    cameraY2++;
            //}
            for (int x = startX; x < cameraX2; x++) {
                for (int y = startY; y < cameraY2; y++) {
                    if (PlayerManager.MyPlayer.CurrentRoom != null && PlayerManager.MyPlayer.CurrentRoom.IsInRoom(x, y)) {

                        Tile currentTile = SeamlessWorldHelper.GetVisibleTile(x, y);

                        // Draw ground
                        if (!mapAnim || (currentTile.GroundAnim == 0 && mapAnim)) {
                            if (currentTile.Ground == 0) {
                                // Do Nothing
                            } else {
                                TileGraphic graphic = currentTile.GroundGraphic;
                                int tileNum = currentTile.Ground;
                                int sheet = currentTile.GroundSet;
                                if (graphic == null || !(tileNum == graphic.TileNum && sheet == graphic.TileSet)) {
                                    graphic = Logic.Graphics.GraphicsManager.Tiles[sheet].GetTileGraphic(tileNum);

                                    currentTile.GroundGraphic = graphic;
                                }
                                DrawTile(destData, graphic, x - cameraX, y - cameraY, true);
                            }
                        }

                        //Draw ground anim
                        if (mapAnim) {
                            if (currentTile.GroundAnim == 0) {
                                // Do Nothing
                            } else {
                                TileGraphic graphic = currentTile.GroundAnimGraphic;
                                int tileNum = currentTile.GroundAnim;
                                int sheet = currentTile.GroundAnimSet;
                                if (graphic == null || !(tileNum == graphic.TileNum && sheet == graphic.TileSet)) {
                                    graphic = Logic.Graphics.GraphicsManager.Tiles[sheet].GetTileGraphic(tileNum);

                                    currentTile.GroundAnimGraphic = graphic;
                                }

                                DrawTile(destData, graphic, x - cameraX, y - cameraY, false);

                            }
                        }

                        // Draw Mask
                        if (!mapAnim || (currentTile.Anim == 0 && mapAnim)) {
                            if (currentTile.Mask == 0 || (currentTile.Anim != 0 && mapAnim) || currentTile.DoorOpen) {
                                // Do Nothing
                            } else {
                                TileGraphic graphic = currentTile.MaskGraphic;
                                int tileNum = currentTile.Mask;
                                int sheet = currentTile.MaskSet;
                                if (graphic == null || !(tileNum == graphic.TileNum && sheet == graphic.TileSet)) {
                                    graphic = Logic.Graphics.GraphicsManager.Tiles[sheet].GetTileGraphic(tileNum);

                                    currentTile.MaskGraphic = graphic;
                                }

                                DrawTile(destData, graphic, x - cameraX, y - cameraY, false);
                            }
                        }

                        // Draw Mask Anim
                        if (mapAnim) {
                            if (currentTile.Anim == 0) {
                                // Do Nothing
                            } else {
                                TileGraphic graphic = currentTile.AnimGraphic;
                                int tileNum = currentTile.Anim;
                                int sheet = currentTile.AnimSet;
                                if (graphic == null || !(tileNum == graphic.TileNum && sheet == graphic.TileSet)) {
                                    graphic = Logic.Graphics.GraphicsManager.Tiles[sheet].GetTileGraphic(tileNum);

                                    currentTile.AnimGraphic = graphic;
                                }

                                DrawTile(destData, graphic, x - cameraX, y - cameraY, false);
                            }
                        }

                        // Draw Mask 2
                        if (!mapAnim || (currentTile.M2Anim == 0 && mapAnim)) {
                            if (currentTile.Mask2 == 0 || (currentTile.M2Anim != 0 && mapAnim)) {
                                // Do Nothing
                            } else {
                                TileGraphic graphic = currentTile.Mask2Graphic;
                                int tileNum = currentTile.Mask2;
                                int sheet = currentTile.Mask2Set;
                                if (graphic == null || !(tileNum == graphic.TileNum && sheet == graphic.TileSet)) {
                                    graphic = Logic.Graphics.GraphicsManager.Tiles[sheet].GetTileGraphic(tileNum);

                                    currentTile.Mask2Graphic = graphic;
                                }

                                DrawTile(destData, graphic, x - cameraX, y - cameraY, false);
                            }
                        }

                        // Draw Mask 2 Anim
                        if (mapAnim) {
                            if (currentTile.M2Anim == 0) {
                                // Do Nothing
                            } else {
                                TileGraphic graphic = currentTile.M2AnimGraphic;
                                int tileNum = currentTile.M2Anim;
                                int sheet = currentTile.M2AnimSet;
                                if (graphic == null || !(tileNum == graphic.TileNum && sheet == graphic.TileSet)) {
                                    graphic = Logic.Graphics.GraphicsManager.Tiles[sheet].GetTileGraphic(tileNum);

                                    currentTile.M2AnimGraphic = graphic;
                                }

                                DrawTile(destData, graphic, x - cameraX, y - cameraY, false);
                            }
                        }

                        DrawSpriteChangeTile(destData, activeMap, x, y);
                    }
                }
            }
            DrawMissionGoalTileSeamless(destData, activeMap, cameraX, cameraY);
        }
Ejemplo n.º 30
0
        public static bool CheckLocked(Enums.Direction dirToTest)
        {
            Maps.Map         map    = Maps.MapHelper.ActiveMap;
            Players.MyPlayer player = Players.PlayerManager.MyPlayer;

            Enums.Direction dir = player.Direction;
            int             x = 0, y = 0;



            switch (dirToTest)
            {
            case Enums.Direction.Up:
                x = player.Location.X;
                y = player.Location.Y - 1;

                break;

            case Enums.Direction.Down:
                x = player.Location.X;
                y = player.Location.Y + 1;


                break;

            case Enums.Direction.Left:
                x = player.Location.X - 1;
                y = player.Location.Y;

                break;

            case Enums.Direction.Right:
                x = player.Location.X + 1;
                y = player.Location.Y;

                break;
            }

            if (x < 0 || x > map.MaxX || y < 0 || y > map.MaxY)
            {
                return(false);
            }

            Maps.Tile tile = map.Tile[x, y];

            switch (tile.Type)
            {
            case Enums.TileType.Story:
            case Enums.TileType.LinkShop:
            case Enums.TileType.Assembly:
            case Enums.TileType.Guild:
            case Enums.TileType.Bank:
            case Enums.TileType.Shop:
            case Enums.TileType.MissionBoard:
            case Enums.TileType.RDungeonGoal:
            case Enums.TileType.Evolution:
            case Enums.TileType.SpriteChange:
            case Enums.TileType.Warp:
            case Enums.TileType.Scripted:

                return(true);
            }

            return(false);
        }
Ejemplo n.º 31
0
 public static void DrawPlayerEmote(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, IPlayer player)
 {
     SpriteRenderer.DrawStatus(destData, activeMap, targetMapID, player, player.CurrentEmote.EmoteIndex, player.CurrentEmote.EmoteFrame, new Point(16, -32));
 }
Ejemplo n.º 32
0
        public static void DrawPlayerGuild(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, IPlayer player)
        {
            Color color = Color.DarkRed;

            // Check access level
            //if (player.PK == false) {
                switch (player.GuildAccess) {
                    case Enums.GuildRank.None:
                        color = Color.Red;
                        break;
                    case Enums.GuildRank.Member:
                        color = Color.LightSkyBlue;
                        break;
                    case Enums.GuildRank.Admin:
                        color = Color.Yellow;
                        break;
                    case Enums.GuildRank.Founder:
                        color = Color.LawnGreen;
                        break;
                }
            //} else {
            //    color = Color.DarkRed;
            //}

            string guild = player.Guild;

            if (guild == null) {
                guild = "";
            }

            //if (Globals.FoolsMode) {
            //    guild = "MewTeam";
            //}

            SpriteRenderer.DrawSpriteGuild(destData, activeMap, targetMapID, player, color, guild);
        }
Ejemplo n.º 33
0
        public static void DrawFringeTiles(RendererDestinationData destData, Map activeMap, bool mapAnim, int cameraX, int cameraX2, int cameraY, int cameraY2)
        {
            bool locYSub = (cameraY > 0 /*&& cameraY2 != activeMap.MaxY + 1*/ && ScreenRenderer.MapYOffset != 0);
            if (cameraX > 0 /*&& cameraX2 != activeMap.MaxX + 1*/ && ScreenRenderer.MapXOffset != 0) {
                cameraX--;
                cameraX2++;
            }
            if (locYSub) {
                cameraY--;
                cameraY2++;
            }
            if (cameraX2 > activeMap.Tile.GetUpperBound(0) + 1) {
                cameraX2 = activeMap.Tile.GetUpperBound(0) + 1;
            }
            if (cameraY2 > activeMap.Tile.GetUpperBound(1) + 1) {
                cameraY2 = activeMap.Tile.GetUpperBound(1) + 1;
            }
            for (int x = cameraX; x < cameraX2; x++) {
                for (int y = cameraY; y < cameraY2; y++) {
                    if (PlayerManager.MyPlayer.CurrentRoom != null && PlayerManager.MyPlayer.CurrentRoom.IsInRoom(x, y)) {
                        // Draw Fringe
                        if (!mapAnim || (activeMap.Tile[x, y].FAnim == 0 && mapAnim)) {
                            if (activeMap.Tile[x, y].Fringe == 0 || (activeMap.Tile[x, y].FAnim != 0 && mapAnim)) {
                                // Do Nothing
                            } else {
                                DrawTile(destData, activeMap.Tile[x, y].FringeSet, activeMap.Tile[x, y].Fringe, x, y);
                            }
                        }

                        // Draw Fringe Anim
                        if (mapAnim) {
                            if (activeMap.Tile[x, y].FAnim == 0) {
                                // Do Nothing
                            } else {
                                DrawTile(destData, activeMap.Tile[x, y].FAnimSet, activeMap.Tile[x, y].FAnim, x, y);
                            }
                        }

                        // Draw Fringe 2
                        if (!mapAnim || (activeMap.Tile[x, y].F2Anim == 0 && mapAnim)) {
                            if (activeMap.Tile[x, y].Fringe2 == 0 || (activeMap.Tile[x, y].F2Anim != 0 && mapAnim)) {
                                // Do Nothing
                            } else {
                                DrawTile(destData, activeMap.Tile[x, y].Fringe2Set, activeMap.Tile[x, y].Fringe2, x, y);
                            }
                        }

                        // Draw Fringe 2 Anim
                        if (mapAnim) {
                            if (activeMap.Tile[x, y].F2Anim == 0) {
                                // Do Nothing
                            } else {
                                DrawTile(destData, activeMap.Tile[x, y].F2AnimSet, activeMap.Tile[x, y].F2Anim, x, y);
                            }
                        }
                    }
                }
            }
        }