Compare commits
37 Commits
Author | SHA1 | Date |
---|---|---|
Shadow15510 | 04f6fe80b4 | |
Shadow15510 | fb5615d018 | |
Shadow15510 | 97b0c4dd60 | |
Shadow15510 | 2a3a1267dd | |
Shadow15510 | f27f2d2e01 | |
Shadow15510 | 9c835445bb | |
Shadow15510 | 7365e237ec | |
Shadow15510 | 398d7564e0 | |
Shadow15510 | c5e377cb39 | |
Shadow15510 | 2e27bc56f8 | |
Shadow15510 | 7daca632c7 | |
Shadow15510 | 2e08e460cd | |
Shadow15510 | 3dba317593 | |
Shadow15510 | d85daa92de | |
Shadow15510 | c2f691d8b7 | |
Shadow15510 | d3d7a5e44d | |
Shadow15510 | 685c162fd4 | |
Shadow15510 | 3369b24a4e | |
Shadow15510 | 9b354884cd | |
Shadow15510 | 7c59b327e8 | |
Shadow15510 | cf70e26dd8 | |
Shadow15510 | 64bc16a99d | |
Shadow15510 | 1b76e69808 | |
Shadow15510 | cbcf50295a | |
Shadow15510 | 6f010578c9 | |
Shadow15510 | a319756efb | |
Shadow15510 | df4755733a | |
Shadow15510 | 8933166165 | |
Shadow15510 | 0b06f5f98e | |
Shadow15510 | 61423f4470 | |
Shadow15510 | c8317eeb40 | |
Shadow15510 | fd30be4033 | |
Shadow15510 | d14acb8ff9 | |
Shadow15510 | c560c9d17f | |
Shadow15510 | 591630c6e1 | |
Shadow15510 | 6e2fae8649 | |
Shadow15510 | c13439cd6b |
|
@ -1,2 +1,3 @@
|
|||
build-fx/*
|
||||
assets-fx/__pycache__/*
|
||||
assets-fx/__pycache__/*
|
||||
*.g1a
|
|
@ -17,11 +17,11 @@ set(SOURCES
|
|||
src/data.c
|
||||
src/epidemic_engine.c
|
||||
src/save.c
|
||||
# ...
|
||||
)
|
||||
|
||||
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
|
||||
set(ASSETS
|
||||
# ...
|
||||
|
||||
)
|
||||
set(ASSETS_fx
|
||||
assets-fx/plague.png
|
||||
|
@ -42,16 +42,15 @@ set(ASSETS_fx
|
|||
assets-fx/mutations_table/transmissions_1.txt
|
||||
assets-fx/mutations_table/transmissions_2.txt
|
||||
assets-fx/mutations_table/transmissions_3.txt
|
||||
# ...
|
||||
)
|
||||
set(ASSETS_cg
|
||||
assets-cg/example.png
|
||||
# ...
|
||||
|
||||
)
|
||||
|
||||
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
|
||||
fxconv_declare_converters(assets-fx/converters.py)
|
||||
|
||||
|
||||
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
|
||||
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os)
|
||||
target_link_libraries(myaddin Gint::Gint)
|
||||
|
@ -60,6 +59,6 @@ if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
|||
generate_g1a(TARGET myaddin OUTPUT "Plague.g1a"
|
||||
NAME "Plague" ICON assets-fx/icon.png)
|
||||
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
||||
generate_g3a(TARGET myaddin OUTPUT "MyAddin.g3a"
|
||||
NAME "MyAddin" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
|
||||
generate_g3a(TARGET myaddin OUTPUT "Plague.g3a"
|
||||
NAME "Plague" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
|
||||
endif()
|
||||
|
|
BIN
Plague.g1a
BIN
Plague.g1a
Binary file not shown.
|
@ -20,11 +20,13 @@ Lancez le jeu, et pressez n'importe quelle touche pour passer l'écran principal
|
|||
- [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].
|
||||
Dans les menus déplacez-vous grâce aux touches fléchées, validez avec [SHIFT] et annulez avec [ALPHA]. Pour quitter les messages pop-up, pressez [ALPHA].
|
||||
|
||||
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.
|
||||
Dans les menus de sélection des mutations, pressez [OPTN] pour avoir une courte description de la mutation sélectionnée. Pressez ensuite [ALPHA] pour revenir sur les données de bases.
|
||||
|
||||
Dans l'écran principal du jeu, le petit plus en haut à gauche vous indique que le mode rapide est activé.
|
||||
|
||||
## Mutations
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 15 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 808 B |
|
@ -1,4 +1,4 @@
|
|||
1 | 2 | 15 | 0 | 6 | 5 | 0 | 0
|
||||
0 | 0 | 0 | 15 | 0 | 0 | 0 | 11
|
||||
9 | 10 | 0 | 0 | 0 | 0 | 0 | 12
|
||||
0 | 0 | 0 | 7 | 8 | 0 | 0 | 15
|
||||
1 | 2 | 15 | 0 | 15 | 5 | 0 | 0
|
||||
0 | 0 | 0 | 15 | 0 | 0 | 0 | 11
|
||||
9 | 10 | 0 | 0 | 0 | 0 | 0 | 12
|
||||
0 | 0 | 0 | 7 | 8 | 0 | 0 | 15
|
51
src/core.c
51
src/core.c
|
@ -9,7 +9,7 @@
|
|||
#include "display_engine.h"
|
||||
|
||||
|
||||
int next_frame(struct game *current_game)
|
||||
int next_frame(struct game *current_game, int *dna_animation, int *vaccine)
|
||||
{
|
||||
for (int i = 0; current_game->planes[i]; i++)
|
||||
{
|
||||
|
@ -48,42 +48,41 @@ int next_frame(struct game *current_game)
|
|||
|
||||
// Infect the plane
|
||||
if (current_game->grid.data[current_game->planes[i]->x + current_game->planes[i]->y * current_game->grid.width] == 1 && current_game->mutations_selected[2] == 4) current_game->planes[i]->is_infected = 1;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
|
||||
>>>>>>> 495d11fabf82a4924f31a1eaf183f97b3cf4fd02
|
||||
}
|
||||
}
|
||||
|
||||
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 % 150)) *dna_animation = (*dna_animation + 1) % 16;
|
||||
|
||||
if (current_game->time > limit_tick)
|
||||
{
|
||||
// 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;
|
||||
<<<<<<< HEAD
|
||||
|
||||
current_game->research += current_game->priority;
|
||||
if (current_game->research > current_game->limit) current_game->research = current_game->limit;
|
||||
|
||||
=======
|
||||
if (current_game->research < current_game->limit) current_game->research += current_game->priority;
|
||||
>>>>>>> 495d11fabf82a4924f31a1eaf183f97b3cf4fd02
|
||||
|
||||
epidemic_simulation(current_game);
|
||||
|
||||
// Check the end of the game
|
||||
if (!current_game->humans[1])
|
||||
{
|
||||
|
||||
if (current_game->humans[0] || current_game->humans[3] < current_game->humans[2]) message("VOUS AVEZ PERDU.");
|
||||
if (current_game->humans[3] < 4 * (current_game->humans[0] + current_game->humans[2])) message("VOUS AVEZ PERDU.");
|
||||
else message("VOUS AVEZ GAGNE !");
|
||||
return 0;
|
||||
}
|
||||
|
@ -109,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)
|
||||
{
|
||||
|
@ -165,25 +164,9 @@ int callback_tick(volatile int *tick)
|
|||
|
||||
void message(char *msg)
|
||||
{
|
||||
int opt = GETKEY_DEFAULT & ~GETKEY_MOD_SHIFT & ~GETKEY_MOD_ALPHA & ~GETKEY_REP_ARROWS;
|
||||
key_event_t ev = {0};
|
||||
|
||||
display_message(msg);
|
||||
|
||||
int key = 0, frame = 1;
|
||||
|
||||
static volatile int tick = 1;
|
||||
int t = timer_configure(TIMER_ANY, DNA_ANIMATION_TICK*1000, GINT_CALL(callback_tick, &tick));
|
||||
if (t >= 0) timer_start(t);
|
||||
|
||||
while (!key)
|
||||
{
|
||||
while(!tick) sleep();
|
||||
tick = 0;
|
||||
|
||||
key = rtc_key();
|
||||
display_dna_animation(frame);
|
||||
|
||||
frame = (frame + 1) % 24;
|
||||
if (!frame) frame = 24;
|
||||
}
|
||||
|
||||
if (t >= 0) timer_stop(t);
|
||||
while (ev.key != KEY_ALPHA && ev.key != KEY_EXIT) ev = getkey_opt(opt, NULL);
|
||||
}
|
||||
|
|
|
@ -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 next_frame(struct game *current_game, int *dna_animation, int *vaccine);
|
||||
|
||||
// rtc_key : get the key with RTC system
|
||||
int rtc_key(void);
|
||||
|
|
30
src/data.c
30
src/data.c
|
@ -4,20 +4,20 @@
|
|||
// (contation, severity, lethality, DNA cost, change to cure requirement)
|
||||
const struct mutation symptoms_data[14] =
|
||||
{
|
||||
{10, 10, 0, 2, 0, "NAUSEE", "DONNE DES NAUSEES"},
|
||||
{10, 0, 0, 2, 0, "NAUSEE", "DONNE DES NAUSEES"},
|
||||
{15, 10, 0, 10, 0, "VOMISSEMENT", "PROVOQUE DES REJETS GASTRIQUES"},
|
||||
{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"},
|
||||
{10, 0, 0, 3, 0, "TOUX", "LA PROJECTION DE PARTICULE AUGMENTE LA CONTAGION"},
|
||||
{15, 10, 5, 10, 0, "PNEUMONIE", "AFFECTION PULMONAIRE PEU MORTELLE"},
|
||||
{ 0, 20, 20, 15, 10, "TUMEUR", "PEU CONTAGIEUX, MAIS MORTEL"},
|
||||
{15, 0, 5, 4, 0, "PLAIES", "LA PEAU S'ASSECHE ET DEVIENT CASSANTE"},
|
||||
{10, 5, 10, 10, 0, "LESIONS", "BLOQUE LA CICATRISATION"},
|
||||
{30, 10, 20, 20, 5, "HEMORRAGIE", "BLOQUE L'ACTION DES PLAQUETTES"},
|
||||
{25, 10, 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"},
|
||||
{ 0, 10, 30, 30, 20, "ARRET TOTAL", "EMPECHE LES ORGANES DE FONCTIONNER"},
|
||||
};
|
||||
|
||||
|
||||
|
@ -26,26 +26,26 @@ const struct mutation abilities_data[6] =
|
|||
{15, 0, 0, 10, 0, "FROID", "RESISTANCE AU FROID"},
|
||||
{15, 0, 0, 15, 0, "CHAUD", "RESISTANCE AU CHAUD"},
|
||||
{ 0, 10, 0, 25, 10, "GENETIQUE", "LE GENOME MUTE, RALENTISSANT LE SEQUENCAGE ADN"},
|
||||
{10, 10, 20, 30, 30, "MUTATION+", "LE VIRUS MUTE, BLOQUANT LES CHERCHEURS"},
|
||||
{10, 10, 10, 30, 30, "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"},
|
||||
{ 0, 15, 30, 15, 20, "MEDICAMENT", "RESISTANCE AU MEDICAMENTS"},
|
||||
};
|
||||
|
||||
|
||||
const struct mutation transmissions_data[13] =
|
||||
{
|
||||
{ 5, 0, 0, 5, 0, "AIR 1", "TRANSMISSION PAR L'AIR"},
|
||||
{10, 10, 0, 15, 0, "AIR 2", "TRANSMISSION PAR L'AIR"},
|
||||
{10, 0, 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, 15, 0, "EAU 1", "TRANSMISSION PAR L'EAU"},
|
||||
{20, 10, 0, 20, 0, "EAU 2", "TRANSMISSION PAR L'EAU"},
|
||||
{20, 0, 5, 12, 0, "ANIMAL 1", "LE VIRUS PEUT PASSER DE L'ANIMAL À L'HOMME"},
|
||||
{20, 0, 5, 12, 0, "ANIMAL 1", "LE VIRUS PEUT PASSER DE L'ANIMAL A L'HOMME"},
|
||||
{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, 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"},
|
||||
{10, 0, 0, 10, 0, "SANG 1", "LE VIRUS SE TRANSMET PAR LE SANG"},
|
||||
{20, 5, 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"},
|
||||
};
|
||||
|
||||
|
|
|
@ -12,10 +12,11 @@ void display_background(const int background)
|
|||
}
|
||||
|
||||
|
||||
void display_foreground(const int background, const struct game *current_game, const int mutation_menu)
|
||||
void display_foreground(const int background, const struct game *current_game, const int mutation_menu, const int dna_animation)
|
||||
{
|
||||
extern const bopti_image_t img_mutations;
|
||||
extern const bopti_image_t img_planes;
|
||||
extern const bopti_image_t img_dna;
|
||||
extern const uint8_t world[64][128];
|
||||
|
||||
GUNUSED int length;
|
||||
|
@ -38,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:
|
||||
|
@ -57,12 +61,19 @@ void display_foreground(const int background, const struct game *current_game, c
|
|||
if (current_game->planes[i]->y + 8 < 57) 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);
|
||||
}
|
||||
|
||||
// Animated DNA
|
||||
dsubimage(1, 51, &img_dna, dna_animation * 8, 0, 7, 12, DIMAGE_NONE);
|
||||
|
||||
// Status bottom bar
|
||||
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);
|
||||
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:
|
||||
|
@ -194,12 +205,3 @@ void display_message(char *msg)
|
|||
}
|
||||
|
||||
|
||||
void display_dna_animation(const int frame)
|
||||
{
|
||||
extern bopti_image_t img_dna;
|
||||
|
||||
dsubimage(114, 29, &img_dna, 11 * (frame - 1), 0, 11, 32, DIMAGE_NONE);
|
||||
dupdate();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
void display_background(const int background);
|
||||
|
||||
// display_foreground : display the foreground, planes, statistics
|
||||
void display_foreground(const int background, const struct game *current_game, const int mutation_menu);
|
||||
void display_foreground(const int background, const struct game *current_game, const int mutation_menu, const int dna_animation);
|
||||
|
||||
// display_mutation : display the mutation selection screen
|
||||
void display_mutation(const int table[4][8], const struct cursor c, const int mutation_menu);
|
||||
|
@ -21,7 +21,4 @@ void display_mutation_description(const char *name, const char *description, con
|
|||
// output_error : display text and message background
|
||||
void display_message(char *msg);
|
||||
|
||||
// display_dna_animation : display the DNA according to the frame number
|
||||
void display_dna_animation(const int frame);
|
||||
|
||||
#endif /* _PLAGUE_DISPLAY_ENGINE_H */
|
|
@ -42,7 +42,7 @@ void epidemic_simulation(struct game *current_game)
|
|||
init_tab(current_game->grid.width * current_game->grid.height, current_grid, current_game->grid.data);
|
||||
|
||||
int healed_rate = 0;
|
||||
if (current_game->research == current_game->limit) healed_rate = rand() % 26;
|
||||
if (current_game->research == current_game->limit) healed_rate = rand() % 6;
|
||||
|
||||
// Make the epidemic grid evolove
|
||||
for (int i = 0; i < current_game->grid.width; i ++)
|
||||
|
@ -97,6 +97,12 @@ void epidemic_simulation(struct game *current_game)
|
|||
}
|
||||
init_tab(current_game->grid.width * current_game->grid.height, current_game->grid.data, current_grid);
|
||||
free(current_grid);
|
||||
|
||||
for (int i = 0; i < 4; i ++)
|
||||
{
|
||||
if (current_game->humans[i] < 0) current_game->humans[i] = 0;
|
||||
else if (current_game->humans[i] > (current_game->grid.width * current_game->grid.height) - BLANK_CASES) current_game->humans[i] = (current_game->grid.width * current_game->grid.height) - BLANK_CASES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
69
src/main.c
69
src/main.c
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Project name ......: Plague
|
||||
Version ...........: 1.3.2
|
||||
Last modification .: 4 June 2021
|
||||
Version ...........: 1.3.10
|
||||
Last modification .: 19 January 2022
|
||||
|
||||
code and assets provided with licence :
|
||||
GNU General Public Licence v3.0
|
||||
|
@ -13,12 +13,15 @@
|
|||
#include <gint/clock.h>
|
||||
#include <gint/defs/types.h>
|
||||
#include <gint/std/stdlib.h>
|
||||
#include <gint/gint.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "display_engine.h"
|
||||
#include "mutation_engine.h"
|
||||
#include "save.h"
|
||||
|
||||
const char *VERSION = "1.3.10";
|
||||
|
||||
// title_screen : display the title screen
|
||||
static void title_screen(void);
|
||||
|
||||
|
@ -72,12 +75,42 @@ int main(void)
|
|||
current_game.grid.data[95 + 20 * current_game.grid.width] = 1;
|
||||
current_game.humans[0] = (current_game.grid.width * current_game.grid.height) - 1 - BLANK_CASES;
|
||||
|
||||
read_save(¤t_game);
|
||||
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) write_save(¤t_game);
|
||||
else delete_save();
|
||||
if (to_save) gint_world_switch(GINT_CALL(write_save, (void *)¤t_game));
|
||||
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);
|
||||
|
@ -95,9 +128,11 @@ static void title_screen(void)
|
|||
dupdate();
|
||||
sleep_ms(250);
|
||||
|
||||
dsubimage(0, 0, &img_title, 0, 0, 128, 64, DIMAGE_NONE);
|
||||
dsubimage(0, 0, &img_title, 0, 0, 128, 64, DIMAGE_NONE);
|
||||
dprint_opt(32, 29, C_WHITE, C_BLACK, 0, 0, "VERSION %s", VERSION, -1);
|
||||
dupdate();
|
||||
sleep_ms(500);
|
||||
sleep_ms(1000);
|
||||
|
||||
|
||||
for (int frame = 0; frame < 5; frame ++)
|
||||
{
|
||||
|
@ -111,15 +146,7 @@ static void title_screen(void)
|
|||
dclear(C_BLACK);
|
||||
dsubimage(0, 0, &img_title, 0, 65, 128, 64, DIMAGE_NONE);
|
||||
dupdate();
|
||||
sleep_ms(500);
|
||||
|
||||
for (int i = 0; i < 5; i ++)
|
||||
{
|
||||
dclear(C_BLACK);
|
||||
dsubimage(0, 0, &img_title, 0, ((i % 2) + 1) * 65, 128, 64, DIMAGE_NONE);
|
||||
dupdate();
|
||||
sleep_ms(250);
|
||||
}
|
||||
sleep_ms(750);
|
||||
|
||||
dclear(C_BLACK);
|
||||
dsubimage(0, 0, &img_title, 0, 130, 128, 64, DIMAGE_NONE);
|
||||
|
@ -132,7 +159,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;
|
||||
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));
|
||||
|
@ -147,12 +174,12 @@ int main_loop(struct game *current_game)
|
|||
// Update the screen
|
||||
dclear(C_WHITE);
|
||||
display_background(background);
|
||||
display_foreground(background, current_game, mutation_menu);
|
||||
display_foreground(background, current_game, mutation_menu, dna_animation);
|
||||
dupdate();
|
||||
|
||||
// Compute the motion of planes, DNA points and infectious model
|
||||
to_save = next_frame(current_game);
|
||||
if (!to_save) end = 1;
|
||||
to_save = next_frame(current_game, &dna_animation, &vaccine);
|
||||
if (!to_save) return 0;
|
||||
|
||||
// Get inputs from the keyboard and manage it
|
||||
background = get_inputs(background, &mutation_menu, ¤t_game->boost);
|
||||
|
@ -167,6 +194,6 @@ int main_loop(struct game *current_game)
|
|||
}
|
||||
|
||||
if (t >= 0) timer_stop(t);
|
||||
return to_save;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ void get_mutation(const struct game *current_game, const int mutation_menu, int
|
|||
if (mutation_menu == 3)
|
||||
{
|
||||
if (current_game->mutations_count[2] < 5) init_mat(8, 4, table, mt_transmissions_1.data);
|
||||
else if (current_game->mutations_count[2] < 10) init_mat(8, 4, table, mt_transmissions_2.data);
|
||||
else if (current_game->mutations_count[2] < 9 ) init_mat(8, 4, table, mt_transmissions_2.data);
|
||||
else init_mat(8, 4, table, mt_transmissions_3.data);
|
||||
}
|
||||
}
|
||||
|
@ -72,15 +72,16 @@ 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;
|
||||
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);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (key == KEY_LEFT) c.x = c.x - 1;
|
||||
if (key == KEY_RIGHT) c.x = (c.x + 1) % 8;
|
||||
if (key == KEY_UP) c.y = c.y - 1;
|
||||
|
@ -88,13 +89,8 @@ void mutation_select(struct game *current_game, const int mutation_menu)
|
|||
|
||||
if (c.x < 0) c.x = 7;
|
||||
if (c.y < 0) c.y = 3;
|
||||
=======
|
||||
if (key == KEY_LEFT && c.x > 0) c.x = (c.x - 1) % 8;
|
||||
if (key == KEY_RIGHT && c.x < 7) c.x = (c.x + 1) % 8;
|
||||
if (key == KEY_UP && c.y > 0) c.y = (c.y - 1) % 4;
|
||||
if (key == KEY_DOWN && c.y < 3) c.y = (c.y + 1) % 4;
|
||||
>>>>>>> 495d11fabf82a4924f31a1eaf183f97b3cf4fd02
|
||||
}
|
||||
|
||||
if (t >= 0) timer_stop(t);
|
||||
}
|
||||
|
||||
|
@ -119,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);
|
||||
getkey();
|
||||
while (ev.key != KEY_ALPHA && ev.key != KEY_EXIT) ev = getkey_opt(opt, NULL);
|
||||
}
|
||||
if (key == KEY_SHIFT)
|
||||
{
|
||||
|
@ -140,21 +136,9 @@ int mutation_buy(struct game *current_game, const struct cursor c, const int mut
|
|||
|
||||
// Update
|
||||
update_disease(current_game);
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< 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);
|
||||
=======
|
||||
=======
|
||||
current_game->priority += ceil((mutation_data->severity + mutation_data->lethality) / 10);
|
||||
>>>>>>> dev
|
||||
current_game->limit += mutation_data->changement;
|
||||
message("MUTATION ACHETEE");
|
||||
>>>>>>> dev
|
||||
}
|
||||
else message("ACHAT IMPOSSIBLE");
|
||||
}
|
||||
|
@ -186,13 +170,7 @@ void update_disease(struct game *current_game)
|
|||
current_game->severity = symptom->severity + ability->severity + transmission->severity;
|
||||
current_game->lethality = symptom->lethality + ability->lethality + transmission->lethality;
|
||||
|
||||
// research parameter
|
||||
current_game->limit = RESEARCH_LIMIT + symptom->changement + ability->changement + transmission->changement;
|
||||
<<<<<<< HEAD
|
||||
if (current_game->research > current_game->limit) current_game->research = current_game->limit;
|
||||
|
||||
=======
|
||||
>>>>>>> 495d11fabf82a4924f31a1eaf183f97b3cf4fd02
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "display_engine.h"
|
||||
|
||||
// Basic limit research
|
||||
#define RESEARCH_LIMIT 250
|
||||
#define RESEARCH_LIMIT 200
|
||||
|
||||
// mutation_table : contain the map of the mutation available
|
||||
struct mutation_table
|
||||
|
|
|
@ -4,12 +4,6 @@
|
|||
|
||||
#include "save.h"
|
||||
|
||||
/* BUG
|
||||
Démarrer le jeu, quitter, revenir sur le jeu, quitter -> la calto plante
|
||||
=> Premier démarrage du jeu : ok (valeur par défaut bien initialisée)
|
||||
=> Quand on revient sur le jeu, pas de problème : tout est sauvé correctement (sauvé correctement et chargé correctement)
|
||||
=> On quitte : bug
|
||||
*/
|
||||
|
||||
// Name of the savefile
|
||||
static const uint16_t *filename = u"\\\\fls0\\Plague.sav";
|
||||
|
|
Loading…
Reference in New Issue