hedgewars/uLand.pas
changeset 11650 573e79db6688
parent 11649 1fd1525653d8
child 11705 4b2179d9516c
equal deleted inserted replaced
11649:1fd1525653d8 11650:573e79db6688
    47         PrettifyAlpha2D(LandPixels, LAND_HEIGHT, LAND_WIDTH);
    47         PrettifyAlpha2D(LandPixels, LAND_HEIGHT, LAND_WIDTH);
    48 end;
    48 end;
    49 
    49 
    50 procedure DrawBorderFromImage(Surface: PSDL_Surface);
    50 procedure DrawBorderFromImage(Surface: PSDL_Surface);
    51 var tmpsurf: PSDL_Surface;
    51 var tmpsurf: PSDL_Surface;
    52     r, rr: TSDL_Rect;
    52     //r, rr: TSDL_Rect;
    53     x, yd, yu: LongInt;
    53     x, yd, yu: LongInt;
    54     targetMask: Word;
    54     targetMask: Word;
    55 begin
    55 begin
    56     tmpsurf:= LoadDataImage(ptCurrTheme, 'Border', ifCritical or ifIgnoreCaps or ifTransparent);
    56     tmpsurf:= LoadDataImage(ptCurrTheme, 'Border', ifCritical or ifIgnoreCaps or ifTransparent);
    57 
    57 
    77 
    77 
    78             while (yu > 0  ) and ((Land[yu, x] and targetMask) <> 0) do dec(yu);
    78             while (yu > 0  ) and ((Land[yu, x] and targetMask) <> 0) do dec(yu);
    79             while (yu < yd ) and ((Land[yu, x] and targetMask) =  0) do inc(yu);
    79             while (yu < yd ) and ((Land[yu, x] and targetMask) =  0) do inc(yu);
    80 
    80 
    81             if (yd < LAND_HEIGHT - 1) and ((yd - yu) >= 16) then
    81             if (yd < LAND_HEIGHT - 1) and ((yd - yu) >= 16) then
    82                 begin
    82                 copyToXYFromRect(tmpsurf, Surface, x mod tmpsurf^.w, 16, 1, 16, x, yd - 15);
    83                 rr.x:= x;
       
    84                 rr.y:= yd - 15;
       
    85                 r.x:= x mod tmpsurf^.w;
       
    86                 r.y:= 16;
       
    87                 r.w:= 1;
       
    88                 r.h:= 16;
       
    89                 SDL_UpperBlit(tmpsurf, @r, Surface, @rr);
       
    90                 end;
       
    91             if (yu > 0) then
    83             if (yu > 0) then
    92                 begin
    84                 copyToXYFromRect(tmpsurf, Surface, x mod tmpsurf^.w, 0, 1, Min(16, yd - yu + 1), x, yu);
    93                 rr.x:= x;
       
    94                 rr.y:= yu;
       
    95                 r.x:= x mod tmpsurf^.w;
       
    96                 r.y:= 0;
       
    97                 r.w:= 1;
       
    98                 r.h:= Min(16, yd - yu + 1);
       
    99                 SDL_UpperBlit(tmpsurf, @r, Surface, @rr);
       
   100                 end;
       
   101             yd:= yu - 1;
    85             yd:= yu - 1;
   102         until yd < 0;
    86         until yd < 0;
   103     end;
    87     end;
   104     SDL_FreeSurface(tmpsurf);
    88     SDL_FreeSurface(tmpsurf);
   105 end;
    89 end;