diff options
author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-06-24 00:01:06 +0200 |
---|---|---|
committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-06-24 00:01:06 +0200 |
commit | f7001d91a75204a2ecc33c9a8b93a996865fb418 (patch) | |
tree | 2d74b5144606904747bcde8f9af520c181900137 /include/content.h | |
parent | 3be565f4e8ee1610aae5b0945185b4012f026c87 (diff) |
rewrite map rendering
Signed-off-by: Lizzy Fleckenstein <lizzy@vlhl.dev>
Diffstat (limited to 'include/content.h')
-rw-r--r-- | include/content.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/include/content.h b/include/content.h index 9d35dc8..16118f6 100644 --- a/include/content.h +++ b/include/content.h @@ -10,11 +10,11 @@ #include "ser.h" #include "vec.h" -#define SIGHT_RANGE 10 +#define SIGHT_RANGE 15 #define PKT_NODES_MAX (50*50) typedef enum : uint16_t { - N_VALLEY_FLOWER, + N_VALLEY_FLOWER = 0, N_MOUNTAIN_FLOWER, N_BIG_TREE, N_NEEDLE_TREE, @@ -55,11 +55,24 @@ typedef struct { return (color) { (u >> 16) & 0xFF, (u >> 8) & 0xFF, u & 0xFF }; } +typedef enum : uint8_t { + FLOWER_ROSE = 0, + FLOWER_HIBISCUS, + FLOWER_SUNFLOWER, + FLOWER_TULIP, + FLOWER_DANDELION, // im in a field of dandelions... + FLOWER_COUNT, +} flower_type; + +#define ser_flower_type ser_u8 +#define deser_flower_type deser_u8 + typedef struct { bool present; node_type type; int8_t z; // for rocks, indicates rock level color col; + uint8_t variant; } node; [[maybe_unused]] static void ser_node(strbuf *w, node *n) @@ -71,6 +84,7 @@ typedef struct { ser_node_type(w, n->type); ser_i8(w, n->z); ser_color(w, n->col); + ser_u8(w, n->variant); } [[maybe_unused]] static bool deser_node(str *r, node *n) @@ -80,7 +94,8 @@ typedef struct { return deser_node_type(r, &n->type) && deser_i8(r, &n->z) - && deser_color(r, &n->col); + && deser_color(r, &n->col) + && deser_u8(r, &n->variant); } typedef enum : uint8_t { @@ -117,14 +132,14 @@ typedef uint64_t entity_id; #define deser_entity_id deser_u64 typedef enum : uint16_t { - ENTITY_PLAYER + ENTITY_PLAYER = 0, } entity_type; #define ser_entity_type ser_u16 #define deser_entity_type deser_u16 typedef enum : uint8_t { - ENTITY_ADD, // type + ENTITY_ADD = 0, // type ENTITY_REMOVE, ENTITY_MOVE, // x y } entity_cmd; |