]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_demo.c
input: stop capturing mouse movement if window is hidden without first losing focus
[xonotic/darkplaces.git] / cl_demo.c
index 4c826c0db6fffa0494df5d3c73126ba9ea90f47c..b1f2e685716f0c1ff4b2a1bf4659c8194342899d 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 extern cvar_t cl_capturevideo;
 extern cvar_t cl_capturevideo_demo_stop;
 #endif
-int old_vsync = 0;
 
 static void CL_FinishTimeDemo (void);
 
@@ -256,7 +255,7 @@ void CL_ReadDemoMessage(void)
                }
                if (cl_message.cursize > cl_message.maxsize)
                {
-                       CL_Disconnect(false, "Demo message (%i) > cl_message.maxsize (%i)", cl_message.cursize, cl_message.maxsize);
+                       CL_DisconnectEx(false, "Demo message (%i) > cl_message.maxsize (%i)", cl_message.cursize, cl_message.maxsize);
                        cl_message.cursize = 0;
                        return;
                }
@@ -284,7 +283,7 @@ void CL_ReadDemoMessage(void)
                }
                else
                {
-                       CL_Disconnect(false, NULL);
+                       CL_Disconnect();
                        return;
                }
        }
@@ -363,7 +362,7 @@ void CL_Record_f(cmd_state_t *cmd)
        }
 
        if (cls.state == ca_connected)
-               CL_Disconnect(false, NULL);
+               CL_Disconnect();
 
        // write the forced cd track number, or -1
        if (c == 4)
@@ -421,7 +420,7 @@ void CL_PlayDemo(const char *demo)
        cls.demostarting = true;
 
        // disconnect from server
-       CL_Disconnect(false, NULL);
+       CL_Disconnect();
 
        // update networking ports (this is mainly just needed at startup)
        NetConn_UpdateSockets();
@@ -586,6 +585,9 @@ static void CL_FinishTimeDemo (void)
                else
                        host.state = host_shutdown;
        }
+
+       // Might need to re-enable vsync
+       Cvar_Callback(&vid_vsync);
 }
 
 /*
@@ -618,6 +620,9 @@ void CL_TimeDemo_f(cmd_state_t *cmd)
        cls.timedemo = host.restless = true;
        cls.td_frames = -2;             // skip the first frame
        cls.demonum = -1;               // stop demo loop
+
+       // Might need to disable vsync
+       Cvar_Callback(&vid_vsync);
 }
 
 /*
@@ -679,7 +684,7 @@ static void CL_Demos_f(cmd_state_t *cmd)
                return;
        if (cls.demonum == -1)
                cls.demonum = 1;
-       CL_Disconnect(false, NULL);
+       CL_Disconnect();
        CL_NextDemo();
 }
 
@@ -694,7 +699,7 @@ static void CL_Stopdemo_f(cmd_state_t *cmd)
 {
        if (!cls.demoplayback)
                return;
-       CL_Disconnect(false, NULL);
+       CL_Disconnect();
 }
 
 // LadyHavoc: pausedemo command