| 552 | //========================================================================== |
| 553 | |
| 554 | void 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) |
no test coverage detected