Esempio n. 1
0
        private void btn_testDirections_Click(object sender, EventArgs e)
        {
            RandomizerModWorldScreen currentWS = _randomizerMod.WorldScreens[_selectedWorldScreenIndex];
            RandomizerModWorldScreen rightWS   = _randomizerMod.WorldScreens[currentWS.ScreenIndexRight];
            RandomizerModWorldScreen leftWS    = _randomizerMod.WorldScreens[currentWS.ScreenIndexLeft];
            RandomizerModWorldScreen topWS     = _randomizerMod.WorldScreens[currentWS.ScreenIndexUp];
            RandomizerModWorldScreen bottomWS  = _randomizerMod.WorldScreens[currentWS.ScreenIndexDown];

            bool rightScreenIsCompatable  = currentWS.CollisionTest_Right_IsCompatable(rightWS);
            bool leftScreenIsCompatable   = currentWS.CollisionTest_Left_IsCompatable(leftWS);
            bool topScreenIsCompatable    = currentWS.CollisionTest_Up_IsCompatable(topWS);
            bool bottomScreenIsCompatable = currentWS.CollisionTest_Down_IsCompatable(bottomWS);

            if (!rightScreenIsCompatable)
            {
                tb_direction_right.BackColor = Color.Red;
            }

            if (!leftScreenIsCompatable)
            {
                tb_direction_left.BackColor = Color.Red;
            }

            if (!topScreenIsCompatable)
            {
                tb_direction_up.BackColor = Color.Red;
            }

            if (!bottomScreenIsCompatable)
            {
                tb_direction_down.BackColor = Color.Red;
            }
        }
Esempio n. 2
0
 public void UpdateDirectionSection(RandomizerModWorldScreen worldScreen)
 {
     tb_direction_up.Text    = worldScreen.ScreenIndexUp.ToString("X2");
     tb_direction_down.Text  = worldScreen.ScreenIndexDown.ToString("X2");
     tb_direction_left.Text  = worldScreen.ScreenIndexLeft.ToString("X2");
     tb_direction_right.Text = worldScreen.ScreenIndexRight.ToString("X2");
 }
Esempio n. 3
0
        private void SaveRom(string path)
        {
            //Update _currentRom
            for (int i = 0; i < _randomizerMod.WorldScreens.Length; i++)
            {
                RandomizerModWorldScreen ws = _randomizerMod.WorldScreens[i];
                _currentRom.SaveWorldScreen(i, RandomizerMod.RandomizerWorldScreenToTmosWorldScreen(ws));
            }
            _currentRom.WriteRom(path);

            // FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
        }
Esempio n. 4
0
        /// <summary>
        /// Draws striaght from TMOS ROM instead of using RandomizerMod classes
        /// </summary>
        /// <param name="worldScreenTiles"></param>
        //private void DrawWorldScreenTiles(TmosWorldScreenTiles worldScreenTiles)
        //{
        //    pb_map.Image = new Bitmap(pb_map.Width, pb_map.Height);

        //    int tile_size = 100;
        //    byte[,] grid = worldScreenTiles.GetTileGrid();
        //    using (var g = Graphics.FromImage(pb_map.Image))
        //    {
        //        g.Clear(Color.LightGray);

        //        for (int y = 0; y < 6; y++)
        //        {
        //            for (int x = 0; x < 8; x++)
        //            {
        //                Point location = new Point(tile_size * x, tile_size * y);

        //                Size size = new Size(tile_size, tile_size);
        //                Rectangle rect = new Rectangle(location, size);
        //                g.DrawRectangle(Pens.Black, rect);


        //                Font font = new Font("Arial", 7);
        //                Brush brush = Pens.Black.Brush;
        //                g.DrawString(grid[x, y].ToString("X6"),font,brush,location.X + 20,location.Y + 20);
        //            }
        //        }
        //        pb_map.Refresh();
        //    }

        //}

        //private void DrawWorldScreenMiniTiles(TmosWorldScreenTiles worldScreenTiles)
        //{
        //    pb_map.Image = new Bitmap(pb_map.Width, pb_map.Height);

        //    int tile_size = 100;
        //    byte[,] grid = worldScreenTiles.GetTileGrid(0);
        //    using (var g = Graphics.FromImage(pb_map.Image))
        //    {
        //        g.Clear(Color.LightGray);

        //        for (int y = 0; y < 6; y++)
        //        {
        //            for (int x = 0; x < 8; x++)
        //            {
        //                Point location = new Point(tile_size * x, tile_size * y);
        //                Size size = new Size(tile_size, tile_size);
        //                Rectangle rect = new Rectangle(location, size);
        //                g.DrawRectangle(Pens.Black, rect);
        //                 g.DrawRectangle(Pens.Black, rect);

        //                Font font = new Font("Arial", 7);
        //                Brush brush = Pens.Black.Brush;
        //                g.DrawString(grid[x, y].ToString("X6"), font, brush, location.X + 20, location.Y + 20);
        //            }
        //        }
        //        pb_map.Refresh();
        //    }

        //}

        private void SelectWorldScreen(int index)
        {
            RandomizerModWorldScreen selectedScreen = _randomizerMod.WorldScreens[index];

            // UpdateWorldScreenDataTextbox(selectedScreen);

            UpdateWorldScreenDataListView(selectedScreen);

            UpdateDirectionSection(selectedScreen);

            UpdateTileSectionListBoxesSelection(selectedScreen);

            DrawWorldScreenTiles(selectedScreen);
        }
Esempio n. 5
0
        private void UpdateWorldScreenDataTextbox(RandomizerModWorldScreen worldScreen)
        {
            tb_output.Clear();

            tb_output.Text += "ParentWorld: " + worldScreen.ParentWorld + Environment.NewLine;
            tb_output.Text += "AmbientSound: " + worldScreen.AmbientSound + Environment.NewLine;
            tb_output.Text += "Content: " + worldScreen.GetContentValue() + " (" + worldScreen.GetContentName() + ")" + Environment.NewLine;
            tb_output.Text += "ObjectSet: " + worldScreen.ObjectSet + Environment.NewLine;
            tb_output.Text += "ScreenIndexRight: " + worldScreen.ScreenIndexRight + Environment.NewLine;
            tb_output.Text += "ScreenIndexLeft: " + worldScreen.ScreenIndexLeft + Environment.NewLine;
            tb_output.Text += "ScreenIndexDown: " + worldScreen.ScreenIndexDown + Environment.NewLine;
            tb_output.Text += "ScreenIndexUp: " + worldScreen.ScreenIndexUp + Environment.NewLine;
            tb_output.Text += "DataPointer: " + worldScreen.DataPointer + Environment.NewLine;
            tb_output.Text += "ExitPosition: " + worldScreen.ExitPosition + Environment.NewLine;
            tb_output.Text += "TopTiles: " + worldScreen.TopTiles + Environment.NewLine;       //Showing just the byte value here, even though we have the TileSection objects which can give more info
            tb_output.Text += "BottomTiles: " + worldScreen.BottomTiles + Environment.NewLine; //Showing just the byte value here, even though we have the TileSection objects which can give more info
            tb_output.Text += "WorldScreenColor: " + worldScreen.WorldScreenColor + Environment.NewLine;
            tb_output.Text += "SpritesColor: " + worldScreen.SpritesColor + Environment.NewLine;
            tb_output.Text += "Unknown: " + worldScreen.Unknown + Environment.NewLine;
            tb_output.Text += "Event: " + worldScreen.Event + Environment.NewLine;
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Save Modified WS Directions
            try
            {
                RandomizerModWorldScreen currentWS = _randomizerMod.WorldScreens[_selectedWorldScreenIndex];

                currentWS.ScreenIndexUp = Convert.ToByte(tb_direction_up.Text);

                RandomizerModWorldScreen destinationWS = _randomizerMod.WorldScreens[currentWS.ScreenIndexUp];

                if (cb_link_back.Checked)
                {
                    destinationWS.ScreenIndexDown = (byte)_selectedWorldScreenIndex;
                }
            }
            catch { }

            try
            {
                RandomizerModWorldScreen currentWS = _randomizerMod.WorldScreens[_selectedWorldScreenIndex];

                currentWS.ScreenIndexDown = Convert.ToByte(tb_direction_down.Text);

                RandomizerModWorldScreen destinationWS = _randomizerMod.WorldScreens[currentWS.ScreenIndexDown];

                if (cb_link_back.Checked)
                {
                    destinationWS.ScreenIndexUp = (byte)_selectedWorldScreenIndex;
                }
            }
            catch { }

            try
            {
                RandomizerModWorldScreen currentWS = _randomizerMod.WorldScreens[_selectedWorldScreenIndex];

                currentWS.ScreenIndexRight = Convert.ToByte(tb_direction_right.Text);

                RandomizerModWorldScreen destinationWS = _randomizerMod.WorldScreens[currentWS.ScreenIndexRight];

                if (cb_link_back.Checked)
                {
                    destinationWS.ScreenIndexLeft = (byte)_selectedWorldScreenIndex;
                }
            }
            catch { }

            try
            {
                RandomizerModWorldScreen currentWS = _randomizerMod.WorldScreens[_selectedWorldScreenIndex];

                currentWS.ScreenIndexLeft = Convert.ToByte(tb_direction_left.Text);

                RandomizerModWorldScreen destinationWS = _randomizerMod.WorldScreens[currentWS.ScreenIndexLeft];

                if (cb_link_back.Checked)
                {
                    destinationWS.ScreenIndexRight = (byte)_selectedWorldScreenIndex;
                }
            }
            catch { }
        }
Esempio n. 7
0
 private void UpdateTileSectionListBoxesSelection(RandomizerModWorldScreen worldScreen)
 {
     lb_tileSection_top.SelectedIndex    = Convert.ToInt32(worldScreen.TopTiles);
     lb_tileSection_bottom.SelectedIndex = Convert.ToInt32(worldScreen.BottomTiles);
 }
Esempio n. 8
0
        private void UpdateWorldScreenDataListView(RandomizerModWorldScreen worldScreen)
        {
            lv_variables.Items[0].SubItems[1].Text  = worldScreen.ParentWorld.ToString("X2");
            lv_variables.Items[1].SubItems[1].Text  = worldScreen.AmbientSound.ToString("X2");
            lv_variables.Items[2].SubItems[1].Text  = worldScreen.GetContentValue().ToString("X2");
            lv_variables.Items[3].SubItems[1].Text  = worldScreen.ObjectSet.ToString("X2");
            lv_variables.Items[4].SubItems[1].Text  = worldScreen.ScreenIndexRight.ToString("X2");
            lv_variables.Items[5].SubItems[1].Text  = worldScreen.ScreenIndexLeft.ToString("X2");
            lv_variables.Items[6].SubItems[1].Text  = worldScreen.ScreenIndexDown.ToString("X2");
            lv_variables.Items[7].SubItems[1].Text  = worldScreen.ScreenIndexUp.ToString("X2");
            lv_variables.Items[8].SubItems[1].Text  = worldScreen.DataPointer.ToString("X2");
            lv_variables.Items[9].SubItems[1].Text  = worldScreen.ExitPosition.ToString("X2");
            lv_variables.Items[10].SubItems[1].Text = worldScreen.TopTiles.ToString("X2");
            lv_variables.Items[11].SubItems[1].Text = worldScreen.BottomTiles.ToString("X2");
            lv_variables.Items[12].SubItems[1].Text = worldScreen.WorldScreenColor.ToString("X2");
            lv_variables.Items[13].SubItems[1].Text = worldScreen.SpritesColor.ToString("X2");
            lv_variables.Items[14].SubItems[1].Text = worldScreen.Unknown.ToString("X2");
            lv_variables.Items[15].SubItems[1].Text = worldScreen.Event.ToString("X2");



            var CONTENTINDEX = 2;

            //hints
            //content
            lv_variables.Items[CONTENTINDEX].SubItems[2].Text = worldScreen.GetContentName();


            ////objectSets
            //if (KnownObjectSets.ContainsKey(ws.ObjectSet.ToString("X2"))) lv_variables.Items[(int)WorldScreen.DataContent.ObjectSet].SubItems[2].Text = KnownObjectSets[ws.ObjectSet.ToString("X2")];
            //else lv_variables.Items[(int)WorldScreen.DataContent.ObjectSet].SubItems[2].Text = "?";

            ////events
            //if (KnownEvents.ContainsKey(ws.Event.ToString("X2"))) lv_variables.Items[(int)WorldScreen.DataContent.Event].SubItems[2].Text = KnownEvents[ws.Event.ToString("X2")];
            //else lv_variables.Items[(int)WorldScreen.DataContent.Event].SubItems[2].Text = "?";

            ////screenexits
            //if (KnownScreenExits.ContainsKey(ws.ScreenIndexLeft.ToString("X2"))) lv_variables.Items[(int)WorldScreen.DataContent.ScreenIndexLeft].SubItems[2].Text = KnownScreenExits[ws.ScreenIndexLeft.ToString("X2")];
            //else lv_variables.Items[(int)WorldScreen.DataContent.ScreenIndexLeft].SubItems[2].Text = "enter screen " + ws.ScreenIndexLeft.ToString("X2");

            //if (KnownScreenExits.ContainsKey(ws.ScreenIndexRight.ToString("X2"))) lv_variables.Items[(int)WorldScreen.DataContent.ScreenIndexRight].SubItems[2].Text = KnownScreenExits[ws.ScreenIndexRight.ToString("X2")];
            //else lv_variables.Items[(int)WorldScreen.DataContent.ScreenIndexRight].SubItems[2].Text = "enter screen " + ws.ScreenIndexRight.ToString("X2");

            //if (KnownScreenExits.ContainsKey(ws.ScreenIndexUp.ToString("X2"))) lv_variables.Items[(int)WorldScreen.DataContent.ScreenIndexUp].SubItems[2].Text = KnownScreenExits[ws.ScreenIndexUp.ToString("X2")];
            //else lv_variables.Items[(int)WorldScreen.DataContent.ScreenIndexUp].SubItems[2].Text = "enter screen " + ws.ScreenIndexUp.ToString("X2");

            //if (KnownScreenExits.ContainsKey(ws.ScreenIndexDown.ToString("X2"))) lv_variables.Items[(int)WorldScreen.DataContent.ScreenIndexDown].SubItems[2].Text = KnownScreenExits[ws.ScreenIndexDown.ToString("X2")];
            //else lv_variables.Items[(int)WorldScreen.DataContent.ScreenIndexDown].SubItems[2].Text = "enter screen " + ws.ScreenIndexDown.ToString("X2");



            //lv_worldScreens.Items.Clear();
            //string[] data = new string[] {

            //    lv_variables

            //     worldScreen.ParentWorld.ToString("X2"),
            //     worldScreen.AmbientSound.ToString("X2"),
            //     worldScreen.GetContentValue().ToString("X2"),
            //     worldScreen.ObjectSet.ToString("X2"),
            //     worldScreen.ScreenIndexRight.ToString("X2"),
            //     worldScreen.ScreenIndexLeft.ToString("X2"),
            //     worldScreen.ScreenIndexDown.ToString("X2"),
            //     worldScreen.ScreenIndexUp.ToString("X2"),
            //     worldScreen.DataPointer.ToString("X2"),
            //     worldScreen.ExitPosition.ToString("X2"),
            //     worldScreen.TopTiles.ToString("X2"),
            //    worldScreen.BottomTiles.ToString("X2"),
            //    worldScreen.WorldScreenColor.ToString("X2"),
            //    worldScreen.SpritesColor.ToString("X2"),
            //    worldScreen.Unknown.ToString("X2"),
            //    worldScreen.Event.ToString("X2")
            //        };
            //     lv_worldScreens.Items.Add(" ").SubItems.AddRange(data);
        }
Esempio n. 9
0
        private void RefreshWorldScreenDrawing()
        {
            RandomizerModWorldScreen selectedScreen = _randomizerMod.WorldScreens[_selectedWorldScreenIndex];

            DrawWorldScreenTiles(selectedScreen);
        }
Esempio n. 10
0
        private void DrawWorldScreenTiles(RandomizerModWorldScreen randomizerWorldScreen)
        {
            pb_map.Image = new Bitmap(pb_map.Width, pb_map.Height);

            int tile_size = 100;

            //calculate tile offsets based on ws data pointer


            Tile[,] grid = randomizerWorldScreen.GetTileGrid();

            //border screens
            Tile[,] grid_wsRight = _randomizerMod.WorldScreens[randomizerWorldScreen.ScreenIndexRight].GetTileGrid();


            using (var g = Graphics.FromImage(pb_map.Image))
            {
                g.Clear(Color.LightGray);

                for (int y = 0; y < 6; y++)
                {
                    for (int x = 0; x < 8; x++)
                    {
                        Point     location = new Point(tile_size * x, tile_size * y);
                        Size      size     = new Size(tile_size, tile_size);
                        Rectangle rect     = new Rectangle(location, size);

                        g.DrawRectangle(Pens.Black, rect);

                        Font  font  = new Font("Arial", 7);
                        Brush brush = Pens.Black.Brush;


                        Tile tile      = grid[x, y];
                        byte tileValue = RandomizerModWorldScreen.GetTileValue(tile);

                        if (!RandomizerModWorldScreen.TileIsWalkable(tile))
                        {
                            g.DrawRectangle(Pens.Red, rect);
                        }


                        if (TileImagePaths.ContainsKey(grid[x, y]))
                        {
                            try
                            {
                                string tileImagePath = TileImagePaths[tile];
                                Image  image         = new Bitmap("TileImages/" + TileImagePaths[tile]);
                                g.DrawImage(image, rect);
                            }
                            catch { }
                        }

                        g.DrawString(RandomizerModWorldScreen.GetTileName(grid[x, y]), font, brush, location.X + 20, location.Y + 20);
                        g.DrawString(RandomizerModWorldScreen.GetTileValue(grid[x, y]).ToString("X6"), font, brush, location.X + 20, location.Y + 40);
                    }
                }



                pb_map.Refresh();
            }
        }