summaryrefslogtreecommitdiff
path: root/src/map.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2023-05-01 16:12:11 +0200
committerAldrik Ramaekers <aldrik@amftech.nl>2023-05-01 16:12:11 +0200
commit314c92ea455c235f1becf71eb420b8461292eae8 (patch)
tree45051b889c62edade4289a644aa5857a9f046b27 /src/map.c
parent7338fe068fb4081938ca6530cd761a607a9c8ce9 (diff)
editor work
Diffstat (limited to 'src/map.c')
-rw-r--r--src/map.c11
1 files changed, 8 insertions, 3 deletions
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();
}