getTile() public method

public getTile ( int x, int y ) : int
x int
y int
return int
Example #1
0
        void executeMove()
        {
            Map   map = Global.ActiveMap;
            Vsp24 vsp = Global.ActiveVsp;

            Operations.OperationManager om = Global.opManager;

            om.beginGroup("VSP Manager: Smart Tile Move");

            Ops.SetTileGroup     stg  = new Ops.SetTileGroup(0);
            Ops.SetTiledataGroup stdg = new Ops.SetTiledataGroup(Global.ActiveVsp);

            //move tiles
            for (int y = 0; y < originalSelection.height; y++)
            {
                for (int x = 0; x < originalSelection.width; x++)
                {
                    int xs = x + originalSelection.x;
                    int ys = y + originalSelection.y;
                    int xd = x + selection.x;
                    int yd = y + selection.y;
                    int ts = ys * TilesWide + xs;
                    int td = yd * TilesWide + xd;

                    if (ts >= vsp.Tiles.Count || ts < 0)
                    {
                        continue;
                    }

                    stdg.addRecord(td, ((Vsp24Tile)vsp.Tiles[ts]).Image.GetArray());

                    for (int l = 0; l < map.Layers.Count; l++)
                    {
                        MapLayer ml = (MapLayer)map.Layers[l];
                        if (ml.type != LayerType.Tile)
                        {
                            continue;
                        }
                        for (int yi = 0; yi < ml.Height; yi++)
                        {
                            for (int xi = 0; xi < ml.Width; xi++)
                            {
                                int t = ml.getTile(xi, yi);
                                if (t == ts)
                                {
                                    stg.addRecord(l, xi, yi, td);
                                }
                            }
                        }
                    }
                }
            }

            om.add(stg);
            om.add(stdg);
            om.endGroupExec();
        }
Example #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();
                }
            }
Example #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();
     }
 }
Example #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();
        }