コード例 #1
0
ファイル: smn_menus.cpp プロジェクト: War3Evo/sourcemod
static cell_t SendPanelToClient(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IMenuPanel *panel;

    if ((err=ReadPanelHandle(hndl, &panel)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    IPluginFunction *pFunction;
    if ((pFunction=pContext->GetFunctionById(params[3])) == NULL)
    {
        return pContext->ThrowNativeError("Function id %x is invalid", params[3]);
    }

    CPanelHandler *handler = g_MenuHelpers.GetPanelHandler(pFunction);
    if (!panel->SendDisplay(params[2], handler, params[4]))
    {
        g_MenuHelpers.FreePanelHandler(handler);
    }

    return 1;
}
コード例 #2
0
bool BaseMenuStyle::RedoClientMenu(int client, ItemOrder order)
{
#if defined MENU_DEBUG
	g_Logger.LogMessage("[SM_MENU] RedoClientMenu() (client %d) (order %d)", client, order);
#endif
	CBaseMenuPlayer *player = GetMenuPlayer(client);
	menu_states_t &states = player->states;

	player->bAutoIgnore = true;
	IMenuPanel *display = g_Menus.RenderMenu(client, states, order);
	if (!display)
	{
#if defined MENU_DEBUG
		g_Logger.LogMessage("[SM_MENU] RedoClientMenu(): Failed to render menu");
#endif
		if (player->menuHoldTime)
		{
			RemoveClientFromWatch(client);
		}
		player->bAutoIgnore = false;
		return false;
	}

	SendDisplay(client, display);

	display->DeleteThis();

	player->bAutoIgnore = false;

#if defined MENU_DEBUG
	g_Logger.LogMessage("[SM_MENU] RedoClientMenu(): Succeeded to client %d", client);
#endif

	return true;
}
コード例 #3
0
ファイル: smn_menus.cpp プロジェクト: War3Evo/sourcemod
static cell_t CreatePanel(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IMenuStyle *style;

    if (hndl != 0)
    {
        if ((err=g_Menus.ReadStyleHandle(params[1], &style)) != HandleError_None)
        {
            return pContext->ThrowNativeError("MenuStyle handle %x is invalid (error %d)", hndl, err);
        }
    } else {
        style = g_Menus.GetDefaultStyle();
    }

    IMenuPanel *panel = style->CreatePanel();

    hndl = MakePanelHandle(panel, pContext);
    if (!hndl)
    {
        panel->DeleteThis();
        return BAD_HANDLE;
    }

    return hndl;
}
コード例 #4
0
ファイル: smn_menus.cpp プロジェクト: War3Evo/sourcemod
    virtual void OnHandleDestroy(HandleType_t type, void *object)
    {
        if (type == m_TempPanelType)
        {
            return;
        }

        IMenuPanel *panel = (IMenuPanel *)object;
        panel->DeleteThis();
    }
コード例 #5
0
ファイル: smn_menus.cpp プロジェクト: War3Evo/sourcemod
static cell_t SetPanelCurrentKey(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IMenuPanel *panel;

    if ((err=ReadPanelHandle(hndl, &panel)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    return panel->SetCurrentKey(params[2]) ? 1 : 0;
}
コード例 #6
0
ファイル: smn_menus.cpp プロジェクト: War3Evo/sourcemod
static cell_t GetPanelTextRemaining(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IMenuPanel *panel;

    if ((err=ReadPanelHandle(hndl, &panel)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    return panel->GetAmountRemaining();
}
コード例 #7
0
ファイル: smn_menus.cpp プロジェクト: War3Evo/sourcemod
static cell_t CanPanelDrawFlags(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IMenuPanel *panel;

    if ((err=ReadPanelHandle(hndl, &panel)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    return panel->CanDrawItem(params[2]);
}
コード例 #8
0
ファイル: smn_menus.cpp プロジェクト: War3Evo/sourcemod
static cell_t DrawPanelText(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IMenuPanel *panel;

    if ((err=ReadPanelHandle(hndl, &panel)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    char *text;
    pContext->LocalToString(params[2], &text);

    return panel->DrawRawLine(text) ? 1 : 0;
}
コード例 #9
0
ファイル: smn_menus.cpp プロジェクト: War3Evo/sourcemod
static cell_t DrawPanelItem(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IMenuPanel *panel;

    if ((err=ReadPanelHandle(hndl, &panel)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    ItemDrawInfo dr;
    pContext->LocalToString(params[2], (char **)&dr.display);
    dr.style = params[3];

    return panel->DrawItem(dr);
}
コード例 #10
0
ファイル: smn_menus.cpp プロジェクト: War3Evo/sourcemod
static cell_t SetPanelTitle(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IMenuPanel *panel;

    if ((err=ReadPanelHandle(hndl, &panel)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    char *text;
    pContext->LocalToString(params[2], &text);

    panel->DrawTitle(text, params[3] ? true : false);

    return 1;
}
コード例 #11
0
ファイル: smn_menus.cpp プロジェクト: War3Evo/sourcemod
static cell_t CreatePanelFromMenu(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IBaseMenu *menu;

    if ((err=g_Menus.ReadMenuHandle(params[1], &menu)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    IMenuPanel *panel = menu->CreatePanel();
    hndl = MakePanelHandle(panel, pContext);
    if (!hndl)
    {
        panel->DeleteThis();
    }

    return hndl;
}
コード例 #12
0
void CRPGPlayer::ShowChar()
{
	IMenuStyle *style = menus->GetDefaultStyle();
	IBaseMenu *menu = style->CreateMenu(&g_RPGPlugin, myself->GetIdentity());

	IMenuPanel *panel = menu->CreatePanel();

	menu->SetDefaultTitle(MENU_CHAR_TITLE);
	panel->DrawTitle(MENU_CHAR_TITLE);

	char text[255];
	sprintf(text, "Player ID: %d", GetSQLIndex());
	panel->DrawItem(ItemDrawInfo(text));

	int classnum = GetCurrentClass();

	if (classnum > RPG_CLASS_NONE)
	{
		int team = GetCachedTeam();
		if ( team == TEAM_SURVIVORS)
		{
			sprintf(text, "Class: %s", HumanClasses[classnum]);
		}
		else if (team == TEAM_UNDEAD)
		{
			sprintf(text, "Class: %s", ZombieClasses[classnum]);
		}
		else
		{
			sprintf(text, "Class: None");
		}

		panel->DrawItem(ItemDrawInfo(text));	// item 1

		sprintf(text, "Level: %d", GetLevel());
		panel->DrawItem(ItemDrawInfo(text)); // item 2

		sprintf(text, "Experience: %d", GetExperience());
		panel->DrawItem(ItemDrawInfo(text)); // item 3

		for (int i = 0; i < MAX_SKILLS; i++)		// item 4-7
		{
			sprintf(text, "%s - (Level %d)", SkillNames[skills[i].iIndex], skills[i].iLevel);
			panel->DrawItem(ItemDrawInfo(text));
		}

	}

	panel->SendDisplay(GetIndex(), &g_RPGPlugin, MENU_TIME_FOREVER );
}
コード例 #13
0
bool BaseMenuStyle::DoClientMenu(int client,
								 CBaseMenu *menu,
								 unsigned int first_item,
								 IMenuHandler *mh,
								 unsigned int time)
{
#if defined MENU_DEBUG
	g_Logger.LogMessage("[SM_MENU] DoClientMenu() (client %d) (menu %p) (mh %p) (time %d)",
		client,
		menu,
		mh,
		time);
#endif
	mh->OnMenuStart(menu);

	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
	if (!pPlayer || pPlayer->IsFakeClient() || !pPlayer->IsInGame())
	{
#if defined MENU_DEBUG
		g_Logger.LogMessage("[SM_MENU] DoClientMenu(): Failed to display to client %d", client);
#endif
		mh->OnMenuCancel(menu, client, MenuCancel_NoDisplay);
		mh->OnMenuEnd(menu, MenuEnd_Cancelled);
		return false;
	}

	CBaseMenuPlayer *player = GetMenuPlayer(client);
	if (player->bAutoIgnore)
	{
#if defined MENU_DEBUG
		g_Logger.LogMessage("[SM_MENU] DoClientMenu(): Client %d is autoIgnoring", client);
#endif
		mh->OnMenuCancel(menu, client, MenuCancel_NoDisplay);
		mh->OnMenuEnd(menu, MenuEnd_Cancelled);
		return false;
	}

	/* For the duration of this, we are going to totally ignore whether
	 * the player is already in a menu or not (except to cancel the old one).
	 * Instead, we are simply going to ignore any further menu displays, so
	 * this display can't be interrupted.
	 */
	player->bAutoIgnore = true;

	/* Cancel any old menus */
	menu_states_t &states = player->states;
	if (player->bInMenu)
	{
#if defined MENU_DEBUG
		g_Logger.LogMessage("[SM_MENU] DoClientMenu(): Cancelling old menu to client %d", client);
#endif
		_CancelClientMenu(client, MenuCancel_Interrupted, true);
	}

	states.firstItem = 0;
	states.lastItem = first_item;
	states.menu = menu;
	states.mh = mh;
	states.apiVers = SMINTERFACE_MENUMANAGER_VERSION;

	IMenuPanel *display = g_Menus.RenderMenu(client, states, ItemOrder_Ascending);
	if (!display)
	{
#if defined MENU_DEBUG
		g_Logger.LogMessage("[SM_MENU] DoClientMenu(): Failed to render to client %d", client);
#endif
		player->bAutoIgnore = false;
		player->bInMenu = false;
		mh->OnMenuCancel(menu, client, MenuCancel_NoDisplay);
		mh->OnMenuEnd(menu, MenuEnd_Cancelled);
		return false;
	}

	/* Finally, set our states */
	player->bInMenu = true;
	player->bInExternMenu = false;
	player->menuStartTime = gpGlobals->curtime;
	player->menuHoldTime = time;

	if (time)
	{
		AddClientToWatch(client);
	}

	/* Draw the display */
	SendDisplay(client, display);

	/* Free the display pointer */
	display->DeleteThis();

	/* We can be interrupted again! */
	player->bAutoIgnore = false;

#if defined MENU_DEBUG
	g_Logger.LogMessage("[SM_MENU] DoClientMenu() finished successfully (client %d)", client);
#endif

	return true;
}
コード例 #14
0
ファイル: smn_menus.cpp プロジェクト: War3Evo/sourcemod
static cell_t InternalShowMenu(IPluginContext *pContext, const cell_t *params)
{
    int client = params[1];
    CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);

    if (pPlayer == NULL)
    {
        return pContext->ThrowNativeError("Invalid client index %d", client);
    }
    else if (!pPlayer->IsInGame())
    {
        return pContext->ThrowNativeError("Client %d is not in game", client);
    }

    if (!g_RadioMenuStyle.IsSupported())
    {
        return pContext->ThrowNativeError("Radio menus are not supported on this mod");
    }

    char *str;
    pContext->LocalToString(params[2], &str);

    IMenuPanel *pPanel = g_RadioMenuStyle.MakeRadioDisplay(str, params[4]);

    if (pPanel == NULL)
    {
        return 0;
    }

    IMenuHandler *pHandler;
    CPanelHandler *pActualHandler = NULL;
    if (params[5] != -1)
    {
        IPluginFunction *pFunction = pContext->GetFunctionById(params[5]);
        if (pFunction == NULL)
        {
            return pContext->ThrowNativeError("Invalid function index %x", params[5]);
        }
        pActualHandler = g_MenuHelpers.GetPanelHandler(pFunction);
    }

    if (pActualHandler == NULL)
    {
        pHandler = &s_EmptyMenuHandler;
    }
    else
    {
        pHandler = pActualHandler;
    }

    bool bSuccess = pPanel->SendDisplay(client, pHandler, params[3]);

    pPanel->DeleteThis();

    if (!bSuccess && pActualHandler != NULL)
    {
        g_MenuHelpers.FreePanelHandler(pActualHandler);
    }

    return bSuccess ? 1 : 0;
}
コード例 #15
0
ファイル: MenuManager.cpp プロジェクト: pmrowla/sourcemod-1.5
IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder order)
{
	IBaseMenu *menu = md.menu;

	if (!menu)
	{
		return NULL;
	}

	struct
	{
		unsigned int position;
		ItemDrawInfo draw;
	} drawItems[10];

	/* Figure out how many items to draw */
	IMenuStyle *style = menu->GetDrawStyle();
	unsigned int pgn = menu->GetPagination();
	unsigned int maxItems = style->GetMaxPageItems();
	bool exitButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_EXIT) == MENUFLAG_BUTTON_EXIT;
	bool novoteButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_NOVOTE) == MENUFLAG_BUTTON_NOVOTE;

	if (pgn != MENU_NO_PAGINATION)
	{
		maxItems = pgn;
	}
	else if (exitButton)
	{
		maxItems--;
	}

	if (novoteButton)
	{
		maxItems--;
	}

	/* This is very not allowed! */
	if (maxItems < 2)
	{
		return NULL;
	}

	unsigned int totalItems = menu->GetItemCount();
	unsigned int startItem = 0;

	/* For pagination, find the starting point. */
	if (pgn != MENU_NO_PAGINATION)
	{
		if (order == ItemOrder_Ascending)
		{
			startItem = md.lastItem;
			/* This shouldn't happen with well-coded menus.
			 * If the item is out of bounds, switch the order to
			 * Items_Descending and make us start from the top.
			 */
			if (startItem >= totalItems)
			{
				startItem = totalItems - 1;
				order = ItemOrder_Descending;
			}
		}
		else if (order == ItemOrder_Descending)
		{
			startItem = md.firstItem;
			/* This shouldn't happen with well-coded menus.
			 * If searching backwards doesn't give us enough room,
			 * start from the beginning and change to ascending.
			 */
			if (startItem <= maxItems)
			{
				startItem = 0;
				order = ItemOrder_Ascending;
			}
		}
	}

	/* Get our Display pointer and initialize some crap */
	IMenuPanel *panel = menu->CreatePanel();
	IMenuHandler *mh = md.mh;
	bool foundExtra = false;
	unsigned int extraItem = 0;

	if (panel == NULL)
	{
		return NULL;
	}

	/**
	 * We keep searching until:
	 * 1) There are no more items
	 * 2) We reach one OVER the maximum number of slot items
	 * 3) We have reached maxItems and pagination is MENU_NO_PAGINATION
	 */
	unsigned int i = startItem;
	unsigned int foundItems = 0;
	while (totalItems)
	{
		ItemDrawInfo &dr = drawItems[foundItems].draw;
		/* Is the item valid? */
		if (menu->GetItemInfo(i, &dr) != NULL)
		{
			/* Ask the user to change the style, if necessary */
			mh->OnMenuDrawItem(menu, client, i, dr.style);
			/* Check if it's renderable */
			if (IsSlotItem(panel, dr.style))
			{
				/* If we've already found the max number of items,
				 * This means we should just cancel out and log our
				 * "last item."
				 */
				if (foundItems >= maxItems)
				{
					foundExtra = true;
					extraItem = i;
					break;
				}
				drawItems[foundItems++].position = i;
			}
		}
		/* If there's no pagination, stop once the menu is full. */
		if (pgn == MENU_NO_PAGINATION)
		{
			/* If we've filled up, then stop */
			if (foundItems >= maxItems)
			{
				break;
			}
		}
		/* If we're descending and this is the first item, stop */
		if (order == ItemOrder_Descending)
		{
			if (i == 0)
			{
				break;
			}
			i--;
		} 
		/* If we're ascending and this is the last item, stop */
		else if (order == ItemOrder_Ascending)
		{
			if (i >= totalItems - 1)
			{
				break;
			}
			i++;
		}
	}

	/* There were no items to draw! */
	if (!foundItems)
	{
		panel->DeleteThis();
		return NULL;
	}

	bool displayPrev = false;
	bool displayNext = false;

	/* This is an annoying process.
	 * Skip it for non-paginated menus, which get special treatment.
	 */
	if (pgn != MENU_NO_PAGINATION)
	{
		if (foundExtra)
		{
			if (order == ItemOrder_Descending)
			{
				displayPrev = true;
				md.firstItem = extraItem;
			}
			else if (order == ItemOrder_Ascending)
			{
				displayNext = true;
				md.lastItem = extraItem;
			}
		}

		unsigned int lastItem = 0;
		ItemDrawInfo dr;
		/* Find the last feasible item to search from. */
		if (order == ItemOrder_Descending)
		{
			lastItem = drawItems[0].position;
			if (lastItem >= totalItems - 1)
			{
				goto skip_search;
			}
			while (++lastItem < totalItems)
			{
				if (menu->GetItemInfo(lastItem, &dr) != NULL)
				{
					mh->OnMenuDrawItem(menu, client, lastItem, dr.style);
					if (IsSlotItem(panel, dr.style))
					{
						displayNext = true;
						md.lastItem = lastItem;
						break;
					}
				}
			}
		}
		else if (order == ItemOrder_Ascending)
		{
			lastItem = drawItems[0].position;
			if (lastItem == 0)
			{
				goto skip_search;
			}
			lastItem--;
			while (lastItem != 0)
			{
				if (menu->GetItemInfo(lastItem, &dr) != NULL)
				{
					mh->OnMenuDrawItem(menu, client, lastItem, dr.style);
					if (IsSlotItem(panel, dr.style))
					{
						displayPrev = true;
						md.firstItem = lastItem;
						break;
					}
				}
				lastItem--;
			}
		}
	}

skip_search:

	/* Draw the item according to the order */
	menu_slots_t *slots = md.slots;
	unsigned int position = 0;			/* Keep track of the last position */

	if (novoteButton)
	{
		char text[50];
		if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "No Vote", &client))
		{
			UTIL_Format(text, sizeof(text), "No Vote");
		}
		ItemDrawInfo dr(text, 0);
		position = panel->DrawItem(dr);
		slots[position].type = ItemSel_Exit;
		position++;
	}

	if (order == ItemOrder_Ascending)
	{
		md.item_on_page = drawItems[0].position;
		for (unsigned int i = 0; i < foundItems; i++)
		{
			ItemDrawInfo &dr = drawItems[i].draw;
			if ((position = mh->OnMenuDisplayItem(menu, client, panel, drawItems[i].position, dr)) == 0)
			{
				position = panel->DrawItem(dr);
			}
			if (position != 0)
			{
				slots[position].item = drawItems[i].position;
				if ((dr.style & ITEMDRAW_DISABLED) == ITEMDRAW_DISABLED)
				{
					slots[position].type = ItemSel_None;
				}
				else
				{
					slots[position].type = ItemSel_Item;
				}
			}
		}
	}
	else if (order == ItemOrder_Descending)
	{
		unsigned int i = foundItems;
		/* NOTE: There will always be at least one item because
		 * of the check earlier.
		 */
		md.item_on_page = drawItems[foundItems - 1].position;
		while (i--)
		{
			ItemDrawInfo &dr = drawItems[i].draw;
			if ((position = mh->OnMenuDisplayItem(menu, client, panel, drawItems[i].position, dr)) == 0)
			{
				position = panel->DrawItem(dr);
			}
			if (position != 0)
			{
				slots[position].item = drawItems[i].position;
				if ((dr.style & ITEMDRAW_DISABLED) == ITEMDRAW_DISABLED)
				{
					slots[position].type = ItemSel_None;
				}
				else
				{
					slots[position].type = ItemSel_Item;
				}
			}
		}
	}

	/* Now, we need to check if we need to add anything extra */
	if (pgn != MENU_NO_PAGINATION || exitButton)
	{
		bool canDrawDisabled = panel->CanDrawItem(ITEMDRAW_DISABLED|ITEMDRAW_CONTROL);
		bool exitBackButton = false;
		char text[50];

		if (pgn != MENU_NO_PAGINATION
			&& (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_EXITBACK) == MENUFLAG_BUTTON_EXITBACK)
		{
			exitBackButton = true;
		}

		/* Calculate how many items we are allowed for control stuff */
		unsigned int padding = style->GetMaxPageItems() - maxItems;
		
		/* Add the number of available slots */
		padding += (maxItems - foundItems);

		/* Someday, if we are able to re-enable this, we will be very lucky men. */
#if 0
		if (!style->FeatureExists(MenuStyleFeature_ImplicitExit))
		{
#endif
		/* Even if we don't draw an exit button, we invalidate the slot. */
		padding--;
#if 0
		} else {
			/* Otherwise, we don't draw anything and leave the slot available */
			exitButton = false;
		}
#endif

		if (pgn != MENU_NO_PAGINATION)
		{
			/* Subtract two slots for the displayNext/displayPrev padding */
			padding -= 2;
		}

		/* If we have an "Exit Back" button and the space to draw it, do so. */
		if (exitBackButton)
		{
			if (!displayPrev)
			{
				displayPrev = true;
			}
			else
			{
				exitBackButton = false;
			}
		}

		/**
		 * We allow next/prev to be undrawn if neither exists.
		 * Thus, we only need padding if one of them will be drawn,
		 * or the exit button will be drawn.
		 */
		ItemDrawInfo padItem(NULL, ITEMDRAW_SPACER);
		if (exitButton || (displayNext || displayPrev))
		{
			/* If there are no control options,
			 * Instead just pad with invisible slots.
			 */
			if (!displayPrev && !displayPrev)
			{
				padItem.style = ITEMDRAW_NOTEXT;
			}
			/* Add spacers so we can pad to the end */
			for (unsigned int i=0; i<padding; i++)
			{
				position = panel->DrawItem(padItem);
				slots[position].type = ItemSel_None;
			}
		}

		/* Put a fake spacer before control stuff, if possible */
		if ((displayPrev || displayNext) || exitButton)
		{
			ItemDrawInfo draw("", ITEMDRAW_RAWLINE|ITEMDRAW_SPACER);
			panel->DrawItem(draw);
		}

		ItemDrawInfo dr(text, 0);

		/**
		 * If we have one or the other, we need to have spacers for both.
		 */
		if (pgn != MENU_NO_PAGINATION)
		{
			if (displayPrev || displayNext)
			{
				/* PREVIOUS */
				ItemDrawInfo padCtrlItem(NULL, ITEMDRAW_SPACER|ITEMDRAW_CONTROL);
				if (displayPrev || canDrawDisabled)
				{
					if (exitBackButton)
					{
						if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Back", &client))
						{
							UTIL_Format(text, sizeof(text), "Back");
						}
						dr.style = ITEMDRAW_CONTROL;
						position = panel->DrawItem(dr);
						slots[position].type = ItemSel_ExitBack;
					}
					else
					{
						if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Previous", &client))
						{
							UTIL_Format(text, sizeof(text), "Previous");
						}
						dr.style = (displayPrev ? 0 : ITEMDRAW_DISABLED)|ITEMDRAW_CONTROL;
						position = panel->DrawItem(dr);
						slots[position].type = ItemSel_Back;
					}
				}
				else if (displayNext || exitButton)
				{
					/* If we can't display this, and there is an exit button,
					 * we need to pad!
					 */
					position = panel->DrawItem(padCtrlItem);
					slots[position].type = ItemSel_None;
				}

				/* NEXT */
				if (displayNext || canDrawDisabled)
				{
					if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Next", &client))
					{
						UTIL_Format(text, sizeof(text), "Next");
					}
					dr.style = (displayNext ? 0 : ITEMDRAW_DISABLED)|ITEMDRAW_CONTROL;
					position = panel->DrawItem(dr);
					slots[position].type = ItemSel_Next;
				}
				else if (exitButton)
				{
					/* If we can't display this,
					 * but there is an "exit" button, we need to pad!
					 */
					position = panel->DrawItem(padCtrlItem);
					slots[position].type = ItemSel_None;
				}
			}
			else
			{
				/* Otherwise, bump to two slots! */
				ItemDrawInfo numBump(NULL, ITEMDRAW_NOTEXT);
				position = panel->DrawItem(numBump);
				slots[position].type = ItemSel_None;
				position = panel->DrawItem(numBump);
				slots[position].type = ItemSel_None;
			}
		}

		/* EXIT */
		if (exitButton)
		{
			if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Exit", &client))
			{
				UTIL_Format(text, sizeof(text), "Exit");
			}
			dr.style = ITEMDRAW_CONTROL;
			position = panel->DrawItem(dr);
			slots[position].type = ItemSel_Exit;
		}
	}

	/* Lastly, fill in any slots we could have missed */
	for (unsigned int i = position + 1; i < 10; i++)
	{
		slots[i].type = ItemSel_None;
	}

	/* Do title stuff */
	mh->OnMenuDisplay(menu, client, panel);
	panel->DrawTitle(menu->GetDefaultTitle(), true);

	return panel;
}