Exemplo n.º 1
0
        public void Picscreen_MouseUp(object sender, MouseEventArgs e)
        {
            // do a re-init so we can see our changes
            E_AutoTiles.InitAutotiles();

            E_Globals.CurX = E_Globals.TileView.Left + ((e.Location.X + E_Globals.Camera.Left) / E_Globals.PIC_X);
            E_Globals.CurY = E_Globals.TileView.Top + ((e.Location.Y + E_Globals.Camera.Top) / E_Globals.PIC_Y);
        }
Exemplo n.º 2
0
        public void BtnSetSize_Click(object sender, EventArgs e)
        {
            int X  = 0;
            int x2 = 0;
            int i  = 0;
            int Y  = 0;
            int y2 = 0;

            Types.TileRec[,] tempArr;

            if (nudMaxX.Value < E_Globals.SCREEN_MAPX)
            {
                nudMaxX.Value = E_Globals.SCREEN_MAPX;
            }
            if (nudMaxY.Value < E_Globals.SCREEN_MAPY)
            {
                nudMaxY.Value = E_Globals.SCREEN_MAPY;
            }

            E_Globals.GettingMap = true;

            // set the data before changing it
            tempArr = new Types.TileRec[E_Types.Map.MaxX + 1, E_Types.Map.MaxY + 1];
            for (X = 0; X <= E_Types.Map.MaxX; X++)
            {
                for (Y = 0; Y <= E_Types.Map.MaxY; Y++)
                {
                    tempArr[X, Y].Layer = new Types.TileDataRec[(int)Enums.LayerType.Count];

                    tempArr[X, Y].Data1    = E_Types.Map.Tile[X, Y].Data1;
                    tempArr[X, Y].Data2    = E_Types.Map.Tile[X, Y].Data2;
                    tempArr[X, Y].Data3    = E_Types.Map.Tile[X, Y].Data3;
                    tempArr[X, Y].DirBlock = E_Types.Map.Tile[X, Y].DirBlock;
                    tempArr[X, Y].Type     = E_Types.Map.Tile[X, Y].Type;

                    for (i = 1; i <= (int)Enums.LayerType.Count - 1; i++)
                    {
                        tempArr[X, Y].Layer[i].AutoTile = E_Types.Map.Tile[X, Y].Layer[i].AutoTile;
                        tempArr[X, Y].Layer[i].Tileset  = E_Types.Map.Tile[X, Y].Layer[i].Tileset;
                        tempArr[X, Y].Layer[i].X        = E_Types.Map.Tile[X, Y].Layer[i].X;
                        tempArr[X, Y].Layer[i].Y        = E_Types.Map.Tile[X, Y].Layer[i].Y;
                    }
                }
            }

            x2 = E_Types.Map.MaxX;
            y2 = E_Types.Map.MaxY;
            // change the data
            E_Types.Map.MaxX = (byte)nudMaxX.Value;
            E_Types.Map.MaxY = (byte)nudMaxY.Value;

            E_Types.Map.Tile     = new Types.TileRec[E_Types.Map.MaxX + 1, E_Types.Map.MaxY + 1];
            E_AutoTiles.Autotile = new E_AutoTiles.AutotileRec[E_Types.Map.MaxX + 1, E_Types.Map.MaxY + 1];

            if (x2 > E_Types.Map.MaxX)
            {
                x2 = E_Types.Map.MaxX;
            }
            if (y2 > E_Types.Map.MaxY)
            {
                y2 = E_Types.Map.MaxY;
            }

            for (X = 0; X <= E_Types.Map.MaxX; X++)
            {
                for (Y = 0; Y <= E_Types.Map.MaxY; Y++)
                {
                    Array.Resize(ref E_Types.Map.Tile[X, Y].Layer, (int)Enums.LayerType.Count);

                    Array.Resize(ref E_AutoTiles.Autotile[X, Y].Layer, (int)Enums.LayerType.Count);

                    if (X <= x2)
                    {
                        if (Y <= y2)
                        {
                            E_Types.Map.Tile[X, Y].Data1    = tempArr[X, Y].Data1;
                            E_Types.Map.Tile[X, Y].Data2    = tempArr[X, Y].Data2;
                            E_Types.Map.Tile[X, Y].Data3    = tempArr[X, Y].Data3;
                            E_Types.Map.Tile[X, Y].DirBlock = tempArr[X, Y].DirBlock;
                            E_Types.Map.Tile[X, Y].Type     = tempArr[X, Y].Type;

                            for (i = 1; i <= (int)Enums.LayerType.Count - 1; i++)
                            {
                                E_Types.Map.Tile[X, Y].Layer[i].AutoTile = tempArr[X, Y].Layer[i].AutoTile;
                                E_Types.Map.Tile[X, Y].Layer[i].Tileset  = tempArr[X, Y].Layer[i].Tileset;
                                E_Types.Map.Tile[X, Y].Layer[i].X        = tempArr[X, Y].Layer[i].X;
                                E_Types.Map.Tile[X, Y].Layer[i].Y        = tempArr[X, Y].Layer[i].Y;
                            }
                        }
                    }
                }
            }
            E_AutoTiles.InitAutotiles();
            ClientDataBase.ClearTempTile();
            //MapEditorSend()

            E_Globals.GettingMap = false;
        }