Fix collecting cases after teleportation
authorunc0rr
Thu, 08 May 2008 14:06:44 +0000
changeset 912 acab672fb1aa
parent 911 b709fe13ed69
child 913 a86f8af21b94
Fix collecting cases after teleportation
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Thu May 08 13:55:14 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Thu May 08 14:06:44 2008 +0000
@@ -1188,6 +1188,19 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepTeleportAfter(Gear: PGear);
+var HHGear: PGear;
+begin
+HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+HHGear^.Y:= HHGear^.Y + HHGear^.dY; // hedgehog falling to collect cases
+HHGear^.dY:= HHGear^.dY + cGravity;
+if TestCollisionYwithGear(HHGear, 1) then
+   begin
+   DeleteGear(Gear);
+   AfterAttack
+   end
+end;
+
+procedure doStepTeleportAnim(Gear: PGear);
 begin
 inc(Gear^.Timer);
 if Gear^.Timer = 65 then
@@ -1195,10 +1208,7 @@
 	Gear^.Timer:= 0;
 	inc(Gear^.Pos);
 	if Gear^.Pos = 11 then
-		begin
-		DeleteGear(Gear);
-		AfterAttack
-		end
+		Gear^.doStep:= @doStepTeleportAfter
 	end
 end;
 
@@ -1221,7 +1231,7 @@
 	else begin
 		DeleteCI(HHGear);
 		SetAllHHToActive;
-		Gear^.doStep:= @doStepTeleportAfter;
+		Gear^.doStep:= @doStepTeleportAnim;
 		Gear^.X:= HHGear^.X;
 		Gear^.Y:= HHGear^.Y;
 		HHGear^.X:= int2hwFloat(TargetPoint.X);