]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Added 3 new entrypoints for VMs
authorReki <spiper212@gmail.com>
Wed, 19 May 2021 02:07:55 +0000 (22:07 -0400)
committerReki <spiper212@gmail.com>
Wed, 19 May 2021 02:07:55 +0000 (22:07 -0400)
prvm_offsets.h
sv_ccmds.c
sv_save.c
vid_shared.c

index e89b058aa5db406361838b5ed830f78deb7df1c8..61210039bc66b53756786aa46ff02007d3c70735 100644 (file)
@@ -92,6 +92,7 @@ PRVM_DECLARE_clientfunction(CSQC_Parse_CenterPrint)
 PRVM_DECLARE_clientfunction(CSQC_Parse_Print)
 PRVM_DECLARE_clientfunction(CSQC_Parse_StuffCmd)
 PRVM_DECLARE_clientfunction(CSQC_Parse_TempEntity)
+PRVM_DECLARE_clientfunction(CSQC_RendererRestarted)
 PRVM_DECLARE_clientfunction(CSQC_Shutdown)
 PRVM_DECLARE_clientfunction(CSQC_UpdateView)
 PRVM_DECLARE_clientfunction(GameCommand)
@@ -417,6 +418,7 @@ PRVM_DECLARE_function(CSQC_Parse_CenterPrint)
 PRVM_DECLARE_function(CSQC_Parse_Print)
 PRVM_DECLARE_function(CSQC_Parse_StuffCmd)
 PRVM_DECLARE_function(CSQC_Parse_TempEntity)
+PRVM_DECLARE_function(CSQC_RendererRestarted)
 PRVM_DECLARE_function(CSQC_Shutdown)
 PRVM_DECLARE_function(CSQC_UpdateView)
 PRVM_DECLARE_function(ClientConnect)
@@ -429,6 +431,8 @@ PRVM_DECLARE_function(PlayerPostThink)
 PRVM_DECLARE_function(PlayerPreThink)
 PRVM_DECLARE_function(PutClientInServer)
 PRVM_DECLARE_function(RestoreGame)
+PRVM_DECLARE_function(LoadTriggered)
+PRVM_DECLARE_function(RestartTriggered)
 PRVM_DECLARE_function(SV_ChangeTeam)
 PRVM_DECLARE_function(SV_OnEntityNoSpawnFunction)
 PRVM_DECLARE_function(SV_OnEntityPostSpawnFunction)
@@ -796,6 +800,8 @@ PRVM_DECLARE_serverfunction(PlayerPostThink)
 PRVM_DECLARE_serverfunction(PlayerPreThink)
 PRVM_DECLARE_serverfunction(PutClientInServer)
 PRVM_DECLARE_serverfunction(RestoreGame)
+PRVM_DECLARE_serverfunction(LoadTriggered)
+PRVM_DECLARE_serverfunction(RestartTriggered)
 PRVM_DECLARE_serverfunction(SV_ChangeTeam)
 PRVM_DECLARE_serverfunction(SV_OnEntityNoSpawnFunction)
 PRVM_DECLARE_serverfunction(SV_OnEntityPostSpawnFunction)
index 31359d0f144d092c14a38f8c72167bd9225d178c..ecc3143879824da7c99bfbbf6e1860494153e2bf 100644 (file)
@@ -140,6 +140,14 @@ static void SV_Restart_f(cmd_state_t *cmd)
                Con_Print("Only the server may restart\n");
                return;
        }
+       
+       prvm_prog_t *prog = SVVM_prog;
+       if (PRVM_serverfunction(RestartTriggered))
+       {
+               Con_DPrint("Calling RestartTriggered\n");
+               PRVM_serverglobalfloat(time) = sv.time;
+               prog->ExecuteProgram(prog, PRVM_serverfunction(RestartTriggered), "QC function RestartTriggered is missing");
+       }
 
        if(host.hook.ToggleMenu)
                host.hook.ToggleMenu();
index a08e33a58b37cd965bf5ce62867ddd4f205d90bf..4fc687a5029ae88cb9afb5a61b21241a6bdbc3ae 100644 (file)
--- a/sv_save.c
+++ b/sv_save.c
@@ -243,6 +243,14 @@ void SV_Loadgame_f(cmd_state_t *cmd)
                Con_Print("load <savename> : load a game\n");
                return;
        }
+       
+       if (PRVM_serverfunction(LoadTriggered))
+       {
+               Con_DPrint("Calling LoadTriggered\n");
+               PRVM_serverglobalfloat(time) = sv.time;
+               PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
+               prog->ExecuteProgram(prog, PRVM_serverfunction(LoadTriggered), "QC function LoadTriggered is missing");
+       }
 
        strlcpy (filename, Cmd_Argv(cmd, 1), sizeof(filename));
        FS_DefaultExtension (filename, ".sav", sizeof (filename));
index bc4c98552e0918f82454f61ddd25d1bf6dae3d36..5f44880d368a4ce2515ae2c54f2f8143569996b6 100644 (file)
@@ -1488,6 +1488,13 @@ void VID_Restart_f(cmd_state_t *cmd)
                        Sys_Error("Unable to restore to last working video mode");
        }
        VID_OpenSystems();
+       
+       prvm_prog_t *prog = CLVM_prog;
+       if (PRVM_clientfunction(CSQC_RendererRestarted))
+       {
+               Con_DPrint("Calling CSQC_RendererRestarted\n");
+               prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_RendererRestarted), "QC function CSQC_RendererRestarted is missing");
+       }
 }
 
 const char *vidfallbacks[][2] =