hedgewars/uLandGenPerlin.pas
changeset 10510 9329dab04490
parent 10494 0eb97cf4c78e
child 10702 528d899443ab
equal deleted inserted replaced
10509:d62d3c706947 10510:9329dab04490
    13     , uUtils
    13     , uUtils
    14     ;
    14     ;
    15 
    15 
    16 var p: array[0..511] of LongInt;
    16 var p: array[0..511] of LongInt;
    17 
    17 
    18 const fadear: array[byte] of LongInt = 
    18 const fadear: array[byte] of LongInt =
    19 (0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 3, 4, 6, 7, 9, 10, 12,
    19 (0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 3, 4, 6, 7, 9, 10, 12,
    20 14, 17, 19, 22, 25, 29, 32, 36, 40, 45, 49, 54, 60, 65, 71,
    20 14, 17, 19, 22, 25, 29, 32, 36, 40, 45, 49, 54, 60, 65, 71,
    21 77, 84, 91, 98, 105, 113, 121, 130, 139, 148, 158, 167, 178,
    21 77, 84, 91, 98, 105, 113, 121, 130, 139, 148, 158, 167, 178,
    22 188, 199, 211, 222, 234, 247, 259, 273, 286, 300, 314, 329, 344,
    22 188, 199, 211, 222, 234, 247, 259, 273, 286, 300, 314, 329, 344,
    23 359, 374, 390, 407, 424, 441, 458, 476, 494, 512, 531, 550,
    23 359, 374, 390, 407, 424, 441, 458, 476, 494, 512, 531, 550,
    42 function fade(t: LongInt) : LongInt; inline;
    42 function fade(t: LongInt) : LongInt; inline;
    43 var t0, t1: LongInt;
    43 var t0, t1: LongInt;
    44 begin
    44 begin
    45     t0:= fadear[t shr 8];
    45     t0:= fadear[t shr 8];
    46 
    46 
    47     if t0 = fadear[255] then 
    47     if t0 = fadear[255] then
    48         t1:= t0
    48         t1:= t0
    49     else
    49     else
    50         t1:= fadear[t shr 8 + 1];
    50         t1:= fadear[t shr 8 + 1];
    51 
    51 
    52     fade:= t0 + ((t and 255) * (t1 - t0) shr 8)
    52     fade:= t0 + ((t and 255) * (t1 - t0) shr 8)
   174             if r < rCutoff then
   174             if r < rCutoff then
   175                 Land[y, x]:= 0
   175                 Land[y, x]:= 0
   176             else if param1 = 0 then
   176             else if param1 = 0 then
   177                 Land[y, x]:= lfObjMask
   177                 Land[y, x]:= lfObjMask
   178             else
   178             else
   179                 Land[y, x]:= lfBasic 
   179                 Land[y, x]:= lfBasic
   180         end;
   180         end;
   181     end;
   181     end;
   182 
   182 
   183     if param1 = 0 then
   183     if param1 = 0 then
   184         begin
   184         begin