anchor.diff:  
       R:=0; G:=0; B:=0;
   
  -    for j:=0 to 31 do for h:=0 to 31 do begin
  -      px:=((511-(ii*32+j))*512+kk*32+h)*4; //TGA comes flipped upside down
  +    for j:=0 to (SizeY div 16 - 1) do
  +    for h:=0 to (SizeX div 16 - 1) do
  +    begin
  +      px := (((SizeX-1)-(ii*(SizeY div 16)+j))*SizeX+kk*(SizeX div 16)+h)*4; //TGA comes flipped upside down
         inc(B, c[px+1]);
         inc(G, c[px+2]);
         inc(R, c[px+3]);
       end;
   
  -    px:=ii*16+kk+1;
  -
  -    TileMMColor[px].R:= round(R / 1024) ; //each tile is 32x32 px
  -    TileMMColor[px].G:= round(G / 1024) ;
  -    TileMMColor[px].B:= round(B / 1024) ;
  +    px := ii*16+kk+1;
  +
  +    TileMMColor[px].R:= round(R / (SizeY*SizeY div 256)) ; //each tile is 32x32 px
  +    TileMMColor[px].G:= round(G / (SizeY*SizeY div 256)) ;
  +    TileMMColor[px].B:= round(B / (SizeY*SizeY div 256)) ;
   
     end;
   end;
  
positive.code:   end
    else
    begin
      blockread(f,c[1],512*512*4);
      closefile(f);
    end;
  
  
negative.code:   assignfile(f,FileName);
    FileMode:=0; Reset(f,1); FileMode:=2; //Open ReadOnly
  
    setlength(c,18+1);
    blockread(f,c[1],18); //SizeOf(TGAHeader)
    SizeX := c[13]+c[14]*256;
    SizeY := c[15]+c[16]*256;
  
    setlength(c,SizeX*SizeY*4+1);
    if c[1]=120 then
    begin
      {$IFDEF VER140}
  