correct "persisting mushroom" bug

add .gitignore
This commit is contained in:
Milang 2020-01-30 21:09:18 +01:00
parent c97342b263
commit 3d22b719ce
103 changed files with 81 additions and 1440 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
build-fx/*
build-cg/*

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
build-fx/src/base.c.o: src/base.c include/base.h
include/base.h:

Binary file not shown.

View File

@ -1,26 +0,0 @@
build-fx/src/bonus.c.o: src/bonus.c include/bonus.h include/box.h \
include/mario.h include/box.h include/world.h include/tile.h \
include/score.h include/ennemi.h include/constants.h include/base.h \
include/camera.h
include/bonus.h:
include/box.h:
include/mario.h:
include/box.h:
include/world.h:
include/tile.h:
include/score.h:
include/ennemi.h:
include/constants.h:
include/base.h:
include/camera.h:

Binary file not shown.

View File

@ -1,17 +0,0 @@
build-fx/src/box.c.o: src/box.c include/box.h include/world.h \
include/ennemi.h include/box.h include/score.h include/constants.h \
include/base.h
include/box.h:
include/world.h:
include/ennemi.h:
include/box.h:
include/score.h:
include/constants.h:
include/base.h:

Binary file not shown.

View File

@ -1,26 +0,0 @@
build-fx/src/bullet.c.o: src/bullet.c include/bullets.h include/bonus.h \
include/box.h include/constants.h include/mario.h include/box.h \
include/tile.h include/camera.h include/base.h include/ennemi.h \
include/score.h
include/bullets.h:
include/bonus.h:
include/box.h:
include/constants.h:
include/mario.h:
include/box.h:
include/tile.h:
include/camera.h:
include/base.h:
include/ennemi.h:
include/score.h:

Binary file not shown.

View File

@ -1,12 +0,0 @@
build-fx/src/camera.c.o: src/camera.c include/camera.h include/mario.h \
include/box.h include/world.h include/base.h
include/camera.h:
include/mario.h:
include/box.h:
include/world.h:
include/base.h:

Binary file not shown.

View File

@ -1,5 +0,0 @@
build-fx/src/config.c.o: src/config.c include/config.h include/keyboard.h
include/config.h:
include/keyboard.h:

Binary file not shown.

View File

@ -1,19 +0,0 @@
build-fx/src/ennemi.c.o: src/ennemi.c include/ennemi.h include/box.h \
include/mario.h include/box.h include/tile.h include/world.h \
include/score.h include/camera.h
include/ennemi.h:
include/box.h:
include/mario.h:
include/box.h:
include/tile.h:
include/world.h:
include/score.h:
include/camera.h:

Binary file not shown.

View File

@ -1 +0,0 @@
build-fx/src/framerate.c.o: src/framerate.c

Binary file not shown.

View File

@ -1,12 +0,0 @@
build-fx/src/keyboard.c.o: src/keyboard.c include/keyboard.h \
include/mario.h include/box.h include/score.h include/config.h
include/keyboard.h:
include/mario.h:
include/box.h:
include/score.h:
include/config.h:

Binary file not shown.

View File

@ -1,21 +0,0 @@
build-fx/src/level.c.o: src/level.c include/level.h include/world.h \
include/mario.h include/box.h include/score.h include/ennemi.h \
include/keyboard.h include/plateforme.h include/tuyau.h
include/level.h:
include/world.h:
include/mario.h:
include/box.h:
include/score.h:
include/ennemi.h:
include/keyboard.h:
include/plateforme.h:
include/tuyau.h:

Binary file not shown.

View File

@ -1,26 +0,0 @@
build-fx/src/levelchanger.c.o: src/levelchanger.c include/levelchanger.h \
include/keyboard.h include/mario.h include/box.h include/world.h \
include/score.h include/level.h include/save.h include/config.h \
include/framerate.h include/camera.h
include/levelchanger.h:
include/keyboard.h:
include/mario.h:
include/box.h:
include/world.h:
include/score.h:
include/level.h:
include/save.h:
include/config.h:
include/framerate.h:
include/camera.h:

Binary file not shown.

View File

@ -1,17 +0,0 @@
build-fx/src/main.c.o: src/main.c include/levelchanger.h include/world.h \
include/mario.h include/box.h include/level.h include/score.h \
include/ennemi.h
include/levelchanger.h:
include/world.h:
include/mario.h:
include/box.h:
include/level.h:
include/score.h:
include/ennemi.h:

Binary file not shown.

View File

@ -1,23 +0,0 @@
build-fx/src/mario.c.o: src/mario.c include/mario.h include/box.h \
include/tile.h include/world.h include/keyboard.h include/box.h \
include/score.h include/bonus.h include/bullets.h include/camera.h
include/mario.h:
include/box.h:
include/tile.h:
include/world.h:
include/keyboard.h:
include/box.h:
include/score.h:
include/bonus.h:
include/bullets.h:
include/camera.h:

Binary file not shown.

View File

@ -1,17 +0,0 @@
build-fx/src/plateforme.c.o: src/plateforme.c include/plateforme.h \
include/world.h include/mario.h include/box.h include/tile.h \
include/score.h include/camera.h
include/plateforme.h:
include/world.h:
include/mario.h:
include/box.h:
include/tile.h:
include/score.h:
include/camera.h:

Binary file not shown.

View File

@ -1,3 +0,0 @@
build-fx/src/save.c.o: src/save.c include/save.h
include/save.h:

Binary file not shown.

View File

@ -1,8 +0,0 @@
build-fx/src/score.c.o: src/score.c include/score.h include/mario.h \
include/box.h
include/score.h:
include/mario.h:
include/box.h:

Binary file not shown.

View File

@ -1,10 +0,0 @@
build-fx/src/teleporteur.c.o: src/teleporteur.c src/teleporteur.h \
src/mario.h src/box.h src/keyboard.h
src/teleporteur.h:
src/mario.h:
src/box.h:
src/keyboard.h:

Binary file not shown.

View File

@ -1,5 +0,0 @@
build-fx/src/tile.c.o: src/tile.c include/tile.h include/constants.h
include/tile.h:
include/constants.h:

Binary file not shown.

View File

@ -1,17 +0,0 @@
build-fx/src/tuyau.c.o: src/tuyau.c include/tuyau.h include/mario.h \
include/box.h include/keyboard.h include/world.h include/framerate.h \
include/camera.h
include/tuyau.h:
include/mario.h:
include/box.h:
include/keyboard.h:
include/world.h:
include/framerate.h:
include/camera.h:

Binary file not shown.

View File

@ -1,32 +0,0 @@
build-fx/src/world.c.o: src/world.c include/world.h include/tile.h \
include/mario.h include/box.h include/ennemi.h include/bonus.h \
include/box.h include/constants.h include/plateforme.h include/tuyau.h \
include/bullets.h include/keyboard.h include/base.h include/camera.h
include/world.h:
include/tile.h:
include/mario.h:
include/box.h:
include/ennemi.h:
include/bonus.h:
include/box.h:
include/constants.h:
include/plateforme.h:
include/tuyau.h:
include/bullets.h:
include/keyboard.h:
include/base.h:
include/camera.h:

Binary file not shown.

View File

@ -95,15 +95,15 @@ typedef struct
{
unsigned type :8;
unsigned data :24; // raw binary format
} world_t;
} cell_t;
int world_get_width();
world_t* world_get(int x, int y);
cell_t* world_get(int x, int y);
void display_cell(int cx, int cy, int sx, int sy, int plan);
void world_set(world_t * w);
void world_set(cell_t * w);
void world_draw();
void world_move();
@ -121,11 +121,16 @@ int world_get_ctg(int x, int y);
void reset_camera();
extern world_t * w_current;
extern image_t * w_fond;
extern int w_current_x;
extern int w_current_y;
extern int w_mario_startx;
extern int w_mario_starty;
typedef struct
{
int w;
int h;
int start_x;
int start_y;
cell_t data[];
}map_t;
extern map_t * map_current;
#endif

View File

@ -1,7 +1,7 @@
// !b Here the generated section begins (see the end at "!e")
w_current_x = 232;
w_current_y = 13;
world_t lvl[]=
map_current->w = 232;
map_current->h = 13;
cell_t lvl[]=
{
{EARTH,0x11}, {EARTH,0x10}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{EARTH,0x11}, {EARTH,0x10}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},

View File

@ -30,7 +30,7 @@ filename = input("File name ?\n> ")
img = Image.open(filename)
print("Converting", filename, "to", "\"" + filename + ".c\",", "size =", img.size)
code = "// !b Here the generated section begins (see the end at \"!e\")\nw_current_x = " + str(img.size[0]) + ";\nw_current_y = " + str(img.size[1]) + ";\nworld_t lvl[]=\n{"
code = "// !b Here the generated section begins (see the end at \"!e\")\nmap_current->w = " + str(img.size[0]) + ";\nmap_current->h = " + str(img.size[1]) + ";\ncell_t lvl[]=\n{"
nombre_ennemis=0
ennemis = "\nennemi_t ennemies0[]={"

View File

@ -5,7 +5,7 @@
static int y=0;
int camera_x() {return min(max(mario.p.x-40,0),w_current_x*8-128);}
int camera_x() {return min(max(mario.p.x-40,0),map_current->w*8-128);}
int camera_y() {return max(y-24,0);}
void camera_move(int delay)

View File

@ -21,26 +21,35 @@ void malloc_error()
dimage(0,0,&img_ram);
dupdate();
while (1)
getkey();
mkb_getkey();
}
void init_level(world_t * lvl)
// width height startx starty array
static void init_level(int w, int h, int x, int y, cell_t const * a)
{
mario.p.vx=0;
mario.p.vy=0;
if (w_current)
{
free(w_current);
}
if (0==w_current_y*w_current_y)
// Resets mario's vx
mario.p.vx=0; mario.p.vy=0;
// Free the previous map
if (map_current)
free(map_current);
// If the new map size is null => invalid map, return
if (0==w*h)
return;
int size=sizeof(world_t)*w_current_y*w_current_x;
w_current=malloc(size);
if (w_current==0)
// Calculates the new struct size
int size= 4*sizeof(int) + sizeof(cell_t)*w*h;
map_current=(map_t*)malloc(size);
if (map_current==0)
malloc_error();
memcpy(w_current, lvl, size);
// Copy the map to ram
map_current->w = w;
map_current->h = h;
mario.p.x = map_current->start_x = x;
mario.p.y = map_current->start_y = y;
memcpy(map_current->data, a, sizeof(cell_t)*w*h);
}
void init_ennemies(ennemi_t * table)
@ -105,16 +114,18 @@ void set_level(int w, int l)
{
new_level();
set_teleporteurs(0,0);
w_current_x=0;
w_current_y=0;
if (map_current)
{ free(map_current);
map_current=0;
}
ennemis_global_size=0;
plateforme_table_size=0;
if (w+1==1 && l+1==1) // 1-1
{
w_current_x=226;
w_current_y=13;
world_t lvl[]=
const int w=226, h=13;
const int x=25, y=16;
cell_t a[]=
{
{EARTH,0x01}, {EARTH,0x00}, {COLLINE,0x01}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{EARTH,0x11}, {EARTH,0x10}, {COLLINE,0x11}, {COLLINE,0x01}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
@ -343,7 +354,7 @@ void set_level(int w, int l)
{EARTH,0x11}, {EARTH,0x10}, {TUYAU,0x11}, {TUYAU,0x10}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{EARTH,0x11}, {EARTH,0x10}, {TUYAU,0x03}, {TUYAU,0x03}, {TUYAU,0x03}, {TUYAU,0x03}, {TUYAU,0x03}, {TUYAU,0x03}, {TUYAU,0x03}, {TUYAU,0x03}, {TUYAU,0x03}, {TUYAU,0x03}, {TUYAU,0x03}
};
init_level(lvl);
init_level(w,h,x,y,a);
ennemis_global_size=10;
ennemi_t ennemies0[]=
@ -362,12 +373,6 @@ void set_level(int w, int l)
};
init_ennemies(ennemies0);
mario_x_max=0;
mario.p.x=25;
mario.p.y=16;
teleport_t t[]=
{
@ -382,9 +387,9 @@ void set_level(int w, int l)
else if (w+1==1 && l+1==2)
{
// !b Here the generated section begins (see the end at "!e")
w_current_x = 232;
w_current_y = 13;
world_t lvl[]=
const int w=226, h=13;
const int x=25, y=16;
cell_t a[]=
{
{EARTH,0x11}, {EARTH,0x10}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{EARTH,0x11}, {EARTH,0x10}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
@ -619,7 +624,7 @@ void set_level(int w, int l)
{EARTH,0x10}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{EARTH,0x10}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
};
init_level(lvl);
init_level(w,h,x,y, a);
ennemi_t ennemies0[]={
GOOMBA(264, 16, -1),
@ -643,9 +648,7 @@ void set_level(int w, int l)
// !e End of generated section
mario_x_max=0;
mario.p.x=25;
mario.p.y=16;
teleport_t t[]=
{
@ -664,14 +667,14 @@ void set_level(int w, int l)
init_plateformes(plateforme0);
}
/*
else if (w+1==1 && l+1==3)
{
// !b Here the generated section begins (see the end at "!e")
w_current_x = 279;
w_current_y = 14;
world_t lvl[]=
const int w=279, h=14;
const int x=25, y=32;
cell_t a[]=
{
{EARTH,0x11}, {EARTH,0x21}, {EARTH,0x21}, {EARTH,0x21}, {EARTH,0x21}, {EARTH,0x21}, {EARTH,0x21}, {EARTH,0x21}, {EARTH,0x21}, {EARTH,0x21}, {EARTH,0x21}, {EARTH,0x21}, {EARTH,0x21}, {EARTH,0x20},
{EARTH,0x10}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {TUYAU,0x04}, {TUYAU,0x03}, {TUYAU,0x03},
@ -981,12 +984,6 @@ void set_level(int w, int l)
// !e End of generated section
mario_x_max=0;
mario.p.x=25;
mario.p.y=32;
teleport_t t[]=
{
{106,4, 222,9, MK_DOWN},
@ -996,7 +993,7 @@ void set_level(int w, int l)
set_teleporteurs(t, sizeof(t)/sizeof(teleport_t));
}
}*/
}
void get_lvl_id(int w, int l, char * str)

Some files were not shown because too many files have changed in this diff Show More