1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-08-09 07:40:21 +00:00

Add option to hideInGameMenu() to cancel the options menu if it's active.

This commit is contained in:
fgenesis 2013-11-17 04:36:13 +01:00
parent 711db4467f
commit 890ca90bd4
3 changed files with 9 additions and 4 deletions

View file

@ -1543,7 +1543,7 @@ void Game::pickupIngredientEffects(IngredientData *data)
ingOffYTimer = 2; ingOffYTimer = 2;
} }
void Game::hideInGameMenu(bool effects) void Game::hideInGameMenu(bool effects, bool cancel)
{ {
if (isCooking) return; if (isCooking) return;
if (FoodSlot::foodSlotIndex != -1) return; if (FoodSlot::foodSlotIndex != -1) return;
@ -1577,8 +1577,11 @@ void Game::hideInGameMenu(bool effects)
} }
dsq->continuity.lastMenuPage = currentMenuPage; dsq->continuity.lastMenuPage = currentMenuPage;
if(cancel && (optionsMenu || keyConfigMenu))
onOptionsCancel();
else
toggleOptionsMenu(false);
toggleOptionsMenu(false);
if (!optionsOnly) if (!optionsOnly)
{ {
toggleFoodMenu(false); toggleFoodMenu(false);

View file

@ -786,7 +786,7 @@ public:
void loadEntityTypeList(); void loadEntityTypeList();
std::vector<EntitySaveData> entitySaveData; std::vector<EntitySaveData> entitySaveData;
int getIdxForEntityType(std::string type); int getIdxForEntityType(std::string type);
void hideInGameMenu(bool effects=true); void hideInGameMenu(bool effects=true, bool cancel=false);
void showInGameMenu(bool force=false, bool optionsOnly=false, MenuPage menuPage = MENUPAGE_NONE); void showInGameMenu(bool force=false, bool optionsOnly=false, MenuPage menuPage = MENUPAGE_NONE);
bool optionsOnly; bool optionsOnly;

View file

@ -3349,7 +3349,9 @@ luaFunc(showInGameMenu)
luaFunc(hideInGameMenu) luaFunc(hideInGameMenu)
{ {
dsq->game->hideInGameMenu(); bool skipEffect = getBool(L, 1);
bool cancel = getBool(L, 2);
dsq->game->hideInGameMenu(!skipEffect, cancel);
luaReturnNil(); luaReturnNil();
} }