Destroy rope when attempting to shoot it through wrap / bouncy world edge
authorWuzzy <almikes@aol.com>
Thu, 05 Oct 2017 02:54:17 +0200
changeset 12656 5e115ed19e27
parent 12655 eaf719616c7b
child 12657 31c4a81823eb
Destroy rope when attempting to shoot it through wrap / bouncy world edge This fixes a variety of graphical glitches
ChangeLog.txt
hedgewars/uGearsHandlersRope.pas
--- a/ChangeLog.txt	Thu Oct 05 02:02:28 2017 +0200
+++ b/ChangeLog.txt	Thu Oct 05 02:54:17 2017 +0200
@@ -35,6 +35,7 @@
  * Fixed screenshots being too bright if taken in quick succession
  * Video recording functionality is restored
  * Fixed bee not being affected by wrap world edge while still being thrown
+ * Rope is now destroyed when attempting to shoot it through wrap or bouncy world edge
  * Fixed turn not ending when sticky mine was trapped on rubberband
  * Fixed sniper rifle disabling laser sight utility after using
  * Fixed hedgehog-voices missing a response type (Justyouwait/"You're gonna pay for that") on some platforms (e.g. Linux)
--- a/hedgewars/uGearsHandlersRope.pas	Thu Oct 05 02:02:28 2017 +0200
+++ b/hedgewars/uGearsHandlersRope.pas	Thu Oct 05 02:54:17 2017 +0200
@@ -441,6 +441,17 @@
         end
     else if not CurrentTeam^.ExtDriven and (FollowGear <> nil) then FollowGear := HHGear;
 
+    // Destroy rope if it touched bouncy or world wrap world edge.
+    // TODO: Allow to shoot rope through the world wrap edge and rope normally.
+    if (WorldWrap(Gear) and (WorldEdge = weWrap)) or
+       ((WorldEdge = weBounce) and ((hwRound(Gear^.X) <= LeftX) or (hwRound(Gear^.X) >= RightX))) then
+        begin
+        HHGear^.State := HHGear^.State and (not (gstAttacking or gstHHJumping or gstHHHJump));
+        HHGear^.Message := HHGear^.Message and (not gmAttack);
+        DeleteGear(Gear);
+        exit()
+        end;
+
     DeleteCI(HHGear);
 
     if (HHGear^.State and gstMoving) <> 0 then