diff --git a/Plague.g1a b/Plague.g1a index 8c6057c..da7b688 100644 Binary files a/Plague.g1a and b/Plague.g1a differ diff --git a/src/core.c b/src/core.c index 0b4573e..833a1c4 100644 --- a/src/core.c +++ b/src/core.c @@ -9,7 +9,7 @@ #include "display_engine.h" -int next_frame(struct game *current_game, int *dna_animation) +int next_frame(struct game *current_game, int *dna_animation, int *vaccine) { for (int i = 0; current_game->planes[i]; i++) { @@ -65,6 +65,10 @@ int next_frame(struct game *current_game, int *dna_animation) // Reset internal clock current_game->time = 0; + // Display message on research + if (!current_game->research && current_game->priority) message("LA RECHERHCE CONTRE VOTRE VIRUS COMMENCE !"); + else if (!*vaccine && (current_game->research == current_game->limit)) {*vaccine = 1; message("LE VACCIN EST TERMINE."); } + // Update the game current_game->dna = current_game->dna + 1 + floor(current_game->severity / 10); if (current_game->dna > 30) current_game->dna = 30; @@ -160,7 +164,9 @@ int callback_tick(volatile int *tick) void message(char *msg) { - display_message(msg); - getkey(); + int opt = GETKEY_DEFAULT & ~GETKEY_MOD_SHIFT & ~GETKEY_MOD_ALPHA & ~GETKEY_REP_ARROWS; + key_event_t ev = {0}; + display_message(msg); + while (ev.key != KEY_ALPHA) ev = getkey_opt(opt, NULL); } diff --git a/src/core.h b/src/core.h index cd72f77..c3a7c4b 100644 --- a/src/core.h +++ b/src/core.h @@ -5,7 +5,7 @@ // Duration for internal clock (ms) #define ENGINE_TICK 50 -#define CURSOR_TICK 150 +#define CURSOR_TICK 110 #define DNA_ANIMATION_TICK 150 // Duration for DNA points and infectious model (ms) @@ -82,7 +82,7 @@ struct cursor // Cursor's coordinates int x, y; - // If the cursor should be displayed + // If the cursor should be displayed (0: display ; 1: hide) int display; }; @@ -90,7 +90,7 @@ struct cursor int get_inputs(const int background, int *mutation_menu, int *boost); // next_frame : compute the plane's positions -int next_frame(struct game *current_game, int *dna_animation); +int next_frame(struct game *current_game, int *dna_animation, int *vaccine); // rtc_key : get the key with RTC system int rtc_key(void); diff --git a/src/display_engine.c b/src/display_engine.c index cc73bb4..021ceef 100644 --- a/src/display_engine.c +++ b/src/display_engine.c @@ -39,6 +39,9 @@ void display_foreground(const int background, const struct game *current_game, c { 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: @@ -67,6 +70,10 @@ void display_foreground(const int background, const struct game *current_game, c dline(51, 60, 51 + length, 60, C_BLACK); dline(51, 59, 51 + length, 59, C_BLACK); + + // Display if boost is activated + if (current_game->boost) dprint(0, 0, C_BLACK, "+"); + break; case 3: diff --git a/src/main.c b/src/main.c index 4ca8bd5..7769062 100644 --- a/src/main.c +++ b/src/main.c @@ -1,11 +1,7 @@ /* Project name ......: Plague -<<<<<<< HEAD - Version ...........: 1.3.3 -======= - Version ...........: 1.3.4 ->>>>>>> dev - Last modification .: 5 June 2021 + Version ...........: 1.3.5 + Last modification .: 6 June 2021 code and assets provided with licence : GNU General Public Licence v3.0 @@ -24,7 +20,7 @@ #include "mutation_engine.h" #include "save.h" -const char *VERSION = "1.3.4"; +const char *VERSION = "1.3.5"; // title_screen : display the title screen static void title_screen(void); @@ -84,7 +80,20 @@ int main(void) int to_save = main_loop(¤t_game); if (to_save) gint_world_switch(GINT_CALL(write_save, (void *)¤t_game)); - else gint_world_switch(GINT_CALL(delete_save)); + else + { + // Display stats at the end of the game + dclear(C_WHITE); + display_background(6); + display_foreground(6, ¤t_game, 0, 0); + dupdate(); + sleep_ms(250); + + int opt = GETKEY_DEFAULT & ~GETKEY_MOD_SHIFT & ~GETKEY_MOD_ALPHA & ~GETKEY_REP_ARROWS; + getkey_opt(opt, NULL); + + gint_world_switch(GINT_CALL(delete_save)); + } // Free memory free(current_game.grid.data); @@ -133,7 +142,7 @@ static void title_screen(void) int main_loop(struct game *current_game) { int background = 1, mutation_menu = 4; - int end = 0, to_save = 1, dna_animation = 0; + int end = 0, to_save = 1, dna_animation = 0, vaccine = 0; static volatile int tick = 1; int t = timer_configure(TIMER_ANY, ENGINE_TICK*1000, GINT_CALL(callback_tick, &tick)); @@ -152,7 +161,7 @@ int main_loop(struct game *current_game) dupdate(); // Compute the motion of planes, DNA points and infectious model - to_save = next_frame(current_game, &dna_animation); + to_save = next_frame(current_game, &dna_animation, &vaccine); if (!to_save) return 0; // Get inputs from the keyboard and manage it diff --git a/src/mutation_engine.c b/src/mutation_engine.c index 7e602fd..cf3be29 100644 --- a/src/mutation_engine.c +++ b/src/mutation_engine.c @@ -72,6 +72,8 @@ void mutation_select(struct game *current_game, const int mutation_menu) // Get the key key = rtc_key(); + + if (key) {tick = 1; c.display = 1;} // Manage input if (key == KEY_ALPHA) end = 1;