Exemple #1
0
 public void SetAllToGrass()
 {
     for (int x = 0; x < this.MapSizeX; x++)
     {
         for (int y = 0; y < this.MapSizeY; y++)
         {
             TileEnc t = new TileEnc();
             encounterTiles.Add(t);
         }
     }
 }
 private void btnPlusTopY_Click(object sender, EventArgs e)
 {
     //y * area.MapSizeX + x
     for (int i = 0; i < thisEnc.MapSizeX; i++)
     {
         TileEnc newTile = new TileEnc();
         thisEnc.encounterTiles.Insert(0, newTile);
     }
     /*TODOforeach (Prop prpRef in thisEnc.Props)
     {
         prpRef.LocationY++;
     }
     foreach (Trigger t in thisEnc.Triggers)
     {
         foreach (Coordinate p in t.TriggerSquaresList)
         {
             p.Y++;
         }
     }*/
     thisEnc.MapSizeY++;
     mapSizeChangeStuff();
 }
Exemple #3
0
        public Encounter DeepCopy()
        {
            Encounter copy = new Encounter();

            copy = (Encounter)this.MemberwiseClone();

            copy.encounterTiles = new List <TileEnc>();
            foreach (TileEnc s in this.encounterTiles)
            {
                TileEnc newTileEnc = new TileEnc();
                newTileEnc.Layer1Filename = s.Layer1Filename;
                newTileEnc.Layer2Filename = s.Layer2Filename;
                newTileEnc.Layer3Filename = s.Layer3Filename;
                newTileEnc.LoSBlocked     = s.LoSBlocked;
                newTileEnc.Walkable       = s.Walkable;
                copy.encounterTiles.Add(newTileEnc);
            }

            copy.encounterCreatureRefsList = new List <CreatureRefs>();
            foreach (CreatureRefs s in this.encounterCreatureRefsList)
            {
                CreatureRefs newCrtRef = new CreatureRefs();
                newCrtRef.creatureResRef         = s.creatureResRef;
                newCrtRef.creatureTag            = s.creatureTag;
                newCrtRef.creatureStartLocationX = s.creatureStartLocationX;
                newCrtRef.creatureStartLocationY = s.creatureStartLocationY;
                copy.encounterCreatureRefsList.Add(newCrtRef);
            }

            copy.encounterCreatureList = new List <string>();
            foreach (string s in this.encounterCreatureList)
            {
                copy.encounterCreatureList.Add(s);
            }

            copy.Triggers = new List <Trigger>();
            foreach (Trigger t in this.Triggers)
            {
                copy.Triggers.Add(t);
            }

            copy.propsList = new List <Prop>();
            foreach (Prop p in this.propsList)
            {
                copy.propsList.Add(p);
            }

            copy.encounterInventoryRefsList = new List <ItemRefs>();
            foreach (ItemRefs s in this.encounterInventoryRefsList)
            {
                ItemRefs newItRef = new ItemRefs();
                newItRef = s.DeepCopy();
                copy.encounterInventoryRefsList.Add(newItRef);
            }

            copy.encounterPcStartLocations = new List <Coordinate>();
            foreach (Coordinate s in this.encounterPcStartLocations)
            {
                Coordinate newCoor = new Coordinate();
                newCoor.X = s.X;
                newCoor.Y = s.Y;
                copy.encounterPcStartLocations.Add(newCoor);
            }

            return(copy);
        }
 private void btnPlusLeftX_Click(object sender, EventArgs e)
 {
     //y * area.MapSizeX + x
     int oldX = thisEnc.MapSizeX;
     for (int i = thisEnc.encounterTiles.Count - oldX; i >= 0; i -= oldX)
     {
         TileEnc newTile = new TileEnc();
         thisEnc.encounterTiles.Insert(i, newTile);
     }
     /*TODOforeach (Prop prpRef in thisEnc.Props)
     {
         prpRef.LocationX++;
     }
     foreach (Trigger t in thisEnc.Triggers)
     {
         foreach (Coordinate p in t.TriggerSquaresList)
         {
             p.X++;
         }
     }*/
     thisEnc.MapSizeX++;
     mapSizeChangeStuff();
 }
 private void btnPlusRightX_Click(object sender, EventArgs e)
 {
     //y * area.MapSizeX + x
     int oldX = thisEnc.MapSizeX;
     for (int i = thisEnc.encounterTiles.Count - 1; i >= 0; i -= oldX)
     {
         TileEnc newTile = new TileEnc();
         thisEnc.encounterTiles.Insert(i + 1, newTile);
     }
     thisEnc.MapSizeX++;
     mapSizeChangeStuff();
 }
 private void btnPlusBottumY_Click(object sender, EventArgs e)
 {
     //y * area.MapSizeX + x
     for (int i = 0; i < thisEnc.MapSizeX; i++)
     {
         TileEnc newTile = new TileEnc();
         thisEnc.encounterTiles.Add(newTile);
     }
     thisEnc.MapSizeY++;
     mapSizeChangeStuff();
 }
 private void resetAreaTileValues(int width, int height)
 {
     thisEnc.MapSizeX = width;
     thisEnc.MapSizeY = height;
     thisEnc.encounterTiles.Clear();
     for (int index = 0; index < (width * height); index++)
     {
         TileEnc newTile = new TileEnc();
         newTile.Walkable = true;
         newTile.LoSBlocked = false;
         thisEnc.encounterTiles.Add(newTile);
     }
 }
        /*private void openLevel(string g_dir, string g_fil, string g_filNoEx)
        {
            this.Cursor = Cursors.WaitCursor;

            try
            {
                area = area.loadAreaFile(g_dir + "\\" + g_fil + ".lvl");
                if (area == null)
                {
                    MessageBox.Show("returned a null area");
                }
                loadAreaObjectBitmapLists();
            }
            catch (Exception ex)
            {
                MessageBox.Show("failed to open file: " + ex.ToString());
            }

            refreshLeftPanelInfo();
            panelView.Width = area.MapSizeX * sqr;
            panelView.Height = area.MapSizeY * sqr;
            panelView.BackgroundImage = (Image)surface;
            device = Graphics.FromImage(surface);
            if (surface == null)
            {
                MessageBox.Show("returned a null Map bitmap");
                return;
            }
            refreshMap(true);
            this.Cursor = Cursors.Arrow;
        }*/
        private void createNewArea(int width, int height)
        {
            //create tilemap
            thisEnc = null;
            thisEnc = new Encounter();
            thisEnc.MapSizeX = width;
            thisEnc.MapSizeY = height;
            for (int index = 0; index < (width * height); index++)
            {
                TileEnc newTile = new TileEnc();
                newTile.Walkable = true;
                newTile.LoSBlocked = false;
                thisEnc.encounterTiles.Add(newTile);
            }
            refreshLeftPanelInfo();
            panelView.Width = thisEnc.MapSizeX * sqr;
            panelView.Height = thisEnc.MapSizeY * sqr;
            panelView.BackgroundImage = (Image)surface;
            device = Graphics.FromImage(surface);
            if (surface == null)
            {
                MessageBox.Show("returned a null Map bitmap");
                return;
            }
            refreshMap(true);
        }
Exemple #9
0
 public void SetAllToGrass()
 {
     for (int x = 0; x < this.MapSizeX; x++)
     {
         for (int y = 0; y < this.MapSizeY; y++)
         {
             TileEnc t = new TileEnc();
             encounterTiles.Add(t);
         }
     }
 }
Exemple #10
0
        public Encounter DeepCopy()
        {
            Encounter copy = new Encounter();
            copy = (Encounter)this.MemberwiseClone();

            copy.encounterTiles = new List<TileEnc>();
            foreach (TileEnc s in this.encounterTiles)
            {
                TileEnc newTileEnc = new TileEnc();
                newTileEnc.Layer1Filename = s.Layer1Filename;
                newTileEnc.Layer2Filename = s.Layer2Filename;
                newTileEnc.LoSBlocked = s.LoSBlocked;
                newTileEnc.Walkable = s.Walkable;
                copy.encounterTiles.Add(newTileEnc);
            }

            copy.encounterCreatureRefsList = new List<CreatureRefs>();
            foreach (CreatureRefs s in this.encounterCreatureRefsList)
            {
                CreatureRefs newCrtRef = new CreatureRefs();
                newCrtRef.creatureResRef = s.creatureResRef;
                newCrtRef.creatureTag = s.creatureTag;
                newCrtRef.creatureStartLocationX = s.creatureStartLocationX;
                newCrtRef.creatureStartLocationY = s.creatureStartLocationY;
                copy.encounterCreatureRefsList.Add(newCrtRef);
            }

            copy.encounterCreatureList = new List<string>();
            foreach (string s in this.encounterCreatureList)
            {
                copy.encounterCreatureList.Add(s);
            }

            copy.encounterInventoryRefsList = new List<ItemRefs>();
            foreach (ItemRefs s in this.encounterInventoryRefsList)
            {
                ItemRefs newItRef = new ItemRefs();
                newItRef = s.DeepCopy();
                copy.encounterInventoryRefsList.Add(newItRef);
            }

            copy.encounterPcStartLocations = new List<Coordinate>();
            foreach (Coordinate s in this.encounterPcStartLocations)
            {
                Coordinate newCoor = new Coordinate();
                newCoor.X = s.X;
                newCoor.Y = s.Y;
                copy.encounterPcStartLocations.Add(newCoor);
            }

            return copy;
        }