Compare commits

...

37 Commits

Author SHA1 Message Date
Shadow15510 04f6fe80b4 Improve ergonomy and add in-game short help 2022-01-19 21:48:09 +01:00
Shadow15510 fb5615d018 finish cleaning 2021-06-29 17:08:30 +02:00
Shadow15510 97b0c4dd60 Add executable 2021-06-29 16:49:55 +02:00
Shadow15510 2a3a1267dd Update master 2021-06-29 16:49:03 +02:00
Shadow15510 f27f2d2e01 Finish cleaning 2021-06-29 16:47:45 +02:00
Shadow15510 9c835445bb Clean the folder 2021-06-29 16:46:46 +02:00
Shadow15510 7365e237ec Update exec for CG 2021-06-08 09:39:28 +02:00
Shadow15510 398d7564e0 Little change on symptoms 2021-06-08 09:37:30 +02:00
Shadow15510 c5e377cb39 Change on symptôms 2021-06-08 09:35:16 +02:00
Shadow15510 2e27bc56f8 Little adjustment 2021-06-08 09:07:47 +02:00
Shadow15510 7daca632c7 Merge branch 'dev'
Fix some bugs on transmissions
2021-06-08 09:01:51 +02:00
Shadow15510 2e08e460cd Fix bugs on transmissions 2021-06-08 09:01:36 +02:00
Shadow15510 3dba317593 Merge branch 'dev'
Some changes with game mecanics
2021-06-07 21:27:35 +02:00
Shadow15510 d85daa92de Some adjust with game mecanics 2021-06-07 21:26:52 +02:00
Shadow15510 c2f691d8b7 Merge branch 'dev'
Add the compilation folder for CG
2021-06-06 18:33:42 +02:00
Shadow15510 d3d7a5e44d Add folder and files for CG compilation 2021-06-06 18:30:40 +02:00
Shadow15510 685c162fd4 Update .gitignore 2021-06-06 18:30:04 +02:00
Shadow15510 3369b24a4e Merge branch 'dev'
Others minor change
2021-06-06 18:14:20 +02:00
Shadow15510 9b354884cd change key of quit the description of the mutation 2021-06-06 18:13:54 +02:00
Shadow15510 7c59b327e8 Some changes 2021-06-06 18:07:22 +02:00
Shadow15510 cf70e26dd8 Change cursor blinking and display messages on research 2021-06-06 18:05:30 +02:00
Shadow15510 64bc16a99d Improve reactivity of the cursor on mutation selection menu 2021-06-06 17:15:05 +02:00
Shadow15510 1b76e69808 Add a message when research start, display statistics at the end, display boost mod on the map 2021-06-06 17:03:29 +02:00
Shadow15510 cbcf50295a Version 1.3.4 on master 2021-06-06 16:21:37 +02:00
Shadow15510 6f010578c9 Version 1.3.4 incoming ! 2021-06-06 16:19:42 +02:00
Shadow15510 a319756efb minor change 2021-06-06 10:11:28 +02:00
Shadow15510 df4755733a minor changes 2021-06-06 09:53:20 +02:00
Shadow15510 8933166165 Clean the message menu 2021-06-05 21:38:14 +02:00
Shadow15510 0b06f5f98e Merge branch 'dev'
Update .g1a file
2021-06-05 20:23:39 +02:00
Shadow15510 61423f4470 Update .g1a 2021-06-05 20:23:30 +02:00
Shadow15510 c8317eeb40 Merge branch 'dev'
Add a compatibility code for G35+E II and others minor changes on title screen and main screen
2021-06-05 20:20:27 +02:00
Shadow15510 fd30be4033 Minor change on title screen and add version 2021-06-05 20:20:10 +02:00
Shadow15510 d14acb8ff9 Patch merge conflit on master 2021-06-05 20:18:32 +02:00
Shadow15510 c560c9d17f Fix bugs on save 2021-06-05 20:13:17 +02:00
Shadow15510 591630c6e1 Add compatility code for G35+E II 2021-06-05 18:29:37 +02:00
Shadow15510 6e2fae8649 Animated DNA in main screen 2021-06-05 14:39:48 +02:00
Shadow15510 c13439cd6b Improve the title screen 2021-06-05 13:38:03 +02:00
17 changed files with 127 additions and 138 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
build-fx/*
assets-fx/__pycache__/*
assets-fx/__pycache__/*
*.g1a

View File

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

Binary file not shown.

View File

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

View File

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

View File

@ -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);
}

View File

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

View File

@ -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"},
};

View File

@ -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();
}

View File

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

View File

@ -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;
}
}

View File

@ -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(&current_game);
gint_world_switch(GINT_CALL(read_save, (void *)&current_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(&current_game);
if (to_save) write_save(&current_game);
else delete_save();
if (to_save) gint_world_switch(GINT_CALL(write_save, (void *)&current_game));
else
{
// Display stats at the end of the game
dclear(C_WHITE);
display_background(6);
display_foreground(6, &current_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, &current_game->boost);
@ -167,6 +194,6 @@ int main_loop(struct game *current_game)
}
if (t >= 0) timer_stop(t);
return to_save;
return 1;
}

View File

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

View File

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

View File

@ -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";