Beispiel #1
0
void ShowInventoryMenu()
{
    // Draw the dialog boxes and associated data inside them
    DrawInventoryScreen();

    // Store an item pointer which is set every time the user clicks on a new item
    CItem *pItem = NULL;

    // Let's loop until we get some valid input from the user
    while(!g_Menu.EscapePressed())
    {
        // Strange, but let's loop again :)  This loop handles prompts
        while(!g_Menu.EscapePressed() && !g_Menu.ChoiceMade())
            g_Menu.HandleInput();

        if(g_Menu.EscapePressed())
            break;

        Sleep(100);

        // Check if the item isn't the same as the last item
        if(g_Menu.GetSelectedItem() && pItem != g_Menu.GetSelectedItem())
        {
            // Get the selected item and redraw the inventory screen
            pItem = g_Menu.GetSelectedItem();
            g_Map.SetDrawFlag(true);
            g_Map.Draw();
            DrawInventoryScreen();
            g_Menu.ResetMenuChoice();
            g_Buffer.SwapBackBuffer(FALSE);
        }
        // If the item is the same, let's display a prompt to the user
        else if(pItem && pItem == g_Menu.GetSelectedItem())
        {
            // Display a prompt, which will do a new input loop
            ShowItemPrompt(pItem);
            pItem = NULL;	// Reset the last clicked on item
        }
    }

    // Let's redraw the main menu after we have chosen to exit from the inventory menu
    g_Menu.RedrawMenu();
}
Beispiel #2
0
void ShowInventoryMenu()
{
	// Draw the dialog boxes and associated data inside them
	DrawInventoryScreen();

	// Store an item pointer which is set every time the user clicks on a new item
	CItem *pItem = NULL;

	// Let's loop until we get some valid input from the user
	while(!g_Menu.EscapePressed())
	{
		// Strange, but let's loop again :)  This loop handles prompts
		while(!g_Menu.EscapePressed() && !g_Menu.ChoiceMade())
			g_Menu.HandleInput();

		// Check if the item isn't the same as the last item
		if(g_Menu.GetSelectedItem() && pItem != g_Menu.GetSelectedItem())
		{
			// Get the selected item and draw the stats for that item at the bottom
			pItem = g_Menu.GetSelectedItem();
			DrawStatsString();
			g_Menu.ResetMenuChoice();
		}
		// If the item is the same, let's display a prompt to the user
		else if(pItem && pItem == g_Menu.GetSelectedItem())
		{
			// Display a prompt, which will do a new input loop.  After that is done
			// it will come back here and we will redraw the inventory menu again.
			ShowItemPrompt(pItem);
			DrawInventoryScreen();
			pItem = NULL;	// Reset the last clicked on item
		}
	}

	// Let's redraw the main menu after we have chosen to exit from the inventory menu
	g_Menu.RedrawMenu();
}