# HG changeset patch # User nemo # Date 1332007331 14400 # Node ID 88036f0e0a9216d6387b27bb79678c90b85be826 # Parent 8a4cd042d1912c1bddc8dca2510829e20ff44c51 I think this is a little more efficient than dxdy, and easier to read. We call DxDy2 a lot, can any of those use Angle/DirAngle? diff -r 8a4cd042d191 -r 88036f0e0a92 hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Sat Mar 17 13:16:50 2012 -0400 +++ b/hedgewars/uGearsRender.pas Sat Mar 17 14:02:11 2012 -0400 @@ -908,6 +908,7 @@ var HHGear: PGear; i: Longword; + aAngle: real; startX, endX, startY, endY: LongInt; begin if Gear^.Target.X <> NoPointX then @@ -926,19 +927,12 @@ else DrawSprite(sprMolotov, x, y, 8); gtRCPlane: begin + aangle:= Gear^.Angle * 360 / 4096; + if Gear^.Tag < 0 then aangle:= 360-aangle; Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF); - if Gear^.Tag = -1 then - begin - DrawRotatedF(sprPlane, x, y, 0, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90); - Tint($FF, $FF, $FF, $FF); - DrawRotatedF(sprPlane, x, y, 1, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90) - end - else - begin - DrawRotatedF(sprPlane, x, y, 0, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); - Tint($FF, $FF, $FF, $FF); - DrawRotatedF(sprPlane, x, y, 1, 0, DxDy2Angle(Gear^.dY, Gear^.dX)) - end + DrawRotatedF(sprPlane, x, y, 0, Gear^.Tag, aangle - 90); + Tint($FF, $FF, $FF, $FF); + DrawRotatedF(sprPlane, x, y, 1, Gear^.Tag, aangle - 90) end; gtBall: DrawRotatedf(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle);