called once a frame on client and server. NOTE: only servers (game masters) check for listen connections.
| 2232 | // called once a frame on client and server. NOTE: only servers (game masters) check for |
| 2233 | // listen connections. |
| 2234 | void MultiDoFrame() { |
| 2235 | if (!(Game_mode & GM_MULTI)) |
| 2236 | return; |
| 2237 | |
| 2238 | ScoreAPIFrameInterval(); |
| 2239 | |
| 2240 | static int debug_id = -2; |
| 2241 | static float last_game_time = 99999999.9f; |
| 2242 | |
| 2243 | CallGameDLL(EVT_GAME_INTERVAL, &DLLInfo); |
| 2244 | |
| 2245 | if (Netgame.local_role == LR_SERVER) |
| 2246 | MultiDoServerFrame(); |
| 2247 | else { |
| 2248 | if (debug_id == -2) { |
| 2249 | debug_id = DebugGraph_Add(0.0f, 10000.0f, "Ping", DGF_MULTIPLAYER); |
| 2250 | } |
| 2251 | if (debug_id >= 0) { |
| 2252 | if (last_game_time > Gametime) { |
| 2253 | // reset last_game_time, we must have started a new level |
| 2254 | last_game_time = Gametime; |
| 2255 | } |
| 2256 | |
| 2257 | float next_time = last_game_time + 0.3f; // update every 1/3 second |
| 2258 | if (Gametime >= next_time) { |
| 2259 | last_game_time = Gametime; |
| 2260 | if (NetPlayers[Player_num].flags & NPF_CONNECTED && NetPlayers[Player_num].sequence == NETSEQ_PLAYING) { |
| 2261 | DebugGraph_Update(debug_id, NetPlayers[Player_num].ping_time * 1000.0f); |
| 2262 | } |
| 2263 | } |
| 2264 | } |
| 2265 | |
| 2266 | MultiDoClientFrame(); |
| 2267 | // Verify object list |
| 2268 | } |
| 2269 | } |
| 2270 | |
| 2271 | // Returns to the slot number of the player that the passed in address belongs to |
| 2272 | int MultiMatchPlayerToAddress(network_address *from_addr) { |
no test coverage detected