game: disable ctf menu if game != ctf

This commit is contained in:
Denis Pauk 2023-11-04 19:45:23 +02:00
parent d27fc1f333
commit 977dbc34e6
2 changed files with 3307 additions and 3285 deletions

View file

@ -2967,7 +2967,7 @@ M_Credits_MenuDraw(void)
}
}
const char *
static const char *
M_Credits_Key(int key)
{
key = Key_GetMenuKey(key);
@ -4159,6 +4159,7 @@ StartServerActionFunc(void *self)
{
capturelimit = (float)strtod(s_capturelimit_field.buffer, (char **)NULL);
Cvar_SetValue("capturelimit", ClampCvar(0, capturelimit, capturelimit));
Cvar_SetValue("ctf", 1);
}
Cvar_SetValue("maxclients", ClampCvar(0, maxclients, maxclients));
@ -4457,9 +4458,13 @@ StartServer_MenuInit(void)
Menu_AddItem(&s_startserver_menu, &s_startmap_list);
if (M_IsGame("ctf"))
{
Menu_AddItem(&s_startserver_menu, &s_capturelimit_field);
}
else
{
Menu_AddItem(&s_startserver_menu, &s_rules_box);
}
Menu_AddItem(&s_startserver_menu, &s_timelimit_field);
Menu_AddItem(&s_startserver_menu, &s_fraglimit_field);
@ -4924,7 +4929,9 @@ DMOptions_MenuInit(void)
Menu_AddItem(&s_dmoptions_menu, &s_force_respawn_box);
if (!M_IsGame("ctf"))
{
Menu_AddItem(&s_dmoptions_menu, &s_teamplay_box);
}
Menu_AddItem(&s_dmoptions_menu, &s_allow_exit_box);
Menu_AddItem(&s_dmoptions_menu, &s_infinite_ammo_box);
@ -4932,7 +4939,9 @@ DMOptions_MenuInit(void)
Menu_AddItem(&s_dmoptions_menu, &s_quad_drop_box);
if (!M_IsGame("ctf"))
{
Menu_AddItem(&s_dmoptions_menu, &s_friendlyfire_box);
}
if (M_IsGame("rogue"))
{
@ -5279,7 +5288,8 @@ ModelCallback(void *unused)
}
// returns true if icon .pcx exists for skin .pcx
static qboolean IconOfSkinExists(char* skin, char** pcxfiles, int npcxfiles)
static qboolean
IconOfSkinExists(char* skin, char** pcxfiles, int npcxfiles)
{
int i;
char scratch[1024];
@ -5300,7 +5310,8 @@ static qboolean IconOfSkinExists(char* skin, char** pcxfiles, int npcxfiles)
}
// strip file extension
void StripExtension(char* path)
static void
StripExtension(char* path)
{
int length;
@ -5349,7 +5360,8 @@ ContainsFile(char* path, char* file)
}
// replace characters in string
void ReplaceCharacters(char* s, char r, char c)
static void
ReplaceCharacters(char* s, char r, char c)
{
char* p = s;

View file

@ -377,7 +377,7 @@ CTFSpawn(void)
void
CTFInit(void)
{
ctf = gi.cvar("ctf", "1", CVAR_SERVERINFO);
ctf = gi.cvar("ctf", "0", CVAR_SERVERINFO);
ctf_forcejoin = gi.cvar("ctf_forcejoin", "", 0);
competition = gi.cvar("competition", "0", CVAR_SERVERINFO);
matchlock = gi.cvar("matchlock", "1", CVAR_SERVERINFO);
@ -1215,6 +1215,11 @@ CTFEffects(edict_t *player)
{
player->s.effects &= ~(EF_FLAG1 | EF_FLAG2);
if (!flag1_item || !flag2_item)
{
return;
}
if (player->health > 0)
{
if (player->client->pers.inventory[ITEM_INDEX(flag1_item)])
@ -4236,6 +4241,11 @@ CTFCredits(edict_t *ent, pmenuhnd_t *p)
qboolean
CTFStartClient(edict_t *ent)
{
if (!ctf->value)
{
return false;
}
if (ent->client->resp.ctf_team != CTF_NOTEAM)
{
return false;