]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_agl.c
fix Collision_ClipTrace_Line_Sphere calculation of impactdist (had a
[xonotic/darkplaces.git] / vid_agl.c
index af5c8b7f9d005c333d00dbce3abde1b37d414690..d21ffc063193ab1078fc0f3c9624fae4bf358e4f 100644 (file)
--- a/vid_agl.c
+++ b/vid_agl.c
@@ -212,11 +212,8 @@ void VID_Finish (void)
 
        if (!vid_hidden)
        {
-               CHECKGLERROR
                if (r_speeds.integer == 2 || gl_finish.integer)
-               {
-                       qglFinish();CHECKGLERROR
-               }
+                       GL_Finish();
                qaglSwapBuffers(context);
        }
        VID_UpdateGamma(false, GAMMA_TABLE_SIZE);
@@ -399,6 +396,7 @@ void VID_Shutdown(void)
        if (context == NULL && window == NULL)
                return;
 
+       VID_EnableJoystick(false);
        VID_SetMouse(false, false, false);
        VID_RestoreSystemGamma();
 
@@ -694,14 +692,11 @@ qboolean VID_InitMode(viddef_mode_t *mode)
                }
        }
 
-       memset(&vid.support, 0, sizeof(vid.support));
-
        if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL)
                Sys_Error("glGetString not found in %s", gl_driver);
 
        gl_platformextensions = "";
        gl_platform = "AGL";
-       gl_videosyncavailable = true;
 
        multithreadedgl = false;
        vid_isfullscreen = mode->fullscreen;
@@ -1116,8 +1111,34 @@ void Sys_SendKeyEvents(void)
        }
 }
 
+void VID_BuildJoyState(vid_joystate_t *joystate)
+{
+       VID_Shared_BuildJoyState_Begin(joystate);
+       VID_Shared_BuildJoyState_Finish(joystate);
+}
+
+void VID_EnableJoystick(qboolean enable)
+{
+       int index = joy_enable.integer > 0 ? joy_index.integer : -1;
+       qboolean success = false;
+       int sharedcount = 0;
+       sharedcount = VID_Shared_SetJoystick(index);
+       if (index >= 0 && index < sharedcount)
+               success = true;
+
+       // update cvar containing count of XInput joysticks
+       if (joy_detected.integer != sharedcount)
+               Cvar_SetValueQuick(&joy_detected, sharedcount);
+
+       Cvar_SetValueQuick(&joy_active, success ? 1 : 0);
+}
+
 void IN_Move (void)
 {
+       vid_joystate_t joystate;
+       VID_EnableJoystick(true);
+       VID_BuildJoyState(&joystate);
+       VID_ApplyJoyState(&joystate);
 }
 
 static bool GetDictionaryBoolean(CFDictionaryRef d, const void *key)