Remove parachute early if hog is inside land
authorWuzzy <Wuzzy2@mail.ru>
Sat, 30 Nov 2019 02:54:49 +0100
changeset 15509 6ddfde71ba6a
parent 15508 dfdd0db89760
child 15516 b907b9071ec5
Remove parachute early if hog is inside land Fixes a bug: When you used parachute right after using a parachute to dig inside land, you might become stuck. Reported here: https://hedgewars.org/node/9035
ChangeLog.txt
hedgewars/uGearsHandlersMess.pas
--- a/ChangeLog.txt	Tue Nov 19 08:35:32 2019 -0500
+++ b/ChangeLog.txt	Sat Nov 30 02:54:49 2019 +0100
@@ -9,6 +9,7 @@
  * Racer: Resize waypoints in custom-sized drawn maps
  * A Space Adventure: The First Stop: Fix broken victory condition when eliminating minions
  * A Space Adventure: Killing the Specialists: Don't award player health if enemy hurts itself
+ * Fix hog getting stuck when opening parachute right after a shoryuken digging through land
 
 Lua:
  + Add RopeKnocking library
--- a/hedgewars/uGearsHandlersMess.pas	Tue Nov 19 08:35:32 2019 -0500
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Nov 30 02:54:49 2019 +0100
@@ -3091,6 +3091,16 @@
 
     AfterAttack;
 
+    // Delete parachute early if hog already collides
+    if (TestCollisionXwithGear(HHGear, -1) <> 0) and (TestCollisionXwithGear(HHGear, 1) <> 0) then
+        begin
+        HHGear^.dY := cGravity * 100;
+        isCursorVisible:= false;
+        ApplyAmmoChanges(HHGear^.Hedgehog^);
+        DeleteGear(Gear);
+        exit;
+        end;
+
     // make sure hog doesn't end up facing in wrong direction due to high jump
     if (HHGear^.State and gstHHHJump) <> 0 then
         HHGear^.dX.isNegative := (not HHGear^.dX.isNegative);