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

Method DoFlow

TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.cpp:814–925  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

812}
813
814bool FlowHandler::DoFlow()
815{
816 // We start with the title level, if no other index is specified
817 if (CurrentLevel == -1)
818 CurrentLevel = SystemNameHash = 0;
819
820 SelectedLevelForNewGame = 0;
821 SelectedSaveGame = 0;
822 SaveGameHeader header;
823
824 // We loop indefinitely, looking for return values of DoLevel
825 bool loadFromSavegame = false;
826
827 while (DoTheGame)
828 {
829 // Check if called level exists in script.
830 if (CurrentLevel >= Levels.size())
831 {
832 TENLog("Level not found. Check Gameflow.lua file integrity.", LogLevel::Error, LogConfig::All);
833 CurrentLevel = 0;
834 }
835
836 GameStatus status;
837
838 if (CurrentLevel == 0)
839 {
840 try
841 {
842 status = DoLevel(CurrentLevel);
843 }
844 catch (TENScriptException const& e)
845 {
846 std::string msg = std::string{ "A Lua error occurred while running the title level; " } + __func__ + ": " + e.what();
847 TENLog(msg, LogLevel::Error, LogConfig::All);
848 ShutdownTENLog();
849 throw;
850 }
851 }
852 else
853 {
854 try
855 {
856 PrepareInventoryObjects();
857 status = DoLevel(CurrentLevel, loadFromSavegame);
858 }
859 catch (TENScriptException const& e)
860 {
861 std::string msg = std::string{ "A Lua error occurred while running a level; " } + __func__ + ": " + e.what();
862 TENLog(msg, LogLevel::Error, LogConfig::All);
863 status = GameStatus::ExitToTitle;
864 }
865
866 loadFromSavegame = false;
867 }
868
869 switch (status)
870 {
871 case GameStatus::ExitGame:

Callers 1

GameMainFunction · 0.80

Calls 8

TENLogFunction · 0.85
DoLevelFunction · 0.85
ShutdownTENLogFunction · 0.85
GetResetHubEnabledMethod · 0.80
GetLevelMethod · 0.80
ResetScriptsMethod · 0.80
sizeMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected