correct "persisting mushroom" bug

add .gitignore
dev
Milang 3 years ago
parent c97342b263
commit 3d22b719ce
  1. 2
      .gitignore
  2. BIN
      SuperCbr.g1a
  3. BIN
      build-fx/SuperCbr.bin
  4. BIN
      build-fx/SuperCbr.elf
  5. BIN
      build-fx/assets/fonts/mario.png.o
  6. BIN
      build-fx/assets/img/1up.png.o
  7. BIN
      build-fx/assets/img/bloc.png.o
  8. BIN
      build-fx/assets/img/bonus.png.o
  9. BIN
      build-fx/assets/img/brick.png.o
  10. BIN
      build-fx/assets/img/buisson.png.o
  11. BIN
      build-fx/assets/img/bullet.png.o
  12. BIN
      build-fx/assets/img/carapace_rouge.png.o
  13. BIN
      build-fx/assets/img/carapace_verte.png.o
  14. BIN
      build-fx/assets/img/castle.png.o
  15. BIN
      build-fx/assets/img/champi.png.o
  16. BIN
      build-fx/assets/img/coin.png.o
  17. BIN
      build-fx/assets/img/colline.png.o
  18. BIN
      build-fx/assets/img/death.png.o
  19. BIN
      build-fx/assets/img/dev.png.o
  20. BIN
      build-fx/assets/img/error.png.o
  21. BIN
      build-fx/assets/img/flag.png.o
  22. BIN
      build-fx/assets/img/fleur.png.o
  23. BIN
      build-fx/assets/img/fond1.png.o
  24. BIN
      build-fx/assets/img/game_over.png.o
  25. BIN
      build-fx/assets/img/gift.png.o
  26. BIN
      build-fx/assets/img/goomba.png.o
  27. BIN
      build-fx/assets/img/koopa_rouge.png.o
  28. BIN
      build-fx/assets/img/koopa_verte.png.o
  29. BIN
      build-fx/assets/img/level.png.o
  30. BIN
      build-fx/assets/img/levelchanger.png.o
  31. BIN
      build-fx/assets/img/lvl0.png.o
  32. BIN
      build-fx/assets/img/main.png.o
  33. BIN
      build-fx/assets/img/mainmenu.png.o
  34. BIN
      build-fx/assets/img/mario.png.o
  35. BIN
      build-fx/assets/img/mariobig.png.o
  36. BIN
      build-fx/assets/img/mariosmall.png.o
  37. BIN
      build-fx/assets/img/menu_pause.png.o
  38. BIN
      build-fx/assets/img/new_level.png.o
  39. BIN
      build-fx/assets/img/nuage.png.o
  40. BIN
      build-fx/assets/img/options.png.o
  41. BIN
      build-fx/assets/img/plateforme.png.o
  42. BIN
      build-fx/assets/img/ram.png.o
  43. BIN
      build-fx/assets/img/select_arrow.png.o
  44. BIN
      build-fx/assets/img/star.png.o
  45. BIN
      build-fx/assets/img/stone.png.o
  46. BIN
      build-fx/assets/img/stone2.png.o
  47. BIN
      build-fx/assets/img/tickbox.png.o
  48. BIN
      build-fx/assets/img/time_over.png.o
  49. BIN
      build-fx/assets/img/tuyau.png.o
  50. BIN
      build-fx/assets/img/w1.png.o
  51. BIN
      build-fx/assets/img/w2.png.o
  52. BIN
      build-fx/assets/img/w3.png.o
  53. BIN
      build-fx/assets/img/w4.png.o
  54. BIN
      build-fx/assets/img/w5.png.o
  55. 1058
      build-fx/map
  56. 3
      build-fx/src/base.c.d
  57. BIN
      build-fx/src/base.c.o
  58. 26
      build-fx/src/bonus.c.d
  59. BIN
      build-fx/src/bonus.c.o
  60. 17
      build-fx/src/box.c.d
  61. BIN
      build-fx/src/box.c.o
  62. 26
      build-fx/src/bullet.c.d
  63. BIN
      build-fx/src/bullet.c.o
  64. 12
      build-fx/src/camera.c.d
  65. BIN
      build-fx/src/camera.c.o
  66. 5
      build-fx/src/config.c.d
  67. BIN
      build-fx/src/config.c.o
  68. 19
      build-fx/src/ennemi.c.d
  69. BIN
      build-fx/src/ennemi.c.o
  70. 1
      build-fx/src/framerate.c.d
  71. BIN
      build-fx/src/framerate.c.o
  72. 12
      build-fx/src/keyboard.c.d
  73. BIN
      build-fx/src/keyboard.c.o
  74. 21
      build-fx/src/level.c.d
  75. BIN
      build-fx/src/level.c.o
  76. 26
      build-fx/src/levelchanger.c.d
  77. BIN
      build-fx/src/levelchanger.c.o
  78. 17
      build-fx/src/main.c.d
  79. BIN
      build-fx/src/main.c.o
  80. 23
      build-fx/src/mario.c.d
  81. BIN
      build-fx/src/mario.c.o
  82. 17
      build-fx/src/plateforme.c.d
  83. BIN
      build-fx/src/plateforme.c.o
  84. 3
      build-fx/src/save.c.d
  85. BIN
      build-fx/src/save.c.o
  86. 8
      build-fx/src/score.c.d
  87. BIN
      build-fx/src/score.c.o
  88. 10
      build-fx/src/teleporteur.c.d
  89. BIN
      build-fx/src/teleporteur.c.o
  90. 5
      build-fx/src/tile.c.d
  91. BIN
      build-fx/src/tile.c.o
  92. 17
      build-fx/src/tuyau.c.d
  93. BIN
      build-fx/src/tuyau.c.o
  94. 32
      build-fx/src/world.c.d
  95. BIN
      build-fx/src/world.c.o
  96. 23
      include/world.h
  97. 6
      levelconverter/1-2.png.c
  98. 2
      levelconverter/levelconv.py
  99. 2
      src/camera.c
  100. 87
      src/level.c
  101. Some files were not shown because too many files have changed in this diff Show More

2
.gitignore vendored

@ -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.

File diff suppressed because it is too large Load Diff

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

Binary file not shown.

@ -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.

@ -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.

@ -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.

@ -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.

@ -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.

@ -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.

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

Binary file not shown.

@ -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.

@ -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.

@ -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.

@ -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.

@ -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.

@ -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.

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

Binary file not shown.

@ -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.

@ -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.

@ -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.

@ -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.

@ -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.

@ -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

@ -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},

@ -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[]={"

@ -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)

@ -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

Loading…
Cancel
Save