hedgewars/uLandTexture.pas
branchtransitional_engine
changeset 15901 f39f0f614dbf
parent 15900 128ace913837
equal deleted inserted replaced
15900:128ace913837 15901:f39f0f614dbf
    48 
    48 
    49 function Pixels(x, y: Longword): Pointer;
    49 function Pixels(x, y: Longword): Pointer;
    50 var ty: Longword;
    50 var ty: Longword;
    51 begin
    51 begin
    52 for ty:= 0 to TEXSIZE - 1 do
    52 for ty:= 0 to TEXSIZE - 1 do
    53     Move(LandPixels[y * TEXSIZE + ty, x * TEXSIZE], tmpPixels[ty, 0], sizeof(Longword) * TEXSIZE);
    53     Move(LandPixelRow(y * TEXSIZE + ty)^[x * TEXSIZE], tmpPixels[ty, 0], sizeof(Longword) * TEXSIZE);
    54 
    54 
    55 Pixels:= @tmpPixels
    55 Pixels:= @tmpPixels
    56 end;
    56 end;
    57 
    57 
    58 function Pixels2(x, y: Longword): Pointer;
    58 function Pixels2(x, y: Longword): Pointer;
   127                     ly:= y * TEXSIZE;
   127                     ly:= y * TEXSIZE;
   128                     lx:= x * TEXSIZE;
   128                     lx:= x * TEXSIZE;
   129                     // first check edges
   129                     // first check edges
   130                     while isEmpty and (ty < TEXSIZE) do
   130                     while isEmpty and (ty < TEXSIZE) do
   131                         begin
   131                         begin
   132                         isEmpty:= LandPixels[ly + ty, lx] and AMask = 0;
   132                         isEmpty:= LandPixelGet(ly + ty, lx) and AMask = 0;
   133                         if isEmpty then isEmpty:= LandPixels[ly + ty, Pred(lx + TEXSIZE)] and AMask = 0;
   133                         if isEmpty then isEmpty:= LandPixelGet(ly + ty, Pred(lx + TEXSIZE)) and AMask = 0;
   134                         inc(ty)
   134                         inc(ty)
   135                         end;
   135                         end;
   136                     while isEmpty and (tx < TEXSIZE-1) do
   136                     while isEmpty and (tx < TEXSIZE-1) do
   137                         begin
   137                         begin
   138                         isEmpty:= LandPixels[ly, lx + tx] and AMask = 0;
   138                         isEmpty:= LandPixelGet(ly, lx + tx) and AMask = 0;
   139                         if isEmpty then isEmpty:= LandPixels[Pred(ly + TEXSIZE), lx + tx] and AMask = 0;
   139                         if isEmpty then isEmpty:= LandPixelGet(Pred(ly + TEXSIZE), lx + tx) and AMask = 0;
   140                         inc(tx)
   140                         inc(tx)
   141                         end;
   141                         end;
   142                     // then search every other remaining. does this sort of stuff defeat compiler opts?
   142                     // then search every other remaining. does this sort of stuff defeat compiler opts?
   143                     ty:= 2;
   143                     ty:= 2;
   144                     while isEmpty and (ty < TEXSIZE-1) do
   144                     while isEmpty and (ty < TEXSIZE-1) do
   145                         begin
   145                         begin
   146                         tx:= 2;
   146                         tx:= 2;
   147                         while isEmpty and (tx < TEXSIZE-1) do
   147                         while isEmpty and (tx < TEXSIZE-1) do
   148                             begin
   148                             begin
   149                             isEmpty:= LandPixels[ly + ty, lx + tx] and AMask = 0;
   149                             isEmpty:= LandPixelGet(ly + ty, lx + tx) and AMask = 0;
   150                             inc(tx,2)
   150                             inc(tx,2)
   151                             end;
   151                             end;
   152                         inc(ty,2);
   152                         inc(ty,2);
   153                         end;
   153                         end;
   154                     // and repeat
   154                     // and repeat
   156                     while isEmpty and (ty < TEXSIZE-1) do
   156                     while isEmpty and (ty < TEXSIZE-1) do
   157                         begin
   157                         begin
   158                         tx:= 1;
   158                         tx:= 1;
   159                         while isEmpty and (tx < TEXSIZE-1) do
   159                         while isEmpty and (tx < TEXSIZE-1) do
   160                             begin
   160                             begin
   161                             isEmpty:= LandPixels[ly + ty, lx + tx] and AMask = 0;
   161                             isEmpty:= LandPixelGet(ly + ty, lx + tx) and AMask = 0;
   162                             inc(tx,2)
   162                             inc(tx,2)
   163                             end;
   163                             end;
   164                         inc(ty,2);
   164                         inc(ty,2);
   165                         end;
   165                         end;
   166                     if not isEmpty then
   166                     if not isEmpty then