Exemple #1
0
    private static void Editor_Maps_Map_Weather(short Index)
    {
        // Somente se necessário
        if (!Editor_Maps.Objects.butVisualization.Checked || Lists.Map[Index].Weather.Type == (byte)Globals.Weathers.Normal)
        {
            return;
        }

        // Dados
        byte x = 0;

        if (Lists.Map[Index].Weather.Type == (byte)Globals.Weathers.Snowing)
        {
            x = 32;
        }

        // Desenha as partículas
        for (int i = 1; i < Lists.Weather.Length; i++)
        {
            if (Lists.Weather[i].Visible)
            {
                Render(Win_Map, Tex_Weather, new Rectangle(x, 0, 32, 32), Editor_Maps.Zoom(new Rectangle(Lists.Weather[i].x, Lists.Weather[i].y, 32, 32)), CColor(255, 255, 255, 150));
            }
        }
    }
Exemple #2
0
    private static void Editor_Maps_Map_Fog(short Index)
    {
        Lists.Structures.Map_Fog Data = Lists.Map[Index].Fog;
        Point Position;

        // Somente se necessário
        if (Data.Texture <= 0)
        {
            return;
        }
        if (!Editor_Maps.Objects.butVisualization.Checked)
        {
            return;
        }

        // Dados
        Size Textura_Tamanho = TSize(Tex_Fog[Data.Texture]);

        for (int x = -1; x <= Editor_Maps.Map_Size.Width * Globals.Grid / Textura_Tamanho.Width + 1; x++)
        {
            for (int y = -1; y <= Editor_Maps.Map_Size.Height * Globals.Grid / Textura_Tamanho.Height + 1; y++)
            {
                // Desenha a fumaça
                Position = new Point(x * Textura_Tamanho.Width + Globals.Fog_X, y * Textura_Tamanho.Height + Globals.Fog_Y);
                Render(Win_Map, Tex_Fog[Data.Texture], Editor_Maps.Zoom(new Rectangle(Position, Textura_Tamanho)), CColor(255, 255, 255, Data.Alpha));
            }
        }
    }
Exemple #3
0
    private static void Editor_Maps_Map_Panorama(short Index)
    {
        short Texture = Lists.Map[Index].Panorama;
        Size  Size    = TSize(Tex_Panorama[Texture]);

        // Limitações
        Size TempSize = new Size
        {
            Width  = (Lists.Map[Index].Width + 1 - Editor_Maps.Objects.scrlMapX.Value) * Globals.Grid_Zoom,
            Height = (Lists.Map[Index].Height + 1 - Editor_Maps.Objects.scrlMapY.Value) * Globals.Grid_Zoom
        };

        // Não permite que o tamanho ultrapasse a tela de jogo
        if (Size.Width > TempSize.Width)
        {
            Size.Width = TempSize.Width;
        }
        if (Size.Height > TempSize.Height)
        {
            Size.Height = TempSize.Height;
        }

        // Desenha o panorama
        if (Editor_Maps.Objects.butVisualization.Checked && Lists.Map[Index].Panorama > 0)
        {
            Render(Win_Map, Tex_Panorama[Texture], Editor_Maps.Zoom(new Rectangle(new Point(0), Size)));
        }
    }
Exemple #4
0
    private static void Editor_Maps_Tile()
    {
        Editor_Maps Objects = Editor_Maps.Objects;

        // Somente se necessário
        if (!Objects.Visible || !Editor_Maps.Objects.butMNormal.Checked)
        {
            return;
        }

        // Reinicia o dispositivo caso haja alguma alteração no tamanho da tela
        if (new Size((int)Win_Map_Tile.Size.X, (int)Win_Map_Tile.Size.Y) != Objects.picTile.Size)
        {
            Win_Map_Tile.Dispose();
            Win_Map_Tile = new RenderWindow(Editor_Maps.Objects.picTile.Handle);
        }

        // Limpa a área com um fundo preto
        Win_Map_Tile.Clear(SFML.Graphics.Color.Black);

        // Dados
        Texture Texture  = Tex_Tile[Objects.cmbTiles.SelectedIndex + 1];
        Size    Size     = TSize(Texture);
        Point   Position = new Point(Objects.scrlTileX.Value, Objects.scrlTileY.Value);

        // Desenha o azulejo e as grades
        Transparent(Win_Map_Tile);
        Render(Win_Map_Tile, Texture, new Rectangle(Position, Size), new Rectangle(new Point(0), Size));
        RenderRectangle(Win_Map_Tile, new Rectangle(new Point(Editor_Maps.Tile_Source.X - Position.X, Editor_Maps.Tile_Source.Y - Position.Y), Editor_Maps.Tile_Source.Size), CColor(165, 42, 42, 250));
        RenderRectangle(Win_Map_Tile, Editor_Maps.Tile_Mouse.X, Editor_Maps.Tile_Mouse.Y, Globals.Grid, Globals.Grid, CColor(65, 105, 225, 250));

        // Exibe o que foi renderizado
        Win_Map_Tile.Display();
    }
Exemple #5
0
    private static void Editor_Maps_Map_Light(short Index)
    {
        Editor_Maps Objects         = Editor_Maps.Objects;
        byte        GlobalLight_Tex = Lists.Map[Index].Light_Global;
        Point       Begin           = Globals.Zoom(Editor_Maps.Objects.scrlMapX.Value, Editor_Maps.Objects.scrlMapY.Value);
        byte        Light           = (byte)((255 * ((decimal)Lists.Map[Index].Lighting / 100) - 255) * -1);

        // Somente se necessário
        if (!Editor_Maps.Objects.butVisualization.Checked)
        {
            return;
        }

        // Escuridão
        Win_Map_Lighting.Clear(CColor(0, 0, 0, Light));

        // Desenha o ponto iluminado
        if (Lists.Map[Index].Light.Count > 0)
        {
            for (byte i = 0; i < Lists.Map[Index].Light.Count; i++)
            {
                Render(Win_Map_Lighting, Tex_Lighting, Editor_Maps.Zoom_Grid(Lists.Map[Index].Light[i].Rec), null, new RenderStates(BlendMode.Multiply));
            }
        }

        // Pré visualização
        if (Editor_Maps.Objects.butMLighting.Checked)
        {
            Render(Win_Map_Lighting, Tex_Lighting, Globals.Zoom(Editor_Maps.Map_Selection), null, new RenderStates(BlendMode.Multiply));
        }

        // Apresenta o que foi renderizado
        Win_Map_Lighting.Display();
        Win_Map.Draw(new Sprite(Win_Map_Lighting.Texture));

        // Luz global
        if (GlobalLight_Tex > 0)
        {
            Render(Win_Map, Tex_Light[GlobalLight_Tex], Editor_Maps.Zoom(new Rectangle(new Point(-Begin.X, -Begin.Y), TSize(Tex_Light[GlobalLight_Tex]))), CColor(255, 255, 255, 175), new RenderStates(BlendMode.Add));
        }

        // Ponto de remoção da luz
        if (Objects.butMLighting.Checked)
        {
            if (Lists.Map[Index].Light.Count > 0)
            {
                for (byte i = 0; i < Lists.Map[Index].Light.Count; i++)
                {
                    RenderRectangle(Win_Map, Lists.Map[Index].Light[i].Rec.X * Globals.Grid_Zoom, Lists.Map[Index].Light[i].Rec.Y * Globals.Grid_Zoom, Globals.Grid_Zoom, Globals.Grid_Zoom, CColor(175, 42, 42, 175));
                }
            }
        }

        // Trovoadas
        Size Size = new Size(Editor_Maps.Zoom((Lists.Map[Index].Width + 1) * Globals.Grid), Editor_Maps.Zoom((Lists.Map[Index].Height + 1) * Globals.Grid));

        Render(Win_Map, Tex_Blank, 0, 0, 0, 0, Size.Width, Size.Height, CColor(255, 255, 255, Globals.Lightning));
    }
Exemple #6
0
 private void butMaps_Click(object sender, EventArgs e)
 {
     // Verifica se os diretórios foram selecionados
     if (string.IsNullOrEmpty(Lists.Options.Directory_Client))
     {
         MessageBox.Show("Select the client directory.");
     }
     else
     {
         Editor_Maps.Request();
     }
 }
Exemple #7
0
    private static void Editor_Maps_Map_Grids(short Index)
    {
        Editor_Maps Objects = Editor_Maps.Objects;
        Rectangle   Source = Editor_Maps.Tile_Source, Destiny = new Rectangle();
        Point       Begin = new Point(Editor_Maps.Map_Selection.X - Objects.scrlMapX.Value, Editor_Maps.Map_Selection.Y - Objects.scrlMapY.Value);

        // Dados
        Destiny.Location = Globals.Zoom(Begin.X, Begin.Y);
        Destiny.Size     = new Size(Source.Width / Editor_Maps.Zoom(), Source.Height / Editor_Maps.Zoom());

        // Desenha as grades
        if (Objects.butGrid.Checked || !Objects.butGrid.Enabled)
        {
            for (byte x = 0; x <= Editor_Maps.Map_Size.Width; x++)
            {
                for (byte y = 0; y <= Editor_Maps.Map_Size.Height; y++)
                {
                    RenderRectangle(Win_Map, x * Globals.Grid_Zoom, y * Globals.Grid_Zoom, Globals.Grid_Zoom, Globals.Grid_Zoom, CColor(25, 25, 25, 70));
                    Editor_Maps_Map_Zones(Index, x, y);
                    Editor_Maps_Map_Attributes(Index, x, y);
                    Editor_Maps_Map_DirBlock(Index, x, y);
                }
            }
        }

        if (!Objects.chkAuto.Checked && Objects.butMNormal.Checked)
        {
            // Normal
            if (Objects.butPencil.Checked)
            {
                Render(Win_Map, Tex_Tile[Objects.cmbTiles.SelectedIndex + 1], Source, Destiny);
            }
            // Retângulo
            else if (Objects.butRectangle.Checked)
            {
                for (int x = Begin.X; x < Begin.X + Editor_Maps.Map_Selection.Width; x++)
                {
                    for (int y = Begin.Y; y < Begin.Y + Editor_Maps.Map_Selection.Height; y++)
                    {
                        Render(Win_Map, Tex_Tile[Objects.cmbTiles.SelectedIndex + 1], Source, new Rectangle(Globals.Zoom(x, y), Destiny.Size));
                    }
                }
            }
        }

        // Desenha a grade
        if (!Objects.butMAttributes.Checked || !Editor_Maps.Objects.optA_DirBlock.Checked)
        {
            RenderRectangle(Win_Map, Destiny.X, Destiny.Y, Editor_Maps.Map_Selection.Width * Globals.Grid_Zoom, Editor_Maps.Map_Selection.Height * Globals.Grid_Zoom);
        }
    }
Exemple #8
0
    private void butSave_Click(object sender, EventArgs e)
    {
        // Redimensiona os azulejos
        Map_Resize();

        // Salva os valores
        Lists.Map[Selected].Name              = txtName.Text;
        Lists.Map[Selected].Width             = (byte)numWidth.Value;
        Lists.Map[Selected].Height            = (byte)numHeight.Value;
        Lists.Map[Selected].Moral             = (byte)Objects.cmbMoral.SelectedIndex;
        Lists.Map[Selected].Music             = (byte)Objects.cmbMusic.SelectedIndex;
        Lists.Map[Selected].Panorama          = (byte)Objects.numPanorama.Value;
        Lists.Map[Selected].Weather.Type      = (byte)Objects.cmbWeather.SelectedIndex;
        Lists.Map[Selected].Weather.Intensity = (byte)Objects.numWeather_Intensity.Value;
        Lists.Map[Selected].Fog.Texture       = (byte)Objects.numFog_Texture.Value;
        Lists.Map[Selected].Fog.Speed_X       = (sbyte)Objects.numFog_Speed_X.Value;
        Lists.Map[Selected].Fog.Speed_Y       = (sbyte)Objects.numFog_Speed_Y.Value;
        Lists.Map[Selected].Fog.Alpha         = (byte)Objects.numFog_Transparency.Value;
        Lists.Map[Selected].Color             = Color.FromArgb((byte)Objects.numColor_Red.Value, (int)Objects.numColor_Green.Value, (int)Objects.numColor_Blue.Value).ToArgb();
        Lists.Map[Selected].Link[(byte)Globals.Directions.Up]    = (short)Objects.numLink_Up.Value;
        Lists.Map[Selected].Link[(byte)Globals.Directions.Down]  = (short)Objects.numLink_Down.Value;
        Lists.Map[Selected].Link[(byte)Globals.Directions.Left]  = (short)Objects.numLink_Left.Value;
        Lists.Map[Selected].Link[(byte)Globals.Directions.Right] = (short)Objects.numLink_Right.Value;
        Lists.Map[Selected].Light_Global = (byte)Objects.numLight_Global.Value;
        Lists.Map[Selected].Lighting     = (byte)Objects.numLighting.Value;

        // Define a nova dimensão dos azulejos
        Editor_Maps.Update_Data();

        // Altera o nome na lista
        Editor_Maps.Objects.cmbList.Items[Selected - 1] = Globals.Numbering(Selected, Editor_Maps.Objects.cmbList.Items.Count, txtName.Text);

        // Reseta os valores
        Globals.Weather_Update();
        Editor_Maps.Objects.numLighting.Value     = Lists.Map[Selected].Lighting;
        Editor_Maps.Objects.numLight_Global.Value = Lists.Map[Selected].Light_Global;

        // Volta ao editor de mapas
        Visible = false;
        Editor_Maps.Objects.Enabled = true;
        Editor_Maps.Objects.Visible = true;
    }
Exemple #9
0
    private void butOk_Click(object sender, EventArgs e)
    {
        // Define o nova quantidade
        if (Editor_Classes.Objects.Visible)
        {
            Editor_Classes.Change_Quantity();
        }
        if (Editor_Maps.Objects.Visible)
        {
            Editor_Maps.Change_Quantity();
        }
        if (Editor_NPCs.Objects.Visible)
        {
            Editor_NPCs.Change_Quantity();
        }
        if (Editor_Items.Objects.Visible)
        {
            Editor_Items.Change_Quantity();
        }

        // Fecha a janela
        Visible = false;
    }
Exemple #10
0
    private static void Editor_Maps_AutoTile(Point Position, Lists.Structures.Map_Tile_Data Data, SFML.Graphics.Color Color)
    {
        // Desenha os 4 mini azulejos
        for (byte i = 0; i <= 3; i++)
        {
            Point Destiny = Position, Source = Data.Mini[i];

            // Partes do azulejo
            switch (i)
            {
            case 1: Destiny.X += 16; break;

            case 2: Destiny.Y += 16; break;

            case 3: Destiny.X += 16; Destiny.Y += 16; break;
            }

            // Renderiza o mini azulejo
            Render(Win_Map, Tex_Tile[Data.Tile], new Rectangle(Source.X, Source.Y, 16, 16), Editor_Maps.Zoom(new Rectangle(Destiny, new Size(16, 16))), Color);
        }
    }
Exemple #11
0
    private static void Editor_Maps_Map_Tiles(short Index)
    {
        Editor_Maps Objects = Editor_Maps.Objects;

        Lists.Structures.Map           Map = Lists.Map[Index];
        Lists.Structures.Map_Tile_Data Data;
        int Begin_X = Objects.scrlMapX.Value, Begin_Y = Objects.scrlMapY.Value;

        SFML.Graphics.Color Color; System.Drawing.Color TempCor = System.Drawing.Color.FromArgb(Map.Color);

        // Desenha todos os azulejos
        for (byte c = 0; c < Map.Layer.Count; c++)
        {
            // Somente se necessário
            if (!Objects.lstLayers.Items[c].Checked)
            {
                continue;
            }

            // Transparência da camada
            Color = CColor(255, 255, 255);
            if (Objects.butEdition.Checked && Objects.butMNormal.Checked)
            {
                if (Editor_Maps.Objects.lstLayers.SelectedIndices.Count > 0)
                {
                    if (c != Editor_Maps.Objects.lstLayers.SelectedItems[0].Index)
                    {
                        Color = CColor(255, 255, 255, 150);
                    }
                }
            }
            else
            {
                Color = CColor(TempCor.R, TempCor.G, TempCor.B);
            }

            // Continua
            for (int x = Begin_X; x <= Editor_Maps.Map_Size.Width; x++)
            {
                for (int y = Begin_Y; y <= Editor_Maps.Map_Size.Height; y++)
                {
                    if (Map.Layer[c].Tile[x, y].Tile > 0)
                    {
                        // Dados
                        Data = Map.Layer[c].Tile[x, y];
                        Rectangle Source  = new Rectangle(new Point(Data.X * Globals.Grid, Data.Y * Globals.Grid), Globals.Grid_Size);
                        Rectangle Destiny = new Rectangle(new Point((x - Begin_X) * Globals.Grid, (y - Begin_Y) * Globals.Grid), Globals.Grid_Size);

                        // Desenha o azulejo
                        if (!Map.Layer[c].Tile[x, y].Auto)
                        {
                            Render(Win_Map, Tex_Tile[Data.Tile], Source, Editor_Maps.Zoom(Destiny), Color);
                        }
                        else
                        {
                            Editor_Maps_AutoTile(Destiny.Location, Data, Color);
                        }
                    }
                }
            }
        }
    }