diff --git a/assets-cg/img/appear.png b/assets-cg/img/appear.png index 0f1009b..141365f 100755 Binary files a/assets-cg/img/appear.png and b/assets-cg/img/appear.png differ diff --git a/assets-cg/img/chock.png b/assets-cg/img/chock.png old mode 100755 new mode 100644 index 92df596..6b90057 Binary files a/assets-cg/img/chock.png and b/assets-cg/img/chock.png differ diff --git a/assets-cg/img/chrono1.png b/assets-cg/img/chrono1.png old mode 100755 new mode 100644 index c1d71fe..98e9e5d Binary files a/assets-cg/img/chrono1.png and b/assets-cg/img/chrono1.png differ diff --git a/assets-cg/img/chrono2.png b/assets-cg/img/chrono2.png index a8bb412..210cf03 100755 Binary files a/assets-cg/img/chrono2.png and b/assets-cg/img/chrono2.png differ diff --git a/assets-cg/img/damaged.png b/assets-cg/img/damaged.png old mode 100755 new mode 100644 index 8b57dcc..8f803d9 Binary files a/assets-cg/img/damaged.png and b/assets-cg/img/damaged.png differ diff --git a/assets-cg/img/dead.png b/assets-cg/img/dead.png old mode 100755 new mode 100644 index 266f58c..88020f1 Binary files a/assets-cg/img/dead.png and b/assets-cg/img/dead.png differ diff --git a/assets-cg/img/end.png b/assets-cg/img/end.png old mode 100755 new mode 100644 index d90d315..7ac2b50 Binary files a/assets-cg/img/end.png and b/assets-cg/img/end.png differ diff --git a/assets-cg/img/ice.png b/assets-cg/img/ice.png old mode 100755 new mode 100644 index 3226d53..3f00fb3 Binary files a/assets-cg/img/ice.png and b/assets-cg/img/ice.png differ diff --git a/assets-cg/img/key1.png b/assets-cg/img/key1.png index 026498f..e1f759a 100755 Binary files a/assets-cg/img/key1.png and b/assets-cg/img/key1.png differ diff --git a/assets-cg/img/key2.png b/assets-cg/img/key2.png index d07656e..a10b43e 100755 Binary files a/assets-cg/img/key2.png and b/assets-cg/img/key2.png differ diff --git a/assets-cg/img/medals.png b/assets-cg/img/medals.png old mode 100755 new mode 100644 index 31e15c4..2458aaf Binary files a/assets-cg/img/medals.png and b/assets-cg/img/medals.png differ diff --git a/assets-cg/img/menu.png b/assets-cg/img/menu.png index 2d96b57..a9a4d9b 100755 Binary files a/assets-cg/img/menu.png and b/assets-cg/img/menu.png differ diff --git a/assets-cg/img/player.png b/assets-cg/img/player.png index c54a509..b6db6a8 100755 Binary files a/assets-cg/img/player.png and b/assets-cg/img/player.png differ diff --git a/assets-cg/img/solid.png b/assets-cg/img/solid.png old mode 100755 new mode 100644 index 2d3bd5e..41f9104 Binary files a/assets-cg/img/solid.png and b/assets-cg/img/solid.png differ diff --git a/assets-cg/img/switch.png b/assets-cg/img/switch.png old mode 100755 new mode 100644 index 74d6021..2dc15a6 Binary files a/assets-cg/img/switch.png and b/assets-cg/img/switch.png differ diff --git a/editor/img/appear.png b/editor/img/appear.png old mode 100755 new mode 100644 index 307adfd..f07f060 Binary files a/editor/img/appear.png and b/editor/img/appear.png differ diff --git a/editor/img/appearblock.png b/editor/img/appearblock.png index 4c8dffe..2dd1ba1 100755 Binary files a/editor/img/appearblock.png and b/editor/img/appearblock.png differ diff --git a/editor/img/chock.png b/editor/img/chock.png old mode 100755 new mode 100644 index 92df596..6b90057 Binary files a/editor/img/chock.png and b/editor/img/chock.png differ diff --git a/editor/img/chrono1.png b/editor/img/chrono1.png old mode 100755 new mode 100644 index c1d71fe..98e9e5d Binary files a/editor/img/chrono1.png and b/editor/img/chrono1.png differ diff --git a/editor/img/chrono2.png b/editor/img/chrono2.png old mode 100755 new mode 100644 index 1dd8a84..a56a8d8 Binary files a/editor/img/chrono2.png and b/editor/img/chrono2.png differ diff --git a/editor/img/chrono2appear.png b/editor/img/chrono2appear.png index 44479f5..0fe6ba1 100755 Binary files a/editor/img/chrono2appear.png and b/editor/img/chrono2appear.png differ diff --git a/editor/img/damaged.png b/editor/img/damaged.png old mode 100755 new mode 100644 index 8b57dcc..5fe68c4 Binary files a/editor/img/damaged.png and b/editor/img/damaged.png differ diff --git a/editor/img/dead.png b/editor/img/dead.png old mode 100755 new mode 100644 index 266f58c..88020f1 Binary files a/editor/img/dead.png and b/editor/img/dead.png differ diff --git a/editor/img/end.png b/editor/img/end.png old mode 100755 new mode 100644 index d90d315..7ac2b50 Binary files a/editor/img/end.png and b/editor/img/end.png differ diff --git a/editor/img/ice.png b/editor/img/ice.png old mode 100755 new mode 100644 index 3226d53..3f00fb3 Binary files a/editor/img/ice.png and b/editor/img/ice.png differ diff --git a/editor/img/key1.png b/editor/img/key1.png old mode 100755 new mode 100644 index b05fc8a..1ea0d52 Binary files a/editor/img/key1.png and b/editor/img/key1.png differ diff --git a/editor/img/key2.png b/editor/img/key2.png old mode 100755 new mode 100644 index 05150e2..d686333 Binary files a/editor/img/key2.png and b/editor/img/key2.png differ diff --git a/editor/img/key2block.png b/editor/img/key2block.png index f0b02fd..c5c0292 100755 Binary files a/editor/img/key2block.png and b/editor/img/key2block.png differ diff --git a/editor/img/key2blockvoid.png b/editor/img/key2blockvoid.png index 2045aa5..e12b807 100755 Binary files a/editor/img/key2blockvoid.png and b/editor/img/key2blockvoid.png differ diff --git a/editor/img/keyblock.png b/editor/img/keyblock.png index 61b28d3..67b5add 100755 Binary files a/editor/img/keyblock.png and b/editor/img/keyblock.png differ diff --git a/editor/img/player.png b/editor/img/player.png index c54a509..b6db6a8 100755 Binary files a/editor/img/player.png and b/editor/img/player.png differ diff --git a/editor/img/solid_0.png b/editor/img/solid_0.png old mode 100755 new mode 100644 index 2d3bd5e..41f9104 Binary files a/editor/img/solid_0.png and b/editor/img/solid_0.png differ diff --git a/editor/levels/0.lvl b/editor/levels/0.lvl index bc4b8a0..2f1d850 100755 --- a/editor/levels/0.lvl +++ b/editor/levels/0.lvl @@ -1,4 +1,4 @@ -111111111111111111111111100000000c300000000000100000000000c3000000K0k0l1000111ddd1111aaa111111111h11111ddd1111aaa1ddddd00000110000001110001d000000000110s00001110001d000000000111111001110001d0011d1100110b01001110001d00e000000110S01001110001d000000000110001001110001d011111000100t01000m00001d000000000000001000m00001ddddd00000011111111111111111111111116 +11111111111111111111000111000000000000000000000001100000000000000000000000110e00000b0000l000S000000111111aaaaaaa11111111111111ddd1ddddddd1mmm1000000011ddd111111111mmm1000000011ddd111111111ccc101BB00011ddd1ddddddd1ccc10i00000111111aaaaaaa111110i000001100000000000030010i0000011000000000000300h0i1BBB111s000K00000k0300h0i0000011111111ddd1111111111000116 -9 +13 13 \ No newline at end of file diff --git a/include/save.h b/include/save.h index 4c13d6d..3318ec9 100755 --- a/include/save.h +++ b/include/save.h @@ -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(); diff --git a/src/drawlevel.c b/src/drawlevel.c index 08f63c5..75600c2 100755 --- a/src/drawlevel.c +++ b/src/drawlevel.c @@ -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); diff --git a/src/main.c b/src/main.c index 32795cc..75839bd 100755 --- a/src/main.c +++ b/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; } diff --git a/src/menu.c b/src/menu.c index bbeda08..17a9d0d 100755 --- a/src/menu.c +++ b/src/menu.c @@ -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)) { diff --git a/src/save.c b/src/save.c index 600994e..5b905d0 100755 --- a/src/save.c +++ b/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]; }