diff --git a/art/gen/water.png b/art/gen/water.png new file mode 100644 index 0000000..536065f Binary files /dev/null and b/art/gen/water.png differ diff --git a/code/game/source/gen/texgen.c b/code/game/source/gen/texgen.c index e842cd2..c362293 100644 --- a/code/game/source/gen/texgen.c +++ b/code/game/source/gen/texgen.c @@ -31,6 +31,9 @@ Image texgen_build_block(uint32_t biome, uint32_t kind) { case BLOCK_KIND_HILL:{ return LoadImageEco("rock"); }break; + case BLOCK_KIND_WATER:{ + return LoadImageEco("water"); + }break; } } } diff --git a/code/game/source/player.c b/code/game/source/player.c index 68d6581..d550ae7 100644 --- a/code/game/source/player.c +++ b/code/game/source/player.c @@ -27,13 +27,18 @@ uint64_t player_spawn(char *name) { ecs_set(world_ecs(), e, Input, {0}); ecs_add(world_ecs(), e, Player); Position *pos = ecs_get_mut(world_ecs(), e, Position, NULL); +#if 1 pos->x=rand() % world_dim(); pos->y=rand() % world_dim(); - +#else + pos->x=10; + pos->y=10; +#endif + librg_entity_owner_set(world_tracker(), e, (int64_t)e); librg_entity_radius_set(world_tracker(), e, 3); librg_entity_chunk_set(world_tracker(), e, librg_chunk_from_realpos(world_tracker(), pos->x, pos->y, 0)); - + return (uint64_t)e; } diff --git a/code/game/source/world/world.c b/code/game/source/world/world.c index ecbb0ee..b4ece14 100644 --- a/code/game/source/world/world.c +++ b/code/game/source/world/world.c @@ -154,10 +154,10 @@ int32_t world_init(int32_t seed, uint16_t chunk_size, uint16_t chunk_amount) { for (int y = 0; y < world.chunk_size; y += 1) { for (int x = 0; x < world.chunk_size; x += 1) { int chk = world.chunk_size * i; - int chk_x = chk % world.chunk_amount; - int chk_y = chk / world.chunk_amount; + int chk_x = chk % world.dim; + int chk_y = chk / world.dim; uint8_t *c = ecs_vector_add(&chunk->blocks, uint8_t); - *c = world.data[(chk_y+y)*world.chunk_amount + (chk_x+x)]; + *c = world.data[(chk_y+y)*world.dim + (chk_x+x)]; } } } diff --git a/code/game/source/world/worldgen/worldgen_test.c b/code/game/source/world/worldgen/worldgen_test.c index 1b75ad3..5949bad 100644 --- a/code/game/source/world/worldgen/worldgen_test.c +++ b/code/game/source/world/worldgen/worldgen_test.c @@ -129,7 +129,7 @@ int32_t worldgen_test(world_data *wld) { uint8_t wall_id = blocks_find(BLOCK_BIOME_DEV, BLOCK_KIND_WALL); uint8_t grnd_id = blocks_find(BLOCK_BIOME_DEV, BLOCK_KIND_GROUND); uint8_t dirt_id = blocks_find(BLOCK_BIOME_DEV, BLOCK_KIND_DIRT); - //uint8_t watr_id = blocks_find(BLOCK_BIOME_DEV, BLOCK_KIND_WATER); + uint8_t watr_id = blocks_find(BLOCK_BIOME_DEV, BLOCK_KIND_WATER); srand(world->seed); @@ -141,18 +141,18 @@ int32_t worldgen_test(world_data *wld) { world_fill_rect(dirt_id, 1, 1, world->dim-2, world->dim-2, shaper_noise50); // water -#if 0 - for (int i=0; idim), RAND_RANGE(0, world->dim), 4+RAND_RANGE(0,3), 4+RAND_RANGE(0,3), 0.5f, 0.5f, shaper_noise33); +#if 1 + for (int i=0; idim), RAND_RANGE(0, world->dim), 4+RAND_RANGE(0,3), 4+RAND_RANGE(0,3), 0.5f, 0.5f, shaper_noise80); } #endif // hills -#if 0 - const uint32_t HILLS_SIZE = 44; - for (int i=0; idim), RAND_RANGE(0, world->dim), RAND_RANGE(0,HILLS_SIZE), RAND_RANGE(0,HILLS_SIZE), 0.5f, 0.5f, shaper_noise33); +#if 1 + const uint32_t HILLS_SIZE = 21; + for (int i=0; idim), RAND_RANGE(0, world->dim), RAND_RANGE(0,HILLS_SIZE), RAND_RANGE(0,HILLS_SIZE), 0.5f, 0.5f, shaper_noise50); } #endif