From: Mario Date: Fri, 6 Nov 2020 13:55:39 +0000 (+0000) Subject: Merge branch 'Mario/matchcount' into 'develop' X-Git-Tag: xonotic-v0.8.5~7^2~21 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=1ea9a8bdfd765f9ccec511cb673db43674777aa7;hp=b3b025b11342cca1a569ae5aecb1082c2d42482b;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'Mario/matchcount' into 'develop' Merge branch Mario/matchcount (XXS merge request) See merge request xonotic/xonotic-data.pk3dir!606 --- diff --git a/gamemodes-client.cfg b/gamemodes-client.cfg index c43b9d1d3f..71d272a174 100644 --- a/gamemodes-client.cfg +++ b/gamemodes-client.cfg @@ -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 diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 16600f7433..944bb2f33c 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -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"); diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index e03dca633c..0593fdfb2d 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -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; } }