alias cl_hook_gamestart_tmayhem
alias cl_hook_gamestart_tka
alias cl_hook_gamestart_surv
+alias cl_hook_intermission
alias cl_hook_gameend
alias cl_hook_shutdown
alias cl_hook_activeweapon
alias cl_hook_demostart
+alias cl_hook_demointermission
alias cl_hook_demoend
// call gameend hook if it hasn't somehow yet fired by intermission starting
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
+ int gamecount = cvar("cl_matchcount");
localcmd(strcat("cl_matchcount ", itos(gamecount + 1), "\n"));
//cvar_set("cl_matchcount", itos(gamecount + 1));
calledhooks |= HOOK_END;
//hooks
int calledhooks;
-const int HOOK_START = 1;
-const int HOOK_END = 2;
+const int HOOK_START = 1; // VM init
+const int HOOK_END = 2; // VM shutdown
+const int HOOK_INTERMISSION = 4; // intermission start
.float ping, ping_packetloss, ping_movementloss;
else if(game_stopped_time && !STAT(GAME_STOPPED))
game_stopped_time = 0;
- // fire game end hooks here once intermission starts
- // do not fire demo end hooks here as we are
- // still running a demo until the CSQC VM is shutdown
- if(intermission && !isdemo() && !(calledhooks & HOOK_END))
+ // fire intermission hooks here once intermission starts
+ // do not fire game/demo end hooks here as we are
+ // still running something until the CSQC VM is shutdown
+ if(intermission && !(calledhooks & HOOK_INTERMISSION))
{
- if(calledhooks & HOOK_START)
+ if(!isdemo())
{
- 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;
+ // ensure that we have properly initiated a gamemode
+ // before firing this hook. gamestart -> intermission
+ if(calledhooks & HOOK_START)
+ {
+ localcmd("\ncl_hook_intermission\n");
+ calledhooks |= HOOK_INTERMISSION;
+ }
+ }
+ else
+ {
+ // ensure that we have properly initiated a gamemode
+ // before firing this hook. demostart -> intermission
+ if(calledhooks & HOOK_START)
+ {
+ localcmd("\ncl_hook_demointermission\n");
+ calledhooks |= HOOK_INTERMISSION;
+ }
}
}