Ejemplo n.º 1
0
Archivo: Map.cs Proyecto: Kukks/CryBits
    public static void Spawn_Items(short Map_Num)
    {
        Lists.Structures.Map       Data = Lists.Map[Map_Num];
        Lists.Structures.Map_Items Item = new Lists.Structures.Map_Items();

        // Verifica se tem algum atributo de item no mapa
        for (byte x = 0; x <= Data.Width; x++)
        {
            for (byte y = 0; y <= Data.Height; y++)
            {
                if (Data.Tile[x, y].Attribute == (byte)Attributes.Item)
                {
                    // Faz o item aparecer
                    Item.Index  = Data.Tile[x, y].Data_1;
                    Item.Amount = Data.Tile[x, y].Data_2;
                    Item.X      = x;
                    Item.Y      = y;
                    Lists.Temp_Map[Map_Num].Item.Add(Item);
                }
            }
        }
    }
Ejemplo n.º 2
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);
                        }
                    }
                }
            }
        }
    }