2021-11-10 00:37:45 +01:00
|
|
|
#pragma once
|
2021-11-10 06:15:41 +01:00
|
|
|
#include "tile.h"
|
|
|
|
#include "vec.h"
|
2021-11-17 15:14:03 +01:00
|
|
|
#include <stdint.h>
|
2021-11-10 00:37:45 +01:00
|
|
|
|
|
|
|
struct LevelBin {
|
2021-11-17 15:14:03 +01:00
|
|
|
uint8_t format;
|
|
|
|
uint8_t chunk_size;
|
|
|
|
uint16_t width;
|
|
|
|
uint16_t height;
|
|
|
|
uint8_t data[];
|
2021-11-10 00:37:45 +01:00
|
|
|
} __attribute__((__packed__));
|
|
|
|
|
|
|
|
struct Level {
|
|
|
|
int width;
|
|
|
|
int height;
|
2021-11-10 06:15:41 +01:00
|
|
|
int size;
|
2021-11-17 15:14:03 +01:00
|
|
|
uint8_t *data;
|
2021-11-11 16:59:37 +01:00
|
|
|
int id;
|
2021-11-10 00:37:45 +01:00
|
|
|
};
|
|
|
|
|
2021-11-11 16:59:37 +01:00
|
|
|
void level_load(int id);
|
2021-11-11 07:09:56 +01:00
|
|
|
void level_reload(void);
|
2021-11-11 16:59:37 +01:00
|
|
|
void level_next(void);
|
2021-11-10 08:08:29 +01:00
|
|
|
void level_free(void);
|
|
|
|
void level_draw(void);
|
|
|
|
struct Vec level_find(enum Tile);
|
|
|
|
enum Tile level_get(int x, int y);
|
|
|
|
enum Tile level_get_px(int x, int y);
|
|
|
|
void level_set(int x, int y, enum Tile v);
|
|
|
|
void level_set_px(int x, int y, enum Tile v);
|
2021-11-11 07:09:56 +01:00
|
|
|
int level_oob(int x, int y);
|