summaryrefslogtreecommitdiff
path: root/include/protocol.h
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2022-12-15 12:59:19 +0100
committerAldrik Ramaekers <aldrik@amftech.nl>2022-12-15 12:59:19 +0100
commit7b956089e6ba5162fb0b667f1c0a60f6ece90c38 (patch)
tree82de31240ad1f1ae77874f07b288fcc39b8948f4 /include/protocol.h
parent23d2cc231e5b4c015a8471d3035dc07802de23d5 (diff)
added drops
Diffstat (limited to 'include/protocol.h')
-rw-r--r--include/protocol.h41
1 files changed, 27 insertions, 14 deletions
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 <projectbase/project_base.h>
-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