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

Function DoGameLoop

TombEngine/Game/control/control.cpp:691–744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689}
690
691GameStatus DoGameLoop(int levelIndex)
692{
693 int frameCount = LOOP_FRAME_COUNT;
694 auto& status = g_GameFlow->LastGameStatus;
695
696 // Before entering actual game loop, GamePhase() must be called once to sort out
697 // various runtime shenanigangs (e.g. hair or freeze mode initialization).
698 status = GamePhase(false);
699
700 g_Synchronizer.Init();
701 bool legacy30FpsDoneDraw = false;
702
703 while (DoTheGame)
704 {
705 g_Synchronizer.Sync();
706
707 if (g_VideoPlayer.Update())
708 continue;
709
710 while (g_Synchronizer.Synced())
711 {
712 status = ControlPhase(false);
713 g_Synchronizer.Step();
714
715 legacy30FpsDoneDraw = false;
716 }
717
718 if (g_VideoPlayer.IsBackgroundPlaybackQueued())
719 continue;
720
721 if (status != GameStatus::Normal)
722 break;
723
724 if (g_GameFlow->LastFreezeMode != g_GameFlow->CurrentFreezeMode)
725 continue;
726
727 if (!g_Configuration.EnableHighFramerate)
728 {
729 if (!legacy30FpsDoneDraw)
730 {
731 DrawPhase(!levelIndex, 0.0f);
732 legacy30FpsDoneDraw = true;
733 }
734 }
735 else
736 {
737 DrawPhase(!levelIndex, g_Synchronizer.GetInterpolationFactor());
738 }
739 }
740
741 EndGameLoop(levelIndex, DoTheGame ? status : GameStatus::ExitGame);
742
743 return status;
744}
745
746void EndGameLoop(int levelIndex, GameStatus reason)
747{

Callers 1

DoLevelFunction · 0.85

Calls 11

GamePhaseFunction · 0.85
ControlPhaseFunction · 0.85
DrawPhaseFunction · 0.85
EndGameLoopFunction · 0.85
SyncMethod · 0.80
SyncedMethod · 0.80
StepMethod · 0.80
InitMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected