| 783 | } |
| 784 | |
| 785 | GameStatus HandleMenuCalls(bool isTitle) |
| 786 | { |
| 787 | auto gameStatus = GameStatus::Normal; |
| 788 | |
| 789 | if (ScreenFading) |
| 790 | return gameStatus; |
| 791 | |
| 792 | if (isTitle) |
| 793 | { |
| 794 | auto invStatus = g_Gui.TitleOptions(LaraItem); |
| 795 | |
| 796 | switch (invStatus) |
| 797 | { |
| 798 | case InventoryResult::NewGame: |
| 799 | case InventoryResult::NewGameSelectedLevel: |
| 800 | return GameStatus::NewGame; |
| 801 | |
| 802 | case InventoryResult::HomeLevel: |
| 803 | return GameStatus::HomeLevel; |
| 804 | break; |
| 805 | |
| 806 | case InventoryResult::LoadGame: |
| 807 | return GameStatus::LoadGame; |
| 808 | |
| 809 | case InventoryResult::ExitGame: |
| 810 | return GameStatus::ExitGame; |
| 811 | } |
| 812 | |
| 813 | return gameStatus; |
| 814 | } |
| 815 | |
| 816 | bool playerAlive = LaraItem->HitPoints > 0; |
| 817 | bool inventoryEnabled = g_GameFlow->GetSettings()->Gameplay.EnableInventory; |
| 818 | |
| 819 | bool doLoad = IsClicked(In::Load) || |
| 820 | (!IsClicked(In::Inventory) && !NoAction() && SaveGame::IsLoadGamePossible() && Lara.Control.Count.Death > DEATH_INPUT_TIMEOUT); |
| 821 | bool doSave = IsClicked(In::Save) && playerAlive; |
| 822 | bool doPause = IsClicked(In::Pause) && playerAlive; |
| 823 | bool doInventory = (IsClicked(In::Inventory) || g_Gui.GetEnterInventory() != NO_VALUE) && playerAlive; |
| 824 | |
| 825 | // Handle inventory. |
| 826 | if (doSave && g_GameFlow->IsLoadSaveEnabled() && Lara.Inventory.HasSave && g_Gui.GetInventoryMode() != InventoryMode::Save && inventoryEnabled) |
| 827 | { |
| 828 | SaveGame::LoadHeaders(); |
| 829 | g_Gui.SetInventoryMode(InventoryMode::Save); |
| 830 | g_Gui.CallInventory(LaraItem, false); |
| 831 | } |
| 832 | else if (doLoad && g_GameFlow->IsLoadSaveEnabled() && Lara.Inventory.HasLoad && g_Gui.GetInventoryMode() != InventoryMode::Load && inventoryEnabled) |
| 833 | { |
| 834 | SaveGame::LoadHeaders(); |
| 835 | g_Gui.SetInventoryMode(InventoryMode::Load); |
| 836 | if (g_Gui.CallInventory(LaraItem, false)) |
| 837 | gameStatus = GameStatus::LoadGame; |
| 838 | } |
| 839 | else if (doPause && g_Gui.GetInventoryMode() != InventoryMode::Pause) |
| 840 | { |
| 841 | if (g_Gui.CallPause()) |
| 842 | gameStatus = GameStatus::ExitToTitle; |
no test coverage detected