setTile() public method

public setTile ( int x, int y, int val ) : void
x int
y int
val int
return void
Exemplo n.º 1
0
            public void undo()
            {
                MapLayer ml = (MapLayer)whichMap.Layers[l];

                ml.setTile(x, y, old);
                Global.mapViewer.Invalidate();
                //?
                //				if(whichMap == Global.ActiveMap)
                //					whichMap.touch();
            }
Exemplo n.º 2
0
            public void exec()
            {
                MapLayer ml = (MapLayer)whichMap.Layers[l];

                old = ml.getTile(x, y);
                ml.setTile(x, y, v);
                if (whichMap == Global.ActiveMap)
                {
                    whichMap.touch();
                }
            }
Exemplo n.º 3
0
 public void exec()
 {
     foreach (Rec r in recs)
     {
         MapLayer ml = (MapLayer)whichMap.Layers[r.l];
         r.old = ml.getTile(r.x, r.y);
         ml.setTile(r.x, r.y, r.v);
     }
     if (whichMap == Global.ActiveMap)
     {
         whichMap.touch();
     }
 }
Exemplo n.º 4
0
        private void b_delzone_Click(object sender, System.EventArgs e)
        {
            if (lv_zones.SelectedItems.Count == 0)
            {
                return;
            }
            MapZone mz = (MapZone)lv_zones.SelectedItems[0].Tag;

            if (MessageBox.Show("Are you sure you want to delete Zone #" + mz.ID + "? This action can not be undone. \r\nWARNING: If there are zones in the list with a higher ID than this zone, they will be shifted down and will henceforth have a different ID. \r\nYou will be given the option to reindex existing map zones, so that your indices do not become invalid.", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning)
                == DialogResult.Cancel)
            {
                return;
            }
            zoneCopy.Remove(mz);
            bool reindex = false;

            if (MessageBox.Show("The zone has been deleted. Do you wish for MapEd to reindex existing zones on your map?\r\nOn larger maps, this may take a moment.\r\nIf you have any existing VC code that relies on the event numbers, do not forget to update that as well!", "Reorder zones?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                == DialogResult.Yes)
            {
                reindex = true;
            }
            int t = 0;

            for (int y = 0; y < zoneLayerCopy.Height; y++)
            {
                for (int x = 0; x < zoneLayerCopy.Width; x++)
                {
                    if (zoneLayerCopy.getTile(x, y) == mz.ID)
                    {
                        zoneLayerCopy.setTile(x, y, 0);
                    }
                    else if ((t = zoneLayerCopy.getTile(x, y)) > mz.ID && reindex)
                    {
                        zoneLayerCopy.setTile(x, y, t - 1);
                    }
                }
            }
            update_zoneIDs();
        }
Exemplo n.º 5
0
            public void undo()
            {
                for (int i = 0; i < recs.Count; i++)
                {
                    Rec      r  = (Rec)recs[recs.Count - i - 1];
                    MapLayer ml = (MapLayer)whichMap.Layers[r.l];
                    ml.setTile(r.x, r.y, r.old);
                }

                if (whichMap == Global.ActiveMap)
                {
                    whichMap.touch();
                }
            }
Exemplo n.º 6
0
 public void ModifyTile(MapLayer ml, int x, int y, int newtile)
 {
     ml.setTile(x, y, newtile);
 }
Exemplo n.º 7
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            Capture = false;
            trackingMouse = false;
            if (trackingDrag)
            {
                trackingDrag = false;

                int _x0 = dragStart.X;
                int _y0 = (dragStart.Y);
                int _x1 = (dragEnd.X);
                int _y1 = (dragEnd.Y);
                int x0 = Math.Min(_x0, _x1);
                int x1 = Math.Max(_x0, _x1);
                int y0 = Math.Min(_y0, _y1);
                int y1 = Math.Max(_y0, _y1);

                Map m = new Map();
                MapLayer ml = new MapLayer(m);
                ml.resize(x1 - x0 + 1, y1 - y0 + 1);
                for (int y = y0; y <= y1; y++)
                {
                    for (int x = x0; x <= x1; x++)
                    {
                        //((scrollOffset / Global.TILE_SIZE) + (my / Global.TILE_SIZE)) * TilesWide + (mx / Global.TILE_SIZE);
                        int tile = y * TilesWide + x + (scrollOffset / Global.TILE_SIZE * TilesWide);
                        ml.setTile(x - x0, y - y0, tile);
                    }
                }
                m.AddLayer(ml);
                m.IsBrush = true;
                m.vsp = vsp;
                Global.clipboard = m;
            }
        }
Exemplo n.º 8
0
 public void ModifyTile(MapLayer ml, int x, int y, int newtile)
 {
     ml.setTile(x, y, newtile);
 }