Now blow torch angle can be changed during blowing :)
authorunc0rr
Sun, 17 Dec 2006 18:40:04 +0000
changeset 303 1659c4aad5ab
parent 302 7aca131ecd7f
child 304 8096e69e839e
Now blow torch angle can be changed during blowing :)
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Sun Dec 17 17:55:41 2006 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Dec 17 18:40:04 2006 +0000
@@ -425,21 +425,26 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-procedure doStepBlowTorch(Gear: PGear);
+procedure doStepBlowTorchWork(Gear: PGear);
 var HHGear: PGear;
 begin
 AllInactive:= false;
 dec(Gear.Timer);
 HHGear:= PHedgehog(Gear.Hedgehog).Gear;
+
+HedgehogChAngle(HHGear);
+
 if Gear.Timer mod cHHStepTicks = 0 then
    begin
-   DrawTunnel(HHGear.X, HHGear.Y - 1, Gear.dX, 0, cHHRadius * 2, cHHRadius * 2);
-   HHGear.State:= HHGear.State and not gstAttacking;
-   if Gear.dX < 0 then HHGear.Message:= gm_Left
-                  else HHGear.Message:= gm_Right;
+   DrawTunnel(HHGear.X, HHGear.Y - 3,
+              Gear.dX, Cos(HHGear.Angle*pi/cMaxAngle) * (-0.5),
+              cHHRadius * 3, cHHRadius * 2 + 4);
+   if Gear.dX < 0 then HHGear.Message:= (HHGear.Message or gm_Left) and not gm_Right
+                  else HHGear.Message:= (HHGear.Message or gm_Right) and not gm_Left;
    HedgehogStep(HHGear);
    if (HHGear.State and gstFalling) <> 0 then Gear.Timer:= 0
    end;
+   
 if Gear.Timer = 0 then
    begin
    HHGear.Message:= 0;
@@ -448,6 +453,14 @@
    end
 end;
 
+procedure doStepBlowTorch(Gear: PGear);
+var HHGear: PGear;
+begin
+HHGear:= PHedgehog(Gear.Hedgehog).Gear;
+HHGear.State:= HHGear.State and not gstAttacking;
+Gear.doStep:= doStepBlowTorchWork
+end;
+
 ////////////////////////////////////////////////////////////////////////////////
 
 procedure doStepRopeWork(Gear: PGear);
--- 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;
--- a/hedgewars/uGears.pas	Sun Dec 17 17:55:41 2006 +0000
+++ b/hedgewars/uGears.pas	Sun Dec 17 18:40:04 2006 +0000
@@ -87,6 +87,7 @@
 procedure AfterAttack; forward;
 procedure FindPlace(Gear: PGear; withFall: boolean; Left, Right: integer); forward;
 procedure HedgehogStep(Gear: PGear); forward;
+procedure HedgehogChAngle(Gear: PGear); forward;
 
 {$INCLUDE GSHandlers.inc}
 {$INCLUDE HHHandlers.inc}
@@ -265,7 +266,7 @@
                 Result.Radius:= 10;
                 end;
    gtBlowTorch: begin
-                Result.Timer:= 6000;
+                Result.Timer:= 7500;
                 end;
      end;
 InsertGearToList(Result)