Add a time boost and some fix on mutations

This commit is contained in:
Shadow15510 2021-06-05 13:15:27 +02:00
parent 47a8f30a45
commit dbfe99632e
9 changed files with 23 additions and 16 deletions

Binary file not shown.

View File

@ -18,6 +18,7 @@ Lancez le jeu, et pressez n'importe quelle touche pour passer l'écran principal
- [OPTN] permet d'afficher / cacher la barre en dessous du monde qui vous affiche vos points ADN et la barre de recherche des humains.
- [VARS] permet de passer au gros du jeu : les mutations. Ce menu vous affiche vos points ADN, mais aussi les mutations sélectionnées ainsi que vos points de contagion, de sévérité, et de létalité. Dans ce menu, vous pouvez modifier tout cela.
- [x^2] permet d'accéder au menu statistique qui vous affiche les stats sur les humains. La barre symbolise le pourcentage de la population totale : donc la somme de toutes les barres doit donner une seule barre entière.
- [→] active (ou désactive) le mode rapide. Ce mode vous permet d'avancer 10 plus vite dans le jeu.
Dans les menus déplacez-vous grâce aux touches fléchées, validez avec [SHIFT] et annulez avec [ALPHA].

View File

@ -51,10 +51,13 @@ int next_frame(struct game *current_game)
}
}
int limit_tick = LIMIT_TICK;
if (current_game->boost) limit_tick = floor(LIMIT_TICK / 10);
current_game->time += ENGINE_TICK;
current_game->total_time += ENGINE_TICK;
if (current_game->time > LIMIT_TICK)
if (current_game->time > limit_tick)
{
// Reset internal clock
current_game->time = 0;
@ -70,7 +73,8 @@ int next_frame(struct game *current_game)
// Check the end of the game
if (!current_game->humans[1])
{
if (current_game->humans[0]) message("VOUS AVEZ PERDU.");
if (current_game->humans[0] || current_game->humans[3] < current_game->humans[2]) message("VOUS AVEZ PERDU.");
else message("VOUS AVEZ GAGNE !");
return 0;
}
@ -79,10 +83,11 @@ int next_frame(struct game *current_game)
}
int get_inputs(const int background, int *mutation_menu)
int get_inputs(const int background, int *mutation_menu, int *boost)
{
int key = rtc_key();
if (key == KEY_ARROW) *boost = (*boost + 1) % 2;
if (key == KEY_OPTN && (background == 1 || background == 2)) return (background % 2) + 1;
if (key == KEY_VARS)
{
@ -98,7 +103,7 @@ int get_inputs(const int background, int *mutation_menu)
if (key == KEY_ALPHA)
{
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;

View File

@ -47,8 +47,8 @@ struct game
// Humans stats : healthy, infected, dead, healed
int humans[4];
// Time
int time, total_time;
// Time and boost (10 times faster)
int time, total_time, boost;
// Planes
struct plane *planes[NB_PLANES + 1];
@ -87,7 +87,7 @@ struct cursor
};
// get_inputs : detect and manage inputs
int get_inputs(const int background, int *mutation_menu);
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);

View File

@ -34,7 +34,7 @@ const struct mutation abilities_data[6] =
const struct mutation transmissions_data[13] =
{
{ 5, 0, 0, 9, 0, "AIR 1", "TRANSMISSION PAR L'AIR"},
{ 5, 0, 0, 5, 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"},
@ -44,7 +44,7 @@ const struct mutation transmissions_data[13] =
{40, 10, 0, 25, 0, "ANIMAL 2", "CAPACITE DE TRANSMISSION HOMME-ANIMAL"},
{20, 0, 0, 15, 0, "OISEAU 1", "LES OISEAUX TRANSMETTENT LE VIRUS"},
{40, 10, 0, 25, 0, "OISEAU 2", "LES OISEAUX TRANSMETTENT LE VIRUS"},
{10, 0, 0, 8, 0, "SANG 1", "LE VIRUS SE TRANSMET PAR LE SANG"},
{10, 0, 0, 10, 0, "SANG 1", "LE VIRUS SE TRANSMET PAR LE SANG"},
{20, 10, 0, 15, 0, "SANG 2", "LE VIRUS SE TRANSMET PAR LE SANG"},
{40, 15, 0, 25, 0, "SANG 3", "LE VIRUS SE TRANSMET PAR LE SANG"},
};

View File

@ -58,7 +58,7 @@ void display_foreground(const int background, const struct game *current_game, c
}
// Status bottom bar
int length = 74 * current_game->research / current_game->limit;
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);

View File

@ -41,8 +41,8 @@ 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 = floor((100 * current_game->research / current_game->limit));
if (!bernoulli(healed_rate)) healed_rate = 0;
int healed_rate = 0;
if (current_game->research == current_game->limit) healed_rate = rand() % 26;
// 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.3.1
Version ...........: 1.3.2
Last modification .: 4 June 2021
code and assets provided with licence :
@ -59,7 +59,7 @@ int main(void)
.priority = 0,
.humans = {0, 1, 0, 0},
.time = 0, .total_time = 0,
.time = 0, .total_time = 0, .boost = 0,
.planes = {&plane_1, &plane_2, &plane_3, &plane_4, &plane_5, NULL},
@ -152,9 +152,10 @@ int main_loop(struct game *current_game)
// Compute the motion of planes, DNA points and infectious model
to_save = next_frame(current_game);
if (!to_save) end = 1;
// Get inputs from the keyboard and manage it
background = get_inputs(background, &mutation_menu);
background = get_inputs(background, &mutation_menu, &current_game->boost);
// Special actions : quit and manage mutations
if (background == -1) end = 1;

View File

@ -5,7 +5,7 @@
#include "display_engine.h"
// Basic limit research
#define RESEARCH_LIMIT 300
#define RESEARCH_LIMIT 250
// mutation_table : contain the map of the mutation available
struct mutation_table