summaryrefslogtreecommitdiff
path: root/include/content.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/content.h')
-rw-r--r--include/content.h33
1 files changed, 24 insertions, 9 deletions
diff --git a/include/content.h b/include/content.h
index ed8b822..664c84e 100644
--- a/include/content.h
+++ b/include/content.h
@@ -7,6 +7,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include "vec.h"
typedef enum {
N_VALLEY_FLOWER,
@@ -25,12 +26,12 @@ typedef struct {
uint8_t r, g, b;
} color;
-static inline uint32_t color_u32(color c)
+static inline uint32_t color_to_u32(color c)
{
return ((uint32_t) c.b) | (((uint32_t) c.g) << 8) | (((uint32_t) c.r) << 16);
}
-static inline color u32_color(uint32_t u)
+static inline color color_from_u32(uint32_t u)
{
return (color) { (u >> 16) & 0xFF, (u >> 8) & 0xFF, u & 0xFF };
}
@@ -42,12 +43,25 @@ typedef struct {
color col;
} node;
+#define SIGHT_RANGE 10
+#define NODES_PKT_MAX (50*50)
+
typedef enum {
- MOVE_UP = 0,
- MOVE_DOWN,
- MOVE_LEFT,
- MOVE_RIGHT,
-} move_dir;
+ DIR_RIGHT = 0,
+ DIR_UP,
+ DIR_LEFT,
+ DIR_DOWN,
+} dir;
+
+static inline vec2 dir_to_vec2(dir d)
+{
+ switch (d) {
+ case DIR_RIGHT: return VEC2(0, 1);
+ case DIR_UP: return VEC2(-1, 0);
+ case DIR_LEFT: return VEC2(0, -1);
+ case DIR_DOWN: return VEC2(1, 0);
+ }
+}
typedef uint8_t fail_reason;
#define ser_fail_reason ser_u8
@@ -66,8 +80,9 @@ enum {
CPKT_HI = 0, // len motd
CPKT_FAIL, // fail_reason
CPKT_PLAYERS, // len [len name id]
- CPKT_MOVE, // player_id remove x y z
- CPKT_NODES, // z x y w h [node]
+ CPKT_MOVE, // player_id remove x y
+ CPKT_NODES, // box2 [node]
+ CPKT_RESET_MAP,
};
enum {