Change title screen
This commit is contained in:
parent
03016fb61c
commit
53b74b377d
|
@ -32,8 +32,6 @@ set(ASSETS_cg
|
|||
assets-cg/mutations.png
|
||||
assets-cg/cursor.png
|
||||
assets-cg/title.png
|
||||
assets-cg/dna.png
|
||||
assets-cg/explosion.png
|
||||
assets-cg/mutations_table/abilities_1.txt
|
||||
assets-cg/mutations_table/abilities_2.txt
|
||||
assets-cg/mutations_table/abilities_3.txt
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 808 B |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 45 KiB |
|
@ -9,7 +9,7 @@
|
|||
#include "display_engine.h"
|
||||
|
||||
|
||||
int next_frame(struct game *current_game, int *dna_animation, int *vaccine)
|
||||
int next_frame(struct game *current_game, int *vaccine)
|
||||
{
|
||||
for (int i = 0; current_game->planes[i]; i++)
|
||||
{
|
||||
|
@ -58,8 +58,6 @@ int next_frame(struct game *current_game, int *dna_animation, int *vaccine)
|
|||
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
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
// Duration for internal clock (ms)
|
||||
#define ENGINE_TICK 50
|
||||
#define CURSOR_TICK 110
|
||||
#define DNA_ANIMATION_TICK 150
|
||||
|
||||
// Duration for DNA points and infectious model (ms)
|
||||
#define LIMIT_TICK 10000
|
||||
|
@ -90,7 +89,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 *dna_animation, int *vaccine);
|
||||
int next_frame(struct game *current_game, int *vaccine);
|
||||
|
||||
// rtc_key : get the key with RTC system
|
||||
int rtc_key(void);
|
||||
|
|
|
@ -40,11 +40,10 @@ void display_background(const int background)
|
|||
}
|
||||
|
||||
|
||||
void display_foreground(const int background, const struct game *current_game, const int mutation_menu, const int dna_animation)
|
||||
void display_foreground(const int background, const struct game *current_game, const int mutation_menu)
|
||||
{
|
||||
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[184][396];
|
||||
|
||||
GUNUSED int length;
|
||||
|
@ -68,9 +67,6 @@ void display_foreground(const int background, const struct game *current_game, c
|
|||
if (current_game->planes[i]->y + 8 < 184) 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);
|
||||
|
||||
// Research bar
|
||||
int length = 73 * current_game->research / current_game->limit;
|
||||
dprint(30, 200, C_WHITE, "%d", current_game->dna);
|
||||
|
@ -89,7 +85,7 @@ void display_foreground(const int background, const struct game *current_game, c
|
|||
*/
|
||||
|
||||
// Display if boost is activated
|
||||
if (current_game->boost) dprint(0, 0, C_BLACK, "+");
|
||||
if (current_game->boost) dprint(0, 0, C_WHITE, "+");
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -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, const int dna_animation);
|
||||
void display_foreground(const int background, const struct game *current_game, const int mutation_menu);
|
||||
|
||||
// display_mutation : display the mutation selection screen
|
||||
void display_mutation(const int table[4][8], const struct cursor c, const int mutation_menu);
|
||||
|
|
34
src/main.c
34
src/main.c
|
@ -86,7 +86,7 @@ int main(void)
|
|||
// Display stats at the end of the game
|
||||
dclear(C_WHITE);
|
||||
display_background(6);
|
||||
display_foreground(6, ¤t_game, 0, 0);
|
||||
display_foreground(6, ¤t_game, 0);
|
||||
dupdate();
|
||||
sleep_ms(250);
|
||||
|
||||
|
@ -106,35 +106,13 @@ int main(void)
|
|||
static void title_screen(void)
|
||||
{
|
||||
extern bopti_image_t img_title;
|
||||
extern bopti_image_t img_explosion;
|
||||
|
||||
dclear(C_BLACK);
|
||||
|
||||
dsubimage(0, 0, &img_title, 0, 0, DWIDTH, DHEIGHT, DIMAGE_NONE);
|
||||
dprint_opt(32, 120, C_WHITE, C_NONE, 0, 0, "VERSION %s", VERSION, -1);
|
||||
dimage(0, 0, &img_title);
|
||||
dprint_opt(5, 200, C_WHITE, C_NONE, 0, 0, "VERSION %s", VERSION, -1);
|
||||
dupdate();
|
||||
sleep_ms(1000);
|
||||
|
||||
|
||||
for (int frame = 0; frame < 5; frame ++)
|
||||
{
|
||||
dsubimage(0, 0, &img_title, 0, 0, DWIDTH, DHEIGHT, DIMAGE_NONE);
|
||||
dsubimage(225, 70, &img_explosion, 123 * frame, 0, 120, 120, DIMAGE_NONE);
|
||||
dupdate();
|
||||
sleep_ms(80);
|
||||
}
|
||||
|
||||
sleep_ms(120);
|
||||
for (int times = 0; times < 3; times ++)
|
||||
{
|
||||
dsubimage(0, 0, &img_title, 0, DHEIGHT, DWIDTH, DHEIGHT, DIMAGE_NONE);
|
||||
dupdate();
|
||||
sleep_ms(200);
|
||||
dsubimage(0, 0, &img_title, 0, DHEIGHT*2, DWIDTH, DHEIGHT, DIMAGE_NONE);
|
||||
dupdate();
|
||||
sleep_ms(200);
|
||||
}
|
||||
|
||||
getkey();
|
||||
}
|
||||
|
||||
|
@ -142,7 +120,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, dna_animation = 0, vaccine = 0;
|
||||
int end = 0, to_save = 1, vaccine = 0;
|
||||
|
||||
static volatile int tick = 1;
|
||||
int t = timer_configure(TIMER_ANY, ENGINE_TICK*1000, GINT_CALL(callback_tick, &tick));
|
||||
|
@ -157,11 +135,11 @@ int main_loop(struct game *current_game)
|
|||
// Update the screen
|
||||
dclear(C_WHITE);
|
||||
display_background(background);
|
||||
display_foreground(background, current_game, mutation_menu, dna_animation);
|
||||
display_foreground(background, current_game, mutation_menu);
|
||||
dupdate();
|
||||
|
||||
// Compute the motion of planes, DNA points and infectious model
|
||||
to_save = next_frame(current_game, &dna_animation, &vaccine);
|
||||
to_save = next_frame(current_game, &vaccine);
|
||||
if (!to_save) return 0;
|
||||
|
||||
// Get inputs from the keyboard and manage it
|
||||
|
|
Loading…
Reference in New Issue