Replicate target sprite properly in world wrap
authorWuzzy <Wuzzy2@mail.ru>
Wed, 08 Aug 2018 11:40:00 +0200
changeset 13636 fc8c8910a281
parent 13635 571f8110957e
child 13637 28e4a9db4690
Replicate target sprite properly in world wrap
hedgewars/uWorld.pas
--- a/hedgewars/uWorld.pas	Wed Aug 08 11:26:33 2018 +0200
+++ b/hedgewars/uWorld.pas	Wed Aug 08 11:40:00 2018 +0200
@@ -1403,19 +1403,32 @@
 
     DrawVisualGears(3, false);
 
-{$WARNINGS OFF}
 // Target
 if (TargetPoint.X <> NoPointX) and (CurrentTeam <> nil) and (CurrentHedgehog <> nil) then
     begin
     with PHedgehog(CurrentHedgehog)^ do
         begin
         if CurAmmoType = amBee then
-            DrawSpriteRotatedF(sprTargetBee, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
+            spr:= sprTargetBee
         else
-            DrawSpriteRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
-        end
+            spr:= sprTargetP;
+        if replicateToLeft then
+            begin
+            ShiftWorld(-1);
+            DrawSpriteRotatedF(spr, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360);
+            UnshiftWorld();
+            end;
+
+        if replicateToRight then
+            begin
+            ShiftWorld(1);
+            DrawSpriteRotatedF(spr, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360);
+            UnshiftWorld();
+            end;
+
+        DrawSpriteRotatedF(spr, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360);
+        end;
     end;
-{$WARNINGS ON}
 
 RenderWorldEdge();