Skip to content

Commit

Permalink
fixed uint8 for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
savaughn committed Dec 14, 2023
1 parent b7b8dc1 commit 4a5c16d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
15 changes: 5 additions & 10 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#define MAX_FRAMES_LEVEL1 200

typedef unsigned char uint8;

enum player_action
{
NONE = -1,
Expand All @@ -32,10 +34,10 @@ struct enemy
Vector2 position;
float speed;
bool active;
u_int8_t health;
uint8 health;
bool hit;
enum enemy_type type;
u_int8_t hitbox_r;
uint8 hitbox_r;
};

static struct enemy basic_enemy = {
Expand Down Expand Up @@ -64,7 +66,7 @@ struct player
Vector2 velocity;
int bullet_count;
struct bullet bullets[MAX_BULLETS];
u_int8_t hitbox_r;
uint8 hitbox_r;
};

struct opts
Expand All @@ -87,13 +89,6 @@ struct enemy_spawn_info
enum enemy_type type;
};

static struct enemy *level1SpawnScript[MAX_FRAMES_LEVEL1] = {
[0 ... 199] = &(struct enemy){.active = false},
[60] = &(struct enemy){.position = (Vector2){100, -100}, .type = BASIC, .speed = 96.0f, .active = true, .health = 1},
[120] = &(struct enemy){.position = (Vector2){200, -200}, .type = BASIC, .speed = 96.0f, .active = true, .health = 1},
[180] = &(struct enemy){.position = (Vector2){300, -300}, .type = BASIC, .speed = 96.0f, .active = true, .health = 1},
};

static struct bullet common_bullet = {
.position = (Vector2){0, 0},
.speed = 800.0f,
Expand Down
7 changes: 7 additions & 0 deletions src/screens/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ static int enemy_count = 0;
static bool is_level_initialized = false;
static int frame_count = 0;

static struct enemy *level1SpawnScript[MAX_FRAMES_LEVEL1] = {
[0 ... 199] = &(struct enemy){.active = false},
[60] = &(struct enemy){.position = (Vector2){100, -100}, .type = BASIC, .speed = 96.0f, .active = true, .health = 1},
[120] = &(struct enemy){.position = (Vector2){200, -200}, .type = BASIC, .speed = 96.0f, .active = true, .health = 1},
[180] = &(struct enemy){.position = (Vector2){300, -300}, .type = BASIC, .speed = 96.0f, .active = true, .health = 1},
};

void init_game(void)
{
for (int i = 0; i < MAX_BULLETS; i++)
Expand Down

0 comments on commit 4a5c16d

Please sign in to comment.