hedgewars/uGearsRender.pas
changeset 6788 88036f0e0a92
parent 6700 e04da46ee43c
child 6924 57b66ee3bff3
equal deleted inserted replaced
6787:8a4cd042d191 6788:88036f0e0a92
   906 
   906 
   907 procedure RenderGear(Gear: PGear; x, y: LongInt);
   907 procedure RenderGear(Gear: PGear; x, y: LongInt);
   908 var
   908 var
   909     HHGear: PGear;
   909     HHGear: PGear;
   910     i: Longword;
   910     i: Longword;
       
   911     aAngle: real;
   911     startX, endX, startY, endY: LongInt;
   912     startX, endX, startY, endY: LongInt;
   912 begin
   913 begin
   913     if Gear^.Target.X <> NoPointX then
   914     if Gear^.Target.X <> NoPointX then
   914         if Gear^.AmmoType = amBee then
   915         if Gear^.AmmoType = amBee then
   915             DrawRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
   916             DrawRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
   924        gtMolotov: if (Gear^.State and gstDrowning) = 0 then
   925        gtMolotov: if (Gear^.State and gstDrowning) = 0 then
   925                        DrawRotatedF(sprMolotov, x, y, (RealTicks div 125) mod 8, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX))
   926                        DrawRotatedF(sprMolotov, x, y, (RealTicks div 125) mod 8, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX))
   926                   else DrawSprite(sprMolotov, x, y, 8);
   927                   else DrawSprite(sprMolotov, x, y, 8);
   927 
   928 
   928        gtRCPlane: begin
   929        gtRCPlane: begin
       
   930                   aangle:= Gear^.Angle * 360 / 4096;
       
   931                   if Gear^.Tag < 0 then aangle:= 360-aangle;
   929                   Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF);
   932                   Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF);
   930                   if Gear^.Tag = -1 then
   933                   DrawRotatedF(sprPlane, x, y, 0, Gear^.Tag, aangle - 90);
   931                       begin
   934                   Tint($FF, $FF, $FF, $FF);
   932                       DrawRotatedF(sprPlane, x, y, 0, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90);
   935                   DrawRotatedF(sprPlane, x, y, 1, Gear^.Tag, aangle - 90)
   933                       Tint($FF, $FF, $FF, $FF);
       
   934                       DrawRotatedF(sprPlane, x, y, 1, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90)
       
   935                       end
       
   936                   else
       
   937                       begin
       
   938                       DrawRotatedF(sprPlane, x, y, 0, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
       
   939                       Tint($FF, $FF, $FF, $FF);
       
   940                       DrawRotatedF(sprPlane, x, y, 1, 0, DxDy2Angle(Gear^.dY, Gear^.dX))
       
   941                       end
       
   942                   end;
   936                   end;
   943        gtBall: DrawRotatedf(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle);
   937        gtBall: DrawRotatedf(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle);
   944 
   938 
   945        gtPortal: if ((Gear^.Tag and 1) = 0) // still moving?
   939        gtPortal: if ((Gear^.Tag and 1) = 0) // still moving?
   946                  or (Gear^.IntersectGear = nil) or (Gear^.IntersectGear^.IntersectGear <> Gear) // not linked&backlinked?
   940                  or (Gear^.IntersectGear = nil) or (Gear^.IntersectGear^.IntersectGear <> Gear) // not linked&backlinked?