Example #1
0
VOID
PAL_InGameMenu(
   VOID
)
/*++
  Purpose:

    Show the in-game main menu.

  Parameters:

    None.

  Return value:

    None.

--*/
{
   LPBOX                lpCashBox, lpMenuBox;
   WORD                 wReturnValue;
   const SDL_Rect       rect = {0, 0, 150, 185};

   //
   // Create menu items
   //
   MENUITEM        rgMainMenuItem[4] =
   {
      // value  label                      enabled   pos
      { 1,      GAMEMENU_LABEL_STATUS,     TRUE,     PAL_XY(16, 50) },
      { 2,      GAMEMENU_LABEL_MAGIC,      TRUE,     PAL_XY(16, 50 + 18) },
      { 3,      GAMEMENU_LABEL_INVENTORY,  TRUE,     PAL_XY(16, 50 + 36) },
      { 4,      GAMEMENU_LABEL_SYSTEM,     TRUE,     PAL_XY(16, 50 + 54) },
   };

   //
   // Display the cash amount.
   //
   lpCashBox = PAL_ShowCash(gpGlobals->dwCash);

   //
   // Create the menu box.
   //
   lpMenuBox = PAL_CreateBox(PAL_XY(3, 37), 3, 1, 0, TRUE);
   VIDEO_UpdateScreen(&rect);

   //
   // Process the menu
   //
   while (TRUE)
   {
      wReturnValue = PAL_ReadMenu(PAL_InGameMenu_OnItemChange, rgMainMenuItem, 4,
         gpGlobals->iCurMainMenuItem, MENUITEM_COLOR);

      if (wReturnValue == MENUITEM_VALUE_CANCELLED)
      {
         break;
      }

      switch (wReturnValue)
      {
      case 1:
         //
         // Status
         //
         PAL_PlayerStatus();
         goto out;

      case 2:
         //
         // Magic
         //
         PAL_InGameMagicMenu();
         goto out;

      case 3:
         //
         // Inventory
         //
         PAL_InventoryMenu();
         goto out;

      case 4:
         //
         // System
         //
         if (PAL_SystemMenu())
         {
            goto out;
         }
         break;
      }
   }

out:
   //
   // Remove the boxes.
   //
   PAL_DeleteBox(lpCashBox);
   PAL_DeleteBox(lpMenuBox);

   VIDEO_UpdateScreen(&rect);
}
Example #2
0
VOID
PAL_StartFrame(
VOID
)
/*++
  Purpose:

  Starts a video frame. Called once per video frame.

  Parameters:

  None.

  Return value:

  None.

  --*/
{
	//
	// Run the game logic of one frame
	//
	PAL_GameUpdate(TRUE);
	if (gpGlobals->fEnteringScene)
	{
		return;
	}

	//
	// Update the positions and gestures of party members
	//
	PAL_UpdateParty();

	//
	// Update the scene
	//
	PAL_MakeScene();
	VIDEO_UpdateScreen(NULL);

	if (g_InputState.dwKeyPress & kKeyMenu)
	{
		//
		// Show the in-game menu
		//
		PAL_InGameMenu();
	}
	else if (g_InputState.dwKeyPress & kKeyUseItem)
	{
		//
		// Show the use item menu
		//
		PAL_GameUseItem();
	}
	else if (g_InputState.dwKeyPress & kKeyThrowItem)
	{
		//
		// Show the equipment menu
		//
		PAL_GameEquipItem();
	}
	else if (g_InputState.dwKeyPress & kKeyForce)
	{
		//
		// Show the magic menu
		//
		PAL_InGameMagicMenu();
	}
	else if (g_InputState.dwKeyPress & kKeyStatus)
	{
		//
		// Show the player status
		//
		PAL_PlayerStatus();
	}
	else if (g_InputState.dwKeyPress & kKeySearch)
	{
		//
		// Process search events
		//
		PAL_Search();
	}
	else if (g_InputState.dwKeyPress & kKeyFlee)
	{
		//
		// Quit Game
		//
		if (PAL_ConfirmMenu())
		{
			PAL_PlayMUS(0, FALSE, 2);
			PAL_FadeOut(2);
			PAL_Shutdown();
			exit(0);
		}
	}

	if (--gpGlobals->wChasespeedChangeCycles == 0)
	{
		gpGlobals->wChaseRange = 1;
	}
}