hedgewars/uVisualGearsHandlers.pas
changeset 10625 125e120165aa
parent 10624 05bb44f4d92f
child 10731 bc359abe0484
--- a/hedgewars/uVisualGearsHandlers.pas	Thu Dec 04 11:19:38 2014 -0500
+++ b/hedgewars/uVisualGearsHandlers.pas	Thu Dec 04 20:15:03 2014 +0100
@@ -80,35 +80,41 @@
 procedure doStepFlake(Gear: PVisualGear; Steps: Longword);
 var sign: real;
     moved: boolean;
+    vfc, vft: LongWord;
 begin
 if vobCount = 0 then exit;
 
 sign:= 1;
 with Gear^ do
     begin
-    if vobFrameTicks < 1000000 then
+
+    X:= X + (cWindSpeedf * 400 + dX + tdX) * Steps * Gear^.Scale;
+
+    if SuddenDeathDmg then
+        begin
+        Y:= Y + (dY + tdY + cGravityf * vobSDFallSpeed) * Steps * Gear^.Scale;
+        vfc:= vobSDFramesCount;
+        vft:= vobSDFrameTicks;
+        end
+    else
+        begin
+        Y:= Y + (dY + tdY + cGravityf * vobFallSpeed) * Steps * Gear^.Scale;
+        vfc:= vobFramesCount;
+        vft:= vobFrameTicks;
+        end;
+
+    if vft > 0 then
         begin
         inc(FrameTicks, Steps);
-        if not SuddenDeathDmg and (FrameTicks > vobFrameTicks) then
+        if FrameTicks > vft then
             begin
-            dec(FrameTicks, vobFrameTicks);
+            dec(FrameTicks, vft);
             inc(Frame);
-            if Frame = vobFramesCount then
-                Frame:= 0
-            end
-        else if SuddenDeathDmg and (FrameTicks > vobSDFrameTicks) then
-            begin
-            dec(FrameTicks, vobSDFrameTicks);
-            inc(Frame);
-            if Frame = vobSDFramesCount then
+            if Frame = vfc then
                 Frame:= 0
             end;
         end;
-    X:= X + (cWindSpeedf * 400 + dX + tdX) * Steps * Gear^.Scale;
-    if SuddenDeathDmg then
-        Y:= Y + (dY + tdY + cGravityf * vobSDFallSpeed) * Steps * Gear^.Scale
-    else
-        Y:= Y + (dY + tdY + cGravityf * vobFallSpeed) * Steps * Gear^.Scale;
+
     Angle:= Angle + dAngle * Steps;
     if Angle > 360 then
         Angle:= Angle - 360