133 rCutoff:= min(max((26-cFeatureSize)*4,15),85); |
133 rCutoff:= min(max((26-cFeatureSize)*4,15),85); |
134 detail:= (26-cFeatureSize)*16000+50000; // feature size is a slider from 1-25 at present. flip it for perlin |
134 detail:= (26-cFeatureSize)*16000+50000; // feature size is a slider from 1-25 at present. flip it for perlin |
135 |
135 |
136 df:= detail * (6 - param2 * 2); |
136 df:= detail * (6 - param2 * 2); |
137 |
137 |
|
138 // Calculate estimate for max. hedgehog count |
|
139 // Tunnels |
|
140 if param1 = 0 then |
|
141 begin |
|
142 // Small tunnels |
|
143 if param2 = 0 then |
|
144 // 12..24 |
|
145 MaxHedgehogs:= 12 + 1 * (cFeatureSize - 1) |
|
146 // Medium tunnels |
|
147 else if param2 = 1 then |
|
148 // 14..24 |
|
149 MaxHedgehogs:= 14 + max(0, 1 * (cFeatureSize - 3)) |
|
150 // Large tunnels |
|
151 else if param2 = 2 then |
|
152 // 16..24 |
|
153 MaxHedgehogs:= 16 + max(0, 1 * (cFeatureSize - 5)); |
|
154 if MaxHedgehogs > 24 then |
|
155 MaxHedgehogs:= 24; |
|
156 end |
|
157 // Islands |
|
158 else if (param1 = 1) and (cFeatureSize <= 25) then |
|
159 // Small islands |
|
160 if param2 = 0 then |
|
161 // 64..32 |
|
162 MaxHedgehogs:= 32 + ((((25 - (cFeatureSize-1))*1000000) div 24) * 32) div 1000000 |
|
163 // Medium islands |
|
164 else if param2 = 1 then |
|
165 // 56..28 |
|
166 MaxHedgehogs:= 28 + ((((25 - (cFeatureSize-1))*1000000) div 24) * 28) div 1000000 |
|
167 // Large islands |
|
168 else if param2 = 2 then |
|
169 // 48..24 |
|
170 MaxHedgehogs:= 24 + ((((25 - (cFeatureSize-1))*1000000) div 24) * 24) div 1000000; |
|
171 // We only want even numbers |
|
172 if (MaxHedgehogs > 0) and ((MaxHedgehogs mod 2) = 1) then |
|
173 MaxHedgehogs:= MaxHedgehogs - 1; |
|
174 |
138 inoise_setup(); |
175 inoise_setup(); |
139 |
176 |
140 for y:= minY to pred(height) do |
177 for y:= minY to pred(height) do |
141 begin |
178 begin |
142 di:= df * y div height; |
179 di:= df * y div height; |