hedgewars/uGears.pas
changeset 3161 cb5f04cc9d76
parent 3149 08c4d9670b54
child 3165 3ec07a7d8456
equal deleted inserted replaced
3160:f2a3d861b23a 3161:cb5f04cc9d76
  1609 end;
  1609 end;
  1610 
  1610 
  1611 procedure DrawGears;
  1611 procedure DrawGears;
  1612 var Gear, HHGear: PGear;
  1612 var Gear, HHGear: PGear;
  1613     i: Longword;
  1613     i: Longword;
       
  1614     startX, endX, startY, endY: LongInt;
  1614 begin
  1615 begin
  1615 Gear:= GearsList;
  1616 Gear:= GearsList;
  1616 while Gear<>nil do
  1617 while Gear<>nil do
  1617     begin
  1618     begin
  1618     case Gear^.Kind of
  1619     case Gear^.Kind of
  1715       gtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State);
  1716       gtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State);
  1716            gtBirdy: begin
  1717            gtBirdy: begin
  1717                     if Gear^.State and gstAnimation = gstAnimation then
  1718                     if Gear^.State and gstAnimation = gstAnimation then
  1718                         begin
  1719                         begin
  1719                         if Gear^.State and gstTmpFlag = 0 then // Appearing
  1720                         if Gear^.State and gstTmpFlag = 0 then // Appearing
  1720                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, hwRound(Gear^.X) + WorldDx + hwRound(Gear^.dX) - trunc(hwRound(Gear^.dX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1)), hwRound(Gear^.Y) + WorldDy + hwRound(Gear^.dY) - trunc(hwRound(Gear^.dY) * sqrt(1 - power((LongInt(Gear^.Timer)/2000)-1, 2))), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75)
  1721                             begin
       
  1722                             endX:= hwRound(Gear^.X);
       
  1723                             endY:= hwRound(Gear^.Y);
       
  1724                             if Gear^.Tag < 0 then
       
  1725                                 startX:= max(LAND_WIDTH + 1024, endX + 2048)
       
  1726                             else
       
  1727                                 startX:= max(-LAND_WIDTH - 1024, endX - 2048);
       
  1728                             startY:= endY - 256;
       
  1729                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + trunc((endX - startX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1)), startY + WorldDy + trunc((endY - startY) * sqrt(1 - power((LongInt(Gear^.Timer)/2000)-1, 2))), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
       
  1730                             end
  1721                         else // Disappearing
  1731                         else // Disappearing
  1722                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, hwRound(Gear^.X) + WorldDx + hwRound(Gear^.dX) - trunc(hwRound(Gear^.dX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1))), hwRound(Gear^.Y) + WorldDy + hwRound(Gear^.dY) - trunc(-hwRound(Gear^.dY) * cos(LongInt(Gear^.Timer)/2000 * (Pi/2)) + hwRound(Gear^.dY)), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
  1732                             begin
       
  1733                             startX:= hwRound(Gear^.X);
       
  1734                             startY:= hwRound(Gear^.Y);
       
  1735                             if Gear^.Tag > 0 then
       
  1736                                 endX:= max(LAND_WIDTH + 1024, startX + 2048)
       
  1737                             else
       
  1738                                 endX:= max(-LAND_WIDTH - 1024, startX - 2048);
       
  1739                             endY:= startY + 256;
       
  1740                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + trunc((endX - startX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1))) + hwRound(Gear^.dX * Gear^.Timer), startY + WorldDy + trunc((endY - startY) * cos(LongInt(Gear^.Timer)/2000 * (Pi/2)) - (endY - startY)) + hwRound(Gear^.dY * Gear^.Timer), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
       
  1741                             end;
  1723                         end
  1742                         end
  1724                     else
  1743                     else
  1725                         DrawTextureF(SpritesData[sprBirdy].Texture, 1, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
  1744                         DrawTextureF(SpritesData[sprBirdy].Texture, 1, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
  1726                     end;
  1745                     end;
  1727     gtBigExplosion: begin
  1746     gtBigExplosion: begin