Add mutation data

This commit is contained in:
Shadow15510 2021-05-29 16:44:46 +02:00
parent 5279fccb55
commit f93811fdf5
21 changed files with 126 additions and 120 deletions

View File

@ -14,6 +14,7 @@ set(SOURCES
src/core.c
src/display_engine.c
src/mutation_engine.c
src/mutation_data.c
# ...
)
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
@ -36,9 +37,6 @@ set(ASSETS_fx
assets-fx/mutations_table/transmissions_1.txt
assets-fx/mutations_table/transmissions_2.txt
assets-fx/mutations_table/transmissions_3.txt
assets-fx/mutations_data/abilities.txt
assets-fx/mutations_data/symptoms.txt
assets-fx/mutations_data/transmissions.txt
# ...
)
set(ASSETS_cg

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -5,7 +5,7 @@ def convert(input_name, output, params, target):
if params["custom-type"] == "mutation-table":
convert_mt(input_name, output, params, target)
return 0
elif params["custom-type"] == "mutation-data":
elif params["custom-type"] == "mutation":
convert_md(input_name, output, params, target)
return 0
else:
@ -26,15 +26,3 @@ def convert_mt(input_name, output, params, target):
fxconv.elf(data, output, "_" + params["name"], **target)
def convert_md(input_name, output, params, target):
with open(input_name, "r") as file:
# Extract informations
lines = file.read().splitlines()
# Convert data into bytes-like object
data = bytes()
for i in lines:
data += bytes(i, encoding="utf-8")
fxconv.elf(data, output, "_" + params["name"], **target)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,14 +0,0 @@
FROID,4,0,0,10,0
CHAUD,7,0,0,15,0
GENETIQUE,0,5,4,25,
MUTATION+,0,8,8,30,2
ENVIRON,10,0,0,30,0
MEDICAMENT,0,2,2,15,1
NONE
NONE
NONE
NONE
NONE
NONE
NONE
NONE

View File

@ -1,3 +0,0 @@
*.txt:
custom-type: mutation-data
name_regex: (.*)\.txt md_\1

View File

@ -1,14 +0,0 @@
NAUSEE,1,1,0,2,0.5,
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| 0 | 14 | 5 | 0 | 0
0 | 0 | 0 | 14 | 0 | 0 | 0 | 11
9 | 14 | 0 | 0 | 0 | 0 | 0 | 14
0 | 0 | 0 | 7 | 14 | 0 | 0 | 14
1 | 15 | 15 | 0 | 15 | 5 | 0 | 0
0 | 0 | 0 | 15 | 0 | 0 | 0 | 11
9 | 15 | 0 | 0 | 0 | 0 | 0 | 15
0 | 0 | 0 | 7 | 15 | 0 | 0 | 15

View File

@ -1,4 +1,4 @@
1 | 2 | 14 | 0 | 6 | 5 | 0 | 0
0 | 0 | 0 | 14 | 0 | 0 | 0 | 11
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 | 14
0 | 0 | 0 | 7 | 8 | 0 | 0 | 15

View File

@ -58,7 +58,7 @@ int get_inputs(const int background, int *mutation_menu)
{
if (background == 5) return 3;
if (background != 1 && background != 2) return 1;
if (background == 1) return -1;
if (background == 1 || background == 2) return -1;
}
if (background == 3)
@ -134,8 +134,6 @@ void manage_mutation(struct game *current_game, const int mutation_menu)
// Get and display the mutation menu
int table[4][8];
get_mutation(current_game, mutation_menu, table);
char data[14];
get_mutation_data(mutation_menu, data);
display_mutation(table, c, mutation_menu);
// Get the key
@ -143,7 +141,11 @@ void manage_mutation(struct game *current_game, const int mutation_menu)
// Manage input
if (key == KEY_EXIT) end = 1;
// if (key == KEY_EXE) mutation_selected(c, mutation_menu, get_mutation_data(current_game, mutation_menu));
if (key == KEY_EXE && table[c.y][c.x] != 15 && table[c.y][c.x] != 0)
{
mutation_selected(c, mutation_menu, table);
getkey();
}
if (key == KEY_LEFT && c.x > 0) c.x--;
if (key == KEY_RIGHT && c.x < 7) c.x++;

View File

@ -3,7 +3,7 @@
// Duration for internal clock
#define ENGINE_TICK 50
#define CURSOR_TICK 200
#define CURSOR_TICK 100
// Number of planes on screen
#define NB_PLANES 5
@ -79,5 +79,4 @@ int callback_tick(volatile int *tick);
// manage_mutation : an independant sub-programm which allow to select, buy and see the mutations.
void manage_mutation(struct game *current_game, const int mutation_menu);
#endif /* _PLAGUE_CORE_H */

View File

@ -98,3 +98,47 @@ void display_mutation(const int table[4][8], const struct cursor c, const int mu
}
void mutation_selected(const struct cursor c, const int mutation_menu, const int table[4][8])
{
extern const bopti_image_t img_mutations;
const int id = table[c.y][c.x];
extern struct mutation symptoms_data[14];
extern struct mutation abilities_data[6];
extern struct mutation transmissions_data[13];
struct mutation *mutation_data;
switch (mutation_menu)
{
case 1:
mutation_data = &symptoms_data[id - 1];
break;
case 2:
mutation_data = &abilities_data[id - 1];
break;
case 3:
mutation_data = &transmissions_data[id - 1];
break;
}
dclear(C_WHITE);
display_background(4);
dsubimage(3, 21, &img_mutations, 16 * (mutation_menu - 1), 16 * (id - 1), 15, 15, DIMAGE_NONE);
dprint(47, 25, C_BLACK, mutation_data->name);
dprint(81, 33, C_BLACK, "%d", mutation_data->dna);
dprint(81, 41, C_BLACK, "%d", mutation_data->contagion);
dprint(81, 49, C_BLACK, "%d", mutation_data->lethality);
dprint(81, 57, C_BLACK, "%d", mutation_data->severity);
dupdate();
}

View File

@ -12,4 +12,7 @@ void display_foreground(const int background, const struct game *current_game);
// display_mutation : display the mutation selection screen
void display_mutation(const int table[4][8], const struct cursor c, const int mutation_menu);
// mutation_selected : display the mutation shop
void mutation_selected(const struct cursor c, const int mutation_menu, const int table[4][8]);
#endif /* _PLAGUE_DISPLAY_ENGINE_H */

View File

@ -30,13 +30,14 @@ int main(void)
title_screen();
// Game statistics
struct plane plane_1 = {22, 20, 2, 84, 20, 22, 20};
struct plane plane_2 = {34, 20, 3, 34, 44, 34, 20};
struct plane plane_3 = {68, 44, 1, 68, 20, 68, 44};
struct plane plane_4 = {104, 20, 3, 104, 50, 104, 20};
struct plane plane_5 = {68, 44, 4, 34, 44, 68, 44};
GUNUSED struct game current_game =
struct game current_game =
{
.contagion = 0,
.severity = 0,

46
src/mutation_data.c Normal file
View File

@ -0,0 +1,46 @@
#include "mutation_engine.h"
const struct mutation abilities_data[6] =
{
{4, 0, 0, 10, 0, "FROID"},
{7, 0, 0, 15, 0, "CHAUD"},
{0, 5, 4, 25, 0, "GENETIQUE"},
{0, 8, 8, 30, 2, "MUTATION+"},
{10, 0, 0, 30, 0, "ENVIRON"},
{0, 2, 2, 15, 1, "MEDICAMENT"},
};
const struct mutation symptoms_data[14] =
{
{1, 1, 0, 2, 0.5, "NAUSEE"},
{3, 2, 0, 4, 0.5, "VOMISSEMENT"},
{2, 1, 0, 3, 0.5, "TOUX"},
{2, 2, 0, 4, 0.5, "PNEUMONIE"},
{4, 2, 5, 15, 1, "TUMEUR"},
{2, 1, 0, 3, 0.5, "PLAIES"},
{5, 4, 0, 10, 0.5, "LESIONS"},
{5, 15, 15, 20, 0.5, "HEMORRAGIE"},
{6, 7, 6, 17, 0.5, "INFECTION"},
{2, 2, 2, 5, 0.5, "INFLAMMATION"},
{2, 6, 4, 12, 1, "IMMUNODEFICIENCE"},
{0, 4, 0, 5, 1, "PARANOIA"},
{6, 15, 0, 20, 2, "FOLIE"},
{0, 20, 25, 30, 2, "ARRET TOTAL"},
};
const struct mutation transmissions_data[13] =
{
{ 2, 0, 0, 9, 0, "AIR 1"},
{ 5, 0, 0, 15, 0, "AIR 2"},
{ 8, 0, 0, 20, 0, "AIR 3"},
{10, 0, 0, 30, 0, "AEROSOL"},
{ 2, 0, 0, 9, 0, "EAU 1"},
{ 4, 0, 0, 12, 0, "EAU 2"},
{ 2, 0, 0, 10, 0, "ANIMAL 1"},
{ 6, 0, 0, 16, 0, "ANIMAL 2"},
{ 3, 0, 0, 12, 0, "OISEAU 1"},
{ 6, 0, 0, 16, 0, "OISEAU 2"},
{ 1, 0, 0, 8, 0, "SANG 1"},
{ 4, 0, 0, 14, 0, "SANG 2"},
{ 9, 0, 0, 20, 0, "SANG 3"},
};

View File

@ -40,29 +40,6 @@ void get_mutation(const struct game *current_game, const int mutation_menu, int
}
void get_mutation_data(const int mutation_menu, char data[14])
{
extern struct mutation_data md_abilities;
extern struct mutation_data md_symptoms;
extern struct mutation_data md_transmissions;
switch (mutation_menu)
{
case 1:
char_init_mat(14, data, md_symptoms.data);
break;
case 2:
char_init_mat(14, data, md_abilities.data);
break;
case 3:
char_init_mat(14, data, md_transmissions.data);
break;
}
}
void init_mat(int x, int y, int dest[][x], int src[][x])
{
for (int i = 0; i < x; i++)
@ -74,11 +51,4 @@ void init_mat(int x, int y, int dest[][x], int src[][x])
}
}
void char_init_mat(int x, char dest[x], char src[x])
{
for (int i = 0; i < x; i++)
{
dest[i] = src[i];
}
}

View File

@ -10,19 +10,19 @@ struct mutation_table
int data[4][8];
};
// mutation_data : contain the mutations data
struct mutation_data
// mutation : data about a mutation
struct mutation
{
// Data of the mutations
char data[14];
// Data of the mutation : contagion, lethality, severity, DNA cost
int contagion, severity, lethality, dna, changement;
// Name of the mutation
char *name;
};
// get_mutation : return the mutation table to display
void get_mutation(const struct game *current_game, const int mutation_menu, int table[4][8]);
// get_mutation_data : return the mutation_data
void get_mutation_data(const int mutation_menu, char data[14]);
// init_mat : copy src into dest (for int)
void init_mat(int x, int y, int dest[][x], int src[][x]);