Revert removal of CurAmmoGear from shotgun/deagle (was a silly idea of speeding up the shots)
authornemo
Sun, 02 May 2010 04:49:07 +0000
changeset 3397 c47af0694a7d
parent 3396 e5b3e5f2818e
child 3398 ede254e24545
Revert removal of CurAmmoGear from shotgun/deagle (was a silly idea of speeding up the shots) Some speculative portal tests.
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
--- a/hedgewars/GSHandlers.inc	Sun May 02 02:58:59 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Sun May 02 04:49:07 2010 +0000
@@ -3039,9 +3039,30 @@
 end;
 
 procedure doStepPortal(Gear: PGear);
+var tmpGear, iterator: PGear;
 begin
-    if Gear^.IntersectGear <> nil then
+AddFileLog('...');
+    if not AllInactive and (Gear^.IntersectGear <> nil) then
         begin
+AddFileLog('!!!');
+        iterator:= GearsList;
+        while iterator <> nil do
+            begin
+            if
+// iterator^.Active and 
+(iterator^.Kind <> gtPortal) and 
+              // (hwRound(hwAbs(Gear^.X-iterator^.X)+hwAbs(Gear^.Y-iterator^.Y)) < Gear^.Radius) and 
+              // ((hwAbs(Gear^.X-(iterator^.X+iterator^.dX))+hwAbs(Gear^.Y-(iterator^.Y+iterator^.dY))).QWordValue < (hwAbs(Gear^.X-iterator^.X)+hwAbs(Gear^.Y-iterator^.Y)).QWordValue) and
+               (hwRound(Distance(Gear^.X-iterator^.X,Gear^.Y-iterator^.Y)) < Gear^.Radius) then // Let's check this one more closely
+                begin
+AddFileLog(inttostr(iterator^.uid));
+                iterator^.X:=Gear^.IntersectGear^.X+_128;
+                iterator^.Y:=Gear^.IntersectGear^.Y+_128;
+                iterator^.dX.isNegative:= not iterator^.dX.isNegative;
+                end;
+
+            iterator:= iterator^.NextGear;
+            end;
 // do portal stuff
         end
 
@@ -3091,7 +3112,12 @@
             if Gear^.Tag = 2 then CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].Timer:= 1
             else CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].Timer:= 2;
         inc(Gear^.Tag);
-        Gear^.doStep:= @doStepPortal
+        Gear^.doStep:= @doStepPortal;
+        if Gear^.IntersectGear <> nil then
+            begin
+            Gear^.IntersectGear^.IntersectGear:= Gear;
+            SetAllToActive
+            end
         end
     end
 else if (y > cWaterLine + cVisibleWater + Gear^.Radius) or (y < -LAND_WIDTH) or (x > LAND_WIDTH + LAND_WIDTH) or (x < -LAND_WIDTH) then
--- a/hedgewars/HHHandlers.inc	Sun May 02 02:58:59 2010 +0000
+++ b/hedgewars/HHHandlers.inc	Sun May 02 04:49:07 2010 +0000
@@ -150,13 +150,13 @@
                           amBee: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtBee,          0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
                       amShotgun: begin
                                  PlaySound(sndShotgunReload);
-                                 AddGear(hwRound(X), hwRound(Y), gtShotgunShot,  0, xx * _0_5, yy * _0_5, 0);
+                                 CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtShotgunShot,  0, xx * _0_5, yy * _0_5, 0);
                                  end;
                    amPickHammer: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
                          amSkip: ParseCommand('/skip', true);
                          amRope: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtRope, 0, xx, yy, 0);
                          amMine: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
-                       amDEagle: AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
+                       amDEagle: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
                       amSineGun: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0);
                     amPortalGun: begin
                                  iterator:= GearsList;