Add roundqueue -show
Reveals the next Round in the queue via server shout message. Can be used manually, or with automate commands for tournament rulesets that permit foreknowledge of the next Round without requiring the host to work off memory or document.
This commit is contained in:
parent
ec5b8fcf04
commit
5557aa312d
4 changed files with 52 additions and 7 deletions
|
|
@ -5443,7 +5443,7 @@ static void PT_ReqMapQueue(int node)
|
|||
}
|
||||
}
|
||||
|
||||
const boolean doclear = (reqmapqueue.newgametype == ROUNDQUEUE_CLEAR);
|
||||
const boolean doclear = (reqmapqueue.newgametype == ROUNDQUEUE_CMD_CLEAR);
|
||||
|
||||
// The following prints will only appear when multiple clients
|
||||
// attempt to affect the round queue at similar time increments
|
||||
|
|
@ -5457,6 +5457,33 @@ static void PT_ReqMapQueue(int node)
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if (reqmapqueue.newgametype == ROUNDQUEUE_CMD_SHOW)
|
||||
{
|
||||
char maprevealmsg[256];
|
||||
if (roundqueue.size == 0)
|
||||
{
|
||||
strlcpy(maprevealmsg, "There are no Rounds queued.", 256);
|
||||
}
|
||||
else if (roundqueue.position >= roundqueue.size)
|
||||
{
|
||||
strlcpy(maprevealmsg, "There are no more Rounds queued!", 256);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *title = G_BuildMapTitle(roundqueue.entries[roundqueue.position].mapnum + 1);
|
||||
|
||||
strlcpy(
|
||||
maprevealmsg,
|
||||
va("The next Round will be on \"%s\".", title),
|
||||
256
|
||||
);
|
||||
|
||||
Z_Free(title);
|
||||
}
|
||||
DoSayCommand(maprevealmsg, 0, HU_SHOUT, servernode);
|
||||
|
||||
return;
|
||||
}
|
||||
else if (roundqueue.size >= ROUNDQUEUE_MAX)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Recieved REQMAPQUEUE, but unable to add map beyond %u\n", roundqueue.size);
|
||||
|
|
|
|||
|
|
@ -4156,6 +4156,7 @@ static void Command_QueueMap_f(void)
|
|||
size_t option_gametype;
|
||||
size_t option_encore;
|
||||
size_t option_clear;
|
||||
size_t option_show;
|
||||
|
||||
boolean usingcheats;
|
||||
boolean ischeating;
|
||||
|
|
@ -4199,7 +4200,21 @@ static void Command_QueueMap_f(void)
|
|||
return;
|
||||
}
|
||||
|
||||
Handle_MapQueueSend(0, ROUNDQUEUE_CLEAR, false);
|
||||
Handle_MapQueueSend(0, ROUNDQUEUE_CMD_CLEAR, false);
|
||||
return;
|
||||
}
|
||||
|
||||
option_show = COM_CheckParm("-show");
|
||||
|
||||
if (option_show)
|
||||
{
|
||||
if (ischeating && !usingcheats)
|
||||
{
|
||||
CONS_Printf(M_GetText("Cheats must be enabled.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
Handle_MapQueueSend(0, ROUNDQUEUE_CMD_SHOW, false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -4219,7 +4234,7 @@ static void Command_QueueMap_f(void)
|
|||
if (first_option < 2)
|
||||
{
|
||||
/* I'm going over the fucking lines and I DON'T CAREEEEE */
|
||||
CONS_Printf("queuemap <name / number> [-gametype <type>] [-force] / [-clear]:\n");
|
||||
CONS_Printf("queuemap <name / number> [-gametype <type>] [-force] / [-clear] / [-spoil]:\n");
|
||||
CONS_Printf(M_GetText(
|
||||
"Queue up a map by its name, or by its number (though why would you).\n"
|
||||
"All parameters are case-insensitive and may be abbreviated.\n"));
|
||||
|
|
@ -4326,7 +4341,7 @@ static void Got_MapQueuecmd(UINT8 **cp, INT32 playernum)
|
|||
return;
|
||||
}
|
||||
|
||||
doclear = (setgametype == ROUNDQUEUE_CLEAR);
|
||||
doclear = (setgametype == ROUNDQUEUE_CMD_CLEAR);
|
||||
|
||||
if (doclear == false && queueposition >= ROUNDQUEUE_MAX)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,6 +37,12 @@ extern "C" {
|
|||
// Selected map etc.
|
||||
// =============================
|
||||
|
||||
#define ROUNDQUEUE_MAX 10 // sane max? maybe make dynamically allocated later
|
||||
// These two live in gametype field of packets
|
||||
#define ROUNDQUEUE_CMD_CLEAR UINT16_MAX
|
||||
#define ROUNDQUEUE_CMD_SHOW UINT16_MAX-1
|
||||
// The roundqueue itself is resident in g_game.h
|
||||
|
||||
// Selected by user.
|
||||
extern mapnum_t gamemap;
|
||||
extern char mapmusname[7];
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@ extern tic_t levelstarttic;
|
|||
// for modding?
|
||||
extern mapnum_t prevmap, nextmap;
|
||||
|
||||
#define ROUNDQUEUE_MAX 10 // sane max? maybe make dynamically allocated later
|
||||
#define ROUNDQUEUE_CLEAR UINT16_MAX // lives in gametype field of packets
|
||||
|
||||
struct roundentry_t
|
||||
{
|
||||
UINT16 mapnum; // Map number at this position
|
||||
|
|
|
|||
Loading…
Reference in a new issue