hedgewars/uLand.pas
changeset 89 f9db56409a86
parent 80 3c3dc6a148ca
child 102 c45643d3fd78
equal deleted inserted replaced
88:6740a1c4edc9 89:f9db56409a86
    62            +inttostr(dig.LongWords[1])+':'+inttostr(dig.LongWords[2])+':'
    62            +inttostr(dig.LongWords[1])+':'+inttostr(dig.LongWords[2])+':'
    63            +inttostr(dig.LongWords[3])+':'+inttostr(dig.LongWords[4])+'}');
    63            +inttostr(dig.LongWords[3])+':'+inttostr(dig.LongWords[4])+'}');
    64 {$ENDIF}
    64 {$ENDIF}
    65 end;
    65 end;
    66 
    66 
    67 procedure DrawBezierEdge(var pa: TPixAr);
    67 procedure DrawBezierEdge(var pa: TPixAr; Color: Longword);
    68 var x, y, i: integer;
    68 var x, y, i: integer;
    69     tx, ty, vx, vy, vlen, t: real;
    69     tx, ty, vx, vy, vlen, t: real;
    70     r1, r2, r3, r4: real;
    70     r1, r2, r3, r4: real;
    71     x1, y1, x2, y2, cx1, cy1, cx2, cy2, tsq, tcb: real;
    71     x1, y1, x2, y2, cx1, cy1, cx2, cy2, tsq, tcb: real;
    72 begin
    72 begin
   119           r3:= (          3*tsq - 3*tcb) * cy2;
   119           r3:= (          3*tsq - 3*tcb) * cy2;
   120           r4:= (                    tcb) * y2;
   120           r4:= (                    tcb) * y2;
   121           Y:= round(r1 + r2 + r3 + r4);
   121           Y:= round(r1 + r2 + r3 + r4);
   122           t:= t + 0.001;
   122           t:= t + 0.001;
   123           if ((x and $FFFFF800) = 0) and ((y and $FFFFFC00) = 0) then
   123           if ((x and $FFFFF800) = 0) and ((y and $FFFFFC00) = 0) then
   124                 Land[y, x]:= 0;
   124                 Land[y, x]:= Color;
   125           end;
   125           end;
   126     end;
   126     end;
   127 end;
   127 end;
   128 
   128 
   129 procedure BezierizeEdge(var pa: TPixAr; Delta: real);
   129 procedure BezierizeEdge(var pa: TPixAr; Delta: real);
   448      for i:= 1 to BezPassCnt do
   448      for i:= 1 to BezPassCnt do
   449          BezierizeEdge(pa, 0.33333334);
   449          BezierizeEdge(pa, 0.33333334);
   450 
   450 
   451      PointWave(Template, pa);
   451      PointWave(Template, pa);
   452      NormalizePoints(pa);
   452      NormalizePoints(pa);
   453      DrawBezierEdge(pa);
   453      DrawBezierEdge(pa, 0);
   454 
   454 
   455      for i:= 0 to pred(FillPointsCount) do
   455      for i:= 0 to pred(FillPointsCount) do
   456          with FillPoints^[i] do
   456          with FillPoints^[i] do
   457               FillLand(x, y)
   457               FillLand(x, y);
       
   458 
       
   459      DrawBezierEdge(pa, COLOR_LAND);
   458      end;
   460      end;
   459 end;
   461 end;
   460 
   462 
   461 procedure GenLandSurface;
   463 procedure GenLandSurface;
   462 var tmpsurf: PSDL_Surface;
   464 var tmpsurf: PSDL_Surface;