| 642 | } |
| 643 | |
| 644 | void InitializeOrLoadGame(bool loadGame) |
| 645 | { |
| 646 | g_Gui.SetInventoryItemChosen(NO_VALUE); |
| 647 | g_Gui.SetEnterInventory(NO_VALUE); |
| 648 | |
| 649 | // Restore game? |
| 650 | if (loadGame) |
| 651 | { |
| 652 | if (!SaveGame::Load(g_GameFlow->SelectedSaveGame)) |
| 653 | { |
| 654 | NextLevel = g_GameFlow->GetNumLevels(); |
| 655 | return; |
| 656 | } |
| 657 | |
| 658 | InitializeGame = false; |
| 659 | |
| 660 | g_Hud.StatusBars.Clamp(*LaraItem); |
| 661 | g_GameFlow->SelectedSaveGame = 0; |
| 662 | g_GameScript->OnLoad(); |
| 663 | HandleAllGlobalEvents(EventType::Load, (Activator)short(LaraItem->Index)); |
| 664 | } |
| 665 | else |
| 666 | { |
| 667 | // If not loading savegame, clear all info. |
| 668 | SaveGame::Statistics.Level = {}; |
| 669 | SaveGame::Statistics.SecretBits = 0; |
| 670 | |
| 671 | if (InitializeGame) |
| 672 | { |
| 673 | // Clear all game info as well. |
| 674 | SaveGame::Statistics.Game = {}; |
| 675 | InitializeGame = false; |
| 676 | |
| 677 | SaveGame::ResetHub(); |
| 678 | TENLog("Starting new game.", LogLevel::Info); |
| 679 | } |
| 680 | else |
| 681 | { |
| 682 | SaveGame::LoadHub(CurrentLevel); |
| 683 | TENLog("Starting new level.", LogLevel::Info); |
| 684 | } |
| 685 | |
| 686 | g_GameScript->OnStart(); |
| 687 | HandleAllGlobalEvents(EventType::Start, (Activator)short(LaraItem->Index)); |
| 688 | } |
| 689 | } |
| 690 | |
| 691 | GameStatus DoGameLoop(int levelIndex) |
| 692 | { |
no test coverage detected