Ejemplo n.º 1
0
        /** <summary> Loads the specified maze into the editor. </summary> */
        public void LoadMaze(TrackDesign maze)
        {
            if (maze.TrackType == TrackTypes.HedgeMaze)
            {
                for (int x = 0; x < this.blocks.GetLength(0); x++)
                {
                    for (int y = 0; y < this.blocks.GetLength(1); y++)
                    {
                        this.blocks[x, y] = new MazeBlock();
                    }
                }

                Point offset = Point.Empty;
                for (int i = 0; i < maze.MazeTiles.Count; i++)
                {
                    MazeTile tile = maze.MazeTiles[i];
                    if (tile.X < 0 && -tile.X > offset.X)
                    {
                        offset.X = -tile.X;
                    }
                    if (tile.Y < 0 && -tile.Y > offset.Y)
                    {
                        offset.Y = -tile.Y;
                    }
                }

                for (int i = 0; i < maze.MazeTiles.Count; i++)
                {
                    MazeTile tile = maze.MazeTiles[i];
                    this.blocks[tile.X + offset.X, tile.Y + offset.Y] = new MazeBlock(tile.Walls, false);
                }
                this.wallStyle = (int)maze.TrackSupportColors[0];
                this.Invalidate();
            }
        }
Ejemplo n.º 2
0
 /** <summary> Creates a new maze design. </summary> */
 private void New(object sender, EventArgs e)
 {
     if (!changed || WarningMessageBox.Show(this, "Maze has been changed.", "Are you sure you want to continue?") == DialogResult.Yes)
     {
         maze           = CreateNewMaze();
         maze.TrackType = TrackTypes.HedgeMaze;
         mazeEditor1.LoadMaze(maze);
         mazeEditor1.ResizeMaze(new Size(10, 10));
         changed  = false;
         fileName = "";
     }
 }
Ejemplo n.º 3
0
        //--------------------------------
        #endregion
        //========= CONSTRUCTORS =========
        #region Constructors

        /** <summary> Constructs the form. </summary> */
        public MazeForm()
        {
            InitializeComponent();

            this.KeyPreview = true;
            //maze = TrackDesign.ReadTrackDesign(@"C:\Programs\Games\Steam\steamapps\common\Rollercoaster Tycoon 2\Tracks\Mini Maze.TD6");
            maze = CreateNewMaze();
            //maze.TrackSupportColors[0] = (RemapColors)1;
            //maze.Excitement--;
            //maze.Save("Untitled.TD6");
            mazeEditor1.LoadMaze(maze);
            mazeEditor1.ResizeMaze(new Size(10, 10));
            changed = false;
            UpdateMazeSize();
        }
Ejemplo n.º 4
0
        //=========== READING ============
        #region Reading

        /** <summary> Creates the default maze. </summary> */
        private TrackDesign CreateNewMaze()
        {
            TrackDesign newMaze = new TrackDesign();

            newMaze.TrackType     = TrackTypes.HedgeMaze;
            newMaze.OperatingMode = OperatingModes.MazeMode;
            newMaze.EntranceType  = EntranceTypes.Plain;

            newMaze.PoweredSpeedLapsMaxPeople = 4;

            newMaze.NumberOfTrains   = 1;
            newMaze.CarsPerTrain     = 1;
            newMaze.ChainLiftSpeed   = 5;
            newMaze.NumberOfCircuits = 1;

            newMaze.MinimumWaitTime       = 10;
            newMaze.MaximumWaitTime       = 60;
            newMaze.DepartureControlFlags = DepartureControlFlags.UseMaximumTime | DepartureControlFlags.FullLoad;

            newMaze.Excitement = 12;
            newMaze.Intensity  = 6;
            newMaze.Nausea     = 0;

            newMaze.VehicleColorScheme = 8;
            newMaze.Unknown0x48        = 0x1C;
            newMaze.Unknown0x5E        = 31;

            newMaze.RideMapWidth  = 10;
            newMaze.RideMapHeight = 10;

            for (int i = 0; i < 4; i++)
            {
                newMaze.TrackRailColors[i]    = RemapColors.Gray;
                newMaze.TrackSpineColors[i]   = RemapColors.Gray;
                newMaze.TrackSupportColors[i] = RemapColors.Gray;
            }
            newMaze.TrackSupportColors[0] = (RemapColors)WallStyles.Hedges;

            newMaze.ObjectHeader.Flags    = 0xC58B180;
            newMaze.ObjectHeader.FileName = "HMAZE";
            newMaze.ObjectHeader.CheckSum = 0x2F963BDC;

            return(newMaze);
        }
Ejemplo n.º 5
0
 /** <summary> Opens the maze design. </summary> */
 private void Open(object sender, EventArgs e)
 {
     if (fileName == "")
     {
         openFileDialog.InitialDirectory = "";
         openFileDialog.FileName         = "";
     }
     else
     {
         openFileDialog.InitialDirectory = Path.GetDirectoryName(fileName);
         openFileDialog.FileName         = Path.GetFileNameWithoutExtension(fileName);
     }
     if (!changed || WarningMessageBox.Show(this, "Maze has been changed.", "Are you sure you want to continue?") == DialogResult.Yes)
     {
         if (openFileDialog.ShowDialog(this) == DialogResult.OK)
         {
             try {
                 TrackDesign newMaze = TrackDesign.FromFile(openFileDialog.FileName);
                 if (newMaze.TrackType == TrackTypes.HedgeMaze)
                 {
                     fileName  = openFileDialog.FileName;
                     changed   = false;
                     this.maze = newMaze;
                     this.mazeEditor1.LoadMaze(newMaze);
                     UpdateMazeSize();
                 }
                 else
                 {
                     ErrorMessageBox.Show(this, "Failed to load maze.", "The track design is not a maze.");
                 }
             }
             catch (Exception) {
                 ErrorMessageBox.Show(this, "Failed to load maze.", "Track design may be invalid.");
             }
         }
     }
 }