diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game.c | 14 | ||||
| -rw-r--r-- | src/players.c | 3 |
2 files changed, 9 insertions, 8 deletions
@@ -158,8 +158,8 @@ void update_server(platform_window* window) { broadcast_to_clients(create_protocol_user_list()); - if (update_timer > 0.05f) { - broadcast_to_clients(create_protocol_zombie_list()); + if (update_timer > 0.2f) { + //broadcast_to_clients(create_protocol_zombie_list()); update_timer = 0.0f; } @@ -173,6 +173,7 @@ void update_client(platform_window* window) { switch (msg->type) { case MESSAGE_GET_ID_DOWNSTREAM: { + if (global_state.network_state == CONNECTED) break; protocol_get_id_downstream* msg_id = (protocol_get_id_downstream*)msg; my_id = msg_id->id; global_state.network_state = CONNECTED; @@ -198,10 +199,6 @@ void update_client(platform_window* window) { array_remove_at(&messages_received_on_client, i); i--; } - - if (!global_state.server) { - update_zombies_client(window); - } } void update_game(platform_window* window) { @@ -211,6 +208,11 @@ void update_game(platform_window* window) { } if (global_state.network_state == CONNECTED) { + if (!global_state.server) { + update_zombies_client(window); + } + take_player_input(window); + draw_grid(window); draw_spawners(window); } diff --git a/src/players.c b/src/players.c index 82804d1..c168eb5 100644 --- a/src/players.c +++ b/src/players.c @@ -1,4 +1,5 @@ #include "../include/players.h" +#include "../include/game.h" float get_bullet_size_in_tile(platform_window* window) { return 1 / 8.0f; @@ -106,8 +107,6 @@ void draw_players_at_tile(platform_window* window, int x, int y) { if (!players[i].active) continue; if ((int)players[i].playerx != x || (int)(players[i].playery+get_player_size_in_tile()) != y) continue; - if (players[i].id == my_id) take_player_input(window); - players[i].sec_since_last_shot += update_delta; float bullets_per_sec = 10; float time_between_bullets = 1.0f/bullets_per_sec; |
