MCPcopy Create free account
hub / github.com/ZDoom/Raze / MainLoop

Function MainLoop

source/core/mainloop.cpp:727–791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

725//==========================================================================
726
727void MainLoop ()
728{
729 int lasttic = 0;
730
731 // Clamp the timer to TICRATE until the playloop has been entered.
732 r_NoInterpolate = true;
733
734 if (userConfig.CommandMap.IsNotEmpty())
735 {
736 auto maprecord = FindMapByName(userConfig.CommandMap.GetChars());
737 if (maprecord == nullptr)
738 {
739 maprecord = SetupUserMap(userConfig.CommandMap.GetChars(), g_gameType & GAMEFLAG_DUKE? "dethtoll.mid" : nullptr);
740 }
741 userConfig.CommandMap = "";
742 if (maprecord)
743 {
744 DeferredStartGame(maprecord, g_nextskill);
745 }
746 }
747
748 for (;;)
749 {
750 try
751 {
752 // frame syncronous IO operations
753 if (gametic > lasttic)
754 {
755 lasttic = gametic;
756 I_StartFrame ();
757 }
758 I_SetFrameTime();
759
760 // update the scale factor for unsynchronised input here.
761 gameInput.UpdateInputScale();
762
763 TryRunTics (); // will run at least one tic
764 // Update display, next frame, with current state.
765 I_StartTic();
766
767 Display();
768 Mus_UpdateMusic(); // must be at the end.
769 }
770 catch (CRecoverableError &error)
771 {
772 if (error.GetMessage ())
773 {
774 Printf (PRINT_BOLD, "\n%s\n", error.GetMessage());
775 }
776 gi->ErrorCleanup();
777 M_ClearMenus();
778 C_FullConsole();
779 gameaction = ga_nothing;
780 }
781 catch (CVMAbortException &error)
782 {
783 error.MaybePrintMessage();
784 Printf("%s", error.stacktrace.GetChars());

Callers 1

RunGameFunction · 0.85

Calls 15

FindMapByNameFunction · 0.85
SetupUserMapFunction · 0.85
DeferredStartGameFunction · 0.85
I_SetFrameTimeFunction · 0.85
TryRunTicsFunction · 0.85
DisplayFunction · 0.85
Mus_UpdateMusicFunction · 0.85
PrintfFunction · 0.85
M_ClearMenusFunction · 0.85
C_FullConsoleFunction · 0.85
IsNotEmptyMethod · 0.80
UpdateInputScaleMethod · 0.80

Tested by

no test coverage detected