This commit is contained in:
Shadow15510 2021-06-01 11:59:33 +02:00
parent b197758c10
commit 863473457e
5 changed files with 24 additions and 23 deletions

Binary file not shown.

View File

@ -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:

View File

@ -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;
}

View File

@ -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(&current_game);

View File

@ -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