Added the notion of a 'cancel' button, and unified all the 'cancel' menu IDs to be kCancelMenuID (ie -1). I've slaved the Menu button (ie Esc on win, 'Start' button on PSP) to this - the idea being, if you hit the Menu button to bring up a menu, hitting it again will dismiss it without doing anything, which is pretty standard behavior for most console/computer games.

This commit is contained in:
wrenczes@gmail.com
2010-11-07 02:08:17 +00:00
parent b0c61049da
commit 3c19533a4c
13 changed files with 303 additions and 274 deletions

View File

@@ -8,6 +8,15 @@
#include "GameOptions.h"
#include "Translate.h"
namespace
{
const int kSaveAndBackToMainMenuID = 1;
const int kBackToMainMenuID = 2;
const int kNewProfileID = 4;
const int kReloadID = 5;
}
GameStateOptions::GameStateOptions(GameApp* parent): GameState(parent), mReload(false), grabber(NULL), optionsMenu(NULL), optionsTabs(NULL) {}
GameStateOptions::~GameStateOptions() {}
@@ -62,7 +71,7 @@ void GameStateOptions::Start()
optionsList->Add(NEW WGuiSplit(cPrf,cThm));
optionsList->Add(cStyle);
optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"),-102,4,this));
optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"),-102, kNewProfileID, this));
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable cheat mode")));
optionsTabs->Add(optionsList);
@@ -89,9 +98,9 @@ void GameStateOptions::Start()
optionsTabs->Add(optionsList);
optionsMenu = NEW SimpleMenu(-102, this,Fonts::MENU_FONT, 50,170);
optionsMenu->Add(2, "Back to Main Menu");
optionsMenu->Add(1, "Save & Back to Main Menu");
optionsMenu->Add(3, "Cancel");
optionsMenu->Add(kBackToMainMenuID, "Back to Main Menu");
optionsMenu->Add(kSaveAndBackToMainMenuID, "Save & Back to Main Menu");
optionsMenu->Add(kCancelMenuID, "Cancel");
optionsTabs->Entering(JGE_BTN_NONE);
}
@@ -245,21 +254,21 @@ void GameStateOptions::ButtonPressed(int controllerId, int controlId)
//Exit menu?
if(controllerId == -102)
switch (controlId){
case 1:
case kSaveAndBackToMainMenuID:
mState = SAVE;
break;
//Set Audio volume
case 2:
case kBackToMainMenuID:
mParent->DoTransition(TRANSITION_FADE,GAME_STATE_MENU);
break;
case 3:
case kCancelMenuID:
mState = SHOW_OPTIONS;
break;
case 4:
case kNewProfileID:
options.keypadStart("",&newProfile);
options.keypadTitle("New Profile");
break;
case 5:
case kReloadID:
mReload = true;
break;
}