Exemplo n.º 1
0
        internal static void DrawFog()
        {
            int fogNum = 0;

            //If InMapEditor Then Exit Sub

            fogNum = E_Globals.CurrentFog;
            if (fogNum <= 0 || fogNum > E_Graphics.NumFogs)
            {
                return;
            }

            int horz = 0;
            int vert = 0;

            for (var x = E_Globals.TileView.Left; x <= E_Globals.TileView.Right + 1; x++)
            {
                for (var y = E_Globals.TileView.Top; y <= E_Globals.TileView.Bottom + 1; y++)
                {
                    if (E_Graphics.IsValidMapPoint(System.Convert.ToInt32(x), System.Convert.ToInt32(y)))
                    {
                        horz = System.Convert.ToInt32(-x);
                        vert = System.Convert.ToInt32(-y);
                    }
                }
            }

            if (E_Graphics.FogGFXInfo[fogNum].IsLoaded == false)
            {
                E_Graphics.LoadTexture(fogNum, (byte)8);
            }

            //seeying we still use it, lets update timer
            E_Graphics.FogGFXInfo[fogNum].TextureTimer = System.Convert.ToInt32(System.Convert.ToInt32(ClientDataBase.GetTickCount()) + 100000);

            Sprite tmpSprite = default(Sprite);

            tmpSprite = new Sprite(E_Graphics.FogGFX[fogNum])
            {
                Color       = new SFML.Graphics.Color(255, 255, 255, (byte)E_Globals.CurrentFogOpacity),
                TextureRect = new IntRect(0, 0, (int)E_Graphics.GameWindow.Size.X + 200, (int)E_Graphics.GameWindow.Size.Y + 200),
                Position    = new Vector2f((float)((horz * 2.5) + 50), (float)((vert * 3.5) + 50)),
                Scale       = (new Vector2f((float)((E_Graphics.GameWindow.Size.X + 200) / E_Graphics.FogGFXInfo[fogNum].width), (float)((E_Graphics.GameWindow.Size.Y + 200) / E_Graphics.FogGFXInfo[fogNum].height)))
            };

            E_Graphics.GameWindow.Draw(tmpSprite);             //
        }
Exemplo n.º 2
0
        internal static void DrawMapAttributes()
        {
            if (E_Globals.SelectedTab == 2)
            {
                int            X   = 0;
                int            y   = 0;
                int            tX  = 0;
                int            tY  = 0;
                RectangleShape rec = new RectangleShape();
                rec.OutlineColor     = new SFML.Graphics.Color(SFML.Graphics.Color.White);
                rec.OutlineThickness = (float)(0.6F);
                rec.Size             = new Vector2f(E_Globals.PIC_X, E_Globals.PIC_X);


                for (X = E_Globals.TileView.Left; X <= E_Globals.TileView.Right; X++)
                {
                    for (y = E_Globals.TileView.Top; y <= E_Globals.TileView.Bottom; y++)
                    {
                        if (E_Graphics.IsValidMapPoint(X, y))
                        {
                            tX = System.Convert.ToInt32(((E_Graphics.ConvertMapX(X * E_Globals.PIC_X)) - 4) + (E_Globals.PIC_X * 0.5));
                            tY = System.Convert.ToInt32(((E_Graphics.ConvertMapY(y * E_Globals.PIC_Y)) - 7) + (E_Globals.PIC_Y * 0.5));

                            //rec.OutlineColor = new SFML.Graphics.Color(SFML.Graphics.Color.White);
                            //rec.OutlineThickness = (float) (0.6F);

                            //rec.Size = new Vector2f(E_Globals.PIC_X, E_Globals.PIC_X);
                            rec.Position = new Vector2f(E_Graphics.ConvertMapX((X)*E_Globals.PIC_X), E_Graphics.ConvertMapY((y) * E_Globals.PIC_Y));

                            if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Blocked)
                            {
                                rec.FillColor = SFML.Graphics.Color.Red;
                                E_Graphics.GameWindow.Draw(rec);
                                DrawText(tX, tY, "B", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Warp)
                            {
                                DrawText(tX, tY, "W", SFML.Graphics.Color.Blue, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Item)
                            {
                                DrawText(tX, tY, "I", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.NpcAvoid)
                            {
                                DrawText(tX, tY, "N", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Key)
                            {
                                DrawText(tX, tY, "K", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.KeyOpen)
                            {
                                DrawText(tX, tY, "KO", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Resource)
                            {
                                DrawText(tX, tY, "R", SFML.Graphics.Color.Green, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Door)
                            {
                                DrawText(tX, tY, "D", SFML.Graphics.Color.Black, SFML.Graphics.Color.Red, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.NpcSpawn)
                            {
                                rec.FillColor = SFML.Graphics.Color.Yellow;
                                E_Graphics.GameWindow.Draw(rec);
                                DrawText(tX, tY, "S", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Shop)
                            {
                                DrawText(tX, tY, "SH", SFML.Graphics.Color.Blue, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Bank)
                            {
                                DrawText(tX, tY, "BA", SFML.Graphics.Color.Blue, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Heal)
                            {
                                DrawText(tX, tY, "H", SFML.Graphics.Color.Green, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Trap)
                            {
                                DrawText(tX, tY, "T", SFML.Graphics.Color.Red, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.House)
                            {
                                DrawText(tX, tY, "H", SFML.Graphics.Color.Green, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Craft)
                            {
                                DrawText(tX, tY, "C", SFML.Graphics.Color.Green, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                            else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Light)
                            {
                                DrawText(tX, tY, "L", SFML.Graphics.Color.Yellow, SFML.Graphics.Color.Black, E_Graphics.GameWindow);
                            }
                        }
                    }
                }
            }
        }