From 95283d70eee749d984b2ca07c0b61d39f9bb350d Mon Sep 17 00:00:00 2001 From: Lizzy Fleckenstein Date: Sat, 13 Jul 2024 12:47:36 +0200 Subject: implement entities Signed-off-by: Lizzy Fleckenstein --- include/array.h | 2 ++ include/content.h | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/array.h b/include/array.h index 5f81798..9affdde 100644 --- a/include/array.h +++ b/include/array.h @@ -6,6 +6,8 @@ #define ARRAY_H #include +#include +#include #define len(X) (sizeof X / sizeof *X) #define array(T) struct { size_t len; T *data; } diff --git a/include/content.h b/include/content.h index 16118f6..ef27e22 100644 --- a/include/content.h +++ b/include/content.h @@ -14,9 +14,7 @@ #define PKT_NODES_MAX (50*50) typedef enum : uint16_t { - N_VALLEY_FLOWER = 0, - N_MOUNTAIN_FLOWER, - N_BIG_TREE, + N_BIG_TREE = 0, N_NEEDLE_TREE, N_ROCK, N_WATER, @@ -133,6 +131,7 @@ typedef uint64_t entity_id; typedef enum : uint16_t { ENTITY_PLAYER = 0, + ENTITY_FLOWER, } entity_type; #define ser_entity_type ser_u16 @@ -142,11 +141,21 @@ typedef enum : uint8_t { ENTITY_ADD = 0, // type ENTITY_REMOVE, ENTITY_MOVE, // x y + ENTITY_CMD_COUNT, } entity_cmd; #define ser_entity_cmd ser_u8 #define deser_entity_cmd deser_u8 +typedef struct { + entity_id id; + entity_type type; + vec2 pos; + union { + flower_type flower; + }; +} entity; + enum : uint16_t { CPKT_HI = 0, // len motd CPKT_FAIL, // fail_reason -- cgit v1.2.3