MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / TelcomRenderScreen

Function TelcomRenderScreen

Descent3/TelCom.cpp:1485–1547  ·  view source on GitHub ↗

Renders the current screen for 1 frame

Source from the content-addressed store, hash-verified

1483
1484// Renders the current screen for 1 frame
1485void TelcomRenderScreen(bool poweron, bool powerup, uint8_t power_effect) {
1486 if (TC_current_screen == -1)
1487 return;
1488
1489 float frametime, newtime;
1490 newtime = timer_GetTime();
1491
1492 float cap_time = last_rendertime + (1.0f / FRAME_RATE);
1493 if (cap_time > newtime) {
1494 Descent->delay(cap_time - newtime);
1495 newtime = timer_GetTime();
1496 }
1497
1498 frametime = newtime - last_rendertime;
1499 last_rendertime = newtime;
1500 last_frametime = frametime;
1501
1502 if (Telcom_first_render) {
1503 Telcom_first_render = false;
1504 frametime = 0;
1505 }
1506
1507 StartFrame(0, 0, Game_window_w, Game_window_h);
1508
1509 if (Telcom_show_glitch) {
1510 if (((int)myrand(100 * (1.0 - Telcom_glitch_setting))) == 0) {
1511 Telcom_glitch_screen = true;
1512 glitch_dx = (int)(myrand(20) - 10.0);
1513 glitch_dy = (int)(myrand(12) - 6.0);
1514 }
1515 }
1516
1517 // first render all the effects
1518 RenderScreen(TC_current_screen, &Telcom_system, frametime);
1519
1520 // call the callback if it exists to render anything on the monitor screen
1521 if (TC_callback)
1522 TC_callback();
1523
1524 // Render the screen overlays
1525 TelcomRenderOverlays();
1526
1527 grtext_Flush();
1528
1529 switch (power_effect) {
1530 case 1:
1531 TelcomDoPowerEffect(false, frametime);
1532 break;
1533 case 2:
1534 TelcomDoPowerEffect(true, frametime);
1535 break;
1536 };
1537
1538 // Draw the TelCom System
1539 TelcomDrawScreen(poweron, powerup);
1540
1541 TelcomRenderMouse();
1542

Callers 8

TelComMainFunction · 0.85
TelComMainMenuFunction · 0.85
TelComSingleShipSelectFunction · 0.85
TelComGoalStatusFunction · 0.85
TelComCargoFunction · 0.85
TelComAutoMapFunction · 0.85
PlayBriefingFunction · 0.85
PBLoopCallbackFunction · 0.85

Calls 11

StartFrameFunction · 0.85
myrandFunction · 0.85
RenderScreenFunction · 0.85
TelcomRenderOverlaysFunction · 0.85
grtext_FlushFunction · 0.85
TelcomDoPowerEffectFunction · 0.85
TelcomDrawScreenFunction · 0.85
TelcomRenderMouseFunction · 0.85
EndFrameFunction · 0.85
rend_FlipFunction · 0.50
delayMethod · 0.45

Tested by

no test coverage detected