Update code

This commit is contained in:
Shadow15510 2021-06-30 23:29:46 +02:00
parent 39f71e65f7
commit 342d621da6
2 changed files with 13 additions and 38 deletions

View File

@ -101,18 +101,13 @@ int get_inputs(const int background, int *mutation_menu, int *boost)
*mutation_menu = 4;
return 3;
}
if (key == KEY_SQUARE)
{
if (background == 1) return 6;
else if (background == 6) return 1;
}
if (key == KEY_ALPHA)
{
if (background == 5) return 3;
else return 1;
}
if (key == KEY_EXIT && (background == 1 || background == 2)) return -1;
if (key == KEY_EXIT && background == 1) return -1;
if (background == 3)
{

View File

@ -8,7 +8,7 @@
void display_background(const int background)
{
extern const bopti_image_t img_bground;
dsubimage(0, 0, &img_bground, 0, 225 * (background - 1), 396, 224, DIMAGE_NONE);
dsubimage(0, 0, &img_bground, 0, 224 * (background - 1), 396, 224, DIMAGE_NONE);
}
@ -25,27 +25,6 @@ void display_foreground(const int background, const struct game *current_game, c
{
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 || current_game->grid.data[i + j * current_game->grid.width] == 3) && world[j][i] != 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);
}
// Display if boost is activated
if (current_game->boost) dprint(0, 0, C_BLACK, "+");
break;
case 2:
// Disease propagation
for (int i = 0; i < current_game->grid.width; i ++)
{
@ -64,13 +43,23 @@ void display_foreground(const int background, const struct game *current_game, c
// Animated DNA
dsubimage(1, 51, &img_dna, dna_animation * 8, 0, 7, 12, DIMAGE_NONE);
// Status bottom bar
// Research bar
int length = 73 * 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);
// Stats bar
/*
for (int i = 0; i < 4; i ++)
{
length = 63 * current_game->humans[i] / ((current_game->grid.width * current_game->grid.height) - BLANK_CASES);
dline(61, i*8 + 31, 61 + length, i*8 + 31, C_BLACK);
dline(61, i*8 + 32, 61 + length, i*8 + 32, C_BLACK);
}
*/
// Display if boost is activated
if (current_game->boost) dprint(0, 0, C_BLACK, "+");
@ -97,15 +86,6 @@ void display_foreground(const int background, const struct game *current_game, c
if (current_game->mutations_selected[1]) dsubimage(37, 15, &img_mutations, 16, 16 * (current_game->mutations_selected[1] - 1), 15, 15, 0);
if (current_game->mutations_selected[2]) dsubimage(67, 15, &img_mutations, 32, 16 * (current_game->mutations_selected[2] - 1), 15, 15, 0);
break;
case 6:
for (int i = 0; i < 4; i ++)
{
length = 63 * current_game->humans[i] / ((current_game->grid.width * current_game->grid.height) - BLANK_CASES);
dline(61, i*8 + 31, 61 + length, i*8 + 31, C_BLACK);
dline(61, i*8 + 32, 61 + length, i*8 + 32, C_BLACK);
}
break;
}
}