2021-03-28 19:35:07 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
|
|
|
/* Copyright (C) 2021 KikooDX */
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#define LEVEL_WIDTH 25
|
|
|
|
#define LEVEL_HEIGHT 14
|
2021-05-08 00:33:55 +02:00
|
|
|
#define LEVEL_SIZE (LEVEL_WIDTH * LEVEL_HEIGHT)
|
2021-03-28 19:35:07 +02:00
|
|
|
#define KBLE_FORMAT_VERSION 0
|
|
|
|
#define KBLE_HEADER_LEN 6
|
|
|
|
|
|
|
|
typedef unsigned int Tile;
|
|
|
|
|
2021-04-11 01:45:40 +02:00
|
|
|
struct VisualTile {
|
|
|
|
int visible;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int texture_x;
|
|
|
|
int texture_y;
|
|
|
|
};
|
|
|
|
|
2021-03-28 19:35:07 +02:00
|
|
|
struct Level {
|
|
|
|
Tile data[LEVEL_WIDTH * LEVEL_HEIGHT];
|
2021-04-11 01:45:40 +02:00
|
|
|
struct VisualTile visual_data[LEVEL_WIDTH * LEVEL_HEIGHT];
|
2021-05-27 16:20:47 +02:00
|
|
|
int water_level;
|
2021-05-27 16:53:40 +02:00
|
|
|
int water_timer;
|
2021-03-28 19:35:07 +02:00
|
|
|
int width;
|
|
|
|
int height;
|
2021-04-04 17:33:17 +02:00
|
|
|
int gold;
|
|
|
|
int exit_locked;
|
2021-04-09 15:11:00 +02:00
|
|
|
int id;
|
2021-03-28 19:35:07 +02:00
|
|
|
};
|
|
|
|
|
2021-05-27 16:20:47 +02:00
|
|
|
extern struct Level level;
|
|
|
|
|
2021-03-28 19:35:07 +02:00
|
|
|
/* need to set global before call: level_id */
|
2021-05-08 00:33:55 +02:00
|
|
|
void level_load_bfile(void);
|
|
|
|
void level_load_binary(void);
|
2021-05-27 16:53:40 +02:00
|
|
|
void level_update(void);
|
2021-03-28 19:35:07 +02:00
|
|
|
void level_draw(void);
|
2021-04-08 18:04:24 +02:00
|
|
|
Tile level_get_tile(int x, int y);
|
2021-05-27 16:20:47 +02:00
|
|
|
int level_is_water(int x, int y);
|