aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-10-01 23:00:58 +1000
committerquou <quou@disroot.org>2024-10-01 23:00:58 +1000
commitc474a43f800c7e7a0a90adcc997ba4e30dd2ae56 (patch)
tree88cfdda5b375decfe55d685471427a4f5da67d9a
parenta5beb2e333f225d4d92f4061c41938f718f69cb1 (diff)
enum for specials
-rw-r--r--obj.h11
-rw-r--r--player.c1
2 files changed, 12 insertions, 0 deletions
diff --git a/obj.h b/obj.h
index c7d9589..4f7d57e 100644
--- a/obj.h
+++ b/obj.h
@@ -13,6 +13,16 @@ typedef enum {
face_right
} Face;
+#define specials_xmacro \
+ x(special_gun, 21, 0)
+
+typedef enum {
+#define x(name, x, y) name,
+ specials_xmacro
+#undef x
+ special_count
+} Special;
+
typedef struct {
int x, y, vx, vy;
int frame;
@@ -22,6 +32,7 @@ typedef struct {
int inv, hp, charge;
Face face;
Rect rect;
+ Special spec;
} Player;
void init_player(Player* p);
diff --git a/player.c b/player.c
index b1aaaee..26a333e 100644
--- a/player.c
+++ b/player.c
@@ -27,6 +27,7 @@ void init_player(Player* p) {
p->inv = 0;
p->hp = player_health;
p->charge = 0;
+ p->spec = special_gun;
}
void update_player_anim(Player* p) {