29 procedure GenPreview(out Preview: TPreview); |
29 procedure GenPreview(out Preview: TPreview); |
30 |
30 |
31 implementation |
31 implementation |
32 uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, SysUtils, |
32 uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, SysUtils, |
33 uVariables, uUtils, uCommands, adler32, uDebug, uLandPainted, uTextures, |
33 uVariables, uUtils, uCommands, adler32, uDebug, uLandPainted, uTextures, |
34 uLandGenMaze, uLandOutline; |
34 uLandGenMaze, uLandOutline, uPhysFSLayer; |
35 |
35 |
36 var digest: shortstring; |
36 var digest: shortstring; |
37 |
37 |
38 procedure ResizeLand(width, height: LongWord); |
38 procedure ResizeLand(width, height: LongWord); |
39 var potW, potH: LongInt; |
39 var potW, potH: LongInt; |
421 BlitImageAndGenerateCollisionInfo(rightX - 150 - tmpsurf^.w, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf); |
421 BlitImageAndGenerateCollisionInfo(rightX - 150 - tmpsurf^.w, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf); |
422 SDL_FreeSurface(tmpsurf); |
422 SDL_FreeSurface(tmpsurf); |
423 end; |
423 end; |
424 |
424 |
425 procedure LoadMapConfig; |
425 procedure LoadMapConfig; |
426 var f: textfile; |
426 var f: PFSFile; |
427 s: shortstring; |
427 s: shortstring; |
428 begin |
428 begin |
429 s:= cPathz[ptMapCurrent] + '/map.cfg'; |
429 s:= cPathz[ptMapCurrent] + '/map.cfg'; |
430 |
430 |
431 WriteLnToConsole('Fetching map HH limit'); |
431 WriteLnToConsole('Fetching map HH limit'); |
432 {$I-} |
432 |
433 Assign(f, s); |
433 f:= pfsOpenRead(s); |
434 filemode:= 0; // readonly |
434 if f <> nil then |
435 Reset(f); |
435 begin |
436 if IOResult <> 0 then |
436 pfsReadLn(f, s); |
437 begin |
437 if not pfsEof(f) then |
438 s:= cPathz[ptMissionMaps] + '/' + ExtractFileName(cPathz[ptMapCurrent]) + '/map.cfg'; |
438 begin |
439 Assign(f, s); |
439 pfsReadLn(f, s); |
440 Reset(f); |
440 val(s, MaxHedgehogs) |
441 end; |
441 end; |
442 Readln(f); |
442 |
443 if not eof(f) then |
443 pfsClose(f) |
444 Readln(f, MaxHedgehogs); |
444 end; |
445 {$I+} |
445 |
446 if (MaxHedgehogs = 0) then |
446 if (MaxHedgehogs = 0) then |
447 MaxHedgehogs:= 18; |
447 MaxHedgehogs:= 18; |
448 end; |
448 end; |
449 |
449 |
450 // Loads Land[] from an image, allowing overriding standard collision |
450 // Loads Land[] from an image, allowing overriding standard collision |