From 7d87e8e3e9eccbb3ae351f3218276b2dae506665 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 28 Oct 2023 14:50:52 +0200 Subject: fix issue with sprites --- src/game.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/game.c') diff --git a/src/game.c b/src/game.c index 993d82e..6bb0301 100644 --- a/src/game.c +++ b/src/game.c @@ -180,6 +180,7 @@ void update_server(platform_window* window) { update_spawners_server(); update_drops_server(); update_wallitems_server(); + update_throwables_server(); broadcast_players = platform_get_time(TIME_FULL, TIME_NS); update_players_server(); @@ -188,8 +189,7 @@ void update_server(platform_window* window) { broadcast_zombies = platform_get_time(TIME_FULL, TIME_NS); update_zombies_server(window); broadcast_zombies = platform_get_time(TIME_FULL, TIME_NS) - broadcast_zombies; - - update_throwables_server(window); + clear_throwables(); broadcast_stamp = platform_get_time(TIME_FULL, TIME_NS); @@ -200,7 +200,7 @@ void update_server(platform_window* window) { // play sounds locally and send them to clients. play_sounds_in_queue(); - + broadcast_to_clients(create_protocol_sound_list()); clear_sounds_in_queue(); update_timer = 0.0f; @@ -251,6 +251,10 @@ void update_client(platform_window* window) { case MESSAGE_USER_LIST: { protocol_user_list* msg_players = (protocol_user_list*)msg; memcpy(players, msg_players->players, sizeof(players)); + + for (int i = 0; i < MAX_PLAYERS; i++) { + players[i].sprite.image = img_player; + } } break; case MESSAGE_ZOMBIE_LIST: { @@ -267,6 +271,13 @@ void update_client(platform_window* window) { protocol_drop_list* msg_drops = (protocol_drop_list*)msg; memcpy(drops, msg_drops->drops, sizeof(drops)); } break; + + case MESSAGE_SOUND_LIST: { + protocol_sound_list* msg_sound = (protocol_sound_list*)msg; + memcpy(audio_events, msg_sound->audio_events, sizeof(audio_events)); + play_sounds_in_queue(); + clear_sounds_in_queue(); + } break; default: log_info("Unhandled message received"); break; -- cgit v1.2.3-70-g09d2