Display the disease propagation : first try. Add a new assets folder (for old assets)
This commit is contained in:
parent
11b1b4bfb1
commit
b197758c10
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
|
@ -16,28 +16,53 @@ void display_foreground(const int background, const struct game *current_game)
|
|||
{
|
||||
extern const bopti_image_t img_mutations;
|
||||
extern const bopti_image_t img_planes;
|
||||
extern const unsigned int world[64][128];
|
||||
|
||||
GUNUSED int length;
|
||||
|
||||
switch (background)
|
||||
{
|
||||
case 1:
|
||||
|
||||
// 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:
|
||||
|
||||
// Planes animations
|
||||
for (int i = 0; current_game->planes[i]; i++)
|
||||
{
|
||||
if (current_game->planes[i]->y + 8 < 57) 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);
|
||||
}
|
||||
|
||||
// Status bottom bar
|
||||
int length = 74 * current_game->research / current_game->limit;
|
||||
dprint(9, 58, C_BLACK, "%d", current_game->dna);
|
||||
|
||||
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:
|
||||
|
|
|
@ -67,6 +67,8 @@ 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;
|
||||
|
||||
main_loop(¤t_game);
|
||||
|
||||
/* free memory */
|
||||
|
|
Loading…
Reference in New Issue