Also shove using shotgun, switch off hat when not active hog
authornemo
Sun, 14 Oct 2012 20:24:08 -0400
changeset 7755 b8958e64e68d
parent 7754 e81dc9bef8b8
child 7756 b89bd0ffb8aa
Also shove using shotgun, switch off hat when not active hog
hedgewars/uGears.pas
hedgewars/uTeams.pas
--- a/hedgewars/uGears.pas	Sun Oct 14 13:35:15 2012 -0400
+++ b/hedgewars/uGears.pas	Sun Oct 14 20:24:08 2012 -0400
@@ -671,6 +671,7 @@
         gtHedgehog,
             gtMine,
             gtSMine,
+            gtKnife,
             gtCase,
             gtTarget,
             gtExplosives,
@@ -698,6 +699,7 @@
                         t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX);
                         t^.dY:= t^.dY + Gear^.dY * dmg * _0_01;
                         t^.State:= t^.State or gstMoving;
+                        if t^.Kind = gtKnife then t^.State:= t^.State and not gstCollision;
                         t^.Active:= true;
                         FollowGear:= t
                         end
--- a/hedgewars/uTeams.pas	Sun Oct 14 13:35:15 2012 -0400
+++ b/hedgewars/uTeams.pas	Sun Oct 14 20:24:08 2012 -0400
@@ -20,7 +20,7 @@
 
 unit uTeams;
 interface
-uses uConsts, uInputHandler, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound,
+uses uConsts, uInputHandler, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound, uStore,
      uTypes{$IFDEF USE_TOUCH_INTERFACE}, uWorld{$ENDIF};
 
 procedure initModule;
@@ -628,12 +628,16 @@
 var oldCI, newCI: boolean;
     oldHH: PHedgehog;
 begin
+   if (CurrentHedgehog <> nil) and (CurrentHedgehog^.CurAmmoType = amKnife) then
+       LoadHedgehogHat(CurrentHedgehog^, CurrentHedgehog^.Hat);
     oldCI:= (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.Gear^.CollisionIndex >= 0);
     newCI:= (newHog^.Gear <> nil) and (newHog^.Gear^.CollisionIndex >= 0);
     if oldCI then DeleteCI(CurrentHedgehog^.Gear);
     if newCI then DeleteCI(newHog^.Gear);
     oldHH:= CurrentHedgehog;
     CurrentHedgehog:= newHog;
+   if (CurrentHedgehog <> nil) and (CurrentHedgehog^.CurAmmoType = amKnife) then
+       LoadHedgehogHat(CurrentHedgehog^, 'Reserved/chef');
     if oldCI then AddGearCI(oldHH^.Gear);
     if newCI then AddGearCI(newHog^.Gear)
 end;