]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Increment cl_matchcount based on the counter before cl_hook_gameend is called, allows...
authorMario <mario.mario@y7mail.com>
Fri, 6 Nov 2020 13:55:39 +0000 (13:55 +0000)
committerMario <mario.mario@y7mail.com>
Fri, 6 Nov 2020 13:55:39 +0000 (13:55 +0000)
gamemodes-client.cfg
qcsrc/client/main.qc
qcsrc/client/view.qc

index c43b9d1d3f2e6fe73fddbb33e8489670350edc4d..71d272a174e7c50dcb868fa34e472d043668a250 100644 (file)
@@ -32,6 +32,6 @@ alias cl_hook_gamestart_ka
 alias cl_hook_gamestart_ft
 alias cl_hook_gamestart_inv
 alias cl_hook_gamestart_duel
-alias cl_hook_gameend "rpn /cl_matchcount dup load 1 + =" // increase match count every time a game ends
+alias cl_hook_gameend
 alias cl_hook_shutdown
 alias cl_hook_activeweapon
index 16600f7433eb17b1af72c33ded08c7db7183d9ec..944bb2f33ccaf6d2f83ef1c4a50ad6b881bc7dbf 100644 (file)
@@ -174,7 +174,14 @@ void Shutdown()
                if (!(calledhooks & HOOK_START))
                        localcmd("\n_cl_hook_gamestart nop\n");
                if (!(calledhooks & HOOK_END))
+               {
+                       int gamecount = cvar("cl_matchcount");
                        localcmd("\ncl_hook_gameend\n");
+                       // NOTE: using localcmd here to ensure it's executed AFTER cl_hook_gameend
+                       // earlier versions of the game abuse the hook to set this cvar
+                       localcmd(strcat("cl_matchcount ", itos(gamecount + 1), "\n"));
+                       //cvar_set("cl_matchcount", itos(gamecount + 1));
+               }
        }
 
        localcmd("\ncl_hook_shutdown\n");
index e03dca633c28b54a030d1f65939437858daa0332..0593fdfb2d4bc86c03ef7db34e60ee1ac40a0ec8 100644 (file)
@@ -1694,7 +1694,12 @@ void CSQC_UpdateView(entity this, float w, float h)
        {
                if(calledhooks & HOOK_START)
                {
+                       int gamecount = cvar("cl_matchcount");
                        localcmd("\ncl_hook_gameend\n");
+                       // NOTE: using localcmd here to ensure it's executed AFTER cl_hook_gameend
+                       // earlier versions of the game abuse the hook to set this cvar
+                       localcmd(strcat("cl_matchcount ", itos(gamecount + 1), "\n"));
+                       //cvar_set("cl_matchcount", itos(gamecount + 1));
                        calledhooks |= HOOK_END;
                }
        }