summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/zombies.exebin2015755 -> 2016824 bytes
-rw-r--r--include/protocol.h9
-rw-r--r--src/game.c7
-rw-r--r--src/protocol.c7
4 files changed, 22 insertions, 1 deletions
diff --git a/build/zombies.exe b/build/zombies.exe
index 8e2b315..ea4ab02 100644
--- a/build/zombies.exe
+++ b/build/zombies.exe
Binary files differ
diff --git a/include/protocol.h b/include/protocol.h
index 51d6fb8..6113682 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -21,6 +21,7 @@ typedef enum t_network_message_type
MESSAGE_DROP_LIST,
MESSAGE_SOUND_LIST,
MESSAGE_THROWABLES_LIST,
+ MESSAGE_ROUND_DATA,
} network_message_type;
typedef struct t_protocol_generic_client_message
@@ -81,6 +82,13 @@ typedef struct t_protocol_drop_list
drop drops[MAX_DROPS];
} protocol_drop_list;
+#include "rounds.h"
+typedef struct t_protocol_round
+{
+ network_message_type type;
+ zombie_round round;
+} protocol_round;
+
typedef enum t_protocol_move_type
{
MOVE_UP,
@@ -169,6 +177,7 @@ network_message create_protocol_zombie_chunk_list();
network_message create_protocol_bullets_list();
network_message create_protocol_drop_list();
network_message create_protocol_throwables_list();
+network_message create_protocol_round_data(zombie_round round);
array messages_received_on_server;
array messages_received_on_client;
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));
diff --git a/src/protocol.c b/src/protocol.c
index de1a8d1..b6c03ee 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -75,6 +75,13 @@ network_message create_protocol_drop_list()
return network_create_message((u8*)buf, sizeof(protocol_drop_list), MAX_NETWORK_BUFFER_SIZE);
}
+network_message create_protocol_round_data(zombie_round round)
+{
+ protocol_round *buf = alloc_network_message(protocol_round);
+ buf->type = MESSAGE_ROUND_DATA;
+ buf->round = round;
+ return network_create_message((u8*)buf, sizeof(protocol_round), MAX_NETWORK_BUFFER_SIZE);
+}
network_message create_protocol_user_moved(protocol_move_type move, u32 id)
{