UnrealScript Game Programming Cookbook

(Chris Devlin) #1

Miscellaneous Recipes


234

{
CurrentPage = -1; // Starts on main page
CurrentIndex = 0;
bShowDebugMenu = !bShowDebugMenu;

// Disables movement
SetCinematicMode
(bShowDebugMenu,false,false,true,true,true);
}

This starts with the main menu each time we pull up the debug screen and
also prevents our pawn from accepting inputs like movement and firing.


  1. With our main menu set, we now need a way to navigate through it. The following
    two functions will allow us to move to the previous or next item on our list:
    /*****

    • Selects the next item on the list
      *****/
      exec function NextItem()
      {
      local int IndexMax;




if (bShowDebugMenu)
{
if (CurrentPage != -1)
{
IndexMax =
CommandDebugPages[CurrentPage].PageCommands.Length-1;
}
else
{
IndexMax = CommandDebugPages.Length-1;
}
CurrentIndex = Min(CurrentIndex +1, IndexMax);
}
}

/*****************************************************************
* Selects the previous item on the list
*****************************************************************/
exec function PreviousItem()
{
if (bShowDebugMenu)
{
CurrentIndex = Max(CurrentIndex -1, 0);
}
}
Free download pdf