hedgewars/HHHandlers.inc
changeset 303 1659c4aad5ab
parent 302 7aca131ecd7f
child 304 8096e69e839e
--- a/hedgewars/HHHandlers.inc	Sun Dec 17 17:55:41 2006 +0000
+++ b/hedgewars/HHHandlers.inc	Sun Dec 17 18:40:04 2006 +0000
@@ -219,6 +219,14 @@
    end
 end;
 
+procedure HedgehogChAngle(Gear: PGear);
+begin
+if ((Gear.State and (gstMoving or gstFalling)) = 0) then
+   if (Gear.Message and gm_Up    )<>0 then if Gear.Angle > 0         then dec(Gear.Angle)
+   else else
+   if (Gear.Message and gm_Down  )<>0 then if Gear.Angle < cMaxAngle then inc(Gear.Angle);
+end;
+
 procedure doStepHedgehog(Gear: PGear); forward;
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepHedgehogDriven(Gear: PGear);
@@ -285,11 +293,7 @@
    exit
    end ;//else if Gear.CollIndex = High(Longword) then AddIntersectorsCR(Gear);
 
-   if ((Gear.State and (gstMoving or gstFalling)) = 0) then
-      if (Gear.Message and gm_Up    )<>0 then if Gear.Angle > 0         then dec(Gear.Angle)
-         else else
-      if (Gear.Message and gm_Down  )<>0 then if Gear.Angle < cMaxAngle then inc(Gear.Angle);
-
+   HedgehogChAngle(Gear);
    if StepTicks > 0 then dec(StepTicks);
    if (StepTicks = 0) then HedgehogStep(Gear)
 end;