From cf3cfecbcac3835c84dce3711884b7ce0a81b6b8 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Tue, 7 Nov 2023 18:36:59 +0100 Subject: sync round data --- src/game.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/game.c') diff --git a/src/game.c b/src/game.c index 1f71495..2ebbcf0 100644 --- a/src/game.c +++ b/src/game.c @@ -236,6 +236,7 @@ void update_server(platform_window* window) { broadcast_to_clients(create_protocol_drop_list()); broadcast_to_clients(create_protocol_throwables_list()); broadcast_to_clients(create_protocol_zombie_chunk_list()); + broadcast_to_clients(create_protocol_round_data(_current_round)); // play sounds locally and send them to clients. play_sounds_in_queue(); @@ -252,7 +253,6 @@ void update_server(platform_window* window) { handle_messages = handle_messages - logic_update_time; logic_update_time = platform_get_time(TIME_FULL, TIME_NS) - logic_update_time; u64 server_tick = platform_get_time(TIME_FULL, TIME_NS) - handle_messages2; - broadcast_stamp = platform_get_time(TIME_FULL, TIME_NS) - broadcast_stamp; if ((logic_update_time/1000000.0f) > 10.0f) { log_infox("Server update took %.2fms:\n\tmessages: %.2fms\n\ttick: %.2fms\n\t\tbroadcast: %.2fms\n\t\tplayers: %.2fms\n\t\tzombies: %.2fms\n", (logic_update_time/1000000.0f), (handle_messages/1000000.0f), (server_tick/1000000.0f), @@ -293,6 +293,11 @@ void update_client(platform_window* window) { memcpy(players, msg_players->players, sizeof(players)); } break; + case MESSAGE_ROUND_DATA: { + protocol_round* msg_round = (protocol_round*)msg; + _current_round = msg_round->round; + } break; + case MESSAGE_ZOMBIE_LIST: { protocol_zombie_list* msg_zombies = (protocol_zombie_list*)msg; memcpy(zombies, msg_zombies->zombies, sizeof(zombies)); -- cgit v1.2.3-70-g09d2