hedgewars/uGearsRender.pas
changeset 6508 bf5db4517148
parent 6490 531bf083e8db
child 6580 6155187bf599
equal deleted inserted replaced
6507:e462a57f432e 6508:bf5db4517148
    72     //glDisable(GL_LINE_SMOOTH)
    72     //glDisable(GL_LINE_SMOOTH)
    73     end
    73     end
    74 end;
    74 end;
    75 
    75 
    76 
    76 
    77 procedure DrawRopeLine(X1, Y1, X2, Y2, roplen: LongInt);
    77 function DrawRopeLine(X1, Y1, X2, Y2, roplen: LongInt): LongInt;
    78 var  eX, eY, dX, dY: LongInt;
    78 var  eX, eY, dX, dY: LongInt;
    79     i, sX, sY, x, y, d: LongInt;
    79     i, sX, sY, x, y, d: LongInt;
    80     b: boolean;
    80     b: boolean;
    81 begin
    81 begin
    82     if (X1 = X2) and (Y1 = Y2) then
    82     if (X1 = X2) and (Y1 = Y2) then
   133         if b then
   133         if b then
   134             begin
   134             begin
   135             inc(roplen);
   135             inc(roplen);
   136             if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0)
   136             if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0)
   137             end
   137             end
   138     end
   138     end;
       
   139 DrawRopeLine:= roplen;
   139 end;
   140 end;
   140 
   141 
   141 procedure DrawRope(Gear: PGear);
   142 procedure DrawRope(Gear: PGear);
   142 var roplen: LongInt;
   143 var roplen: LongInt;
   143     i: Longword;
   144     i: Longword;
   150         if RopePoints.Count > 0 then
   151         if RopePoints.Count > 0 then
   151             begin
   152             begin
   152             i:= 0;
   153             i:= 0;
   153             while i < Pred(RopePoints.Count) do
   154             while i < Pred(RopePoints.Count) do
   154                     begin
   155                     begin
   155                     DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
   156                     roplen:= DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
   156                                 hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy, roplen);
   157                                 hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy, roplen);
   157                     inc(i)
   158                     inc(i)
   158                     end;
   159                     end;
   159             DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
   160             roplen:= DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
   160                         hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, roplen);
   161                         hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, roplen);
   161             DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   162             roplen:= DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   162                         hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen);
   163                         hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen);
   163             end else
   164             end else
   164             if Gear^.Elasticity.QWordValue > 0 then
   165             if Gear^.Elasticity.QWordValue > 0 then
   165             DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   166             roplen:= DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   166                         hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen);
   167                         hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen);
   167         end;
   168         end;
   168 
   169 
   169 
   170 
   170 if RopePoints.Count > 0 then
   171 if RopePoints.Count > 0 then