]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
mathlib: Simplify VectorNormalizeLength to use existing math macros
[xonotic/darkplaces.git] / cl_main.c
index d758cec83fab938b79cb1f7f504e96d1f965fcb3..2a2b9976d204dd82cc6e41bf67c9c3e1b1e6cf50 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -340,6 +340,16 @@ void CL_ExpandCSQCRenderEntities(int num)
        }
 }
 
+static void CL_ToggleMenu_Hook(void)
+{
+#ifdef CONFIG_MENU
+       // remove menu
+       if (key_dest == key_menu || key_dest == key_menu_grabbed)
+               MR_ToggleMenu(0);
+#endif
+       key_dest = key_game;
+}
+
 extern cvar_t rcon_secure;
 
 /*
@@ -2718,6 +2728,21 @@ void CL_UpdateEntityShading(void)
                CL_UpdateEntityShading_Entity(r_refdef.scene.entities[i]);
 }
 
+qbool vid_opened = false;
+void CL_StartVideo(void)
+{
+       if (!vid_opened && cls.state != ca_dedicated)
+       {
+               vid_opened = true;
+#ifdef WIN32
+               // make sure we open sockets before opening video because the Windows Firewall "unblock?" dialog can screw up the graphics context on some graphics drivers
+               NetConn_UpdateSockets();
+#endif
+               VID_Start();
+               CDAudio_Startup();
+       }
+}
+
 extern cvar_t host_framerate;
 extern cvar_t host_speeds;
 
@@ -3060,6 +3085,8 @@ void CL_Init (void)
                CL_Video_Init();
 
                host.hook.ConnectLocal = CL_EstablishConnection_Local;
+               host.hook.Disconnect = CL_Disconnect;
                host.hook.CL_Intermission = CL_Intermission;
+               host.hook.ToggleMenu = CL_ToggleMenu_Hook;
        }
 }