From bbd7bc28a2cd8716eac6add006abb91ee55c4f91 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Thu, 4 May 2023 20:10:33 +0200 Subject: editor work --- src/map.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/map.c') diff --git a/src/map.c b/src/map.c index 1263e66..72da245 100644 --- a/src/map.c +++ b/src/map.c @@ -139,15 +139,16 @@ void load_mapdata_into_world() { } } - light_emitter emitters[1] = { - {.brightness = 1.0f, .position = (vec3f){0, 0, 0}, .range = 10.0f}, - }; + // Load emitters + for (int i = 0; i < MAX_LIGHT_EMITTERS; i++) { + loaded_map.light_emitters[i] = map_to_load.light_emitters[i]; + } // Load lightmap for (int y = 0; y < MAP_SIZE_Y; y++) { for (int x = 0; x < MAP_SIZE_X; x++) { for (int l = 0; l < 1; l++) { - light_emitter emitter = emitters[l]; + light_emitter emitter = loaded_map.light_emitters[l]; float dist_tl = distance_between_3f(emitter.position, (vec3f){x, y, loaded_map.heightmap[y][x].topleft}); float dist_tr = distance_between_3f(emitter.position, (vec3f){x, y, loaded_map.heightmap[y][x].topright}); float dist_bl = distance_between_3f(emitter.position, (vec3f){x, y, loaded_map.heightmap[y][x].bottomleft}); @@ -204,6 +205,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}; + map_to_load.light_emitters[0] = (light_emitter){.brightness = 1.0f, .position = (vec3f){0, 0, 0}, .range = 10.0f, .active = true}; + load_mapdata_into_world(); } -- cgit v1.2.3-70-g09d2