]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Added new SSQC entrypoint SaveTriggered
authorReki <spiper212@gmail.com>
Mon, 24 May 2021 15:48:02 +0000 (11:48 -0400)
committerReki <spiper212@gmail.com>
Mon, 24 May 2021 15:48:02 +0000 (11:48 -0400)
prvm_offsets.h
sv_save.c

index fb53c24fef45efa1fc8cf3246e98f230d2067d04..ec0112ae9429ff766dd2d32379c2a8d271df64e6 100644 (file)
@@ -433,6 +433,7 @@ PRVM_DECLARE_function(PlayerPreThink)
 PRVM_DECLARE_function(PutClientInServer)
 PRVM_DECLARE_function(RestoreGame)
 PRVM_DECLARE_function(LoadTriggered)
+PRVM_DECLARE_function(SaveTriggered)
 PRVM_DECLARE_function(RestartTriggered)
 PRVM_DECLARE_function(SV_ChangeTeam)
 PRVM_DECLARE_function(SV_OnEntityNoSpawnFunction)
@@ -803,6 +804,7 @@ PRVM_DECLARE_serverfunction(PlayerPreThink)
 PRVM_DECLARE_serverfunction(PutClientInServer)
 PRVM_DECLARE_serverfunction(RestoreGame)
 PRVM_DECLARE_serverfunction(LoadTriggered)
+PRVM_DECLARE_serverfunction(SaveTriggered)
 PRVM_DECLARE_serverfunction(RestartTriggered)
 PRVM_DECLARE_serverfunction(SV_ChangeTeam)
 PRVM_DECLARE_serverfunction(SV_OnEntityNoSpawnFunction)
index 4fc687a5029ae88cb9afb5a61b21241a6bdbc3ae..a90b439a1c33f86d346da3610d140c28d5315774 100644 (file)
--- a/sv_save.c
+++ b/sv_save.c
@@ -55,6 +55,14 @@ void SV_Savegame_to(prvm_prog_t *prog, const char *name)
                Con_Print("ERROR: couldn't open.\n");
                return;
        }
+       
+       if (PRVM_serverfunction(SaveTriggered))
+       {
+               Con_DPrint("Calling SaveTriggered\n");
+               PRVM_serverglobalfloat(time) = sv.time;
+               PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
+               prog->ExecuteProgram(prog, PRVM_serverfunction(SaveTriggered), "QC function SaveTriggered is missing");
+       }
 
        FS_Printf(f, "%i\n", SAVEGAME_VERSION);