From b856c3d0b8beb93d81078f5a90d160207327efc4 Mon Sep 17 00:00:00 2001 From: Reki Date: Mon, 24 May 2021 11:48:02 -0400 Subject: [PATCH] Added new SSQC entrypoint SaveTriggered --- prvm_offsets.h | 2 ++ sv_save.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/prvm_offsets.h b/prvm_offsets.h index fb53c24f..ec0112ae 100644 --- a/prvm_offsets.h +++ b/prvm_offsets.h @@ -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) diff --git a/sv_save.c b/sv_save.c index 4fc687a5..a90b439a 100644 --- 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); -- 2.39.2