summaryrefslogtreecommitdiff
path: root/src/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c17
1 files changed, 14 insertions, 3 deletions
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;