BosonX/src/level.h

53 lines
1.1 KiB
C
Raw Normal View History

#ifndef __LEVEL_H__
# define __LEVEL_H__
2022-08-20 13:00:23 +02:00
#include "settings.h"
2022-08-20 13:00:23 +02:00
#include <vector>
2022-08-20 15:06:19 +02:00
#include <memory>
2022-08-20 13:00:23 +02:00
typedef enum {
PLATFORM_EMPTY,
PLATFORM_WHITE,
PLATFORM_RED,
PLATFORM_BLUE,
2023-08-02 18:37:03 +02:00
PLATFORM_SEPARATING_WALL,
PLATFORM_BLOCK,
PLATFORM_BLOCK_TOP,
2022-08-20 13:00:23 +02:00
} platform_type_t;
struct platform {
/* Face number along the level's cylinder */
2023-05-24 13:08:59 +02:00
int face;
/* Depth and length; the platform lies at [z ... z+length). */
2023-05-24 13:08:59 +02:00
num z;
num length;
/* Platform height above the default height (cylinder quasiradius). This
can be compared with player->height. */
num height;
/* Platform kind. */
2022-08-20 13:00:23 +02:00
platform_type_t type;
/* Whether the platform is currently falling. This is only used for red
platforms. */
bool falling;
2023-08-02 18:37:03 +02:00
/* Whether the SEPARATING_WALL platform is seen from the left side and/or
seen from the right side. */
bool wall_left_sided;
bool wall_right_sided;
2022-08-20 13:00:23 +02:00
};
struct Generator;
2022-08-20 13:00:23 +02:00
2023-05-24 13:08:59 +02:00
struct level {
2023-06-15 20:22:33 +02:00
char const *name;
2023-05-24 13:08:59 +02:00
std::vector<struct platform> platform_buffer;
std::unique_ptr<Generator> gen;
uint16_t bgcolor;
2023-05-24 13:08:59 +02:00
};
2022-08-20 15:06:19 +02:00
2023-08-02 18:37:03 +02:00
extern void level_update(struct level *level, num z, int reference_face);
2023-05-24 13:08:59 +02:00
extern struct level level_create(int level);
2022-08-20 15:06:19 +02:00
#endif /* __LEVEL_H__ */