client: extend multiplayer rules with ctf

This commit is contained in:
Denis Pauk 2025-03-08 22:16:54 +02:00
parent 84cc99d559
commit 5d4a2facbd
3 changed files with 23 additions and 43 deletions

View file

@ -644,10 +644,7 @@ Con_DrawConsole(float frac)
verLen = strlen(version);
for (x = 0; x < verLen; x++)
{
Draw_CharScaled(viddef.width - ((verLen*8+5) * scale) + x * 8 * scale, lines - 35 * scale, 128 + version[x], scale);
}
Draw_StringScaled(viddef.width - ((verLen * 8 + 5) * scale), lines - 35 * scale, scale, true, version);
t = time(NULL);
today = localtime(&t);
@ -655,10 +652,7 @@ Con_DrawConsole(float frac)
Com_sprintf(tmpbuf, sizeof(tmpbuf), "%s", timebuf);
for (x = 0; x < 21; x++)
{
Draw_CharScaled(viddef.width - (173 * scale) + x * 8 * scale, lines - 25 * scale, 128 + tmpbuf[x], scale);
}
Draw_StringScaled(viddef.width - (173 * scale), lines - 25 * scale, scale, true, tmpbuf);
/* draw the text */
con.vislines = lines;

View file

@ -4244,15 +4244,10 @@ RulesChangeFunc(void *self)
s_maxclients_field.generic.statusbar = NULL;
s_startserver_dmoptions_action.generic.statusbar = NULL;
}
/* Ground Zero game modes */
else if (M_IsGame("rogue"))
else if (s_rules_box.curvalue == 2)
{
if (s_rules_box.curvalue == 2)
{
s_maxclients_field.generic.statusbar = NULL;
s_startserver_dmoptions_action.generic.statusbar = NULL;
}
s_maxclients_field.generic.statusbar = NULL;
s_startserver_dmoptions_action.generic.statusbar = NULL;
}
}
@ -4287,16 +4282,12 @@ StartServerActionFunc(void *self)
Cvar_SetValue("singleplayer", 0);
if ((s_rules_box.curvalue < 2) || M_IsGame("rogue"))
{
Cvar_SetValue("deathmatch", (float)!s_rules_box.curvalue);
Cvar_SetValue("coop", (float)s_rules_box.curvalue);
}
else
{
Cvar_SetValue("deathmatch", 1); /* deathmatch is always true for rogue games */
Cvar_SetValue("coop", 0); /* This works for at least the main game and both addons */
}
/* deathmatch is always true for rogue games */
Cvar_SetValue("deathmatch",
(s_rules_box.curvalue == 3 || s_rules_box.curvalue == 0) ? 1 : 0);
/* This works for at least the main game and both addons */
Cvar_SetValue("coop", s_rules_box.curvalue == 1 ? 1 : 0);
Cvar_SetValue("ctf", s_rules_box.curvalue == 3 ? 1 : 0);
spot = NULL;
@ -4364,16 +4355,11 @@ static void
StartServer_MenuInit(void)
{
static const char *dm_coop_names[] =
{
"deathmatch",
"cooperative",
0
};
static const char *dm_coop_names_rogue[] =
{
"deathmatch",
"cooperative",
"tag",
"ctf",
0
};
@ -4483,24 +4469,24 @@ StartServer_MenuInit(void)
s_rules_box.generic.y = 20;
s_rules_box.generic.name = "rules";
/* Ground Zero games only available with rogue game */
if (M_IsGame("rogue"))
{
s_rules_box.itemnames = dm_coop_names_rogue;
}
else
{
s_rules_box.itemnames = dm_coop_names;
}
s_rules_box.itemnames = dm_coop_names;
if (Cvar_VariableValue("coop"))
{
s_rules_box.curvalue = 1;
}
else
else if (Cvar_VariableValue("ctf"))
{
s_rules_box.curvalue = 3;
}
else if (Cvar_VariableValue("deathmatch"))
{
s_rules_box.curvalue = 0;
}
else
{
s_rules_box.curvalue = 2;
}
s_rules_box.generic.callback = RulesChangeFunc;
}

View file

@ -207,7 +207,7 @@ PF_Configstring(int index, const char *val)
if ((internal_index < 0) || (internal_index >= MAX_CONFIGSTRINGS))
{
Com_Error(ERR_DROP, "configstring: bad internal_index %i\n", internal_index);
Com_Error(ERR_DROP, "configstring: bad index %i\n", internal_index);
}
/* change the string in sv */