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

Function TryRunTics

source/core/mainloop.cpp:554–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552//==========================================================================
553
554void TryRunTics (void)
555{
556 int i;
557 int lowtic;
558 int realtics;
559 int availabletics;
560 int counts;
561 int numplaying;
562
563 // If paused, do not eat more CPU time than we need, because it
564 // will all be wasted anyway.
565 bool doWait = (cl_capfps || pauseext || (r_NoInterpolate && !M_IsAnimated() && gamestate != GS_CUTSCENE && gamestate != GS_INTRO));
566
567 if (vid_dontdowait && ((vid_maxfps > 0) || (vid_vsync == true)))
568 doWait = false;
569
570 // get real tics
571 if (doWait)
572 {
573 entertic = I_WaitForTic (oldentertics);
574 }
575 else
576 {
577 entertic = I_GetTime ();
578 }
579 realtics = entertic - oldentertics;
580 oldentertics = entertic;
581
582 // get available tics
583 NetUpdate ();
584
585 if (pauseext)
586 return;
587
588 lowtic = INT_MAX;
589 numplaying = 0;
590 for (i = 0; i < doomcom.numnodes; i++)
591 {
592 if (nodeingame[i])
593 {
594 numplaying++;
595 if (nettics[i] < lowtic)
596 lowtic = nettics[i];
597 }
598 }
599
600 availabletics = lowtic - gametic / ticdup;
601
602 // decide how many tics to run
603 if (realtics < availabletics-1)
604 counts = realtics+1;
605 else if (realtics < availabletics)
606 counts = realtics;
607 else
608 counts = availabletics;
609
610 // Uncapped framerate needs seprate checks
611 if (counts == 0 && !doWait)

Callers 1

MainLoopFunction · 0.85

Calls 15

M_IsAnimatedFunction · 0.85
I_WaitForTicFunction · 0.85
I_GetTimeFunction · 0.85
NetUpdateFunction · 0.85
TicStabilityWaitFunction · 0.85
Net_CheckLastReceivedFunction · 0.85
C_TickerFunction · 0.85
M_TickerFunction · 0.85
I_ErrorFunction · 0.85
I_SetFrameTimeFunction · 0.85
TicStabilityBeginFunction · 0.85
GameTickerFunction · 0.85

Tested by

no test coverage detected