Save when close and Massena's textures by default
- new tutorial
Before Width: | Height: | Size: 940 B After Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 610 B After Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 883 B After Width: | Height: | Size: 349 B |
Before Width: | Height: | Size: 616 B After Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 554 B After Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 812 B After Width: | Height: | Size: 349 B |
Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 520 B After Width: | Height: | Size: 444 B |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 675 B After Width: | Height: | Size: 644 B |
Before Width: | Height: | Size: 461 B After Width: | Height: | Size: 99 B |
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 279 B |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 610 B After Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 348 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 616 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 554 B After Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 582 B After Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 590 B After Width: | Height: | Size: 219 B |
Before Width: | Height: | Size: 675 B After Width: | Height: | Size: 644 B |
Before Width: | Height: | Size: 461 B After Width: | Height: | Size: 99 B |
|
@ -1,4 +1,4 @@
|
|||
111111111111111111111111100000000c300000000000100000000000c3000000K0k0l1000111ddd1111aaa111111111h11111ddd1111aaa1ddddd00000110000001110001d000000000110s00001110001d000000000111111001110001d0011d1100110b01001110001d00e000000110S01001110001d000000000110001001110001d011111000100t01000m00001d000000000000001000m00001ddddd00000011111111111111111111111116
|
||||
11111111111111111111000111000000000000000000000001100000000000000000000000110e00000b0000l000S000000111111aaaaaaa11111111111111ddd1ddddddd1mmm1000000011ddd111111111mmm1000000011ddd111111111ccc101BB00011ddd1ddddddd1ccc10i00000111111aaaaaaa111110i000001100000000000030010i0000011000000000000300h0i1BBB111s000K00000k0300h0i0000011111111ddd1111111111000116
|
||||
|
||||
9
|
||||
13
|
||||
13
|
|
@ -1,6 +1,5 @@
|
|||
void savefile(void);
|
||||
int loadtime(int idlevel);
|
||||
void loadfile(void);
|
||||
void restore(void);
|
||||
void savetimes(float framelevel, int id_level);
|
||||
|
||||
void savetime(float framelevel, int id_level);
|
||||
void reset_times();
|
||||
|
|
|
@ -133,7 +133,6 @@ void draw_end(int framelevel, int id_level, char record)
|
|||
dimage(144,60,&img_endscreen);
|
||||
if(record!=2)
|
||||
{
|
||||
dprint_opt(220, 115, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "%d", framelevel);
|
||||
dprint(166, 87, C_RED, "%.2j",(int)(framefloat/FPS*100));
|
||||
check_medal(framelevel, id_level, 178, 140);
|
||||
if(record==1) dimage(60,100,&img_new);
|
||||
|
|
54
src/main.c
|
@ -21,6 +21,8 @@
|
|||
int main(void);
|
||||
void end(unsigned int frame);
|
||||
|
||||
char run = 0;
|
||||
|
||||
int callback(volatile int *frame_elapsed)
|
||||
{
|
||||
*frame_elapsed = 1;
|
||||
|
@ -48,7 +50,8 @@ void game(int *id_level, char mode, char *type)
|
|||
int coin = 0;
|
||||
char check_coin = 0;
|
||||
char double_check = 1;
|
||||
|
||||
char chock = 0;
|
||||
|
||||
int appear = 10;
|
||||
int disappear = 13;
|
||||
|
||||
|
@ -71,19 +74,24 @@ void game(int *id_level, char mode, char *type)
|
|||
if(!(frame%2))
|
||||
{
|
||||
draw_level(level);
|
||||
if(blackout) draw_blackout(player_x, player_y);
|
||||
if(blackout)
|
||||
draw_blackout(player_x, player_y);
|
||||
|
||||
if(blackout && *id_level == 0) {
|
||||
dtext(20, 20, C_WHITE, "You have touched the blackout item");
|
||||
dtext(20, 40, C_WHITE, "it makes you partially blind");
|
||||
dtext(20, 60, C_WHITE, "until your death :p");
|
||||
}
|
||||
if(chock > 0 && *id_level == 0) {
|
||||
dtext(20, 165, C_BLACK, "You have touched the chock");
|
||||
dtext(20, 180, C_BLACK, "item. It rotates your screen");
|
||||
dtext(20, 195, C_BLACK, "horizontally and vertically");
|
||||
}
|
||||
|
||||
draw_player(player_x, player_y, *type);
|
||||
if(!mode) draw_timer(frame);
|
||||
else draw_timer(framelevel);
|
||||
|
||||
if(*id_level==0 && !mode)
|
||||
{
|
||||
dprint(85,180,C_RGB(245,245,0),"SHIFT");
|
||||
dprint(120,3,C_RGB(220,220,220),"Keys has effects on blocks");
|
||||
dprint(15,67,C_RGB(220,220,220),"Red blocks = death");
|
||||
dprint(30,211,C_RGB(220,220,220),"^ special blocks");
|
||||
dprint(290,131,C_RGB(110,110,110),"Well done !");
|
||||
}
|
||||
if(!mode) dprint_opt(330, 0, C_RGB(255,190,0), C_BLACK, DTEXT_LEFT, DTEXT_TOP, "Coin : %d", coin);
|
||||
dupdate();
|
||||
}
|
||||
|
@ -280,6 +288,7 @@ void game(int *id_level, char mode, char *type)
|
|||
}
|
||||
if(!gravity) gravity=1;
|
||||
else gravity=0;
|
||||
chock++;
|
||||
}
|
||||
|
||||
if(collide(player_x, player_y+(int)vspd+2, level, 'B') && vspd>=5) //Damaged block
|
||||
|
@ -391,13 +400,18 @@ void game(int *id_level, char mode, char *type)
|
|||
//when a level is quit
|
||||
if(mode)
|
||||
{
|
||||
if(*id_level==0) *id_level=1;
|
||||
if(*id_level==0) {
|
||||
game_loop = 0;
|
||||
draw_end(framelevel, *id_level, 0);
|
||||
sleep_ms(2500);
|
||||
*id_level = 1;
|
||||
}
|
||||
if(game_loop) //end of a level with level selection
|
||||
{
|
||||
float framefloat = framelevel;
|
||||
draw_end(framelevel, *id_level, 0);
|
||||
savetimes(framefloat, *id_level);
|
||||
sleep_ms(3000);
|
||||
savetime(framefloat, *id_level);
|
||||
sleep_ms(2500);
|
||||
}
|
||||
if(!speed_menu(id_level))
|
||||
{
|
||||
|
@ -419,6 +433,10 @@ void end(unsigned int frame)
|
|||
|
||||
int main(void)
|
||||
{
|
||||
if(!run) {
|
||||
gint_switch(restore);
|
||||
run = 1;
|
||||
}
|
||||
char mode = 0;
|
||||
char type = 1;
|
||||
char valeur = start_menu(&type);
|
||||
|
@ -432,19 +450,19 @@ int main(void)
|
|||
}
|
||||
else main();
|
||||
}
|
||||
else if(valeur==1)
|
||||
else if(valeur==1) //all mode
|
||||
{
|
||||
int id_level = 1;
|
||||
mode = 0;
|
||||
game(&id_level, mode, &type);
|
||||
}
|
||||
else if(valeur==2)
|
||||
else if(valeur==2) // tutorial
|
||||
{
|
||||
int id_level = 0;
|
||||
mode = 1;
|
||||
game(&id_level, mode, &type);
|
||||
}
|
||||
gint_setrestart(1);
|
||||
gint_osmenu();
|
||||
main();
|
||||
else if(valeur == 3) //exit
|
||||
gint_switch(savefile);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ char start_menu(char *type)
|
|||
char buffer = 1;
|
||||
char buffer2 = 1;
|
||||
int Y_POS = 85;
|
||||
gint_switch(restore);
|
||||
while(menu_loop)
|
||||
{
|
||||
clearevents();
|
||||
|
@ -31,7 +30,7 @@ char start_menu(char *type)
|
|||
else if (selection == -1) selection = 3;
|
||||
dtext(32, Y_POS, C_BLACK, "PLAY");
|
||||
dtext(32, Y_POS + 12, C_BLACK, "ALL MODE");
|
||||
dtext(32, Y_POS + 24, C_BLACK, "TUTORIAL");
|
||||
dtext(32, Y_POS + 24, C_BLACK, "TEST LEVEL");
|
||||
dtext(32, Y_POS + 36, C_BLACK, "EXIT GAME");
|
||||
dtext(16, Y_POS + (selection * 12), C_BLACK, ">");
|
||||
dupdate();
|
||||
|
@ -40,7 +39,7 @@ char start_menu(char *type)
|
|||
}
|
||||
else buffer2 = 0;
|
||||
if(keydown_any(KEY_EXIT, KEY_MENU, 0)) {
|
||||
if(!buffer) return -1;
|
||||
if(!buffer) return 3;
|
||||
}
|
||||
else buffer = 0;
|
||||
if(keydown_all(KEY_5,KEY_6)) *type = 3;
|
||||
|
@ -80,7 +79,6 @@ char speed_menu(int *id_level)
|
|||
dprint(80,20,C_BLACK,"Level : %d",*id_level);
|
||||
if(sto != 0) dprint(194,60,C_RED, "%.2j", sto);
|
||||
else dprint(202,60,C_RED, "/");
|
||||
if(*id_level == 14) dprint_opt(180, 8, C_RGB(0,255,255), C_BLACK, DTEXT_LEFT, DTEXT_TOP, "VVVVVV");
|
||||
dupdate();
|
||||
if (keydown_any(KEY_SHIFT, KEY_EXE, 0))
|
||||
{
|
||||
|
|
31
src/save.c
|
@ -6,7 +6,6 @@
|
|||
|
||||
int retcode;
|
||||
|
||||
int id_leveltab = 0;
|
||||
int times[LEVEL_MAX];
|
||||
static const uint16_t *filepath = u"\\\\fls0\\AST3.sav";
|
||||
|
||||
|
@ -22,30 +21,16 @@ void savefile(void)
|
|||
BFile_Close(descriptor);
|
||||
}
|
||||
|
||||
/* loadfile() is only called by the function loadtime() because
|
||||
* loadtime() set the value of "id_leveltab". It store in the global retcode
|
||||
* the time of the player. This function is called once per level in the
|
||||
* level selection menu to avoid loading time. */
|
||||
void loadfile(void)
|
||||
{
|
||||
int descriptor;
|
||||
descriptor = BFile_Open(filepath, BFile_ReadOnly);
|
||||
BFile_Read(descriptor, &retcode,
|
||||
sizeof(times[0]), sizeof(times[0]) * id_leveltab);
|
||||
BFile_Close(descriptor);
|
||||
}
|
||||
|
||||
/* savetimes() is call when the player has reached the end of a level.
|
||||
* If his time is better than the save time, it will call the function
|
||||
* savefile() else, nothing append to avoid loading time. */
|
||||
void savetimes(float framelevel, int id_level)
|
||||
/* savetime() is call when the player has reached the end of a level.
|
||||
* If his time is better than the save time, it will save it in the array
|
||||
*/
|
||||
void savetime(float framelevel, int id_level)
|
||||
{
|
||||
if(times[id_level - 1] > (int)(framelevel / FPS * 100) ||
|
||||
times[id_level - 1] == 0 || keydown(KEY_7))
|
||||
{
|
||||
times[id_level - 1] = (int)(framelevel / FPS * 100);
|
||||
draw_end((int)framelevel, id_level, 1);
|
||||
gint_switch(savefile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,13 +55,7 @@ void restore(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* loadtime() is changing the current value of the global "id_leveltab" to
|
||||
* set it to the current level then it execute loadfile and read and
|
||||
* stock in the global retcode 4 bytes at the place 4*level (times are in
|
||||
* 4 bytes) */
|
||||
int loadtime(int idlevel)
|
||||
{
|
||||
id_leveltab = idlevel;
|
||||
gint_switch(loadfile);
|
||||
return (int)retcode;
|
||||
return times[idlevel];
|
||||
}
|
||||
|
|