diff --git a/Plague.g1a b/Plague.g1a index 4b30fe9..c155969 100644 Binary files a/Plague.g1a and b/Plague.g1a differ diff --git a/README.md b/README.md index 6b5e06a..ca09346 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,6 @@ Vous commencez la partie en Asie Centrale. La totalité du projet est soumise à la licence GNU General Public Licence v3.0. -### To do list - - - Ajouter *in-game* des information sur chaque mutation - - Corriger le calcul avec les statistiques des humains - ## Contrôles Lancez le jeu, et pressez n'importe quelle touche pour passer l'écran principal. Une fois sur l'écran représentant la Terre, plusieurs choix s'offrent à vous : @@ -28,6 +23,8 @@ Dans les menus déplacez-vous grâce aux touches fléchées, validez avec [SHIFT Pour quitter le jeu, allez sur la mappemonde et pressez [EXIT]. +Dans les menus de sélection des mutations, pressez [OPTN] pour avoir une courte description de la mutation sélectionnée. Pressez ensuite n'importe quelle autre touche pour revenir sur les données de bases. + ## Mutations Dans ce jeu, vous aurez le choix entre plusieurs mutations pour faire le plus de dégât possible parmi les humains ! Comme dans le jeu d'origine, celles-ci sont divisées en 3 catégories : Symptômes, Capacités, et Transmissions. diff --git a/assets-fx/bground.png b/assets-fx/bground.png index 83b496d..37e9f89 100644 Binary files a/assets-fx/bground.png and b/assets-fx/bground.png differ diff --git a/src/core.c b/src/core.c index 929806e..72f2788 100644 --- a/src/core.c +++ b/src/core.c @@ -79,16 +79,8 @@ void next_frame(struct game *current_game) // Check the end of the game if (!current_game->humans[1]) { - if (current_game->humans[0] != 0) - { - const char *msg[5] = {"Vous avez", "perdu.", "", "", ""}; - message(msg); - } - else - { - const char *msg[5] = {"Vous avez", "gagne.", "", "", ""}; - message(msg); - } + if (current_game->humans[0]) message("VOUS AVEZ PERDU."); + else message("VOUS AVEZ GAGNE !"); } } } @@ -101,7 +93,7 @@ int get_inputs(const int background, int *mutation_menu) if (key == KEY_OPTN && (background == 1 || background == 2)) return (background % 2) + 1; if (key == KEY_VARS) { - *mutation_menu = 1; + *mutation_menu = 4; return 3; } if (key == KEY_SQUARE) return 6; @@ -160,7 +152,7 @@ int callback_tick(volatile int *tick) } -void message(const char *msg[5]) +void message(char *msg) { display_message(msg); diff --git a/src/core.h b/src/core.h index 9332e3d..f756376 100644 --- a/src/core.h +++ b/src/core.h @@ -99,6 +99,6 @@ int rtc_key(void); int callback_tick(volatile int *tick); // message : display a message -void message(const char *msg[5]); +void message(char *msg); #endif /* _PLAGUE_CORE_H */ diff --git a/src/data.c b/src/data.c index 4854748..1c92e66 100644 --- a/src/data.c +++ b/src/data.c @@ -4,53 +4,53 @@ // (contation, severity, lethality, DNA cost, change to cure requirement) const struct mutation symptoms_data[14] = { - {10, 10, 0, 2, 0, "NAUSEE"}, - {15, 10, 0, 10, 0, "VOMISSEMENT"}, - {10, 5, 0, 3, 0, "TOUX"}, - {15, 20, 0, 10, 0, "PNEUMONIE"}, - {10, 30, 20, 15, 10, "TUMEUR"}, - {15, 10, 5, 4, 0, "PLAIES"}, - {10, 10, 10, 10, 0, "LESIONS"}, - {30, 20, 20, 20, 5, "HEMORRAGIE"}, - {25, 15, 10, 17, 0, "INFECTION"}, - {15, 10, 5, 5, 0, "INFLAMMATION"}, - {10, 15, 20, 15, 0, "IMMUNITE"}, - { 0, 20, 0, 15, 10, "PARANOIA"}, - { 0, 15, 15, 20, 10, "FOLIE"}, - { 0, 30, 30, 30, 20, "ARRET TOTAL"}, + {10, 10, 0, 2, 0, "NAUSEE", "DONNE DES NAUSEES"}, + {15, 10, 0, 10, 0, "VOMISSEMENT", "PROVOQUE DES REJETS GESTRIQUES"}, + {10, 5, 0, 3, 0, "TOUX", "LA PROJECTION DE PARTICULE AUGMENTE LA CONTAGION"}, + {15, 20, 5, 10, 0, "PNEUMONIE", "AFFECTION PULMONAIRE PEU MORTELLE"}, + { 0, 30, 20, 15, 10, "TUMEUR", "PEU CONTAGIEUX, MAIS MORTEL"}, + {15, 10, 5, 4, 0, "PLAIES", "LA PEAU S'ASSECHE ET DEVIENT CASSANTE"}, + {10, 10, 10, 10, 0, "LESIONS", "BLOQUE LA CICATRISATION"}, + {30, 20, 20, 20, 5, "HEMORRAGIE", "BLOQUE L'ACTION DES PLAQUETTES"}, + {25, 15, 10, 17, 0, "INFECTION", "CREER DES FOYERS D'INFECTION DANS LE CORPS"}, + {15, 10, 5, 5, 0, "INFLAMMATION", "PROVOQUE DES ROUGEURS ET DEMANGEAISONS"}, + {10, 15, 20, 15, 0, "IMMUNITE", "BLOQUE L'ACTION DU SYSTEME IMMUNITAIRE"}, + { 0, 20, 0, 15, 10, "PARANOIA", "LES CHERCHEURS N'ARRIVENT PLUS A COOPERER ENTRE EUX"}, + { 0, 15, 15, 20, 10, "FOLIE", "PROVOQUE DES CRISES D'HYSTERIES"}, + { 0, 30, 30, 30, 20, "ARRET TOTAL", "EMPECHE LES ORGANES DE FONCTIONNER"}, }; const struct mutation abilities_data[6] = { - {15, 0, 0, 10, 0, "FROID"}, - {15, 0, 0, 15, 0, "CHAUD"}, - { 0, 10, 4, 25, 10, "GENETIQUE"}, - {10, 40, 20, 30, 20, "MUTATION+"}, - {30, 10, 0, 30, 0, "ENVIRON"}, - { 0, 15, 30, 15, 20, "MEDICAMENT"}, + {15, 0, 0, 10, 0, "FROID", "RESISTANCE AU FROID"}, + {15, 0, 0, 15, 0, "CHAUD", "RESISTANCE AU CHAUD"}, + { 0, 10, 4, 25, 10, "GENETIQUE", "LE GENOME MUTE, RALENTISSANT LE SEQUENCAGE ADN"}, + {10, 40, 20, 30, 20, "MUTATION+", "LE VIRUS MUTE, BLOQUANT LES CHERCHEURS"}, + {30, 10, 0, 30, 0, "ENVIRON", "LE VIRUS RESISTE AUX ENVIRONNEMENTS LES PLUS HOSTILES"}, + { 0, 15, 30, 15, 20, "MEDICAMENT", "RESISTANCES AU MEDICAMENTS"}, }; const struct mutation transmissions_data[13] = { - { 5, 0, 0, 9, 0, "AIR 1"}, - {10, 10, 0, 15, 0, "AIR 2"}, - {20, 10, 0, 20, 0, "AIR 3"}, - {40, 15, 0, 30, 0, "AEROSOL"}, - {10, 0, 0, 9, 0, "EAU 1"}, - {20, 10, 0, 12, 0, "EAU 2"}, - {20, 0, 0, 10, 0, "ANIMAL 1"}, - {40, 10, 0, 16, 0, "ANIMAL 2"}, - {20, 0, 0, 12, 0, "OISEAU 1"}, - {40, 10, 0, 16, 0, "OISEAU 2"}, - {10, 0, 0, 8, 0, "SANG 1"}, - {20, 10, 0, 14, 0, "SANG 2"}, - {40, 15, 0, 20, 0, "SANG 3"}, + { 5, 0, 0, 9, 0, "AIR 1", "TRANSMISSION PAR L'AIR"}, + {10, 10, 0, 15, 0, "AIR 2", "TRANSMISSION PAR L'AIR"}, + {20, 10, 0, 20, 0, "AIR 3", "TRANSMISSION PAR L'AIR"}, + {40, 15, 0, 30, 0, "AEROSOL", "TRANSMISSION PAR L'AIR ET PAR L'EAU"}, + {10, 0, 0, 9, 0, "EAU 1", "TRANSMISSION PAR L'EAU"}, + {20, 10, 0, 12, 0, "EAU 2", "TRANSMISSION PAR L'EAU"}, + {20, 0, 0, 10, 0, "ANIMAL 1", "LE VIRUS PEUT PASSER DE L'ANIMAL À L'HOMME"}, + {40, 10, 0, 16, 0, "ANIMAL 2", "CAPACITE DE TRANSMISSION HOMME-ANIMAL"}, + {20, 0, 0, 12, 0, "OISEAU 1", "CAPACITE DE TRANSMISSION ENTRE LES OISEAU"}, + {40, 10, 0, 16, 0, "OISEAU 2", "LES OISEAUX DEVIENNENT DES VECTEURS VIRALS"}, + {10, 0, 0, 8, 0, "SANG 1", "LE VIRUS SE TRANSMET PAR LE SANG"}, + {20, 10, 0, 14, 0, "SANG 2", "LE VIRUS SE TRANSMET PAR LE SANG"}, + {40, 15, 0, 20, 0, "SANG 3", "LE VIRUS SE TRANSMET PAR LE SANG"}, }; -const struct mutation default_value = {0, 0, 0, 0, 0, "NONE"}; +const struct mutation default_value = {0, 0, 0, 0, 0, "NONE", "NONE"}; /* Encoded data for the world diff --git a/src/display_engine.c b/src/display_engine.c index 6cc5fd6..6821d0e 100644 --- a/src/display_engine.c +++ b/src/display_engine.c @@ -66,7 +66,7 @@ void display_foreground(const int background, const struct game *current_game, c break; case 3: - drect(mutation_menu + 31 * (mutation_menu - 1), 0, mutation_menu + 31 * (mutation_menu), 7, C_INVERT); + drect(mutation_menu + 31 * (mutation_menu - 1), 0, mutation_menu + 31 * (mutation_menu) - 1, 7, C_INVERT); dprint(102, 37, C_BLACK, "%d", current_game->dna); @@ -146,14 +146,54 @@ void display_mutation_buy(const struct cursor c, const int mutation_menu, const } -void display_message(const char *msg[5]) +void display_mutation_description(const char *name, const char *description, const int mutation_menu, const int id) { + extern const bopti_image_t img_mutations; + + int decalage = 0; + dclear(C_WHITE); - display_background(7); - for (int i = 0; i < 5; i ++) dprint(54, 6 * i + 4, C_BLACK, msg[i]); + + display_background(8); + dsubimage(3, 21, &img_mutations, 16 * (mutation_menu - 1), 16 * (id - 1), 15, 15, DIMAGE_NONE); + dprint(47, 25, C_BLACK, name); + + for (int i = 0; i < 4; i ++) + { + dtext_opt(25, 33 + i * 7, C_BLACK, C_WHITE, 0 ,0, description + decalage, 16); + + int offset = 0; + while (description[decalage + offset] != '\0') offset += 1; + + if (!offset) break; + else if (offset > 16) decalage += 16; + else decalage += offset; + } dupdate(); } + +void display_message(char *msg) +{ + int decalage = 0; + + dclear(C_WHITE); + display_background(7); + for (int i = 0; i < 5; i ++) + { + dtext_opt(54, 6 * i + 4, C_BLACK, C_WHITE, 0, 0, msg + decalage, 11); + + int offset = 0; + while (msg[decalage + offset] != '\0') offset += 1; + + if (!offset) break; + else if (offset > 11) decalage += 11; + else decalage += offset; + } + dupdate(); +} + + void display_dna_animation(const int frame) { extern bopti_image_t img_dna; diff --git a/src/display_engine.h b/src/display_engine.h index 20290cc..a9c314e 100644 --- a/src/display_engine.h +++ b/src/display_engine.h @@ -15,8 +15,11 @@ void display_mutation(const int table[4][8], const struct cursor c, const int mu // mutation_selected : display the mutation's informations screen void display_mutation_buy(const struct cursor c, const int mutation_menu, const int table[4][8], const int button_selected, const struct game *current_game); +// display_mutation_description : display the description of the selected mutation +void display_mutation_description(const char *name, const char *description, const int mutation_menu, const int id); + // output_error : display text and message background -void display_message(const char *msg[5]); +void display_message(char *msg); // display_dna_animation : display the DNA according to the frame number void display_dna_animation(const int frame); diff --git a/src/epidemic_engine.c b/src/epidemic_engine.c index a2d6417..f10108a 100644 --- a/src/epidemic_engine.c +++ b/src/epidemic_engine.c @@ -41,7 +41,7 @@ void epidemic_simulation(struct game *current_game) uint8_t *current_grid = calloc(current_game->grid.width * current_game->grid.height, sizeof(uint8_t)); init_tab(current_game->grid.width * current_game->grid.height, current_grid, current_game->grid.data); - int healed_rate = ceil(100 * (current_game->research / current_game->limit)); + int healed_rate = ceil((100 * current_game->research / current_game->limit)); // Make the epidemic grid evolove for (int i = 0; i < current_game->grid.width; i ++) diff --git a/src/main.c b/src/main.c index 8adeb4b..e23b835 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ /* Project name ......: Plague - Version ...........: 1.2.1 + Version ...........: 1.3 Last modification .: 4 June 2021 code and assets provided with licence : diff --git a/src/mutation_engine.c b/src/mutation_engine.c index 8403fd7..fd2251b 100644 --- a/src/mutation_engine.c +++ b/src/mutation_engine.c @@ -116,6 +116,11 @@ int mutation_buy(struct game *current_game, const struct cursor c, const int mut if (key == KEY_DOWN || key == KEY_UP) button_selected = (button_selected + 1) % 2; if (key == KEY_ALPHA) return 1; + if (key == KEY_OPTN) + { + display_mutation_description(mutation_data->name, mutation_data->description, mutation_menu, id); + getkey(); + } if (key == KEY_SHIFT) { if (!button_selected) return 0; @@ -137,13 +142,17 @@ int mutation_buy(struct game *current_game, const struct cursor c, const int mut update_disease(current_game); <<<<<<< HEAD current_game->priority += ceil((mutation_data->severity + mutation_data->lethality)/8); +<<<<<<< HEAD ======= current_game->priority += ceil((mutation_data->severity + mutation_data->lethality)/10); >>>>>>> 495d11fabf82a4924f31a1eaf183f97b3cf4fd02 const char *msg[5] = {"mutation", "achetee", "", "", ""}; message(msg); +======= + message("MUTATION ACHETEE"); +>>>>>>> dev } - else {const char *msg[5] = {"achat", "impossible", "", "", ""}; message(msg);} + else message("ACHAT IMPOSSIBLE"); } // if the player has already bought this mutation @@ -151,8 +160,7 @@ int mutation_buy(struct game *current_game, const struct cursor c, const int mut { current_game->mutations_selected[mutation_menu - 1] = id; update_disease(current_game); - const char *msg[5] = {"mutation", "selectionnee", "", "", ""}; - message(msg); + message("MUTATION SELECTIONNEE"); } } diff --git a/src/mutation_engine.h b/src/mutation_engine.h index f41a68b..0a31ef0 100644 --- a/src/mutation_engine.h +++ b/src/mutation_engine.h @@ -21,7 +21,7 @@ struct mutation int contagion, severity, lethality, dna, changement; // Name of the mutation - char *name; + char *name, *description; }; // get_mutation : return the mutation table to display