supercasiobros/src/level.c

45 lines
809 B
C

#include "level.h"
#include "world.h"
#include "mario.h"
#include "score.h"
#include "ennemi.h"
#include "keyboard.h"
#include <plateforme.h>
#include <tuyau.h>
#include <gint/display.h>
#include <gint/std/stdlib.h>
#include <gint/keyboard.h>
#include <gint/timer.h>
#include <gint/std/string.h>
#include <gint/std/stdio.h>
void malloc_error()
{
extern image_t img_ram;
timer_stop(0);
dimage(0,0,&img_ram);
dupdate();
while (1)
mkb_getkey();
}
void unpack_level(packed_level_t const * const packed_level_t p)
{
unsigned int const size = p->width*p->height;
map_t * m = (map_t *) malloc( 4*sizeof(int) + size*sizeof(cell_t) );
if (m==0)
malloc_error();
if (map_current)
{
free(map_current);
map_current=0;
}
map_current=m;
map_current->w = p->width;
map_current->h = p->height;
}