]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
ZQ_PAUSE extension patch from GreEn`mArine
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 25 Feb 2009 10:28:47 +0000 (10:28 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 25 Feb 2009 10:28:47 +0000 (10:28 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8757 d7cf8633-e32d-0410-b094-e92efae38249

clvm_cmds.c
host.c
progsvm.h
prvm_edict.c
server.h
svvm_cmds.c

index f0faa31fe659f916f7917d3ea8eeced913e95302..7849ffe2a29b846d032a1704bc334a798904f8dd 100644 (file)
@@ -3606,6 +3606,17 @@ VM_cvar_description,                                     // #518 float(string name) cvar_description = #518; (DP
 NULL,                                                  // #519
 VM_keynumtostring,                             // #520 string keynumtostring(float keynum)
 VM_findkeysforcommand,         // #521 string findkeysforcommand(string command)
 NULL,                                                  // #519
 VM_keynumtostring,                             // #520 string keynumtostring(float keynum)
 VM_findkeysforcommand,         // #521 string findkeysforcommand(string command)
+NULL,                                                  // #522
+NULL,                                                  // #523
+NULL,                                                  // #524
+NULL,                                                  // #525
+NULL,                                                  // #526
+NULL,                                                  // #527
+NULL,                                                  // #528
+NULL,                                                  // #529
+NULL,                                                  // #530
+NULL,                                  // #531
+NULL,                                                  // #532
 };
 
 const int vm_cl_numbuiltins = sizeof(vm_cl_builtins) / sizeof(prvm_builtin_t);
 };
 
 const int vm_cl_numbuiltins = sizeof(vm_cl_builtins) / sizeof(prvm_builtin_t);
diff --git a/host.c b/host.c
index f00b8e6d0623a3caa18779d6afe507076b8fa1f6..dbad918f04bd65a6e7dc45bf07853f3c55cd13a9 100644 (file)
--- a/host.c
+++ b/host.c
@@ -801,6 +801,11 @@ void Host_Main(void)
 
                        // send all messages to the clients
                        SV_SendClientMessages();
 
                        // send all messages to the clients
                        SV_SendClientMessages();
+                       
+                       if (sv.paused == 1 && realtime > sv.pausedstart && sv.pausedstart > 0) {
+                               prog->globals.generic[OFS_PARM0] = realtime - sv.pausedstart;
+                               PRVM_ExecuteProgram(prog->funcoffsets.SV_PausedTic, "QC function SV_PausedTic is missing");
+                       }
 
                        // end the server VM frame
                        SV_VM_End();
 
                        // end the server VM frame
                        SV_VM_End();
index 1f459d4356ff10d9c18603ad642fec002cd56c04..d53c6f42a654324c43c22f8e3a8f09814d12b514 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -300,6 +300,7 @@ typedef struct prvm_prog_funcoffsets_s
        func_t GameCommand; // any
        func_t SV_Shutdown; // ssqc
        func_t URI_Get_Callback; // any
        func_t GameCommand; // any
        func_t SV_Shutdown; // ssqc
        func_t URI_Get_Callback; // any
+       func_t SV_PausedTic; //ssqc
 
        // menu qc only uses some functions, nothing else
        func_t m_draw; // mqc
 
        // menu qc only uses some functions, nothing else
        func_t m_draw; // mqc
index 72b9c3e20a01d8a47c93fc37005020e7317d8a46..a751a15ecfc7e5b50c57244ffd49822b5adecba9 100644 (file)
@@ -1523,6 +1523,7 @@ void PRVM_FindOffsets(void)
        prog->funcoffsets.GameCommand                     = PRVM_ED_FindFunctionOffset("GameCommand");
        prog->funcoffsets.SV_Shutdown                     = PRVM_ED_FindFunctionOffset("SV_Shutdown");
        prog->funcoffsets.URI_Get_Callback                = PRVM_ED_FindFunctionOffset("URI_Get_Callback");
        prog->funcoffsets.GameCommand                     = PRVM_ED_FindFunctionOffset("GameCommand");
        prog->funcoffsets.SV_Shutdown                     = PRVM_ED_FindFunctionOffset("SV_Shutdown");
        prog->funcoffsets.URI_Get_Callback                = PRVM_ED_FindFunctionOffset("URI_Get_Callback");
+       prog->funcoffsets.SV_PausedTic                    = PRVM_ED_FindFunctionOffset("SV_PausedTic");
        prog->globaloffsets.SV_InitCmd                    = PRVM_ED_FindGlobalOffset("SV_InitCmd");
        prog->globaloffsets.self                          = PRVM_ED_FindGlobalOffset("self");
        prog->globaloffsets.time                          = PRVM_ED_FindGlobalOffset("time");
        prog->globaloffsets.SV_InitCmd                    = PRVM_ED_FindGlobalOffset("SV_InitCmd");
        prog->globaloffsets.self                          = PRVM_ED_FindGlobalOffset("self");
        prog->globaloffsets.time                          = PRVM_ED_FindGlobalOffset("time");
index 7095d4364ac55b3b27f49f31ff6b3fec3170598f..99c5296d263be02a4519cf44a195623191f8cc3a 100644 (file)
--- a/server.h
+++ b/server.h
@@ -68,6 +68,7 @@ typedef struct server_s
        qboolean active;
 
        qboolean paused;
        qboolean active;
 
        qboolean paused;
+       double pausedstart;
        // handle connections specially
        qboolean loadgame;
 
        // handle connections specially
        qboolean loadgame;
 
index 9ce38d3b0edf7e6860f715e87ac6871462572ae9..0bd684c91c752af429d6b481cb9c897c884c00e8 100644 (file)
@@ -170,6 +170,7 @@ char *vm_sv_extensions =
 "PRYDON_CLIENTCURSOR "
 "TENEBRAE_GFX_DLIGHTS "
 "TW_SV_STEPCONTROL "
 "PRYDON_CLIENTCURSOR "
 "TENEBRAE_GFX_DLIGHTS "
 "TW_SV_STEPCONTROL "
+"ZQ_PAUSE "
 //"EXT_CSQC " // not ready yet
 ;
 
 //"EXT_CSQC " // not ready yet
 ;
 
@@ -2954,6 +2955,24 @@ static void VM_SV_pointparticles (void)
        SV_FlushBroadcastMessages();
 }
 
        SV_FlushBroadcastMessages();
 }
 
+//PF_setpause,    // void(float pause) setpause        = #531;
+static void VM_SV_setpause(void) {
+       int pauseValue;
+       pauseValue = (int)PRVM_G_FLOAT(OFS_PARM0);
+       if (pauseValue != 0) { //pause the game
+               sv.paused = 1;
+               sv.pausedstart = Sys_DoubleTime();
+       } else { //disable pause, in case it was enabled
+               if (sv.paused != 0) {
+                       sv.paused = 0;
+                       sv.pausedstart = 0;
+               }
+       }
+       // send notification to all clients
+       MSG_WriteByte(&sv.reliable_datagram, svc_setpause);
+       MSG_WriteByte(&sv.reliable_datagram, sv.paused);
+}
+
 prvm_builtin_t vm_sv_builtins[] = {
 NULL,                                                  // #0 NULL function (not callable) (QUAKE)
 VM_makevectors,                                        // #1 void(vector ang) makevectors (QUAKE)
 prvm_builtin_t vm_sv_builtins[] = {
 NULL,                                                  // #0 NULL function (not callable) (QUAKE)
 VM_makevectors,                                        // #1 void(vector ang) makevectors (QUAKE)
@@ -3479,6 +3498,19 @@ VM_argv_end_index,                                               // #516 float(float idx) argv_end_index = #516; (DP_QC_T
 VM_buf_cvarlist,                                               // #517 void(float buf, string prefix, string antiprefix) buf_cvarlist = #517; (DP_QC_STRINGBUFFERS_CVARLIST)
 VM_cvar_description,                                   // #518 float(string name) cvar_description = #518; (DP_QC_CVAR_DESCRIPTION)
 NULL,                                                  // #519
 VM_buf_cvarlist,                                               // #517 void(float buf, string prefix, string antiprefix) buf_cvarlist = #517; (DP_QC_STRINGBUFFERS_CVARLIST)
 VM_cvar_description,                                   // #518 float(string name) cvar_description = #518; (DP_QC_CVAR_DESCRIPTION)
 NULL,                                                  // #519
+NULL,                                                  // #520
+NULL,                                                  // #521
+NULL,                                                  // #522
+NULL,                                                  // #523
+NULL,                                                  // #524
+NULL,                                                  // #525
+NULL,                                                  // #526
+NULL,                                                  // #527
+NULL,                                                  // #528
+NULL,                                                  // #529
+NULL,                                                  // #530
+VM_SV_setpause,                                        // #531 void(float pause) setpause = #531;
+NULL,                                                  // #532
 };
 
 const int vm_sv_numbuiltins = sizeof(vm_sv_builtins) / sizeof(prvm_builtin_t);
 };
 
 const int vm_sv_numbuiltins = sizeof(vm_sv_builtins) / sizeof(prvm_builtin_t);