Пример #1
0
/*
==============
TDM_ShowTeamMenu
==============
Show/hide the join team menu
*/
void TDM_ShowTeamMenu (edict_t *ent)
{
	if (ent->client->pers.menu.active)
	{
		// if the votemenu is open, go back to normal menu
		// close the menu after this condition!
		if (ent->client->pers.votemenu_values.show)
		{
			PMenu_Close (ent);
			PMenu_Open (ent, ent->client->pers.joinmenu, teamJoinEntries[ent->client->pers.team], MENUSIZE_JOINMENU, false);
		}
		else
			PMenu_Close (ent);
	}
	else
		PMenu_Open (ent, ent->client->pers.joinmenu, teamJoinEntries[ent->client->pers.team], MENUSIZE_JOINMENU, false);
}
Пример #2
0
void xMenu_Next (edict_t * ent, pmenu_t * p)
{
	X_MENU->xmenucount = 2;
	X_MENU->DoAddMenu (ent, X_MENU->xmenutop + XMENU_MAX_ENTRIES);
	if (X_MENU->xmenucount > 2)
	{
		X_MENU->xmenutop += XMENU_MAX_ENTRIES;
		xMenu_Set (ent);

		PMenu_Close (ent);
		PMenu_Open (ent, X_MENU->themenu, 5, XMENU_END_ENTRY);
		//PMenu_Update(ent);
	}
}
Пример #3
0
qboolean
xMenu_New (edict_t * ent, char *title, char *subtitle,
	   void (*DoAddMenu) (edict_t * ent, int fromix))
{
	if (!DoAddMenu)
		return false;

	if (!X_MENU)
	{
		//no menu yet, allocate memory for it...
		X_MENU = gi.TagMalloc (sizeof (xmenu_t), TAG_GAME);
		if (!X_MENU)
		{
			gi.dprintf ("Error allocating xmenu space\n");
			return false;
		}
	}
	X_MENU->DoAddMenu = DoAddMenu;
	X_MENU->xmenucount = 2;
	X_MENU->xmenutop = 0;
	//memset(xmenuentries, 0, sizeof(xmenuentries));
	strcpy (X_MENU->xmenuentries[0].name, "*");
	if (title)
		Q_strncatz(X_MENU->xmenuentries[0].name, title, XMENU_TITLE_MAX);
	else
		Q_strncatz(X_MENU->xmenuentries[0].name, "Menu", XMENU_TITLE_MAX);
	if (subtitle)
		Q_strncpyz(X_MENU->xmenuentries[1].name, subtitle, XMENU_TITLE_MAX);
	else
		Q_strncpyz(X_MENU->xmenuentries[1].name, "make your choice", XMENU_TITLE_MAX);

	X_MENU->xmenuentries[0].SelectFunc = NULL;
	X_MENU->xmenuentries[1].SelectFunc = NULL;

	DoAddMenu (ent, 0);
	if (X_MENU->xmenucount > 2)
	{
		xMenu_Set (ent);

		if (ent->client->menu)
			PMenu_Close (ent);

		PMenu_Open (ent, X_MENU->themenu, 5, XMENU_END_ENTRY);
		return true;
	}

	return false;
}
Пример #4
0
void xMenu_Prev (edict_t * ent, pmenu_t * p)
{
	int temptop;

	X_MENU->xmenucount = 2;
	if (X_MENU->xmenutop < XMENU_MAX_ENTRIES)
		temptop = 0;
	else
		temptop = X_MENU->xmenutop - XMENU_MAX_ENTRIES;
	X_MENU->DoAddMenu (ent, temptop);
	if (X_MENU->xmenucount > 2)
	{
		X_MENU->xmenutop = temptop;
		xMenu_Set (ent);

		PMenu_Close (ent);
		PMenu_Open (ent, X_MENU->themenu, 5, XMENU_END_ENTRY);
		//PMenu_Update(ent);
	}
}
Пример #5
0
void Cmd_Menu_f(edict_t *ent)
{
    if (ent->client->layout == LAYOUT_MENU) {
        PMenu_Close(ent);
        return;
    }

    PMenu_Open(ent, main_menu);

    switch (ent->client->pers.connected) {
    case CONN_PREGAME:
    case CONN_SPECTATOR:
        ent->client->menu.entries[3].text = "*Enter the game";
        break;
    case CONN_SPAWNED:
        ent->client->menu.entries[3].text = "*Leave the game";
        break;
    default:
        return;
    }
}
Пример #6
0
/*
==============
OpenVoteMenu
==============
Update vote menu with current settings and open it.
*/
void OpenVoteMenu (edict_t *ent)
{
    //global 'disallow voting' check
    if (!(int)g_vote_mask->value)
    {
        gi.cprintf (ent, PRINT_HIGH, "Proposing new settings is not allowed on this server.\n");
        return;
    }

    if (!ent->client->pers.team && !ent->client->pers.admin)
    {
        gi.cprintf (ent, PRINT_HIGH, "Spectators cannot vote.\n");
        return;
    }

    // allow timelimit vote during the match
    if (tdm_match_status == MM_PLAYING && ((int)g_vote_mask->value & VOTE_TIMELIMIT))
    {
        ent->client->pers.votemenu_values.timelimit = ((int)g_match_time->value / 60);
        memcpy (ent->client->pers.votemenu, votemenu, sizeof(votemenu));
        VoteMenuUpdate (ent, VOTE_MENU_TIMELIMIT);

        PMenu_Close (ent);
        PMenu_Open (ent, ent->client->pers.votemenu, 0, MENUSIZE_JOINMENU, false);
        return;
    }
    else if (tdm_match_status != MM_WARMUP)
    {
        gi.cprintf (ent, PRINT_HIGH, "You can propose new settings only during warmup.\n");
        return;
    }

    // initialize all current settings
    ent->client->pers.votemenu_values.gamemode = (int)g_gamemode->value;

    // if we don't use maplist we cannot tell what maps are allowed :(
    if (!g_maplistfile || !g_maplistfile->string[0])
        ent->client->pers.votemenu_values.map[0] = '\0';
    else
    {
        strcpy (ent->client->pers.votemenu_values.map, "---");
        ent->client->pers.votemenu_values.map_index = -1;
    }

    if (!g_allow_vote_config->value)
        ent->client->pers.votemenu_values.config[0] = '\0';
    else
    {
        strcpy (ent->client->pers.votemenu_values.config, "---");
        ent->client->pers.votemenu_values.cfg_index = -1;
    }

    ent->client->pers.votemenu_values.timelimit = ((int)g_match_time->value / 60);

    if (g_tie_mode->value == 1)
        ent->client->pers.votemenu_values.overtime = ((int)g_overtime->value / 60);
    else if (g_tie_mode->value == 2)
        ent->client->pers.votemenu_values.overtime = -1;
    else
        ent->client->pers.votemenu_values.overtime = 0;

    if (g_powerupflags->value == 0)
        ent->client->pers.votemenu_values.powerups = 1;
    else
        ent->client->pers.votemenu_values.powerups = 0;

    if ((int)g_itemflags->value & WEAPON_BFG10K)
        ent->client->pers.votemenu_values.bfg = 0;
    else
        ent->client->pers.votemenu_values.bfg = 1;

    ent->client->pers.votemenu_values.kick = NULL;
    ent->client->pers.votemenu_values.chat = (int)g_chat_mode->value;
    ent->client->pers.votemenu_values.bugs = (int)g_bugs->value;

    // set increasing values as default (used for invdrop)
    ent->client->pers.votemenu_values.decrease = false;

    memcpy (ent->client->pers.votemenu, votemenu, sizeof(votemenu));

    VoteMenuUpdate (ent, VOTE_MENU_ALL);

    // we are supposed to be here only from menu, so close it
    PMenu_Close (ent);

    ent->client->pers.votemenu_values.show = true;
    PMenu_Open (ent, ent->client->pers.votemenu, 0, MENUSIZE_JOINMENU, false);
}