Esempio n. 1
0
        public void NudFurniture_ValueChanged(object sender, EventArgs e)
        {
            if (E_Globals.Editorindex == 0 || E_Globals.Editorindex > Constants.MAX_ITEMS)
            {
                return;
            }

            Types.Item[E_Globals.Editorindex].Data2 = (int)nudFurniture.Value;

            if (E_Graphics.FurnitureGFXInfo[(int)nudFurniture.Value].IsLoaded == false)
            {
                E_Graphics.LoadTexture((int)nudFurniture.Value, (byte)10);
            }

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

            if (nudFurniture.Value > 0 && nudFurniture.Value <= E_Housing.NumFurniture)
            {
                Types.Item[E_Globals.Editorindex].FurnitureWidth  = System.Convert.ToInt32((double)E_Graphics.FurnitureGFXInfo[(int)nudFurniture.Value].width / 32);
                Types.Item[E_Globals.Editorindex].FurnitureHeight = System.Convert.ToInt32((double)E_Graphics.FurnitureGFXInfo[(int)nudFurniture.Value].height / 32);
                if (Types.Item[E_Globals.Editorindex].FurnitureHeight > 1)
                {
                    Types.Item[E_Globals.Editorindex].FurnitureHeight = Types.Item[E_Globals.Editorindex].FurnitureHeight - 1;
                }
            }
            else
            {
                Types.Item[E_Globals.Editorindex].FurnitureWidth  = 1;
                Types.Item[E_Globals.Editorindex].FurnitureHeight = 1;
            }

            E_Items.EditorItem_DrawFurniture();
        }
Esempio n. 2
0
        public override void DrawParticles(RenderWindow gameWindow)
        {
            foreach (ProjectileBullet proj in projectiles)
            {
                if (E_Graphics.ProjectileSprite.Count() > 0)
                {
                    if (!E_Graphics.ProjectileGFXInfo[picture].IsLoaded)
                    {
                        E_Graphics.LoadTexture(picture, 11);
                    }

                    E_Graphics.RenderSprite(E_Graphics.ProjectileSprite[picture], gameWindow, proj.x, proj.y, 0, 0, E_Graphics.ProjectileGFXInfo[picture].width, E_Graphics.ProjectileGFXInfo[picture].height);
                }
            }
        }
Esempio n. 3
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);             //
        }
Esempio n. 4
0
        public override void InitializeEmitter()
        {
            if (!E_Graphics.ProjectileGFXInfo[picture].IsLoaded)
            {
                E_Graphics.LoadTexture(picture, 11);
            }

            int height = frmProjectile.Default.picProjectilePreview.Height;
            int width  = frmProjectile.Default.picProjectilePreview.Width;

            projectiles = new List <ProjectileBullet>();
            projectiles.Add(new ProjectileBullet());

            projectiles[0].x   = (width / 2) + (int)E_Graphics.ProjectileSprite[picture].Texture.Size.X / 2;
            projectiles[0].y   = (height / 2) + (int)E_Graphics.ProjectileSprite[picture].Texture.Size.Y / 2;
            projectiles[0].dir = (byte)frmProjectile.Default.PreviewDirectionDropdown.SelectedIndex;
        }
Esempio n. 5
0
        internal static void EditorItem_DrawFurniture()
        {
            int       Furniturenum = 0;
            Rectangle sRECT        = new Rectangle();
            Rectangle dRECT        = new Rectangle();

            Furniturenum = (int)FrmItem.Default.nudFurniture.Value;

            if (Furniturenum < 1 || Furniturenum > E_Housing.NumFurniture)
            {
                E_Graphics.EditorItem_Furniture.Clear(E_Graphics.ToSFMLColor(FrmItem.Default.picFurniture.BackColor));
                E_Graphics.EditorItem_Furniture.Display();
                return;
            }

            if (E_Graphics.FurnitureGFXInfo[Furniturenum].IsLoaded == false)
            {
                E_Graphics.LoadTexture(Furniturenum, (byte)10);
            }

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

            // rect for source
            sRECT.Y      = 0;
            sRECT.Height = E_Graphics.FurnitureGFXInfo[Furniturenum].height;
            sRECT.X      = 0;
            sRECT.Width  = E_Graphics.FurnitureGFXInfo[Furniturenum].width;

            // same for destination as source
            dRECT = sRECT;

            E_Graphics.EditorItem_Furniture.Clear(E_Graphics.ToSFMLColor(FrmItem.Default.picFurniture.BackColor));

            E_Graphics.RenderSprite(E_Graphics.FurnitureSprite[Furniturenum], E_Graphics.EditorItem_Furniture, dRECT.X, dRECT.Y, sRECT.X, sRECT.Y, sRECT.Width, sRECT.Height);

            if (FrmItem.Default.optSetBlocks.Checked == true)
            {
                for (var X = 0; X <= 3; X++)
                {
                    for (var Y = 0; Y <= 3; Y++)
                    {
                        if (X <= ((double)E_Graphics.FurnitureGFXInfo[Furniturenum].width / 32) - 1)
                        {
                            if (Y <= ((double)E_Graphics.FurnitureGFXInfo[Furniturenum].height / 32) - 1)
                            {
                                if (Types.Item[E_Globals.Editorindex].FurnitureBlocks[(int)X, (int)Y] == 1)
                                {
                                    E_Text.DrawText(System.Convert.ToInt32(X * 32 + 8), System.Convert.ToInt32(Y * 32 + 8), "X", SFML.Graphics.Color.Red, SFML.Graphics.Color.Black, E_Graphics.EditorItem_Furniture);
                                }
                                else
                                {
                                    E_Text.DrawText(System.Convert.ToInt32(X * 32 + 8), System.Convert.ToInt32(Y * 32 + 8), "O", SFML.Graphics.Color.Blue, SFML.Graphics.Color.Black, E_Graphics.EditorItem_Furniture);
                                }
                            }
                        }
                    }
                }
            }
            else if (FrmItem.Default.optSetFringe.Checked == true)
            {
                for (var X = 0; X <= 3; X++)
                {
                    for (var Y = 0; Y <= 3; Y++)
                    {
                        if (X <= ((double)E_Graphics.FurnitureGFXInfo[Furniturenum].width / 32) - 1)
                        {
                            if (Y <= ((double)E_Graphics.FurnitureGFXInfo[Furniturenum].height / 32))
                            {
                                if (Types.Item[E_Globals.Editorindex].FurnitureFringe[(int)X, (int)Y] == 1)
                                {
                                    E_Text.DrawText(System.Convert.ToInt32(X * 32 + 8), System.Convert.ToInt32(Y * 32 + 8), "O", SFML.Graphics.Color.Blue, SFML.Graphics.Color.Black, E_Graphics.EditorItem_Furniture);
                                }
                            }
                        }
                    }
                }
            }
            E_Graphics.EditorItem_Furniture.Display();
        }
Esempio n. 6
0
        internal static void DrawFurniture(int index, int Layer)
        {
            int i       = 0;
            int ItemNum = 0;
            int X       = 0;
            int Y       = 0;
            int Width   = 0;
            int Height  = 0;
            int X1      = 0;
            int Y1      = 0;

            ItemNum = Furniture[index].ItemNum;

            if (Types.Item[ItemNum].Type != (int)Enums.ItemType.Furniture)
            {
                return;
            }

            i = Types.Item[ItemNum].Data2;

            if (E_Graphics.FurnitureGFXInfo[i].IsLoaded == false)
            {
                E_Graphics.LoadTexture(i, (byte)10);
            }

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

            Width  = Types.Item[ItemNum].FurnitureWidth;
            Height = Types.Item[ItemNum].FurnitureHeight;

            if (Width > 4)
            {
                Width = 4;
            }
            if (Height > 4)
            {
                Height = 4;
            }
            if (i <= 0 || i > NumFurniture)
            {
                return;
            }

            // make sure it's not out of map
            if (Furniture[index].X > E_Types.Map.MaxX)
            {
                return;
            }
            if (Furniture[index].Y > E_Types.Map.MaxY)
            {
                return;
            }

            for (X1 = 0; X1 <= Width - 1; X1++)
            {
                for (Y1 = 0; Y1 <= Height; Y1++)
                {
                    if (Types.Item[Furniture[index].ItemNum].FurnitureFringe[X1, Y1] == Layer)
                    {
                        // Set base x + y, then the offset due to size
                        X = (Furniture[index].X * 32) + (X1 * 32);
                        Y = (Furniture[index].Y * 32 - (Height * 32)) + (Y1 * 32);
                        X = E_Graphics.ConvertMapX(X);
                        Y = E_Graphics.ConvertMapY(Y);

                        Sprite tmpSprite = new Sprite(E_Graphics.FurnitureGFX[i])
                        {
                            TextureRect = new IntRect(0 + (X1 * 32), 0 + (Y1 * 32), 32, 32),
                            Position    = new Vector2f(X, Y)
                        };
                        E_Graphics.GameWindow.Draw(tmpSprite);
                    }
                }
            }
        }