summaryrefslogtreecommitdiff
path: root/include/protocol.h
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2022-12-12 18:06:53 +0100
committerAldrik Ramaekers <aldrik@amftech.nl>2022-12-12 18:06:53 +0100
commit9528c0c69dba57117f38f84f576af2c81a3b435b (patch)
tree14f3b21a19f3733e05d64e1fc4113af52516a441 /include/protocol.h
parent10ae402862df4337772fe8e35f68ee8ab5bfc224 (diff)
multiplayer
Diffstat (limited to 'include/protocol.h')
-rw-r--r--include/protocol.h48
1 files changed, 43 insertions, 5 deletions
diff --git a/include/protocol.h b/include/protocol.h
index 316a21f..989c4d5 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -6,17 +6,21 @@
typedef enum t_network_message_type {
MESSAGE_GET_ID_UPSTREAM,
MESSAGE_GET_ID_DOWNSTREAM,
+ MESSAGE_USER_LIST,
+ MESSAGE_USER_MOVED,
+ MESSAGE_USER_LOOK,
+ MESSAGE_ZOMBIE_LIST,
} network_message_type;
-typedef struct t_protocol_generic_message {
- network_client client;
- network_message_type type;
-} protocol_generic_message;
-
typedef struct t_protocol_generic_client_message {
network_message_type type;
} protocol_generic_client_message;
+typedef struct t_protocol_generic_message {
+ network_client client;
+ protocol_generic_client_message *message;
+} protocol_generic_message;
+
typedef struct t_protocol_get_id_upstream {
network_message_type type;
} protocol_get_id_upstream;
@@ -26,10 +30,44 @@ typedef struct t_protocol_get_id_downstream {
u32 id;
} protocol_get_id_downstream;
+typedef struct t_protocol_user_list {
+ network_message_type type;
+ player players[10];
+} protocol_user_list;
+
+typedef struct t_protocol_zombie_list {
+ network_message_type type;
+ zombie zombies[20];
+} protocol_zombie_list;
+
+typedef enum t_protocol_move_type {
+ MOVE_UP,
+ MOVE_DOWN,
+ MOVE_LEFT,
+ MOVE_RIGHT,
+} protocol_move_type;
+
+typedef struct t_protocol_move {
+ network_message_type type;
+ protocol_move_type move;
+ u32 id;
+} protocol_move;
+
+typedef struct t_protocol_user_look {
+ network_message_type type;
+ u32 id;
+ float gunx;
+ float guny;
+} protocol_user_look;
+
#define MAX_NETWORK_BUFFER_SIZE 50000
u8 network_buffer[50000];
network_message create_protocol_get_id_up();
network_message create_protocol_get_id_down(u32 id);
+network_message create_protocol_user_list();
+network_message create_protocol_user_moved(protocol_move_type move, u32 id);
+network_message create_protocol_user_look(u32 id, float gunx, float guny);
+network_message create_protocol_zombie_list();
array messages_received_on_server;
array messages_received_on_client;