#include "level.h" #include "world.h" #include "mario.h" #include "score.h" #include "ennemi.h" #include "keyboard.h" #include #include #include #include #include #include #include #include #include #include #define PACKED_EMPTY 0 #define PACKED_STONE 1 #define PACKED_COIN 2 #define PACKED_BRICK 3 #define PACKED_BRICK_COIN 4 #define PACKED_BOX_COIN 5 #define PACKED_BOX_CHAMPI 6 #define PACKED_BETON 7 #define PACKED_TUYAU_BOUT 8 #define PACKED_TUYAU_MIDDLE 9 #define PACKED_FLAG 10 #define PACKED_GOOMBA 11 #define PACKED_KOOPA_VERT 12 #define PACKED_KOOPA_ROUGE 13 #define PACKED_MARIO_START 14 #define PACKED_NUAGE 15 #define PACKED_ARBRE_TRONC 16 #define PACKED_ARBRE_FEUILLES 17 #define PACKED_PLANTE 18 void mallocError() { extern image_t img_ram; timer_stop(0); dimage(0,0,&img_ram); dupdate(); while (1) MKB_getkey(); } static uint8_t packAccess(packed_level_t const * const p, unsigned int x, unsigned int y) { if (xwidth && yheight) return p->data[x*p->height+y]; else return PACKED_EMPTY; } static void cellSet(cell_t *const array, unsigned int w, unsigned int h, unsigned int x, unsigned int y, cell_t const cell) { if (xwidth; unsigned int h = p->height; ll_sendp(LEVEL_INFO, "\nUnpacking level %dx%d", w,h); cell_t * c = (cell_t *) mallocProf(sizeof(cell_t) * w * h); ll_sendp(LEVEL_INFO, "\n[i]malloc %d", sizeof(cell_t) * w * h); if (c==0) { // overriding parameters w = 232;//p->width; h = 13;//p->height; ll_sendp(LEVEL_CRITICAL, "\n[e]malloc %d failed !\n[i]Trying defaults:\n %dx%d",sizeof(cell_t) * w * h, w,h); ll_sendp(LEVEL_WARNING, "\n[w]writing into pack new coordinates:\n %dx%d", w,h); p->width=w; p->height=h; cell_t * c = (cell_t *) mallocProf(sizeof(cell_t) * w * h); if (c==0) mallocError(); } //ll_setLevel(LEVEL_WARNING); int sx=0, sy=p->height; // Mario start coords ennemi_t ennemis[30]={0}; int nombre_ennemis=0; for (unsigned int x=0; x