From 342d621da66b6ac138a314ced5080d92b3135262 Mon Sep 17 00:00:00 2001 From: Shadow15510 Date: Wed, 30 Jun 2021 23:29:46 +0200 Subject: [PATCH] Update code --- src/core.c | 7 +------ src/display_engine.c | 44 ++++++++++++-------------------------------- 2 files changed, 13 insertions(+), 38 deletions(-) diff --git a/src/core.c b/src/core.c index ceb5c3a..5c8fb97 100644 --- a/src/core.c +++ b/src/core.c @@ -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) { diff --git a/src/display_engine.c b/src/display_engine.c index d08239a..00be0f5 100644 --- a/src/display_engine.c +++ b/src/display_engine.c @@ -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; } }