280 if (LandBackSurface <> nil) and GrayScale then Surface2GrayScale(LandBackSurface); |
280 if (LandBackSurface <> nil) and GrayScale then Surface2GrayScale(LandBackSurface); |
281 end; |
281 end; |
282 |
282 |
283 |
283 |
284 procedure GenDrawnMap; |
284 procedure GenDrawnMap; |
285 begin |
285 var lowerX, upperX, lowerY, upperY, lowerFS, upperFS, value: LongInt; |
286 if (cFeatureSize <= 3) then |
286 begin |
287 // sizes 1-3 are identical |
287 if (cFeatureSize <= 6) then |
288 MaxHedgehogs:= 8 |
|
289 else if (cFeatureSize <= 6) then |
|
290 MaxHedgehogs:= 6 + (cFeatureSize-1) * 2 |
288 MaxHedgehogs:= 6 + (cFeatureSize-1) * 2 |
291 else if (cFeatureSize < 11) then |
289 else if (cFeatureSize < 11) then |
292 MaxHedgehogs:= 16 + (cFeatureSize-6) * 4 |
290 MaxHedgehogs:= 16 + (cFeatureSize-6) * 4 |
293 else if (cFeatureSize = 11) then |
291 else if (cFeatureSize = 11) then |
294 MaxHedgehogs:= 48 |
292 MaxHedgehogs:= 48 |
296 MaxHedgehogs:= 64 |
294 MaxHedgehogs:= 64 |
297 else |
295 else |
298 MaxHedgehogs:= cMaxHHs; |
296 MaxHedgehogs:= cMaxHHs; |
299 |
297 |
300 if GameType = gmtLandPreview then |
298 if GameType = gmtLandPreview then |
301 cFeatureSize:= 3; |
299 cFeatureSize:= 1; |
302 playWidth:= (4096 * max(min(cFeatureSize,24),3)) div 12; |
300 |
303 playHeight:= (2048 * max(min(cFeatureSize,24),3)) div 12; |
301 // Calculate map size for drawn map, use cFeatureSize to scale. |
|
302 |
|
303 // We have pre-determined map size for cFeatureSize 1, 6, 12 and 25. |
|
304 // The other values will be interpolated. |
|
305 if cFeatureSize < 6 then |
|
306 begin |
|
307 // reference size for cFeatureSize 1 |
|
308 lowerFS:= 1; |
|
309 lowerX:= 1024; |
|
310 lowerY:= 512; |
|
311 upperFS:= 6; |
|
312 end |
|
313 else if cFeatureSize < 12 then |
|
314 begin |
|
315 // reference size for cFeatureSize 6 |
|
316 lowerFS:= 6; |
|
317 lowerX:= 2048; |
|
318 lowerY:= 1024; |
|
319 upperFS:= 12; |
|
320 end |
|
321 else |
|
322 begin |
|
323 // reference size for cFeatureSize 12, size of drawn maps in pre-1.0.0 versions |
|
324 lowerFS:= 12; |
|
325 lowerX:= 4096; |
|
326 lowerY:= 2048; |
|
327 upperFS:= 25; |
|
328 end; |
|
329 |
|
330 upperX:= lowerX * 2; |
|
331 upperY:= lowerY * 2; |
|
332 |
|
333 if cFeatureSize = 25 then |
|
334 begin |
|
335 // hardcoded size for size level 25 |
|
336 playWidth:= 8192; |
|
337 playHeight:= 4096; |
|
338 end |
|
339 else |
|
340 begin |
|
341 // Interpolation formula |
|
342 playWidth:= lowerX + ((upperX-lowerX) div (upperFS-lowerFS))*(cFeatureSize-lowerFS); |
|
343 playHeight:= lowerY + ((upperY-lowerY) div (upperFS-lowerFS))*(cFeatureSize-lowerFS); |
|
344 end; |
|
345 |
|
346 if GameType <> gmtLandPreview then |
|
347 WriteLnToConsole('Drawn map size: cFeatureSize='+IntToStr(cFeatureSize)+' playWidth='+IntToStr(playWidth)+' playHeight='+IntToStr(playHeight)); |
|
348 |
304 ResizeLand(playWidth, playHeight); |
349 ResizeLand(playWidth, playHeight); |
305 |
350 |
306 hasGirders:= true; |
351 hasGirders:= true; |
307 leftX:= ((LAND_WIDTH - playWidth) div 2); |
352 leftX:= ((LAND_WIDTH - playWidth) div 2); |
308 rightX:= (playWidth + ((LAND_WIDTH - playWidth) div 2)) - 1; |
353 rightX:= (playWidth + ((LAND_WIDTH - playWidth) div 2)) - 1; |