supercasiobros/src/level.c

45 lines
809 B
C
Raw Normal View History

#include "level.h"
#include "world.h"
#include "mario.h"
#include "score.h"
2019-12-03 19:53:30 +01:00
#include "ennemi.h"
#include "keyboard.h"
#include <plateforme.h>
2020-01-23 21:03:58 +01:00
#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>
2020-01-23 21:03:58 +01:00
#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();
}
2020-02-01 14:39:08 +01:00
void unpack_level(packed_level_t const * const packed_level_t p)
{
2020-02-01 14:39:08 +01:00
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)
2020-01-13 20:26:37 +01:00
{
2020-02-01 14:39:08 +01:00
free(map_current);
map_current=0;
}
2020-02-01 14:39:08 +01:00
map_current=m;
map_current->w = p->width;
map_current->h = p->height;
2020-02-01 14:39:08 +01:00
}