Exemplo n.º 1
0
 public override void SetCompatibilityHacks(CompatabilityHacks EnabledHacks)
 {
     enabledHacks = EnabledHacks;
 }
Exemplo n.º 2
0
 public override void SetCompatabilityHacks(CompatabilityHacks enabledHacks)
 {
     EnabledHacks = enabledHacks;
 }
Exemplo n.º 3
0
        internal static void Main(string[] args)
        {
            CurrentHost = new Host();
            // file system
            FileSystem = FileSystem.FromCommandLineArgs(args, CurrentHost);
            FileSystem.CreateFileSystem();
            Renderer     = new NewRenderer();
            CurrentRoute = new CurrentRoute(Renderer);
            Renderer.CameraTrackFollower = new TrackFollower(CurrentHost);
            Options.LoadOptions();
            if (Renderer.Screen.Width == 0 || Renderer.Screen.Height == 0)
            {
                Renderer.Screen.Width  = 960;
                Renderer.Screen.Height = 600;
            }
            Plugins.LoadPlugins();
            // command line arguments
            List <string> filesToLoad = new List <string>();

            if (args.Length != 0)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i] != null)
                    {
                        if (System.IO.File.Exists(args[i]))
                        {
                            for (int j = 0; j < CurrentHost.Plugins.Length; j++)
                            {
                                if (CurrentHost.Plugins[j].Route != null && CurrentHost.Plugins[j].Route.CanLoadRoute(args[i]))
                                {
                                    string File = System.IO.Path.Combine(Application.StartupPath, "RouteViewer.exe");
                                    if (System.IO.File.Exists(File))
                                    {
                                        System.Diagnostics.Process.Start(File, args[i]);
                                    }
                                    continue;
                                }

                                if (CurrentHost.Plugins[j].Object != null && CurrentHost.Plugins[j].Object.CanLoadObject(args[i]))
                                {
                                    filesToLoad.Add(args[i]);
                                }
                            }
                        }
                        else if (args[i].ToLowerInvariant() == "/enablehacks")
                        {
                            //Deliberately undocumented option for debugging use
                            Interface.CurrentOptions.EnableBveTsHacks = true;
                            for (int j = 0; j < CurrentHost.Plugins.Length; j++)
                            {
                                if (CurrentHost.Plugins[j].Object != null)
                                {
                                    CompatabilityHacks enabledHacks = new CompatabilityHacks
                                    {
                                        BveTsHacks        = true,
                                        CylinderHack      = false,
                                        BlackTransparency = true
                                    };
                                    CurrentHost.Plugins[j].Object.SetCompatibilityHacks(enabledHacks);
                                }
                            }
                        }
                    }
                }

                if (filesToLoad.Count != 0)
                {
                    Files = filesToLoad.ToArray();
                }
            }

            var options = new ToolkitOptions
            {
                Backend = PlatformBackend.PreferX11
            };

            Toolkit.Init(options);
            Interface.CurrentOptions.ObjectOptimizationBasicThreshold = 1000;
            Interface.CurrentOptions.ObjectOptimizationFullThreshold  = 250;
            Interface.CurrentOptions.AntiAliasingLevel         = 16;
            Interface.CurrentOptions.AnisotropicFilteringLevel = 16;
            // initialize camera

            currentGraphicsMode = new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8, Interface.CurrentOptions.AntiAliasingLevel);
            currentGameWindow   = new ObjectViewer(Renderer.Screen.Width, Renderer.Screen.Height, currentGraphicsMode, "Object Viewer", GameWindowFlags.Default)
            {
                Visible = true,
                TargetUpdateFrequency = 0,
                TargetRenderFrequency = 0,
                Title = "Object Viewer"
            };
            currentGameWindow.Run();
            // quit
            Renderer.TextureManager.UnloadAllTextures();
        }
Exemplo n.º 4
0
 public override void SetCompatibilityHacks(CompatabilityHacks EnabledHacks)
 {
     BlackTransparency = EnabledHacks.BlackTransparency;
 }
Exemplo n.º 5
0
 /// <summary>Sets various hacks to workaround buggy objects</summary>
 public virtual void SetCompatibilityHacks(CompatabilityHacks EnabledHacks)
 {
 }
Exemplo n.º 6
0
        internal static void Main(string[] args)
        {
            CurrentHost = new Host();
            // file system
            FileSystem = FileSystem.FromCommandLineArgs(args, CurrentHost);
            FileSystem.CreateFileSystem();
            Renderer     = new NewRenderer();
            CurrentRoute = new CurrentRoute(Renderer);
            Sounds       = new Sounds();

            Options.LoadOptions();
            Plugins.LoadPlugins();
            // command line arguments
            StringBuilder objectsToLoad = new StringBuilder();

            if (args.Length != 0)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i] != null)
                    {
                        if (System.IO.File.Exists(args[i]))
                        {
                            for (int j = 0; j < CurrentHost.Plugins.Length; j++)
                            {
                                if (CurrentHost.Plugins[j].Object != null && CurrentHost.Plugins[j].Object.CanLoadObject(args[i]))
                                {
                                    objectsToLoad.Append(args[i] + " ");
                                    continue;
                                }

                                if (CurrentHost.Plugins[j].Route != null && CurrentHost.Plugins[j].Route.CanLoadRoute(args[i]))
                                {
                                    if (string.IsNullOrEmpty(CurrentRouteFile))
                                    {
                                        CurrentRouteFile       = args[i];
                                        processCommandLineArgs = true;
                                    }
                                }
                            }
                        }
                        else if (args[i].ToLowerInvariant() == "/enablehacks")
                        {
                            //Deliberately undocumented option for debugging use
                            Interface.CurrentOptions.EnableBveTsHacks = true;
                            for (int j = 0; j < CurrentHost.Plugins.Length; j++)
                            {
                                if (CurrentHost.Plugins[j].Object != null)
                                {
                                    CompatabilityHacks enabledHacks = new CompatabilityHacks
                                    {
                                        BveTsHacks        = true,
                                        CylinderHack      = false,
                                        BlackTransparency = true
                                    };
                                    CurrentHost.Plugins[j].Object.SetCompatibilityHacks(enabledHacks);
                                }
                            }
                        }
                    }
                }
            }

            if (objectsToLoad.Length != 0)
            {
                string File = System.IO.Path.Combine(Application.StartupPath, "ObjectViewer.exe");
                if (System.IO.File.Exists(File))
                {
                    System.Diagnostics.Process.Start(File, objectsToLoad.ToString());
                    if (string.IsNullOrEmpty(CurrentRouteFile))
                    {
                        //We only supplied objects, so launch Object Viewer instead
                        Environment.Exit(0);
                    }
                }
            }

            var options = new ToolkitOptions();

            Plugins.LoadPlugins();
            options.Backend = PlatformBackend.PreferX11;
            Toolkit.Init(options);
            string folder = Program.FileSystem.GetDataFolder("Languages");

            Translations.LoadLanguageFiles(folder);
            Interface.CurrentOptions.ObjectOptimizationBasicThreshold = 1000;
            Interface.CurrentOptions.ObjectOptimizationFullThreshold  = 250;
            // application
            currentGraphicsMode = new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8, Interface.CurrentOptions.AntiAliasingLevel);
            if (Renderer.Screen.Width == 0 || Renderer.Screen.Height == 0)
            {
                //Duff values saved, so reset to something sensible else we crash
                Renderer.Screen.Width  = 1024;
                Renderer.Screen.Height = 768;
            }
            Renderer.CameraTrackFollower            = new TrackFollower(Program.CurrentHost);
            currentGameWindow                       = new RouteViewer(Renderer.Screen.Width, Renderer.Screen.Height, currentGraphicsMode, "Route Viewer", GameWindowFlags.Default);
            currentGameWindow.Visible               = true;
            currentGameWindow.TargetUpdateFrequency = 0;
            currentGameWindow.TargetRenderFrequency = 0;
            currentGameWindow.Title                 = "Route Viewer";
            processCommandLineArgs                  = true;
            currentGameWindow.Run();
            //Unload
            Sounds.Deinitialize();
        }