hedgewars/uLand.pas
changeset 566 1c1cb593cb81
parent 561 19d2d422ff84
child 567 b6de36975a3c
equal deleted inserted replaced
565:092cb8deffc5 566:1c1cb593cb81
    23 type TLandArray = packed array[0..1023, 0..2047] of LongWord;
    23 type TLandArray = packed array[0..1023, 0..2047] of LongWord;
    24      TPreview = packed array[0..127, 0..31] of byte;
    24      TPreview = packed array[0..127, 0..31] of byte;
    25 
    25 
    26 var  Land: TLandArray;
    26 var  Land: TLandArray;
    27      LandSurface: PSDL_Surface;
    27      LandSurface: PSDL_Surface;
    28      Preview: TPreview;
       
    29 
    28 
    30 procedure GenMap;
    29 procedure GenMap;
    31 procedure GenPreview;
    30 function GenPreview: TPreview;
    32 procedure CheckLandDigest(s: shortstring);
    31 procedure CheckLandDigest(s: shortstring);
    33 
    32 
    34 implementation
    33 implementation
    35 uses uConsole, uStore, uMisc, uConsts, uRandom, uTeams, uLandObjects, uSHA, uIO;
    34 uses uConsole, uStore, uMisc, uConsts, uRandom, uTeams, uLandObjects, uSHA, uIO;
    36 
    35 
   601                                else MakeFortsMap;
   600                                else MakeFortsMap;
   602 AddProgress;
   601 AddProgress;
   603 {$IFDEF DEBUGFILE}LogLandDigest{$ENDIF}
   602 {$IFDEF DEBUGFILE}LogLandDigest{$ENDIF}
   604 end;
   603 end;
   605 
   604 
   606 procedure GenPreview;
   605 function GenPreview: TPreview;
   607 var x, y, xx, yy, t, bit: LongInt;
   606 var x, y, xx, yy, t, bit: LongInt;
       
   607     Preview: TPreview;
   608 begin
   608 begin
   609 WriteLnToConsole('Generating preview...');
   609 WriteLnToConsole('Generating preview...');
   610 GenBlank(EdgeTemplates[SelectTemplate]);
   610 GenBlank(EdgeTemplates[SelectTemplate]);
   611 
   611 
   612 for y:= 0 to 127 do
   612 for y:= 0 to 127 do
   619             for yy:= y * 8 to y * 8 + 7 do
   619             for yy:= y * 8 to y * 8 + 7 do
   620                 for xx:= x * 64 + bit * 8 to x * 64 + bit * 8 + 7 do
   620                 for xx:= x * 64 + bit * 8 to x * 64 + bit * 8 + 7 do
   621                     if Land[yy, xx] <> 0 then inc(t);
   621                     if Land[yy, xx] <> 0 then inc(t);
   622             if t > 8 then Preview[y, x]:= Preview[y, x] or ($80 shr bit)
   622             if t > 8 then Preview[y, x]:= Preview[y, x] or ($80 shr bit)
   623             end
   623             end
   624         end
   624         end;
       
   625 GenPreview:= Preview
   625 end;
   626 end;
   626 
   627 
   627 initialization
   628 initialization
   628 
   629 
   629 end.
   630 end.