//========= CONSTRUCTORS ========= #region Constructors /**<summary>Constructs the default track design.</summary>*/ public TrackDesign() { this.TrackType = TrackTypes.None; this.Unknown0x01 = 0; this.SpecialTrackFlags = 0; this.OperatingMode = OperatingModes.NormalMode; this.VehicleColorScheme = 0; this.VehicleColorSpecifiers = new RemapColors[64]; this.Unknown0x48 = 0; this.EntranceType = EntranceTypes.Plain; this.AirTime = 0; this.DepartureControlFlags = DepartureControlFlags.UseMaximumTime | DepartureControlFlags.FullLoad; this.NumberOfTrains = 0; this.CarsPerTrain = 0; this.MinimumWaitTime = 10; this.MaximumWaitTime = 60; this.PoweredSpeedLapsMaxPeople = 0; this.MaximumSpeed = 0; this.AverageSpeed = 0; this.RideLength = 0; this.PositiveGForce = 0; this.NegativeGForce = 0; this.LateralGForce = 0; this.NumberOfInversions = 0; this.NumberOfDrops = 0; this.HighestDrop = 0; this.Excitement = 0; this.Intensity = 0; this.Nausea = 0; this.Unknown0x5E = 0; this.Unknown0x5F = 0; this.TrackSpineColors = new RemapColors[4]; this.TrackRailColors = new RemapColors[4]; this.TrackSupportColors = new RemapColors[4]; this.Unknown0x6C = 0; this.Unknown0x6D = 0; this.Unknown0x6E = 0; this.SixFlagsRide = 0; this.ObjectHeader = new ObjectDataHeader(); this.RideMapWidth = 0; this.RideMapHeight = 0; this.VehicleAdditionalColors = new RemapColors[32]; this.CircuitsChainLiftSpeed = 0; this.MazeTiles = new List <MazeTile>(); this.TrackPieces = new List <TrackPiece>(); }
//=========== READING ============ #region Reading /**<summary>Reads the track design.</summary>*/ public void Read(BinaryReader reader) { this.TrackType = (TrackTypes)reader.ReadByte(); this.Unknown0x01 = reader.ReadByte(); this.SpecialTrackFlags = reader.ReadUInt32(); this.OperatingMode = (OperatingModes)reader.ReadByte(); this.VehicleColorScheme = reader.ReadByte(); for (int i = 0; i < this.VehicleColorSpecifiers.Length; i++) { this.VehicleColorSpecifiers[i] = (RemapColors)reader.ReadByte(); } this.Padding0x48 = reader.ReadByte(); this.EntranceType = (EntranceTypes)reader.ReadByte(); this.AirTime = reader.ReadByte(); this.DepartureControlFlags = (DepartureControlFlags)reader.ReadByte(); this.NumberOfTrains = reader.ReadByte(); this.CarsPerTrain = reader.ReadByte(); this.MinimumWaitTime = reader.ReadByte(); this.MaximumWaitTime = reader.ReadByte(); this.PoweredSpeedLapsMaxPeople = reader.ReadByte(); this.MaximumSpeed = reader.ReadByte(); this.AverageSpeed = reader.ReadByte(); this.RideLength = reader.ReadUInt16(); this.PositiveGForce = reader.ReadByte(); this.NegativeGForce = reader.ReadByte(); this.LateralGForce = reader.ReadByte(); this.NumberOfInversions = reader.ReadByte(); this.NumberOfDrops = reader.ReadByte(); this.HighestDrop = reader.ReadByte(); this.Excitement = reader.ReadByte(); this.Intensity = reader.ReadByte(); this.Nausea = reader.ReadByte(); this.UpkeepCost = reader.ReadInt16(); for (int i = 0; i < this.TrackSpineColors.Length; i++) { this.TrackSpineColors[i] = (RemapColors)reader.ReadByte(); } for (int i = 0; i < this.TrackRailColors.Length; i++) { this.TrackRailColors[i] = (RemapColors)reader.ReadByte(); } for (int i = 0; i < this.TrackSupportColors.Length; i++) { this.TrackSupportColors[i] = (RemapColors)reader.ReadByte(); } this.Unknown0x6C = reader.ReadByte(); this.Unknown0x6D = reader.ReadByte(); this.Unknown0x6E = reader.ReadByte(); this.SixFlagsRide = reader.ReadByte(); this.ObjectHeader.Read(reader); this.RideMapWidth = reader.ReadByte(); this.RideMapHeight = reader.ReadByte(); for (int i = 0; i < this.VehicleAdditionalColors.Length; i++) { this.VehicleAdditionalColors[i] = (RemapColors)reader.ReadByte(); } this.CircuitsChainLiftSpeed = reader.ReadByte(); // Read the track data if (this.TrackType == TrackTypes.HedgeMaze) { MazeTile mazeTile = new MazeTile(); mazeTile.Read(reader); // Read the maze tiles until an empty one is read. while (!mazeTile.IsEnd) { this.MazeTiles.Add(mazeTile); mazeTile = new MazeTile(); mazeTile.Read(reader); } } else { byte b = reader.ReadByte(); // Read the track pieces until byte 0xFF. while (b != 0xFF) { reader.BaseStream.Position--; TrackPiece trackPiece = new TrackPiece(); trackPiece.Read(reader); this.TrackPieces.Add(trackPiece); b = reader.ReadByte(); } } while (reader.BaseStream.Position < reader.BaseStream.Length) { reader.ReadByte(); } }