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

Function GameFrame

Descent3/GameLoop.cpp:2885–3180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2883// The main loop for D3. It renders, gets input, etc. for one frame
2884extern bool Skip_render_game_frame;
2885void GameFrame(void) {
2886#ifdef USE_RTP
2887 INT64 curr_time;
2888#endif
2889
2890 bool is_game_idle = !Descent->active();
2891
2892 if (Tracking_FVI) {
2893 mprintf(0, "Beginning frame!\n");
2894 }
2895
2896 // Begin Gameloop stuff
2897 Physics_normal_counter = 0;
2898 Physics_normal_looping_counter = 0;
2899 Physics_walking_counter = 0;
2900 Physics_walking_looping_counter = 0;
2901 Physics_vis_counter = 0;
2902
2903 FVI_counter = 0;
2904 FVI_room_counter = 0;
2905
2906#ifdef _DEBUG
2907 // Dump networking stats to virtual window
2908 tNetworkStatus netstat;
2909 static tNetworkStatus old_netstat;
2910 static bool netstat_init = false;
2911 static float netstat_time = 0;
2912
2913 nw_GetNetworkStats(&netstat);
2914 mprintf_at(5, 0, 0, "TCP/IP Network Stats:");
2915 mprintf_at(5, 1, 0, "TCP: tx: %d/%d rtx: %d/%d rx: %d/%d", netstat.tcp_total_packets_sent,
2916 netstat.tcp_total_bytes_sent, netstat.tcp_total_packets_resent, netstat.tcp_total_bytes_resent,
2917 netstat.tcp_total_packets_rec, netstat.tcp_total_bytes_rec);
2918 mprintf_at(5, 2, 0, "UDP: tx: %d/%d rx: %d/%d", netstat.udp_total_packets_sent, netstat.udp_total_bytes_sent,
2919 netstat.udp_total_packets_rec, netstat.udp_total_bytes_rec);
2920
2921 if (!netstat_init) {
2922 netstat_time = timer_GetTime();
2923
2924 old_netstat = netstat;
2925 netstat_init = true;
2926 } else {
2927 float newt = timer_GetTime();
2928 if (netstat_time + 0.5f <= newt) {
2929 // time to update
2930 float tcp_rx, tcp_rtx, tcp_tx;
2931 float udp_rx, udp_tx;
2932 float time_diff = newt - netstat_time;
2933
2934 tcp_rx = ((float)(netstat.tcp_total_bytes_rec - old_netstat.tcp_total_bytes_rec)) / time_diff;
2935 tcp_tx = ((float)(netstat.tcp_total_bytes_sent - old_netstat.tcp_total_bytes_sent)) / time_diff;
2936 tcp_rtx = ((float)(netstat.tcp_total_bytes_resent - old_netstat.tcp_total_bytes_resent)) / time_diff;
2937
2938 udp_rx = ((float)(netstat.udp_total_bytes_rec - old_netstat.udp_total_bytes_rec)) / time_diff;
2939 udp_tx = ((float)(netstat.udp_total_bytes_sent - old_netstat.udp_total_bytes_sent)) / time_diff;
2940
2941 mprintf_at(5, 3, 0, "TCP/s: TX: % 5.1f RTX: % 5.1f RX: % 5.1f", tcp_tx, tcp_rtx, tcp_rx);
2942 mprintf_at(5, 4, 0, "UDP/s: TX: % 5.1f RX: % 5.1f", udp_tx, udp_rx);

Callers 5

GameSequencerFunction · 0.85
GameFrameUIFunction · 0.85
CtlConfigUICBFunction · 0.85
TelComHandleAllEventsFunction · 0.85
D3DeferHandlerFunction · 0.85

Calls 15

nw_GetNetworkStatsFunction · 0.85
UpdateVoicesFunction · 0.85
DemoWriteChangedObjectsFunction · 0.85
DemoStartNewFrameFunction · 0.85
DemoFrameFunction · 0.85
ProcessKeysFunction · 0.85
ProcessButtonsFunction · 0.85
AIFrameAllFunction · 0.85
ObjDoFrameAllFunction · 0.85
DoMatcensFrameFunction · 0.85
DoorwayDoFrameFunction · 0.85
DoPlayerFrameFunction · 0.85

Tested by

no test coverage detected