From 314c92ea455c235f1becf71eb420b8461292eae8 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Mon, 1 May 2023 16:12:11 +0200 Subject: editor work --- src/map.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/map.c') diff --git a/src/map.c b/src/map.c index 2f6b6b0..62b72a4 100644 --- a/src/map.c +++ b/src/map.c @@ -105,7 +105,7 @@ void load_mapdata_into_world() { int highest_point_topright = get_height_of_tile_tr(h, x, y); int highest_point_bottomright = get_height_of_tile_br(h, x, y); int highest_point_bottomleft = get_height_of_tile_bl(h, x, y); - loaded_map.heightmap[y][x] = (tile){h, TILE_COBBLESTONE1, highest_point_topleft, highest_point_topright, highest_point_bottomleft, highest_point_bottomright}; + loaded_map.heightmap[y][x] = (tile){.height = h, .type = map_to_load.tiles[y][x], highest_point_topleft, highest_point_topright, highest_point_bottomleft, highest_point_bottomright}; } } @@ -117,8 +117,11 @@ void create_empty_map() { map_to_load.width = MAP_SIZE_X; map_to_load.height = MAP_SIZE_Y; - memset(map_to_load.tiles, TILE_COBBLESTONE1, sizeof(map_to_load.tiles)); - memset(map_to_load.heightmap, 0, sizeof(loaded_map.heightmap)); + for (int y = 0; y < MAP_SIZE_Y; y++) { + for (int x = 0; x < MAP_SIZE_X; x++) { + map_to_load.tiles[y][x] = TILE_COBBLESTONE1; + } + } map_to_load.objects[0] = (object){.active = true, .h = 0, .position = (vec2f){16, 8}, .size = (vec3f){1,1,2}, .type = OBJECT_PLANTBOX1}; @@ -126,6 +129,8 @@ void create_empty_map() { map_to_load.objects[2] = (object){.active = true, .h = 0, .position = (vec2f){0, 1}, .size = (vec3f){1,1,2}, .type = OBJECT_COBBLESTONEWALL1}; map_to_load.objects[3] = (object){.active = true, .h = 0, .position = (vec2f){0, 2}, .size = (vec3f){1,1,2}, .type = OBJECT_COBBLESTONEWALL1}; + printf("XDD: %d\n", map_to_load.tiles[0][0]); + load_mapdata_into_world(); } -- cgit v1.2.3-70-g09d2