Clear gstAnimation and reset Timer before entering death animation
authornemo
Tue, 20 Sep 2011 13:27:07 -0400
changeset 5972 add1cae1add6
parent 5971 44b063166bb2
child 5973 94abd65e7d4f
Clear gstAnimation and reset Timer before entering death animation
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
--- a/hedgewars/GSHandlers.inc	Tue Sep 20 12:59:02 2011 -0400
+++ b/hedgewars/GSHandlers.inc	Tue Sep 20 13:27:07 2011 -0400
@@ -5126,16 +5126,14 @@
 if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then 
     begin
     inc(Gear^.Power);
-    if (Gear^.Power = 172) and (Gear^.Hedgehog^.Gear <> nil) and ((Gear^.Hedgehog^.Gear^.State and gstHHDeath) = 0) then
-        begin
+    if (Gear^.Power = 172) and (Gear^.Hedgehog^.Gear <> nil) then
         with Gear^.Hedgehog^.Gear^ do
             begin
-	    State:= State or gstAnimation;
-	    Tag:= 2;
-	    Timer:= 0;
-	    Pos:= 0
+	        State:= State or gstAnimation;
+	        Tag:= 2;
+	        Timer:= 0;
+	        Pos:= 0
             end
-        end
     end;
 if (Gear^.Pos = 3) and (GameTicks and $1F = 0) and (Gear^.Power > 0) then dec(Gear^.Power);
 if (Gear^.Pos = 1) and (Gear^.Power = 255) and ((GameTicks mod 2000) = 1000) then Gear^.Pos:= 2;
--- a/hedgewars/HHHandlers.inc	Tue Sep 20 12:59:02 2011 -0400
+++ b/hedgewars/HHHandlers.inc	Tue Sep 20 13:27:07 2011 -0400
@@ -482,15 +482,16 @@
     AllInactive:= false;
     dec(Gear^.Timer);
     if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos)
-    end else
-if Gear^.Timer = 1 then
+    end 
+else if Gear^.Timer = 1 then
     begin
     Gear^.State:= Gear^.State or gstNoDamage;
     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, CurrentHedgehog, EXPLAutoSound);
     AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
     DeleteGear(Gear);
     SetAllToActive
-    end else // Gear^.Timer = 0
+    end 
+else // Gear^.Timer = 0
     begin
     AllInactive:= false;
     Gear^.Z:= cCurrHHZ;
@@ -1043,12 +1044,14 @@
             Gear^.Hedgehog^.Effects[hePoisoned] := false;
             if Gear^.Hedgehog^.Effects[heResurrectable] then begin
                 ResurrectHedgehog(Gear);
-            end else begin
-                Gear^.State:= Gear^.State or gstHHDeath;
+            end else 
+                begin
+                Gear^.State:= (Gear^.State or gstHHDeath) and not gstAnimation;
+                Gear^.Timer:= 0;
                 Gear^.doStep:= @doStepHedgehogDead;
                 // Death message
                 AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
-            end;
+                end;
             end
         else
             begin