From 7b956089e6ba5162fb0b667f1c0a60f6ece90c38 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Thu, 15 Dec 2022 12:59:19 +0100 Subject: added drops --- include/protocol.h | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'include/protocol.h') diff --git a/include/protocol.h b/include/protocol.h index 64822a2..aec65b4 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -3,7 +3,8 @@ #include -typedef enum t_network_message_type { +typedef enum t_network_message_type +{ MESSAGE_GET_ID_UPSTREAM, MESSAGE_GET_ID_DOWNSTREAM, MESSAGE_USER_LIST, @@ -14,48 +15,58 @@ typedef enum t_network_message_type { MESSAGE_BULLET_LIST, } network_message_type; -typedef struct t_protocol_generic_client_message { +typedef struct t_protocol_generic_client_message +{ network_message_type type; } protocol_generic_client_message; -typedef struct t_protocol_generic_message { +typedef struct t_protocol_generic_message +{ network_client client; protocol_generic_client_message *message; + u64 send_timestamp; } protocol_generic_message; -typedef struct t_protocol_get_id_upstream { +typedef struct t_protocol_get_id_upstream +{ network_message_type type; } protocol_get_id_upstream; -typedef struct t_protocol_get_id_downstream { +typedef struct t_protocol_get_id_downstream +{ network_message_type type; u32 id; } protocol_get_id_downstream; -typedef struct t_protocol_user_list { +typedef struct t_protocol_user_list +{ network_message_type type; player players[10]; } protocol_user_list; -typedef struct t_protocol_zombie_list { +typedef struct t_protocol_zombie_list +{ network_message_type type; zombie zombies[20]; } protocol_zombie_list; -typedef enum t_protocol_move_type { +typedef enum t_protocol_move_type +{ MOVE_UP, MOVE_DOWN, MOVE_LEFT, MOVE_RIGHT, } protocol_move_type; -typedef struct t_protocol_move { +typedef struct t_protocol_move +{ network_message_type type; protocol_move_type move; u32 id; } protocol_move; -typedef struct t_protocol_user_look { +typedef struct t_protocol_user_look +{ network_message_type type; u32 id; float gunx; @@ -64,12 +75,14 @@ typedef struct t_protocol_user_look { #include "bullets.h" -typedef struct t_protocol_bullets_list { +typedef struct t_protocol_bullets_list +{ network_message_type type; bullet bullets[500]; } protocol_bullets_list; -typedef struct t_protocol_user_shoot { +typedef struct t_protocol_user_shoot +{ network_message_type type; u32 id; float dirx; @@ -90,7 +103,7 @@ network_message create_protocol_bullets_list(); array messages_received_on_server; array messages_received_on_client; -void server_on_message_received(u8* buffer, u32 length, network_client client); -void client_on_message_received(u8* buffer, u32 length); +void server_on_message_received(u8 *buffer, u32 length, u64 timestamp, network_client client); +void client_on_message_received(u8 *buffer, u32 length); #endif \ No newline at end of file -- cgit v1.2.3-70-g09d2