From 04f6fe80b4eb2ba9d705c40c3edd275e739514b7 Mon Sep 17 00:00:00 2001 From: Shadow15510 Date: Wed, 19 Jan 2022 21:48:09 +0100 Subject: [PATCH] Improve ergonomy and add in-game short help --- src/core.c | 6 +++--- src/main.c | 23 ++++++++++++++++++++--- src/mutation_engine.c | 4 ++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/core.c b/src/core.c index e9df5f6..a55070f 100644 --- a/src/core.c +++ b/src/core.c @@ -108,12 +108,12 @@ int get_inputs(const int background, int *mutation_menu, int *boost) else if (background == 6) return 1; } - if (key == KEY_ALPHA) + if (key == KEY_ALPHA || key == KEY_EXIT) { if (background == 5) return 3; + if (background == 1 || background == 2) return -1; else return 1; } - if (key == KEY_EXIT && (background == 1 || background == 2)) return -1; if (background == 3) { @@ -168,5 +168,5 @@ void message(char *msg) key_event_t ev = {0}; display_message(msg); - while (ev.key != KEY_ALPHA) ev = getkey_opt(opt, NULL); + while (ev.key != KEY_ALPHA && ev.key != KEY_EXIT) ev = getkey_opt(opt, NULL); } diff --git a/src/main.c b/src/main.c index 2a3a8df..d49b78d 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,7 @@ /* Project name ......: Plague - Version ...........: 1.3.9 - Last modification .: 8 June 2021 + Version ...........: 1.3.10 + Last modification .: 19 January 2022 code and assets provided with licence : GNU General Public Licence v3.0 @@ -20,7 +20,7 @@ #include "mutation_engine.h" #include "save.h" -const char *VERSION = "1.3.9"; +const char *VERSION = "1.3.10"; // title_screen : display the title screen static void title_screen(void); @@ -77,6 +77,23 @@ int main(void) gint_world_switch(GINT_CALL(read_save, (void *)¤t_game)); + if (current_game.total_time == 0) + { + dclear(C_WHITE); + + dtext(10, 1, C_BLACK, "CONTROLES :"); + dtext(1, 7, C_BLACK, "[REPLAY]:SELECTIONNER"); + dtext(1, 14, C_BLACK, "[SHIFT]:VALIDER"); + dtext(1, 21, C_BLACK, "[ALPHA/EXIT]:REVENIR"); + dtext(1, 28, C_BLACK, "[VARS]:MUTATIONS"); + dtext(1, 35, C_BLACK, "[OPTN]:RECHERCHE+ADN"); + dtext(1, 42, C_BLACK, "[X^2]:STATISTIQUES"); + dtext(1, 49, C_BLACK, "[->]:MODE RAPIDE"); + + dupdate(); + getkey(); + } + int to_save = main_loop(¤t_game); if (to_save) gint_world_switch(GINT_CALL(write_save, (void *)¤t_game)); diff --git a/src/mutation_engine.c b/src/mutation_engine.c index 1a2e9a6..402c3d0 100644 --- a/src/mutation_engine.c +++ b/src/mutation_engine.c @@ -76,7 +76,7 @@ void mutation_select(struct game *current_game, const int mutation_menu) if (key) {tick = 1; c.display = 1;} // Manage input - if (key == KEY_ALPHA) end = 1; + if (key == KEY_ALPHA || key == KEY_EXIT) end = 1; if (key == KEY_SHIFT && table[c.y][c.x] != 15 && table[c.y][c.x] != 0) { end = mutation_buy(current_game, c, mutation_menu, table); @@ -115,7 +115,7 @@ int mutation_buy(struct game *current_game, const struct cursor c, const int mut if (key == KEY_OPTN) { display_mutation_description(mutation_data->name, mutation_data->description, mutation_menu, id); - while (ev.key != KEY_ALPHA) ev = getkey_opt(opt, NULL); + while (ev.key != KEY_ALPHA && ev.key != KEY_EXIT) ev = getkey_opt(opt, NULL); } if (key == KEY_SHIFT) {