- Many fixes related to hh switcher
authorunc0rr
Mon, 11 Jun 2007 15:52:32 +0000
changeset 540 b06c5aace2fa
parent 539 6a9bf1852bbc
child 541 bc7be7f6d3e8
- Many fixes related to hh switcher
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uGears.pas
hedgewars/uTeams.pas
--- a/hedgewars/GSHandlers.inc	Thu Jun 07 18:09:54 2007 +0000
+++ b/hedgewars/GSHandlers.inc	Mon Jun 11 15:52:32 2007 +0000
@@ -1172,7 +1172,7 @@
 begin
 AllInactive:= false;
 
-if (Gear^.Message and not gm_Switch) <> 0 then
+if ((Gear^.Message and not gm_Switch) <> 0) or (TurnTimeLeft = 0) then
    begin
    HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
    Msg:= Gear^.Message and not gm_Switch;
--- a/hedgewars/HHHandlers.inc	Thu Jun 07 18:09:54 2007 +0000
+++ b/hedgewars/HHHandlers.inc	Mon Jun 11 15:52:32 2007 +0000
@@ -264,15 +264,17 @@
    Gear^.State:= Gear^.State or gstFalling or gstMoving;
    Gear^.dY:= Gear^.dY + cGravity
    end else
-   if (not Gear^.dY.isNegative) then
    begin
-   CheckHHDamage(Gear);
    if ((hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) < _0_55)
       and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX);
 
-   Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping or gstHHHJump);
+   if not Gear^.dY.isNegative then
+      begin
+      CheckHHDamage(Gear);
+      Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping or gstHHHJump);
+      Gear^.dY:= _0;
+      end else Gear^.dY:= Gear^.dY + cGravity;
 
-   if Gear^.dY > _0 then Gear^.dY:= _0;
    if ((Gear^.State and gstMoving) <> 0) then Gear^.dX:= Gear^.dX * Gear^.Friction
    end;
 
@@ -374,7 +376,6 @@
          end;
    Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
 
-
    if ((Gear^.State and gstHHJumping) <> 0) and
       TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX);
 
--- a/hedgewars/uGears.pas	Thu Jun 07 18:09:54 2007 +0000
+++ b/hedgewars/uGears.pas	Mon Jun 11 15:52:32 2007 +0000
@@ -288,6 +288,9 @@
                 Result^.Timer:= 1100;
                 Result^.Z:= 2000;
                 end;
+    gtSwitcher: begin
+                Result^.Z:= cCurrHHZ
+                end;
      end;
 InsertGearToList(Result);
 AddGear:= Result
--- a/hedgewars/uTeams.pas	Thu Jun 07 18:09:54 2007 +0000
+++ b/hedgewars/uTeams.pas	Mon Jun 11 15:52:32 2007 +0000
@@ -131,6 +131,7 @@
 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do
      if Gear <> nil then
         begin
+        AttacksNum:= 0;
         Gear^.Message:= 0;
         Gear^.Z:= cHHZ;
         RemoveGearFromList(Gear);
@@ -150,7 +151,6 @@
 
 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do
      begin
-     AttacksNum:= 0;
      with Gear^ do
           begin
           Z:= cCurrHHZ;