jtmm2/inc/level.h

47 lines
994 B
C
Raw Normal View History

2021-12-16 13:56:02 +01:00
#pragma once
2021-12-17 23:07:06 +01:00
#include "player.h"
2021-12-17 18:44:13 +01:00
#include "tile.h"
#include "vec.h"
2021-12-16 15:57:50 +01:00
#include "visual_data.h"
2021-12-16 13:56:02 +01:00
#include <stdint.h>
struct LevelBin {
uint8_t format, chunk_size;
uint16_t width, height;
uint8_t data[];
} __attribute__((__packed__));
2021-12-18 12:47:35 +01:00
struct LevelBinNamed {
struct LevelBin *bin;
char *name;
};
2021-12-16 13:56:02 +01:00
struct Level {
2021-12-17 23:07:06 +01:00
int width, height, size, id;
2021-12-16 13:56:02 +01:00
uint8_t *data;
2021-12-16 15:57:50 +01:00
struct VisualData *visual_data;
2021-12-17 23:07:06 +01:00
struct Player *player;
2021-12-16 13:56:02 +01:00
};
2021-12-17 23:07:06 +01:00
void level_init(struct Player *);
2021-12-16 13:56:02 +01:00
void level_deinit(void);
2021-12-17 23:07:06 +01:00
void level_load(int id);
2022-01-12 22:36:10 +01:00
void level_save_kble(const char *path);
2022-01-12 23:10:31 +01:00
void level_load_kble(const char *path);
void level_load_kble_followup(void);
2021-12-16 13:56:02 +01:00
void level_reload(void);
2021-12-19 00:30:09 +01:00
void level_regen_visual_data(int editing);
2021-12-17 23:07:06 +01:00
void level_next(void);
2021-12-16 23:27:04 +01:00
2021-12-16 15:57:50 +01:00
void level_draw(void);
2021-12-19 00:30:09 +01:00
void level_draw_name(void);
2021-12-16 23:27:04 +01:00
int level_get(int x, int y);
int level_get_px(int x, int y);
2021-12-19 00:30:09 +01:00
void level_set(int x, int y, int v);
2021-12-20 11:33:34 +01:00
void level_set_px(int x, int y, int v);
2021-12-17 18:44:13 +01:00
struct Vec level_find(enum Tile);
2021-12-21 00:14:49 +01:00
int level_count(enum Tile);
2021-12-19 00:30:09 +01:00
struct Vec level_dim(void);