From 11fc04b238ff9d42b17e6befa6ab4a673606fc1a Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Thu, 2 Nov 2023 18:24:46 +0100 Subject: throwables on server side --- src/game.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/game.c') diff --git a/src/game.c b/src/game.c index 1999815..df65282 100644 --- a/src/game.c +++ b/src/game.c @@ -174,6 +174,11 @@ void update_server(platform_window* window) { } break; + case MESSAGE_USER_THROW: { + protocol_user_throw* throw_msg = (protocol_user_throw*)msg->message; + throw_throwable(throw_msg->id, throw_msg->throwable, throw_msg->dirx, throw_msg->diry); + } break; + case MESSAGE_USER_MOVED: { protocol_move* move_msg = (protocol_move*)msg->message; move_user(window, move_msg->id, move_msg->move, move_msg->delta); @@ -225,6 +230,7 @@ void update_server(platform_window* window) { broadcast_to_clients(create_protocol_zombie_list()); broadcast_to_clients(create_protocol_bullets_list()); broadcast_to_clients(create_protocol_drop_list()); + broadcast_to_clients(create_protocol_throwables_list()); // play sounds locally and send them to clients. play_sounds_in_queue(); @@ -286,6 +292,11 @@ void update_client(platform_window* window) { memcpy(zombies, msg_zombies->zombies, sizeof(zombies)); } break; + case MESSAGE_THROWABLES_LIST: { + protocol_throwables_list* msg_throwables = (protocol_throwables_list*)msg; + memcpy(throwables, msg_throwables->throwables, sizeof(throwables)); + } break; + case MESSAGE_BULLET_LIST: { protocol_bullets_list* msg_bullets = (protocol_bullets_list*)msg; load_bullets_into_existing_list(msg_bullets); -- cgit v1.2.3-70-g09d2