hedgewars/uLand.pas
branchtransitional_engine
changeset 15900 128ace913837
parent 15179 cd38295cac16
child 15901 f39f0f614dbf
equal deleted inserted replaced
15899:73cdc306888f 15900:128ace913837
    36      uLandGenTemplateBased, uLandUtils, uRenderUtils;
    36      uLandGenTemplateBased, uLandUtils, uRenderUtils;
    37 
    37 
    38 var digest: shortstring;
    38 var digest: shortstring;
    39     maskOnly: boolean;
    39     maskOnly: boolean;
    40 
    40 
    41 
       
    42 procedure PrettifyLandAlpha();
    41 procedure PrettifyLandAlpha();
    43 begin
    42 begin
    44     if (cReducedQuality and rqBlurryLand) <> 0 then
    43     if (cReducedQuality and rqBlurryLand) <> 0 then
    45         PrettifyAlpha2D(LandPixels, LAND_HEIGHT div 2, LAND_WIDTH div 2)
    44         PrettifyAlpha2D(LandPixels, LAND_HEIGHT div 2, LAND_WIDTH div 2)
    46     else
    45     else
    62 
    61 
    63     for x:= 0 to LAND_WIDTH - 1 do
    62     for x:= 0 to LAND_WIDTH - 1 do
    64     begin
    63     begin
    65         yd:= LAND_HEIGHT - 1;
    64         yd:= LAND_HEIGHT - 1;
    66         repeat
    65         repeat
    67             while (yd > 0) and ((Land[yd, x] and targetMask) = 0) do dec(yd);
    66             while (yd > 0) and ((LandGet(yd, x) and targetMask) = 0) do dec(yd);
    68 
    67 
    69             if (yd < 0) then
    68             if (yd < 0) then
    70                 yd:= 0;
    69                 yd:= 0;
    71 
    70 
    72             while (yd < LAND_HEIGHT) and ((Land[yd, x] and targetMask) <> 0) do
    71             while (yd < LAND_HEIGHT) and ((LandGet(yd, x) and targetMask) <> 0) do
    73                 inc(yd);
    72                 inc(yd);
    74             dec(yd);
    73             dec(yd);
    75             yu:= yd;
    74             yu:= yd;
    76 
    75 
    77             while (yu > 0  ) and ((Land[yu, x] and targetMask) <> 0) do dec(yu);
    76             while (yu > 0  ) and ((LandGet(yu, x) and targetMask) <> 0) do dec(yu);
    78             while (yu < yd ) and ((Land[yu, x] and targetMask) =  0) do inc(yu);
    77             while (yu < yd ) and ((LandGet(yu, x) and targetMask) =  0) do inc(yu);
    79 
    78 
    80             if (yd < LAND_HEIGHT - 1) and ((yd - yu) >= 16) then
    79             if (yd < LAND_HEIGHT - 1) and ((yd - yu) >= 16) then
    81                 copyToXYFromRect(tmpsurf, Surface, x mod tmpsurf^.w, 16, 1, 16, x, yd - 15);
    80                 copyToXYFromRect(tmpsurf, Surface, x mod tmpsurf^.w, 16, 1, 16, x, yd - 15);
    82             if (yu > 0) then
    81             if (yu > 0) then
    83                 copyToXYFromRect(tmpsurf, Surface, x mod tmpsurf^.w, 0, 1, Min(16, yd - yu + 1), x, yu);
    82                 copyToXYFromRect(tmpsurf, Surface, x mod tmpsurf^.w, 0, 1, Min(16, yd - yu + 1), x, yu);
    98     // vertical
    97     // vertical
    99     s:= LAND_HEIGHT;
    98     s:= LAND_HEIGHT;
   100 
    99 
   101     for x:= 0 to LAND_WIDTH - 1 do
   100     for x:= 0 to LAND_WIDTH - 1 do
   102         for y:= 0 to LAND_HEIGHT - 1 do
   101         for y:= 0 to LAND_HEIGHT - 1 do
   103             if Land[y, x] = 0 then
   102             if LandGet(y, x) = 0 then
   104                 if s < y then
   103                 if s < y then
   105                     begin
   104                     begin
   106                     for i:= max(s, y - 8) to y - 1 do
   105                     for i:= max(s, y - 8) to y - 1 do
   107                         begin
   106                         begin
   108                         if ((x + i) and 16) = 0 then c:= c1 else c:= c2;
   107                         if ((x + i) and 16) = 0 then c:= c1 else c:= c2;
   132     // horizontal
   131     // horizontal
   133     s:= LAND_WIDTH;
   132     s:= LAND_WIDTH;
   134 
   133 
   135     for y:= 0 to LAND_HEIGHT - 1 do
   134     for y:= 0 to LAND_HEIGHT - 1 do
   136         for x:= 0 to LAND_WIDTH - 1 do
   135         for x:= 0 to LAND_WIDTH - 1 do
   137             if Land[y, x] = 0 then
   136             if LandGet(y, x) = 0 then
   138                 if s < x then
   137                 if s < x then
   139                     begin
   138                     begin
   140                     for i:= max(s, x - 8) to x - 1 do
   139                     for i:= max(s, x - 8) to x - 1 do
   141                         begin
   140                         begin
   142                         if ((y + i) and 16) = 0 then c:= c1 else c:= c2;
   141                         if ((y + i) and 16) = 0 then c:= c1 else c:= c2;
   403 
   402 
   404 p:= Surface^.pixels;
   403 p:= Surface^.pixels;
   405 for y:= 0 to LAND_HEIGHT - 1 do
   404 for y:= 0 to LAND_HEIGHT - 1 do
   406     begin
   405     begin
   407     for x:= 0 to LAND_WIDTH - 1 do
   406     for x:= 0 to LAND_WIDTH - 1 do
   408     if Land[y, x] <> 0 then
   407     if LandGet(y, x) <> 0 then
   409         if (cReducedQuality and rqBlurryLand) = 0 then
   408         if (cReducedQuality and rqBlurryLand) = 0 then
   410             LandPixels[y, x]:= p^[x]// or AMask
   409             LandPixels[y, x]:= p^[x]// or AMask
   411         else
   410         else
   412             LandPixels[y div 2, x div 2]:= p^[x];
   411             LandPixels[y div 2, x div 2]:= p^[x];
   413 
   412 
   437 
   436 
   438     if gameFlags and gfShoppaBorder <> 0 then DrawShoppaBorder;
   437     if gameFlags and gfShoppaBorder <> 0 then DrawShoppaBorder;
   439 
   438 
   440     for x:= LongWord(leftX+2) to LongWord(rightX-2) do
   439     for x:= LongWord(leftX+2) to LongWord(rightX-2) do
   441         for y:= LongWord(topY+2) to LAND_HEIGHT-3 do
   440         for y:= LongWord(topY+2) to LAND_HEIGHT-3 do
   442             if (Land[y, x] = 0) and
   441             if (LandGet(y, x) = 0) and
   443                (((Land[y, x-1] = lfBasic) and ((Land[y+1,x] = lfBasic)) or (Land[y-1,x] = lfBasic)) or
   442                (((LandGet(y, x-1) = lfBasic) and ((LandGet(y+1,x) = lfBasic)) or (LandGet(y-1,x) = lfBasic)) or
   444                ((Land[y, x+1] = lfBasic) and ((Land[y-1,x] = lfBasic) or (Land[y+1,x] = lfBasic)))) then
   443                ((LandGet(y, x+1) = lfBasic) and ((LandGet(y-1,x) = lfBasic) or (LandGet(y+1,x) = lfBasic)))) then
   445             begin
   444             begin
   446                 if (cReducedQuality and rqBlurryLand) = 0 then
   445                 if (cReducedQuality and rqBlurryLand) = 0 then
   447                     begin
   446                     begin
   448                     if (Land[y, x-1] = lfBasic) and (LandPixels[y, x-1] and AMask <> 0) then
   447                     if (LandGet(y, x-1) = lfBasic) and (LandPixels[y, x-1] and AMask <> 0) then
   449                         LandPixels[y, x]:= LandPixels[y, x-1]
   448                         LandPixels[y, x]:= LandPixels[y, x-1]
   450 
   449 
   451                     else if (Land[y, x+1] = lfBasic) and (LandPixels[y, x+1] and AMask <> 0) then
   450                     else if (LandGet(y, x+1) = lfBasic) and (LandPixels[y, x+1] and AMask <> 0) then
   452                         LandPixels[y, x]:= LandPixels[y, x+1]
   451                         LandPixels[y, x]:= LandPixels[y, x+1]
   453 
   452 
   454                     else if (Land[y-1, x] = lfBasic) and (LandPixels[y-1, x] and AMask <> 0) then
   453                     else if (LandGet(y-1, x) = lfBasic) and (LandPixels[y-1, x] and AMask <> 0) then
   455                         LandPixels[y, x]:= LandPixels[y-1, x]
   454                         LandPixels[y, x]:= LandPixels[y-1, x]
   456 
   455 
   457                     else if (Land[y+1, x] = lfBasic) and (LandPixels[y+1, x] and AMask <> 0) then
   456                     else if (LandGet(y+1, x) = lfBasic) and (LandPixels[y+1, x] and AMask <> 0) then
   458                         LandPixels[y, x]:= LandPixels[y+1, x];
   457                         LandPixels[y, x]:= LandPixels[y+1, x];
   459 
   458 
   460                     if (((LandPixels[y,x] and AMask) shr AShift) > 10) then
   459                     if (((LandPixels[y,x] and AMask) shr AShift) > 10) then
   461                         LandPixels[y,x]:= (LandPixels[y,x] and (not AMask)) or (128 shl AShift)
   460                         LandPixels[y,x]:= (LandPixels[y,x] and (not AMask)) or (128 shl AShift)
   462                     end;
   461                     end;
   463                 Land[y,x]:= lfObject
   462                 LandSet(y, x, lfObject)
   464             end
   463             end
   465             else if (Land[y, x] = 0) and
   464             else if (LandGet(y, x) = 0) and
   466                     (((Land[y, x-1] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y+2,x] = lfBasic)) or
   465                     (((LandGet(y, x-1) = lfBasic) and (LandGet(y+1,x-1) = lfBasic) and (LandGet(y+2,x) = lfBasic)) or
   467                     ((Land[y, x-1] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y-2,x] = lfBasic)) or
   466                     ((LandGet(y, x-1) = lfBasic) and (LandGet(y-1,x-1) = lfBasic) and (LandGet(y-2,x) = lfBasic)) or
   468                     ((Land[y, x+1] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y+2,x] = lfBasic)) or
   467                     ((LandGet(y, x+1) = lfBasic) and (LandGet(y+1,x+1) = lfBasic) and (LandGet(y+2,x) = lfBasic)) or
   469                     ((Land[y, x+1] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y-2,x] = lfBasic)) or
   468                     ((LandGet(y, x+1) = lfBasic) and (LandGet(y-1,x+1) = lfBasic) and (LandGet(y-2,x) = lfBasic)) or
   470                     ((Land[y+1, x] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or
   469                     ((LandGet(y+1, x) = lfBasic) and (LandGet(y+1,x+1) = lfBasic) and (LandGet(y,x+2) = lfBasic)) or
   471                     ((Land[y-1, x] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or
   470                     ((LandGet(y-1, x) = lfBasic) and (LandGet(y-1,x+1) = lfBasic) and (LandGet(y,x+2) = lfBasic)) or
   472                     ((Land[y+1, x] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic)) or
   471                     ((LandGet(y+1, x) = lfBasic) and (LandGet(y+1,x-1) = lfBasic) and (LandGet(y,x-2) = lfBasic)) or
   473                     ((Land[y-1, x] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic))) then
   472                     ((LandGet(y-1, x) = lfBasic) and (LandGet(y-1,x-1) = lfBasic) and (LandGet(y,x-2) = lfBasic))) then
   474 
   473 
   475                 begin
   474                 begin
   476 
   475 
   477                 if (cReducedQuality and rqBlurryLand) = 0 then
   476                 if (cReducedQuality and rqBlurryLand) = 0 then
   478 
   477 
   479                     begin
   478                     begin
   480 
   479 
   481                     if (Land[y, x-1] = lfBasic) and (LandPixels[y,x-1] and AMask <> 0) then
   480                     if (LandGet(y, x-1) = lfBasic) and (LandPixels[y,x-1] and AMask <> 0) then
   482                         LandPixels[y, x]:= LandPixels[y, x-1]
   481                         LandPixels[y, x]:= LandPixels[y, x-1]
   483 
   482 
   484                     else if (Land[y, x+1] = lfBasic) and (LandPixels[y,x+1] and AMask <> 0) then
   483                     else if (LandGet(y, x+1) = lfBasic) and (LandPixels[y,x+1] and AMask <> 0) then
   485                         LandPixels[y, x]:= LandPixels[y, x+1]
   484                         LandPixels[y, x]:= LandPixels[y, x+1]
   486 
   485 
   487                     else if (Land[y+1, x] = lfBasic) and (LandPixels[y+1,x] and AMask <> 0) then
   486                     else if (LandGet(y+1, x) = lfBasic) and (LandPixels[y+1,x] and AMask <> 0) then
   488                         LandPixels[y, x]:= LandPixels[y+1, x]
   487                         LandPixels[y, x]:= LandPixels[y+1, x]
   489 
   488 
   490                     else if (Land[y-1, x] = lfBasic) and (LandPixels[y-1,x] and AMask <> 0) then
   489                     else if (LandGet(y-1, x) = lfBasic) and (LandPixels[y-1,x] and AMask <> 0) then
   491                         LandPixels[y, x]:= LandPixels[y-1, x];
   490                         LandPixels[y, x]:= LandPixels[y-1, x];
   492 
   491 
   493                     if (((LandPixels[y,x] and AMask) shr AShift) > 10) then
   492                     if (((LandPixels[y,x] and AMask) shr AShift) > 10) then
   494                         LandPixels[y,x]:= (LandPixels[y,x] and (not AMask)) or (64 shl AShift)
   493                         LandPixels[y,x]:= (LandPixels[y,x] and (not AMask)) or (64 shl AShift)
   495                     end;
   494                     end;
   496                 Land[y,x]:= lfObject
   495                 LandSet(y, x, lfObject)
   497             end;
   496             end;
   498 
   497 
   499     AddProgress();
   498     AddProgress();
   500 end;
   499 end;
   501 
   500 
   525         begin
   524         begin
   526         if x mod 4 <> 0 then
   525         if x mod 4 <> 0 then
   527             begin
   526             begin
   528             if (y <= wbm) and ((x - w1) mod (bmWidth * 2) >= bmWidth) then
   527             if (y <= wbm) and ((x - w1) mod (bmWidth * 2) >= bmWidth) then
   529                 continue;
   528                 continue;
   530             Land[y,x]:= lfBasic;
   529             LandSet(y, x, lfBasic);
   531             Land[y,lastX-x]:= lfBasic;
   530             LandSet(y, lastX - x, lfBasic);
   532             end;
   531             end;
   533         end;
   532         end;
   534 
   533 
   535 w2:= w1 - gap;
   534 w2:= w1 - gap;
   536 w1:= max(0, w2 - fortWidth);
   535 w1:= max(0, w2 - fortWidth);
   543         if ((y - x) mod 2) = 0 then
   542         if ((y - x) mod 2) = 0 then
   544             begin
   543             begin
   545             // align battlement on inner edge, because real outer edge could be offscreen
   544             // align battlement on inner edge, because real outer edge could be offscreen
   546             if (y <= wbm) and ((LAND_WIDTH + x - bmref) mod (bmWidth * 2) >= bmWidth) then
   545             if (y <= wbm) and ((LAND_WIDTH + x - bmref) mod (bmWidth * 2) >= bmWidth) then
   547                 continue;
   546                 continue;
   548             Land[y,x]:= lfBasic;
   547             LandSet(y, x, lfBasic);
   549             Land[y,lastX-x]:= lfBasic;
   548             LandSet(y, lastX - x, lfBasic);
   550             end;
   549             end;
   551         end;
   550         end;
   552 end;
   551 end;
   553 
   552 
   554 procedure MakeFortsMap;
   553 procedure MakeFortsMap;
   689     begin
   688     begin
   690         p:= tmpsurf^.pixels;
   689         p:= tmpsurf^.pixels;
   691         for y:= 0 to Pred(tmpsurf^.h) do
   690         for y:= 0 to Pred(tmpsurf^.h) do
   692             begin
   691             begin
   693             for x:= 0 to Pred(tmpsurf^.w) do
   692             for x:= 0 to Pred(tmpsurf^.w) do
   694                 SetLand(Land[cpY + y, cpX + x], p^[x]);
   693                 SetLand(cpY + y, cpX + x, p^[x]);
   695             p:= PLongwordArray(@(p^[tmpsurf^.pitch div 4]));
   694             p:= PLongwordArray(@(p^[tmpsurf^.pitch div 4]));
   696             end;
   695             end;
   697 
   696 
   698         if SDL_MustLock(tmpsurf) then
   697         if SDL_MustLock(tmpsurf) then
   699             SDL_UnlockSurface(tmpsurf);
   698             SDL_UnlockSurface(tmpsurf);
   754 begin
   753 begin
   755 for w:= 0 to 23 do
   754 for w:= 0 to 23 do
   756     for x:= LongWord(leftX) to LongWord(rightX) do
   755     for x:= LongWord(leftX) to LongWord(rightX) do
   757         begin
   756         begin
   758         y:= Longword(cWaterLine) - 1 - w;
   757         y:= Longword(cWaterLine) - 1 - w;
   759         Land[y, x]:= lfIndestructible;
   758         LandSet(y, x, lfIndestructible);
   760         if (x + y) mod 32 < 16 then
   759         if (x + y) mod 32 < 16 then
   761             c:= AMask
   760             c:= AMask
   762         else
   761         else
   763             c:= AMask or RMask or GMask; // FF00FFFF
   762             c:= AMask or RMask or GMask; // FF00FFFF
   764 
   763 
   813 if (GameFlags and gfBorder) <> 0 then
   812 if (GameFlags and gfBorder) <> 0 then
   814     hasBorder:= true
   813     hasBorder:= true
   815 else
   814 else
   816     for y:= LongWord(topY) to LongWord(topY + 5) do
   815     for y:= LongWord(topY) to LongWord(topY + 5) do
   817         for x:= LongWord(leftX) to LongWord(rightX) do
   816         for x:= LongWord(leftX) to LongWord(rightX) do
   818             if Land[y, x] <> 0 then
   817             if LandGet(y, x) <> 0 then
   819                 begin
   818                 begin
   820                 inc(c);
   819                 inc(c);
   821                 if c > LongWord((LAND_WIDTH div 2)) then // avoid accidental triggering
   820                 if c > LongWord((LAND_WIDTH div 2)) then // avoid accidental triggering
   822                     begin
   821                     begin
   823                     hasBorder:= true;
   822                     hasBorder:= true;
   832     if WorldEdge = weNone then
   831     if WorldEdge = weNone then
   833         begin
   832         begin
   834         for y:= 0 to LAND_HEIGHT - 1 do
   833         for y:= 0 to LAND_HEIGHT - 1 do
   835             for x:= 0 to LAND_WIDTH - 1 do
   834             for x:= 0 to LAND_WIDTH - 1 do
   836                 if (y < LongWord(topY)) or (x < LongWord(leftX)) or (x > LongWord(rightX)) then
   835                 if (y < LongWord(topY)) or (x < LongWord(leftX)) or (x > LongWord(rightX)) then
   837                     Land[y, x]:= lfIndestructible;
   836                     LandSet(y, x, lfIndestructible);
   838         end
   837         end
   839     else if topY > 0 then
   838     else if topY > 0 then
   840         begin
   839         begin
   841         for y:= 0 to LongWord(topY - 1) do
   840         for y:= 0 to LongWord(topY - 1) do
   842             for x:= 0 to LAND_WIDTH - 1 do
   841             for x:= 0 to LAND_WIDTH - 1 do
   843                 Land[y, x]:= lfIndestructible;
   842                 LandSet(y, x, lfIndestructible);
   844         end;
   843         end;
   845     // Render map border
   844     // Render map border
   846     for w:= 0 to (cBorderWidth-1) do
   845     for w:= 0 to (cBorderWidth-1) do
   847         begin
   846         begin
   848         // Left and right border
   847         // Left and right border
   849         if (WorldEdge <> weBounce) and (WorldEdge <> weWrap) then
   848         if (WorldEdge <> weBounce) and (WorldEdge <> weWrap) then
   850             for y:= LongWord(topY) to LAND_HEIGHT - 1 do
   849             for y:= LongWord(topY) to LAND_HEIGHT - 1 do
   851                     begin
   850                     begin
   852                     // set land flags
   851                     // set land flags
   853                     Land[y, leftX + w]:= lfIndestructible;
   852                     LandSet(y, leftX + w, lfIndestructible);
   854                     Land[y, rightX - w]:= lfIndestructible;
   853                     LandSet(y, rightX - w, lfIndestructible);
   855 
   854 
   856                     // paint black and yellow stripes
   855                     // paint black and yellow stripes
   857                     if (y + leftX + w) mod 32 < 16 then
   856                     if (y + leftX + w) mod 32 < 16 then
   858                         c:= AMask // black
   857                         c:= AMask // black
   859                     else
   858                     else
   876                     end;
   875                     end;
   877 
   876 
   878         // Top border
   877         // Top border
   879         for x:= LongWord(leftX) to LongWord(rightX) do
   878         for x:= LongWord(leftX) to LongWord(rightX) do
   880             begin
   879             begin
   881             Land[topY + w, x]:= lfIndestructible;
   880             LandSet(topY + w, x, lfIndestructible);
   882             if (topY + x + w) mod 32 < 16 then
   881             if (topY + x + w) mod 32 < 16 then
   883                 c:= AMask // black
   882                 c:= AMask // black
   884             else
   883             else
   885                 c:= AMask or RMask or GMask; // yellow
   884                 c:= AMask or RMask or GMask; // yellow
   886 
   885 
   992                 t:= 0;
   991                 t:= 0;
   993                 cbit:= bit * 8;
   992                 cbit:= bit * 8;
   994                 for yy:= y * lh to y * lh + 7 do
   993                 for yy:= y * lh to y * lh + 7 do
   995                     for xx:= x * lw + cbit to x * lw + cbit + 7 do
   994                     for xx:= x * lw + cbit to x * lw + cbit + 7 do
   996                         if ((yy-oy) and LAND_HEIGHT_MASK = 0) and ((xx-ox) and LAND_WIDTH_MASK = 0)
   995                         if ((yy-oy) and LAND_HEIGHT_MASK = 0) and ((xx-ox) and LAND_WIDTH_MASK = 0)
   997                            and (Land[yy-oy, xx-ox] <> 0) then
   996                            and (LandGet(yy-oy, xx-ox) <> 0) then
   998                             inc(t);
   997                             inc(t);
   999                 if t > 8 then
   998                 if t > 8 then
  1000                     Preview[y, x]:= Preview[y, x] or ($80 shr bit);
   999                     Preview[y, x]:= Preview[y, x] or ($80 shr bit);
  1001             end;
  1000             end;
  1002         end;
  1001         end;
  1050             t:= 0;
  1049             t:= 0;
  1051 
  1050 
  1052             for yy:= y * lh - oy to y * lh + lh - 1 - oy do
  1051             for yy:= y * lh - oy to y * lh + lh - 1 - oy do
  1053                 for xx:= x * lw - ox to x * lw + lw - 1 - ox do
  1052                 for xx:= x * lw - ox to x * lw + lw - 1 - ox do
  1054                     if (yy and LAND_HEIGHT_MASK = 0) and (xx and LAND_WIDTH_MASK = 0)
  1053                     if (yy and LAND_HEIGHT_MASK = 0) and (xx and LAND_WIDTH_MASK = 0)
  1055                         and (Land[yy, xx] <> 0) then
  1054                         and (LandGet(yy, xx) <> 0) then
  1056                         inc(t);
  1055                         inc(t);
  1057 
  1056 
  1058             Preview[y, x]:= t * 255 div (lh * lw);
  1057             Preview[y, x]:= t * 255 div (lh * lw);
  1059             end;
  1058             end;
  1060 end;
  1059 end;
  1071 procedure chSendLandDigest(var s: shortstring);
  1070 procedure chSendLandDigest(var s: shortstring);
  1072 var i: LongInt;
  1071 var i: LongInt;
  1073     landPixelDigest  : LongInt;
  1072     landPixelDigest  : LongInt;
  1074 begin
  1073 begin
  1075     landPixelDigest:= 1;
  1074     landPixelDigest:= 1;
  1076     for i:= 0 to LAND_HEIGHT-1 do
  1075 //    for i:= 0 to LAND_HEIGHT-1 do
  1077         landPixelDigest:= Adler32Update(landPixelDigest, @Land[i,0], LAND_WIDTH*2);
  1076 //        landPixelDigest:= Adler32Update(landPixelDigest, @LandGet(i,x), 2);
  1078     s:= 'M' + IntToStr(syncedPixelDigest)+'|'+IntToStr(landPixelDigest);
  1077     s:= 'M' + IntToStr(syncedPixelDigest)+'|'+IntToStr(landPixelDigest);
  1079 
  1078 
  1080     ScriptSetString('LandDigest',IntToStr(landPixelDigest));
  1079     ScriptSetString('LandDigest',IntToStr(landPixelDigest));
  1081 
  1080 
  1082     chLandCheck(s);
  1081     chLandCheck(s);
  1091     LandBackSurface:= nil;
  1090     LandBackSurface:= nil;
  1092     digest:= '';
  1091     digest:= '';
  1093     maskOnly:= false;
  1092     maskOnly:= false;
  1094     LAND_WIDTH:= 0;
  1093     LAND_WIDTH:= 0;
  1095     LAND_HEIGHT:= 0;
  1094     LAND_HEIGHT:= 0;
  1096 (*
       
  1097     if (cReducedQuality and rqBlurryLand) = 0 then
       
  1098         SetLength(LandPixels, LAND_HEIGHT, LAND_WIDTH)
       
  1099     else
       
  1100         SetLength(LandPixels, LAND_HEIGHT div 2, LAND_WIDTH div 2);
       
  1101 
       
  1102     SetLength(Land, LAND_HEIGHT, LAND_WIDTH);
       
  1103     SetLength(LandDirty, (LAND_HEIGHT div 32), (LAND_WIDTH div 32));
       
  1104 *)
       
  1105 end;
  1095 end;
  1106 
  1096 
  1107 procedure freeModule;
  1097 procedure freeModule;
  1108 begin
  1098 begin
  1109     SetLength(Land, 0, 0);
  1099     DisposeLand;
  1110     SetLength(LandPixels, 0, 0);
  1100     SetLength(LandPixels, 0, 0);
  1111     SetLength(LandDirty, 0, 0);
  1101     SetLength(LandDirty, 0, 0);
  1112 end;
  1102 end;
  1113 
  1103 
  1114 end.
  1104 end.