MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / HandleMenuCalls

Function HandleMenuCalls

TombEngine/Game/control/control.cpp:785–858  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783}
784
785GameStatus 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;

Callers 1

GamePhaseFunction · 0.85

Calls 12

IsClickedFunction · 0.85
NoActionFunction · 0.85
StopAllSoundsFunction · 0.85
StopRumbleFunction · 0.85
TitleOptionsMethod · 0.80
GetSettingsMethod · 0.80
GetEnterInventoryMethod · 0.80
IsLoadSaveEnabledMethod · 0.80
GetInventoryModeMethod · 0.80
SetInventoryModeMethod · 0.80
CallInventoryMethod · 0.80
CallPauseMethod · 0.80

Tested by

no test coverage detected