Example #1
0
        // ================================

        /// <summary>Call this function to reset the game</summary>
        /// <param name="ResetLogs">Whether the logs should be reset</param>
        /// <param name="ResetRenderer">Whether the renderer should be reset</param>
        internal static void Reset(bool ResetLogs, bool ResetRenderer)
        {
            // track manager
            for (int i = 0; i < Program.CurrentRoute.Tracks.Count; i++)
            {
                int key = Program.CurrentRoute.Tracks.ElementAt(i).Key;
                Program.CurrentRoute.Tracks[key] = new Track();
            }
            // train manager
            TrainManager.Trains = new TrainManager.Train[] { };
            // game
            Interface.ClearMessages();
            CurrentInterface             = InterfaceType.Normal;
            Program.CurrentRoute.Comment = "";
            Program.CurrentRoute.Image   = "";
            Program.CurrentRoute.Atmosphere.AccelerationDueToGravity = 9.80665;
            Program.CurrentRoute.Atmosphere.InitialAirPressure       = 101325.0;
            Program.CurrentRoute.Atmosphere.InitialAirTemperature    = 293.15;
            Program.CurrentRoute.Atmosphere.InitialElevation         = 0.0;
            Program.CurrentRoute.Atmosphere.SeaLevelAirPressure      = 101325.0;
            Program.CurrentRoute.Atmosphere.SeaLevelAirTemperature   = 293.15;
            Program.CurrentRoute.BufferTrackPositions = new double[] { };
            //Messages = new Message[] { };
            Program.Renderer.Marker.MarkerTextures = new Texture[] { };
            Program.CurrentRoute.PointsOfInterest  = new PointOfInterest[] { };
            PrecedingTrainTimeDeltas = new double[] { };
            PrecedingTrainSpeedLimit = double.PositiveInfinity;
            Program.CurrentRoute.BogusPreTrainInstructions = new BogusPreTrainInstruction[] { };
            TrainName  = "";
            TrainStart = TrainStartMode.EmergencyBrakesNoAts;
            Program.CurrentRoute.NoFogStart  = (float)Math.Max(1.33333333333333 * Interface.CurrentOptions.ViewingDistance, 800.0);
            Program.CurrentRoute.NoFogEnd    = (float)Math.Max(2.66666666666667 * Interface.CurrentOptions.ViewingDistance, 1600.0);
            Program.CurrentRoute.PreviousFog = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 0.0);
            Program.CurrentRoute.CurrentFog  = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 0.5);
            Program.CurrentRoute.NextFog     = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 1.0);
            if (ResetLogs)
            {
                LogRouteName       = "";
                LogTrainName       = "";
                LogDateTime        = DateTime.Now;
                CurrentScore       = new Score();
                ScoreMessages      = new ScoreMessage[] { };
                ScoreLogs          = new ScoreLog[64];
                ScoreLogCount      = 0;
                BlackBoxEntries    = new BlackBoxEntry[256];
                BlackBoxEntryCount = 0;
                BlackBoxNextUpdate = 0.0;
            }
            // renderer
            if (ResetRenderer)
            {
                Program.Renderer.InfoTotalTriangles     = 0;
                Program.Renderer.InfoTotalTriangleStrip = 0;
                Program.Renderer.InfoTotalQuads         = 0;
                Program.Renderer.InfoTotalQuadStrip     = 0;
                Program.Renderer.InfoTotalPolygon       = 0;
                Program.Renderer.Reset();
            }
        }
Example #2
0
        // ================================

        /// <summary>Call this function to reset the game</summary>
        /// <param name="ResetLogs">Whether the logs should be reset</param>
        internal static void Reset(bool ResetLogs)
        {
            // track manager
            for (int i = 0; i < TrackManager.Tracks.Length; i++)
            {
                TrackManager.Tracks[i] = new TrackManager.Track();
            }
            // train manager
            TrainManager.Trains = new TrainManager.Train[] { };
            // game
            Interface.ClearMessages();
            CurrentInterface = InterfaceType.Normal;
            RouteComment     = "";
            RouteImage       = "";
            RouteAccelerationDueToGravity = 9.80665;
            RouteRailGauge              = 1.435;
            RouteInitialAirPressure     = 101325.0;
            RouteInitialAirTemperature  = 293.15;
            RouteInitialElevation       = 0.0;
            RouteSeaLevelAirPressure    = 101325.0;
            RouteSeaLevelAirTemperature = 293.15;
            Stations = new RouteStation[] { };
            CurrentRoute.Sections = new Section[] { };
            BufferTrackPositions  = new double[] { };
            //Messages = new Message[] { };
            MarkerTextures           = new Texture[] { };
            PointsOfInterest         = new PointOfInterest[] { };
            PrecedingTrainTimeDeltas = new double[] { };
            PrecedingTrainSpeedLimit = double.PositiveInfinity;
            CurrentRoute.BogusPretrainInstructions = new BogusPretrainInstruction[] { };
            TrainName  = "";
            TrainStart = TrainStartMode.EmergencyBrakesNoAts;
            CurrentRoute.NoFogStart   = (float)Math.Max(1.33333333333333 * Interface.CurrentOptions.ViewingDistance, 800.0);
            CurrentRoute.NoFogEnd     = (float)Math.Max(2.66666666666667 * Interface.CurrentOptions.ViewingDistance, 1600.0);
            CurrentRoute.PreviousFog  = new Fog(CurrentRoute.NoFogStart, CurrentRoute.NoFogEnd, Color24.Grey, 0.0);
            CurrentRoute.CurrentFog   = new Fog(CurrentRoute.NoFogStart, CurrentRoute.NoFogEnd, Color24.Grey, 0.5);
            CurrentRoute.NextFog      = new Fog(CurrentRoute.NoFogStart, CurrentRoute.NoFogEnd, Color24.Grey, 1.0);
            InfoTotalTriangles        = 0;
            InfoTotalTriangleStrip    = 0;
            InfoTotalQuads            = 0;
            InfoTotalQuadStrip        = 0;
            InfoTotalPolygon          = 0;
            InfoStaticOpaqueFaceCount = 0;
            if (ResetLogs)
            {
                LogRouteName       = "";
                LogTrainName       = "";
                LogDateTime        = DateTime.Now;
                CurrentScore       = new Score();
                ScoreMessages      = new ScoreMessage[] { };
                ScoreLogs          = new ScoreLog[64];
                ScoreLogCount      = 0;
                BlackBoxEntries    = new BlackBoxEntry[256];
                BlackBoxEntryCount = 0;
                BlackBoxNextUpdate = 0.0;
            }
            // renderer
            Renderer.Reset();
        }
Example #3
0
        // ================================

        internal static void Reset()
        {
            // track manager
            TrackManager.CurrentTrack = new TrackManager.Track();
            // train manager
            TrainManager.Trains = new TrainManager.Train[] { };
            // game
            Interface.ClearMessages();
            RouteComment = "";
            RouteImage   = "";
            RouteAccelerationDueToGravity = 9.80665;
            RouteRailGauge              = 1.435;
            RouteInitialAirPressure     = 101325.0;
            RouteInitialAirTemperature  = 293.15;
            RouteInitialElevation       = 0.0;
            RouteSeaLevelAirPressure    = 101325.0;
            RouteSeaLevelAirTemperature = 293.15;
            Stations                  = new Station[] { };
            Sections                  = new Section[] { };
            BufferTrackPositions      = new double[] { };
            MarkerTextures            = new int[] { };
            PointsOfInterest          = new PointOfInterest[] { };
            BogusPretrainInstructions = new BogusPretrainInstruction[] { };
            TrainName                 = "";
            TrainStart                = TrainStartMode.EmergencyBrakesNoAts;
            PreviousFog               = new Fog(0.0f, 0.0f, new Color24(128, 128, 128), 0.0);
            CurrentFog                = new Fog(0.0f, 0.0f, new Color24(128, 128, 128), 0.5);
            NextFog                = new Fog(0.0f, 0.0f, new Color24(128, 128, 128), 1.0);
            NoFogStart             = (float)World.BackgroundImageDistance + 200.0f;
            NoFogEnd               = 2.0f * NoFogStart;
            InfoTotalTriangles     = 0;
            InfoTotalTriangleStrip = 0;
            InfoTotalQuads         = 0;
            InfoTotalQuadStrip     = 0;
            InfoTotalPolygon       = 0;
            // object manager
            ObjectManager.Objects                     = new ObjectManager.StaticObject[16];
            ObjectManager.ObjectsUsed                 = 0;
            ObjectManager.ObjectsSortedByStart        = new int[] { };
            ObjectManager.ObjectsSortedByEnd          = new int[] { };
            ObjectManager.ObjectsSortedByStartPointer = 0;
            ObjectManager.ObjectsSortedByEndPointer   = 0;
            ObjectManager.LastUpdatedTrackPosition    = 0.0;
            ObjectManager.AnimatedWorldObjects        = new ObjectManager.AnimatedWorldObject[4];
            ObjectManager.AnimatedWorldObjectsUsed    = 0;
            // renderer / sound
            Renderer.Reset();
            SoundManager.StopAllSounds(true);
            GC.Collect();
        }
Example #4
0
        // ================================

        internal static void Reset()
        {
            // track manager
            Program.CurrentRoute.Tracks = new Dictionary <int, Track>();
            Track t = new Track
            {
                Elements = new TrackElement[0]
            };

            Program.CurrentRoute.Tracks.Add(0, t);
            // train manager
            TrainManager.Trains = new TrainManager.Train[] { };
            // game
            Interface.ClearMessages();
            Program.CurrentRoute.Comment = "";
            Program.CurrentRoute.Image   = "";
            Program.CurrentRoute.Atmosphere.AccelerationDueToGravity = 9.80665;
            Program.CurrentRoute.Atmosphere.InitialAirPressure       = 101325.0;
            Program.CurrentRoute.Atmosphere.InitialAirTemperature    = 293.15;
            Program.CurrentRoute.Atmosphere.InitialElevation         = 0.0;
            Program.CurrentRoute.Atmosphere.SeaLevelAirPressure      = 101325.0;
            Program.CurrentRoute.Atmosphere.SeaLevelAirTemperature   = 293.15;
            Program.CurrentRoute.Stations                  = new RouteStation[] { };
            Program.CurrentRoute.Sections                  = new Section[] { };
            Program.CurrentRoute.BufferTrackPositions      = new double[] { };
            Program.Renderer.Marker.MarkerTextures         = new Texture[] { };
            Program.CurrentRoute.PointsOfInterest          = new PointOfInterest[] { };
            Program.CurrentRoute.BogusPreTrainInstructions = new BogusPreTrainInstruction[] { };
            TrainName  = "";
            TrainStart = TrainStartMode.EmergencyBrakesNoAts;
            Program.CurrentRoute.PreviousFog        = new Fog(0.0f, 0.0f, Color24.Grey, 0.0);
            Program.CurrentRoute.CurrentFog         = new Fog(0.0f, 0.0f, Color24.Grey, 0.5);
            Program.CurrentRoute.NextFog            = new Fog(0.0f, 0.0f, Color24.Grey, 1.0);
            Program.CurrentRoute.NoFogStart         = (float)Program.CurrentRoute.CurrentBackground.BackgroundImageDistance + 200.0f;
            Program.CurrentRoute.NoFogEnd           = 2.0f * Program.CurrentRoute.NoFogStart;
            Program.Renderer.InfoTotalTriangles     = 0;
            Program.Renderer.InfoTotalTriangleStrip = 0;
            Program.Renderer.InfoTotalQuads         = 0;
            Program.Renderer.InfoTotalQuadStrip     = 0;
            Program.Renderer.InfoTotalPolygon       = 0;
            // object manager
            Program.Renderer.InitializeVisibility();
            ObjectManager.AnimatedWorldObjects     = new WorldObject[4];
            ObjectManager.AnimatedWorldObjectsUsed = 0;
            // renderer / sound
            Program.Renderer.Reset();
            Program.Sounds.StopAllSounds();
            GC.Collect();
        }
Example #5
0
 // ================================
 internal static void Reset(bool ResetLogs)
 {
     // track manager
     TrackManager.CurrentTrack = new TrackManager.Track();
     // train manager
     TrainManager.Trains = new TrainManager.Train[] { };
     // game
     Interface.ClearMessages();
     CurrentInterface = InterfaceType.Normal;
     RouteComment = "";
     RouteImage = "";
     RouteAccelerationDueToGravity = 9.80665;
     RouteRailGauge = 1.435;
     RouteInitialAirPressure = 101325.0;
     RouteInitialAirTemperature = 293.15;
     RouteInitialElevation = 0.0;
     RouteSeaLevelAirPressure = 101325.0;
     RouteSeaLevelAirTemperature = 293.15;
     Stations = new Station[] { };
     Sections = new Section[] { };
     BufferTrackPositions = new double[] { };
     Messages = new Message[] { };
     MarkerTextures = new Textures.Texture[] { };
     PointsOfInterest = new PointOfInterest[] { };
     PrecedingTrainTimeDeltas = new double[] { };
     PrecedingTrainSpeedLimit = double.PositiveInfinity;
     BogusPretrainInstructions = new BogusPretrainInstruction[] { };
     TrainName = "";
     TrainStart = TrainStartMode.EmergencyBrakesNoAts;
     NoFogStart = (float)Math.Max(1.33333333333333 * Interface.CurrentOptions.ViewingDistance, 800.0);
     NoFogEnd = (float)Math.Max(2.66666666666667 * Interface.CurrentOptions.ViewingDistance, 1600.0);
     PreviousFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.0);
     CurrentFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.5);
     NextFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 1.0);
     InfoTotalTriangles = 0;
     InfoTotalTriangleStrip = 0;
     InfoTotalQuads = 0;
     InfoTotalQuadStrip = 0;
     InfoTotalPolygon = 0;
     InfoStaticOpaqueFaceCount = 0;
     if (ResetLogs) {
         LogRouteName = "";
         LogTrainName = "";
         LogDateTime = DateTime.Now;
         CurrentScore = new Score();
         ScoreMessages = new ScoreMessage[] { };
         ScoreLogs = new ScoreLog[64];
         ScoreLogCount = 0;
         BlackBoxEntries = new BlackBoxEntry[256];
         BlackBoxEntryCount = 0;
         BlackBoxNextUpdate = 0.0;
     }
     // renderer
     Renderer.Reset();
 }
Example #6
0
		// ================================

		internal static void Reset() {
			// track manager
			TrackManager.CurrentTrack = new TrackManager.Track();
			// train manager
			TrainManager.Trains = new TrainManager.Train[] { };
			// game
			Interface.ClearMessages();
			RouteComment = "";
			RouteImage = "";
			RouteAccelerationDueToGravity = 9.80665;
			RouteRailGauge = 1.435;
			RouteInitialAirPressure = 101325.0;
			RouteInitialAirTemperature = 293.15;
			RouteInitialElevation = 0.0;
			RouteSeaLevelAirPressure = 101325.0;
			RouteSeaLevelAirTemperature = 293.15;
			Stations = new Station[] { };
			Sections = new Section[] { };
			BufferTrackPositions = new double[] { };
			MarkerTextures = new int[] { };
			PointsOfInterest = new PointOfInterest[] { };
			BogusPretrainInstructions = new BogusPretrainInstruction[] { };
			TrainName = "";
			TrainStart = TrainStartMode.EmergencyBrakesNoAts;
			PreviousFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 0.0);
			CurrentFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 0.5);
			NextFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 1.0);
			NoFogStart = (float)World.BackgroundImageDistance + 200.0f;
			NoFogEnd = 2.0f * NoFogStart;
			InfoTotalTriangles = 0;
			InfoTotalTriangleStrip = 0;
			InfoTotalQuads = 0;
			InfoTotalQuadStrip = 0;
			InfoTotalPolygon = 0;
			// object manager
			ObjectManager.Objects = new ObjectManager.StaticObject[16];
			ObjectManager.ObjectsUsed = 0;
			ObjectManager.ObjectsSortedByStart = new int[] { };
			ObjectManager.ObjectsSortedByEnd = new int[] { };
			ObjectManager.ObjectsSortedByStartPointer = 0;
			ObjectManager.ObjectsSortedByEndPointer = 0;
			ObjectManager.LastUpdatedTrackPosition = 0.0;
			ObjectManager.AnimatedWorldObjects = new ObjectManager.AnimatedWorldObject[4];
			ObjectManager.AnimatedWorldObjectsUsed = 0;
			// renderer / sound
			Renderer.Reset();
			SoundManager.StopAllSounds(true);
			GC.Collect();
		}