fix an infinite loop bug when a level is not coded yet

This commit is contained in:
Milang 2020-01-25 20:35:34 +01:00
parent ef4d0ffcdf
commit a071d0373e
11 changed files with 502 additions and 482 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
build-fx/src/tuyau.c.o: src/tuyau.c include/tuyau.h include/mario.h \
include/box.h include/keyboard.h
include/box.h include/keyboard.h include/world.h
include/tuyau.h:
@ -8,3 +8,5 @@ include/mario.h:
include/box.h:
include/keyboard.h:
include/world.h:

Binary file not shown.

View File

@ -376,7 +376,8 @@ void set_level(int w, int l)
teleport_t t[]=
{
{57,6, 212,12, MK_LITTLE}
{57,6, 212,12, MK_LITTLE},
{222,2, 178,4, MK_RIGHT}
};
set_teleporteurs(t, sizeof(t)/sizeof(teleport_t));

View File

@ -88,6 +88,17 @@ static void levelchanger(int w)
mario_immunity=0;
for (int i=0; i<7; i+=0)
{
extern image_t img_new_level;
dimage(0,0,&img_new_level);
char lvl[4];
get_lvl_id(w, i, lvl);
dtext(53,28, lvl, C_WHITE, C_BLACK);
sprintf(lvl, "%d", lifes);
dtext(65,54, lvl, C_WHITE, C_BLACK);
dupdate();
sleep_ms(3,2000);
int a=play_level(w, i);
if (a==0)
lifes--;
@ -109,6 +120,17 @@ static void levelchanger(int w)
}
else
{
extern image_t img_new_level;
dimage(0,0,&img_new_level);
char lvl[4];
get_lvl_id(w, choice, lvl);
dtext(53,28, lvl, C_WHITE, C_BLACK);
sprintf(lvl, "%d", lifes);
dtext(65,54, lvl, C_WHITE, C_BLACK);
dupdate();
sleep_ms(3,2000);
while (1)
{
new_game();
@ -234,20 +256,13 @@ int play_level(int w, int l)
//int finish_status=0; // FAil
finish_level=0; mario_dead=0;
set_level(w, l);
if (w_current==0)
return 0;
if (w_current_x*w_current_y==0)
{
timer_stop(0);
return -1;
}
reset_camera();
extern image_t img_new_level;
dimage(0,0,&img_new_level);
char lvl[4];
get_lvl_id(w, l, lvl);
dtext(53,28, lvl, C_WHITE, C_BLACK);
sprintf(lvl, "%d", lifes);
dtext(65,54, lvl, C_WHITE, C_BLACK);
dupdate();
sleep_ms(3,2000);
while(global_quit==0)

View File

@ -1,6 +1,7 @@
#include <tuyau.h>
#include <mario.h>
#include <keyboard.h>
#include <world.h>
#include <gint/std/string.h>
@ -38,6 +39,7 @@ void teleport_active()
}
mario.p.x=t.tx*8; mario.p.y=t.ty*8;
mario.p.vx=0; mario.p.vy=0;
reset_camera();
}
}
}