]> git.mcshandy.xyz Git - barrow_crawler/commitdiff
Transition small room generation to circlish
authorRandy McShandy <randy@mcshandy.xyz>
Fri, 10 May 2024 01:34:05 +0000 (20:34 -0500)
committerRandy McShandy <randy@mcshandy.xyz>
Fri, 10 May 2024 01:34:05 +0000 (20:34 -0500)
src/utils.c

index 6fe514a2a827b8c480c4b4ddf23cc0b2f8bac127..8e75c34933bc5ed676010fbff9e4b445dffd7225 100644 (file)
@@ -125,6 +125,7 @@ int initialize(int worker_count, RD_Opts active_opt)
        const int seed_count = 9;//sqrt(grid_size.x) * 2;
        const int width = 12 * (grid_size.x/128);
        const int height = width * 1;
+       const float small_room_radius = 16.0f;
 
        float phase = ((rand() % 360)/(float)360) * (M_PI*2);
        for (int n = 0; n < seed_count; n++)
@@ -142,10 +143,9 @@ int initialize(int worker_count, RD_Opts active_opt)
                {
                        for (int y = seed_y-(height/2); y < seed_y+(height/2); y++)
                        {
-                               if (y >= grid_size.y || x >= grid_size.x || y < 0 || x < 0)
-                                       continue;
-                               // Third parameter for permanent presence of B chemicals (black)
-                               grid[x][y].c = 1.0f;
+                               if ((sqrtf(((x-seed_x)*(x-seed_x))+((y-seed_y)*(y-seed_y))) < small_room_radius))
+                                       // Third parameter for permanent presence of B chemicals (black)
+                                       grid[x][y].c = 1.0f;
                        }
                }
        }