crystal-tower/inc/level.h

31 lines
645 B
C
Raw Normal View History

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-10 00:37:45 +01:00
struct LevelBin {
unsigned char format;
unsigned char chunk_size;
unsigned short width;
unsigned short height;
unsigned char data[];
} __attribute__((__packed__));
struct Level {
int width;
int height;
2021-11-10 06:15:41 +01:00
int size;
2021-11-10 00:37:45 +01:00
char *data;
2021-11-11 07:09:56 +01:00
struct LevelBin *source;
2021-11-10 00:37:45 +01:00
};
2021-11-10 08:08:29 +01:00
void level_load(struct LevelBin *);
2021-11-11 07:09:56 +01:00
void level_reload(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);