From b72bc73d2894cf964ab848f943639df5d646c201 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 3 May 2023 22:08:13 +0100 Subject: [PATCH] Two new command automation events - "QueueStart" - Activates just before RoundStart, but only if a roundqueue is being started - "QueueEnd" - Activates just before IntermissionStart, but only if the roundqueue has just finished its final map I chose before in both instances because Automate_Run runs off COM_BufAddText, and I don't completely trust that the buffer won't overflow for particularly complicated server commands, so prioritising the rarer event. However, this is open for discussion --- src/d_netcmd.c | 4 +++- src/d_netcmd.h | 2 ++ src/g_game.c | 5 +++++ src/y_inter.c | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index dfd86c0ed..f24d34b6f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -592,7 +592,9 @@ const char *automate_names[AEV__MAX] = { "RoundStart", // AEV_ROUNDSTART "IntermissionStart", // AEV_INTERMISSIONSTART - "VoteStart" // AEV_VOTESTART + "VoteStart", // AEV_VOTESTART + "QueueStart", // AEV_QUEUESTART + "QueueEnd", // AEV_QUEUEEND }; UINT32 livestudioaudience_timer = 90; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index ebc87bbfc..5428d3c04 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -276,6 +276,8 @@ typedef enum AEV_ROUNDSTART, AEV_INTERMISSIONSTART, AEV_VOTESTART, + AEV_QUEUESTART, + AEV_QUEUEEND, AEV__MAX } automateEvents_t; diff --git a/src/g_game.c b/src/g_game.c index d74bd1a4f..2798b516f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1598,6 +1598,11 @@ void G_DoLoadLevelEx(boolean resetplayer, gamestate_t newstate) if (doAutomate == true) { + if (roundqueue.size > 0 && roundqueue.position == 1) + { + Automate_Run(AEV_QUEUESTART); + } + Automate_Run(AEV_ROUNDSTART); } diff --git a/src/y_inter.c b/src/y_inter.c index 07e2961b3..c69e21ad6 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -849,6 +849,11 @@ void Y_StartIntermission(void) K_CashInPowerLevels(); } + if (roundqueue.size > 0 && roundqueue.position == roundqueue.size) + { + Automate_Run(AEV_QUEUEEND); + } + Automate_Run(AEV_INTERMISSIONSTART); bgpatch = W_CachePatchName("MENUBG", PU_STATIC); widebgpatch = W_CachePatchName("WEIRDRES", PU_STATIC);