| 480 | |
| 481 | #define UI_FPS_FRAMES 4 |
| 482 | void _UI_Refresh( int realtime ) |
| 483 | { |
| 484 | static int index; |
| 485 | static int previousTimes[UI_FPS_FRAMES]; |
| 486 | |
| 487 | if ( !( Key_GetCatcher() & KEYCATCH_UI ) ) |
| 488 | { |
| 489 | return; |
| 490 | } |
| 491 | |
| 492 | extern void SE_CheckForLanguageUpdates(void); |
| 493 | SE_CheckForLanguageUpdates(); |
| 494 | |
| 495 | if ( Menus_AnyFullScreenVisible() ) |
| 496 | {//if not in full screen, don't mess with ghoul2 |
| 497 | //rww - ghoul2 needs to know what time it is even if the client/server are not running |
| 498 | //FIXME: this screws up the game when you go back to the game... |
| 499 | re.G2API_SetTime(realtime, 0); |
| 500 | re.G2API_SetTime(realtime, 1); |
| 501 | } |
| 502 | |
| 503 | uiInfo.uiDC.frameTime = realtime - uiInfo.uiDC.realTime; |
| 504 | uiInfo.uiDC.realTime = realtime; |
| 505 | |
| 506 | previousTimes[index % UI_FPS_FRAMES] = uiInfo.uiDC.frameTime; |
| 507 | index++; |
| 508 | if ( index > UI_FPS_FRAMES ) |
| 509 | { |
| 510 | int i, total; |
| 511 | // average multiple frames together to smooth changes out a bit |
| 512 | total = 0; |
| 513 | for ( i = 0 ; i < UI_FPS_FRAMES ; i++ ) |
| 514 | { |
| 515 | total += previousTimes[i]; |
| 516 | } |
| 517 | if ( !total ) |
| 518 | { |
| 519 | total = 1; |
| 520 | } |
| 521 | uiInfo.uiDC.FPS = 1000 * UI_FPS_FRAMES / total; |
| 522 | } |
| 523 | |
| 524 | UI_UpdateCvars(); |
| 525 | |
| 526 | if (Menu_Count() > 0) |
| 527 | { |
| 528 | // paint all the menus |
| 529 | Menu_PaintAll(); |
| 530 | // refresh server browser list |
| 531 | // UI_DoServerRefresh(); |
| 532 | // refresh server status |
| 533 | // UI_BuildServerStatus(qfalse); |
| 534 | // refresh find player list |
| 535 | // UI_BuildFindPlayerList(qfalse); |
| 536 | } |
| 537 | |
| 538 | // draw cursor |
| 539 | UI_SetColor( NULL ); |
no test coverage detected