additional changes

isolation_bkp/dynres
Dominik Madarász 2021-01-11 15:51:42 +01:00
parent 88fa3cbb71
commit 61403ce807
2 changed files with 11 additions and 3 deletions

View File

@ -7,7 +7,7 @@
#define WORLD_ERROR_INVALID_DIMENSIONS -0x0003 #define WORLD_ERROR_INVALID_DIMENSIONS -0x0003
#define WORLD_ERROR_INVALID_BUFFER -0x0004 #define WORLD_ERROR_INVALID_BUFFER -0x0004
int32_t world_gen(int32_t seed, uint8_t width, uint8_t height); int32_t world_init(int32_t seed, uint8_t width, uint8_t height);
int32_t world_destroy(void); int32_t world_destroy(void);
uint32_t world_buf(uint8_t const **ptr, uint32_t *width); uint32_t world_buf(uint8_t const **ptr, uint32_t *width);

View File

@ -5,7 +5,9 @@ static uint8_t *world = NULL;
static uint32_t world_size = 0; static uint32_t world_size = 0;
static uint32_t world_width = 0; static uint32_t world_width = 0;
int32_t world_gen(int32_t seed, uint8_t width, uint8_t height) { static int32_t world_gen(int32_t seed);
int32_t world_init(int32_t seed, uint8_t width, uint8_t height) {
if (world) { if (world) {
world_destroy(); world_destroy();
} }
@ -16,7 +18,7 @@ int32_t world_gen(int32_t seed, uint8_t width, uint8_t height) {
if (!world) { if (!world) {
return WORLD_ERROR_OUTOFMEM; return WORLD_ERROR_OUTOFMEM;
} }
return WORLD_ERROR_NONE; return world_gen(seed);
} }
int32_t world_destroy(void) { int32_t world_destroy(void) {
@ -32,3 +34,9 @@ uint32_t world_buf(uint8_t const **ptr, uint32_t *width) {
if (width) *width = world_width; if (width) *width = world_width;
return world_size; return world_size;
} }
static int32_t world_gen(int32_t seed) {
// TODO: perform world gen
return WORLD_ERROR_NONE;
}