]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
New OffscreenGecko scripting stuff
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index 5089a6a588730199bb464e6814f54ce434dac1b4..7862e440f2b95a519a8378518b5c40c069de8421 100644 (file)
--- a/host.c
+++ b/host.c
@@ -220,15 +220,9 @@ Host_SaveConfig_f
 Writes key bindings and archived cvars to config.cfg
 ===============
 */
-void Host_SaveConfig_f(void)
+void Host_SaveConfig_to(const char *file)
 {
        qfile_t *f;
-       const char *file = "config.cfg";
-
-       if(Cmd_Argc() >= 2) {
-               file = Cmd_Argv(1);
-               Con_Printf("Saving to %s\n", file);
-       }
 
 // dedicated servers initialize the host but don't parse and set the
 // config.cfg cvars
@@ -248,7 +242,21 @@ void Host_SaveConfig_f(void)
                FS_Close (f);
        }
 }
+void Host_SaveConfig(void)
+{
+       Host_SaveConfig_to("config.cfg");
+}
+void Host_SaveConfig_f(void)
+{
+       const char *file = "config.cfg";
+
+       if(Cmd_Argc() >= 2) {
+               file = Cmd_Argv(1);
+               Con_Printf("Saving to %s\n", file);
+       }
 
+       Host_SaveConfig_to(file);
+}
 
 /*
 ===============
@@ -508,6 +516,13 @@ void Host_ShutdownServer(void)
        for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
                if (host_client->active)
                        SV_DropClient(false); // server shutdown
+       if(prog->loaded)
+               if(prog->funcoffsets.SV_Shutdown)
+               {
+                       func_t s = prog->funcoffsets.SV_Shutdown;
+                       prog->funcoffsets.SV_Shutdown = 0; // prevent it from getting called again
+                       PRVM_ExecuteProgram(s,"SV_Shutdown() required");
+               }
        SV_VM_End();
 
        NetConn_CloseServerPorts();
@@ -849,9 +864,7 @@ void Host_Main(void)
                        //ui_update();
 
                        CL_Video_Frame();
-#ifdef SUPPORT_GECKO
                        CL_Gecko_Frame();
-#endif
 
                        CL_UpdateScreen();
 
@@ -865,7 +878,7 @@ void Host_Main(void)
                                cl.csqc_usecsqclistener = false;
                        }
                        else
-                               S_Update(&r_view.matrix);
+                               S_Update(&r_refdef.view.matrix);
 
                        CDAudio_Update();
 
@@ -986,23 +999,7 @@ static void Host_Init (void)
        COM_InitGameType();
 
        // construct a version string for the corner of the console
-#if defined(__linux__)
-       os = "Linux";
-#elif defined(WIN32)
-       os = "Windows";
-#elif defined(__FreeBSD__)
-       os = "FreeBSD";
-#elif defined(__NetBSD__)
-       os = "NetBSD";
-#elif defined(__OpenBSD__)
-       os = "OpenBSD";
-#elif defined(MACOSX)
-       os = "Mac OS X";
-#elif defined(__MORPHOS__)
-       os = "MorphOS";
-#else
-       os = "Unknown";
-#endif
+       os = DP_OS_NAME;
        dpsnprintf (engineversion, sizeof (engineversion), "%s %s %s", gamename, os, buildstring);
        Con_Printf("%s\n", engineversion);
 
@@ -1164,12 +1161,10 @@ void Host_Shutdown(void)
        // AK shutdown PRVM
        // AK hmm, no PRVM_Shutdown(); yet
 
-#ifdef SUPPORT_GECKO
        CL_Gecko_Shutdown();
-#endif
        CL_Video_Shutdown();
 
-       Host_SaveConfig_f();
+       Host_SaveConfig();
 
        CDAudio_Shutdown ();
        S_Terminate ();