diff --git a/Plague.g1a b/Plague.g1a index 55c22dd..d69480a 100644 Binary files a/Plague.g1a and b/Plague.g1a differ diff --git a/src/display_engine.c b/src/display_engine.c index 25ecd00..4b81f45 100644 --- a/src/display_engine.c +++ b/src/display_engine.c @@ -24,24 +24,33 @@ void display_foreground(const int background, const struct game *current_game) { case 1: + // Disease propagation + for (int i = 0; i < current_game->grid.width; i ++) + { + for (int j = 0; j < current_game->grid.height; j ++) + { + if (current_game->grid.data[i + j * current_game->grid.width] == 1 && world[i][j] != 0) dpixel(i, j, C_BLACK); + } + } + // Planes animations for (int i = 0; current_game->planes[i]; i++) { dsubimage(current_game->planes[i]->x - 4, current_game->planes[i]->y - 4, &img_planes, 0, 8 * (current_game->planes[i]->direction - 1), 8, 8, DIMAGE_NONE); } - - // Disease propagation - for (int i = 0; i < current_game->grid.height; i ++) - { - for (int j = 0; j < current_game->grid.width, j ++) - { - if (current_game->grid[i + j * current_game->grid.width] == 1 && world[i][j] != 0) dpixel(i, j, C_BLACK); - } - } break; case 2: + // Disease propagation + for (int i = 0; i < current_game->grid.width; i ++) + { + for (int j = 0; j < 50; j ++) + { + if (current_game->grid.data[i + j * current_game->grid.width] == 1 && world[i][j] != 0) dpixel(i, j, C_BLACK); + } + } + // Planes animations for (int i = 0; current_game->planes[i]; i++) { @@ -54,15 +63,6 @@ void display_foreground(const int background, const struct game *current_game) dline(51, 60, 51 + length, 60, C_BLACK); dline(51, 59, 51 + length, 59, C_BLACK); - - // Disease propagation - for (int i = 0; i < current_game->grid.height; i ++) - { - for (int j = 0; j < 50, j ++) - { - if (current_game->grid[i + j * current_game->grid.width] == 1 && world[i][j] != 0) dpixel(i, j, C_BLACK); - } - } break; case 3: diff --git a/src/epidemic_engine.c b/src/epidemic_engine.c index 9ef4ad2..1372521 100644 --- a/src/epidemic_engine.c +++ b/src/epidemic_engine.c @@ -14,12 +14,12 @@ int can_become_infected(const struct grid epidemic_grid, const int mutations_sel // return (epidemic_grid.data[i-1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i+1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j-1) * epidemic_grid.width] - 1) * (epidemic_grid.data[i (j+1) * epidemic_grid.width] - 1) == 0; if (i == 0 && j == 0) return (epidemic_grid.data[i+1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j+1) * epidemic_grid.width] - 1) == 0; - if (i == 0 && j == epidemic_grid.width - 1) return (epidemic_grid.data[i+1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j-1) * epidemic_grid.width] - 1) == 0; + if (i == 0 && j == epidemic_grid.height - 1) return (epidemic_grid.data[i+1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j-1) * epidemic_grid.width] - 1) == 0; if (i == 0) return (epidemic_grid.data[i + (j-1) * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j+1) * epidemic_grid.width] - 1) * (epidemic_grid.data[i+1 + j * epidemic_grid.width] - 1) == 0; - if (i == epidemic_grid.height -1 && j == 0) return (epidemic_grid.data[i-1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j+1) * epidemic_grid.width] - 1) == 0; - if (i == epidemic_grid.height - 1 && j == epidemic_grid.height - 1) return (epidemic_grid.data[i-1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j-1) * epidemic_grid.width] - 1) == 0; - if (i == epidemic_grid.height) return (epidemic_grid.data[i-1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j-1) * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j+1) * epidemic_grid.width] - 1) == 0; + if (i == epidemic_grid.width - 1 && j == 0) return (epidemic_grid.data[i-1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j+1) * epidemic_grid.width] - 1) == 0; + if (i == epidemic_grid.width - 1 && j == epidemic_grid.height - 1) return (epidemic_grid.data[i-1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j-1) * epidemic_grid.width] - 1) == 0; + if (i == epidemic_grid.width - 1) return (epidemic_grid.data[i-1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j-1) * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j+1) * epidemic_grid.width] - 1) == 0; return (epidemic_grid.data[i-1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i+1 + j * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j-1) * epidemic_grid.width] - 1) * (epidemic_grid.data[i + (j+1) * epidemic_grid.width] - 1) == 0; } diff --git a/src/main.c b/src/main.c index ad8cbd4..ae48d8b 100644 --- a/src/main.c +++ b/src/main.c @@ -67,7 +67,7 @@ int main(void) /* allocate memory */ current_game.grid.data = calloc(current_game.grid.width * current_game.grid.height, sizeof(uint8_t)); - current_game.grid.data[95 + 25 * currnet_game.grid.width] = 1; + current_game.grid.data[95 + 20 * current_game.grid.width] = 1; main_loop(¤t_game); diff --git a/src/mutation_engine.c b/src/mutation_engine.c index 78e6783..fc6e795 100644 --- a/src/mutation_engine.c +++ b/src/mutation_engine.c @@ -5,6 +5,7 @@ #include "mutation_engine.h" + void get_mutation(const struct game *current_game, const int mutation_menu, int table[4][8]) { // Load symptoms