]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_sdl.c
Rename COM_CheckParm to Sys_CheckParm and move it to sys_shared.c
[xonotic/darkplaces.git] / vid_sdl.c
index 8b0d1e3af2f77022ce9ae74dc2574ae217642a83..de693c42fe1f973b971940d36ad0127d9c83cfb3 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -607,7 +607,7 @@ static void VID_TouchscreenCursor(float px, float py, float pwidth, float pheigh
                }
                if (scr_numtouchscreenareas < 128)
                {
-                       if (clickrealtime + 1 > realtime)
+                       if (clickrealtime + 1 > host.realtime)
                        {
                                scr_touchscreenareas[scr_numtouchscreenareas].pic = "gfx/gui/touch_puck_cur_click.tga";
                        }
@@ -617,7 +617,7 @@ static void VID_TouchscreenCursor(float px, float py, float pwidth, float pheigh
                        }
                        else
                        {
-                               switch ((int)realtime * 10 % 20)
+                               switch ((int)host.realtime * 10 % 20)
                                {
                                case 0:
                                        scr_touchscreenareas[scr_numtouchscreenareas].pic = "gfx/gui/touch_puck_cur_touch.tga";
@@ -671,11 +671,11 @@ static void VID_TouchscreenCursor(float px, float py, float pwidth, float pheigh
                        {
                                Key_Event(key, 0, true);
                                canclick = false;
-                               clickrealtime = realtime;
+                               clickrealtime = host.realtime;
                        }
 
                        // SS:BR can't qc can't cope with presses and releases on the same frame
-                       if (clickrealtime && clickrealtime + 0.1 < realtime)
+                       if (clickrealtime && clickrealtime + 0.1 < host.realtime)
                        {
                                Key_Event(key, 0, false);
                                clickrealtime = 0;
@@ -1076,7 +1076,7 @@ void Sys_SendKeyEvents( void )
 #ifdef DEBUGSDLEVENTS
                                Con_DPrintf("SDL_Event: SDL_QUIT\n");
 #endif
-                               Sys_Quit(0);
+                               host.state = host_shutdown;
                                break;
                        case SDL_KEYDOWN:
                        case SDL_KEYUP:
@@ -1202,7 +1202,7 @@ void Sys_SendKeyEvents( void )
                                                vid_hasfocus = false;
                                                break;
                                        case SDL_WINDOWEVENT_CLOSE:
-                                               Sys_Quit(0);
+                                               host.state = host_shutdown;
                                                break;
                                        }
                                }
@@ -1338,7 +1338,7 @@ void VID_Init (void)
                Sys_Error ("Failed to init SDL video subsystem: %s", SDL_GetError());
        vid_sdl_initjoysticksystem = SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0;
        if (!vid_sdl_initjoysticksystem)
-               Con_Errorf("Failed to init SDL joystick subsystem: %s\n", SDL_GetError());
+               Con_Printf(CON_ERROR "Failed to init SDL joystick subsystem: %s\n", SDL_GetError());
        vid_isfullscreen = false;
 }
 
@@ -1392,7 +1392,7 @@ void VID_EnableJoystick(qboolean enable)
                        }
                        else
                        {
-                               Con_Errorf("Joystick %i failed (SDL_JoystickOpen(%i) returned: %s)\n", index, sdlindex, SDL_GetError());
+                               Con_Printf(CON_ERROR "Joystick %i failed (SDL_JoystickOpen(%i) returned: %s)\n", index, sdlindex, SDL_GetError());
                                sdlindex = -1;
                        }
                }
@@ -1475,8 +1475,8 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode)
        // https://trello.com/c/j56vUcwZ/81-centered-vs-undefined-window-position
        int xPos = SDL_WINDOWPOS_UNDEFINED;
        int yPos = SDL_WINDOWPOS_UNDEFINED;
-#ifndef USE_GLES2
        int i;
+#ifndef USE_GLES2
        const char *drivername;
 #endif
 
@@ -1493,12 +1493,12 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode)
        drivername = NULL;
 
 // COMMANDLINEOPTION: SDL GL: -gl_driver <drivername> selects a GL driver library, default is whatever SDL recommends, useful only for 3dfxogl.dll/3dfxvgl.dll or fxmesa or similar, if you don't know what this is for, you don't need it
-       i = COM_CheckParm("-gl_driver");
-       if (i && i < com_argc - 1)
-               drivername = com_argv[i + 1];
+       i = Sys_CheckParm("-gl_driver");
+       if (i && i < sys.argc - 1)
+               drivername = sys.argv[i + 1];
        if (SDL_GL_LoadLibrary(drivername) < 0)
        {
-               Con_Errorf("Unable to load GL driver \"%s\": %s\n", drivername, SDL_GetError());
+               Con_Printf(CON_ERROR "Unable to load GL driver \"%s\": %s\n", drivername, SDL_GetError());
                return false;
        }
 #endif
@@ -1578,7 +1578,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode)
        window = SDL_CreateWindow(gamename, xPos, yPos, mode->width, mode->height, windowflags);
        if (window == NULL)
        {
-               Con_Errorf("Failed to set video mode to %ix%i: %s\n", mode->width, mode->height, SDL_GetError());
+               Con_Printf(CON_ERROR "Failed to set video mode to %ix%i: %s\n", mode->width, mode->height, SDL_GetError());
                VID_Shutdown();
                return false;
        }
@@ -1586,7 +1586,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode)
        context = SDL_GL_CreateContext(window);
        if (context == NULL)
        {
-               Con_Errorf("Failed to initialize OpenGL context: %s\n", SDL_GetError());
+               Con_Printf(CON_ERROR "Failed to initialize OpenGL context: %s\n", SDL_GetError());
                VID_Shutdown();
                return false;
        }
@@ -1606,10 +1606,15 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode)
        Cvar_SetQuick(&gl_info_driver, gl_driver);
 
        // LadyHavoc: report supported extensions
+       Con_DPrintf("\nQuakeC extensions for server and client:");
+       for (i = 0; vm_sv_extensions[i]; i++)
+               Con_DPrintf(" %s", vm_sv_extensions[i]);
+       Con_DPrintf("\n");
 #ifdef CONFIG_MENU
-       Con_DPrintf("\nQuakeC extensions for server and client: %s\nQuakeC extensions for menu: %s\n", vm_sv_extensions, vm_m_extensions);
-#else
-       Con_DPrintf("\nQuakeC extensions for server and client: %s\n", vm_sv_extensions);
+       Con_DPrintf("\nQuakeC extensions for menu:");
+       for (i = 0; vm_m_extensions[i]; i++)
+               Con_DPrintf(" %s", vm_m_extensions[i]);
+       Con_DPrintf("\n");
 #endif
 
        // clear to black (loading plaque will be seen over this)