changeset 10040 | 4ac87acbaed9 |
parent 10017 | de822cd3df3a |
parent 10022 | eb981a03de90 |
child 10108 | c68cf030eded |
10019:c00db97a668f | 10040:4ac87acbaed9 |
---|---|
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, uPhysFSLayer; |
34 uLandGenMaze, uLandOutline, uPhysFSLayer, uScript; |
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; |
58 if (width div 4096 >= 2) or (height div 2048 >= 2) then cMaxZoomLevel:= 0.5; |
58 if (width div 4096 >= 2) or (height div 2048 >= 2) then cMaxZoomLevel:= 0.5; |
59 cMinMaxZoomLevelDelta:= cMaxZoomLevel - cMinZoomLevel |
59 cMinMaxZoomLevelDelta:= cMaxZoomLevel - cMinZoomLevel |
60 end; |
60 end; |
61 end; |
61 end; |
62 |
62 |
63 procedure PrettifyLandAlpha(); |
|
64 begin |
|
65 if (cReducedQuality and rqBlurryLand) <> 0 then |
|
66 PrettifyAlpha2D(LandPixels, LAND_HEIGHT div 2, LAND_WIDTH div 2) |
|
67 else |
|
68 PrettifyAlpha2D(LandPixels, LAND_HEIGHT, LAND_WIDTH); |
|
69 end; |
|
63 |
70 |
64 procedure DrawBorderFromImage(Surface: PSDL_Surface); |
71 procedure DrawBorderFromImage(Surface: PSDL_Surface); |
65 var tmpsurf: PSDL_Surface; |
72 var tmpsurf: PSDL_Surface; |
66 r, rr: TSDL_Rect; |
73 r, rr: TSDL_Rect; |
67 x, yd, yu: LongInt; |
74 x, yd, yu: LongInt; |
809 w:= 255; |
816 w:= 255; |
810 w:= (w and $FF shl RShift) or (w and $FF shl BShift) or (w and $FF shl GShift) or (LandPixels[y div 2,x div 2] and AMask); |
817 w:= (w and $FF shl RShift) or (w and $FF shl BShift) or (w and $FF shl GShift) or (LandPixels[y div 2,x div 2] and AMask); |
811 LandPixels[y,x]:= w or (LandPixels[y div 2, x div 2] and AMask) |
818 LandPixels[y,x]:= w or (LandPixels[y div 2, x div 2] and AMask) |
812 end |
819 end |
813 end; |
820 end; |
821 |
|
822 PrettifyLandAlpha(); |
|
814 end; |
823 end; |
815 |
824 |
816 procedure GenPreview(out Preview: TPreview); |
825 procedure GenPreview(out Preview: TPreview); |
817 var rh, rw, ox, oy, x, y, xx, yy, t, bit, cbit, lh, lw: LongInt; |
826 var rh, rw, ox, oy, x, y, xx, yy, t, bit, cbit, lh, lw: LongInt; |
818 begin |
827 begin |
875 adler:= 1; |
884 adler:= 1; |
876 for i:= 0 to LAND_HEIGHT-1 do |
885 for i:= 0 to LAND_HEIGHT-1 do |
877 adler:= Adler32Update(adler, @Land[i,0], LAND_WIDTH); |
886 adler:= Adler32Update(adler, @Land[i,0], LAND_WIDTH); |
878 s:= 'M' + IntToStr(adler) + cScriptName; |
887 s:= 'M' + IntToStr(adler) + cScriptName; |
879 |
888 |
889 ScriptSetString('LandDigest', s); |
|
890 |
|
880 chLandCheck(s); |
891 chLandCheck(s); |
881 SendIPCRaw(@s[0], Length(s) + 1) |
892 SendIPCRaw(@s[0], Length(s) + 1) |
882 end; |
893 end; |
883 |
894 |
884 procedure initModule; |
895 procedure initModule; |