From e49e3073c67af785447ddb0ecbdc521b68cf3ea9 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sat, 27 Jan 2024 17:53:11 +0100 Subject: Add unit sprites --- src/game/src/res.c | 36 ++++++++++++++++++++++++++++++++++++ src/unit/inc/unit.h | 17 +++++++++-------- src/unit/src/unit.c | 2 +- 3 files changed, 46 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/game/src/res.c b/src/game/src/res.c index f38443e..dead212 100644 --- a/src/game/src/res.c +++ b/src/game/src/res.c @@ -73,6 +73,42 @@ static const struct container c[] = .type = CONTAINER_TYPE_SPRITE, .data.sprite = &terrain_sprites[GRASS] }, + + { + .path = "unit1", + .type = CONTAINER_TYPE_SPRITE, + .data.sprite = &unit_sprites[UNIT_1_SPRITE] + }, + + { + .path = "unit2", + .type = CONTAINER_TYPE_SPRITE, + .data.sprite = &unit_sprites[UNIT_2_SPRITE] + }, + + { + .path = "unit3", + .type = CONTAINER_TYPE_SPRITE, + .data.sprite = &unit_sprites[UNIT_3_SPRITE] + }, + + { + .path = "unit4", + .type = CONTAINER_TYPE_SPRITE, + .data.sprite = &unit_sprites[UNIT_4_SPRITE] + }, + + { + .path = "unit5", + .type = CONTAINER_TYPE_SPRITE, + .data.sprite = &unit_sprites[UNIT_5_SPRITE] + }, + + { + .path = "unit6", + .type = CONTAINER_TYPE_SPRITE, + .data.sprite = &unit_sprites[UNIT_6_SPRITE] + } }; static bool init; diff --git a/src/unit/inc/unit.h b/src/unit/inc/unit.h index d86704d..8d3e1bf 100644 --- a/src/unit/inc/unit.h +++ b/src/unit/inc/unit.h @@ -76,16 +76,17 @@ const char *unit_str(const struct unit *u); enum { - UNIT_SPRITE_N, - UNIT_SPRITE_NE, - UNIT_SPRITE_E, - UNIT_SPRITE_SE, - UNIT_SPRITE_S, - - MAX_UNIT_SPRIES + UNIT_1_SPRITE, + UNIT_2_SPRITE, + UNIT_3_SPRITE, + UNIT_4_SPRITE, + UNIT_5_SPRITE, + UNIT_6_SPRITE, + + MAX_UNIT_SPRITES }; -extern struct sprite unit_sprites[MAX_UNIT_SPRIES]; +extern struct sprite unit_sprites[MAX_UNIT_SPRITES]; enum unit_sound { diff --git a/src/unit/src/unit.c b/src/unit/src/unit.c index 3333797..1bb1e0f 100644 --- a/src/unit/src/unit.c +++ b/src/unit/src/unit.c @@ -8,7 +8,7 @@ #include #include -struct sprite unit_sprites[MAX_UNIT_SPRIES]; +struct sprite unit_sprites[MAX_UNIT_SPRITES]; struct sound unit_sounds[MAX_UNIT_SOUNDS]; enum {N_FRAMES = 5}; -- cgit v1.2.3