diff --git a/.gitignore b/.gitignore index 993f8c5..5402c75 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ -build -.vscode +build +.vscode + +GPATH +GRTAGS +GTAGS diff --git a/code/apps/server/source/blocks.c b/code/apps/server/source/blocks.c index 625623b..25609bf 100644 --- a/code/apps/server/source/blocks.c +++ b/code/apps/server/source/blocks.c @@ -3,12 +3,11 @@ // todo: csv parsing + utils -#define BLOCK_NAMELEN 80 #define BLOCKS_COUNT (sizeof(blocks)/sizeof(block)) typedef struct { uint8_t tex_id; - char name[BLOCK_NAMELEN]; + const char *name; uint32_t flags; uint32_t kind; uint32_t biome; diff --git a/code/apps/server/source/world_gen.c b/code/apps/server/source/world_gen.c index ed993d2..c74a828 100644 --- a/code/apps/server/source/world_gen.c +++ b/code/apps/server/source/world_gen.c @@ -31,6 +31,26 @@ static void world_fill_rect(uint32_t id, uint32_t x, uint32_t y, uint32_t w, uin } } +static void world_fill_circle(uint32_t id, uint32_t x, uint32_t y, uint32_t w, uint32_t h, world_block_observer_proc *proc) { + for (uint32_t cy=y; cy= world_width) continue; + if (cy < 0 || cy >= world_height) continue; + uint32_t i = (cy*world_width) + cx; + + if (proc) { + uint32_t new_id = (*proc)(id, i); + if (new_id != BLOCK_INVALID) { + id = new_id; + } + else continue; + } + + world[i] = id; + } + } +} + static void world_fill_rect_anchor(uint32_t id, uint32_t x, uint32_t y, uint32_t w, uint32_t h, float ax, float ay, world_block_observer_proc *proc) { uint32_t w2 = (uint32_t)floorf(w*ax); uint32_t h2 = (uint32_t)floorf(h*ay); @@ -74,6 +94,10 @@ static WORLD_BLOCK_OBSERVER(shaper_noise33) { return world_perlin_cond(block_idx, 0.33) ? shaper(id, block_idx) : BLOCK_INVALID; } +static void world_fill_mountain(uint32_t x, uint32_t y) { + +} + #define RAND_RANGE(x,y) (x + (uint32_t)rand()%(y-(x))) int32_t world_gen() { diff --git a/code/common/system.h b/code/common/system.h index 20bf192..b2925a6 100644 --- a/code/common/system.h +++ b/code/common/system.h @@ -1,3 +1,4 @@ #pragma once #include +#include