Correction of the display of the mutation descriptions

This commit is contained in:
Shadow15510 2021-06-04 22:26:31 +02:00
parent 5e5e17c540
commit 6915a1d5e7
9 changed files with 35 additions and 27 deletions

Binary file not shown.

View File

@ -70,16 +70,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 !");
}
}
}
@ -151,7 +143,7 @@ int callback_tick(volatile int *tick)
}
void message(const char *msg[5])
void message(char *msg)
{
display_message(msg);

View File

@ -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 */

View File

@ -17,7 +17,7 @@ const struct mutation symptoms_data[14] =
{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 "},
{ 0, 30, 30, 30, 20, "ARRET TOTAL", "EMPECHE LES ORGANES DE FONCTIONNER"},
};

View File

@ -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);
@ -160,22 +160,40 @@ void display_mutation_description(const char *name, const char *description, con
for (int i = 0; i < 4; i ++)
{
dtext_opt(25, 33 + i * 7, C_BLACK, C_WHITE, 0 ,0, description + decalage, 16 );
if (description[decalage+1] == '\0') break;
else decalage += 16;
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(const char *msg[5])
void display_message(char *msg)
{
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]);
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;

View File

@ -19,7 +19,7 @@ void display_mutation_buy(const struct cursor c, const int mutation_menu, const
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);

View File

@ -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 ++)

View File

@ -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 :

View File

@ -134,10 +134,9 @@ int mutation_buy(struct game *current_game, const struct cursor c, const int mut
// Update
update_disease(current_game);
current_game->priority += ceil((mutation_data->severity + mutation_data->lethality)/8);
const char *msg[5] = {"mutation", "achetee", "", "", ""};
message(msg);
message("MUTATION ACHETEE");
}
else {const char *msg[5] = {"achat", "impossible", "", "", ""}; message(msg);}
else message("ACHAT IMPOSSIBLE");
}
// if the player has already bought this mutation
@ -145,8 +144,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");
}
}