2019-11-24 14:28:04 +01:00
|
|
|
#include "level.h"
|
|
|
|
#include "world.h"
|
2019-11-25 19:12:25 +01:00
|
|
|
#include "mario.h"
|
2019-11-30 13:57:18 +01:00
|
|
|
#include "score.h"
|
2019-12-03 19:53:30 +01:00
|
|
|
#include "ennemi.h"
|
2020-01-06 18:43:36 +01:00
|
|
|
#include "keyboard.h"
|
2020-01-11 15:19:53 +01:00
|
|
|
#include <plateforme.h>
|
2020-01-23 21:03:58 +01:00
|
|
|
#include <tuyau.h>
|
2020-01-11 15:19:53 +01:00
|
|
|
|
2019-11-24 14:28:04 +01:00
|
|
|
#include <gint/display.h>
|
2019-11-30 13:57:18 +01:00
|
|
|
#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>
|
2020-01-11 15:19:53 +01:00
|
|
|
|
2019-11-30 13:57:18 +01:00
|
|
|
void malloc_error()
|
2019-11-24 14:28:04 +01:00
|
|
|
{
|
2019-11-30 13:57:18 +01:00
|
|
|
extern image_t img_ram;
|
|
|
|
timer_stop(0);
|
|
|
|
dimage(0,0,&img_ram);
|
|
|
|
dupdate();
|
|
|
|
while (1)
|
2020-01-30 21:09:18 +01:00
|
|
|
mkb_getkey();
|
2019-11-30 13:57:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-01 14:39:08 +01:00
|
|
|
void unpack_level(packed_level_t const * const packed_level_t p)
|
2020-01-11 15:19:53 +01:00
|
|
|
{
|
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)
|
2020-01-11 15:19:53 +01:00
|
|
|
malloc_error();
|
2020-01-30 21:09:18 +01:00
|
|
|
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-01-28 21:32:58 +01:00
|
|
|
}
|
2020-02-01 14:39:08 +01:00
|
|
|
|
|
|
|
map_current=m;
|
|
|
|
|
|
|
|
map_current->w = p->width;
|
|
|
|
map_current->h = p->height;
|
2020-01-28 14:32:39 +01:00
|
|
|
|
2020-02-01 14:39:08 +01:00
|
|
|
}
|