hedgewars/GSHandlers.inc
branch0.9.16
changeset 5949 7e12141c5e10
parent 5940 c025b4842cb4
child 5969 6b245d2215c2
--- a/hedgewars/GSHandlers.inc	Thu Sep 15 20:40:59 2011 +0400
+++ b/hedgewars/GSHandlers.inc	Sat Sep 17 16:20:09 2011 +0400
@@ -534,16 +534,29 @@
         PlaySound(sndMolotov);
         gX := hwRound(Gear^.X);
         gY := hwRound(Gear^.Y);
-        for i:= 0 to 2 do
+        for i:= 0 to 4 do
             begin
-            glass:= AddVisualGear(gx+random(7)-3, gy+random(5)-2, vgtEgg);
+            (*glass:= AddVisualGear(gx+random(7)-3, gy+random(5)-2, vgtEgg);
             if glass <> nil then
                 begin
                 glass^.Frame:= 2;
                 glass^.Tint:= $41B83ED0 - i * $10081000;
                 glass^.dX:= 1/(10*(random(11)-5));
                 glass^.dY:= -1/(random(4)+5);
-                end;
+                end;*)
+            glass:= AddVisualGear(gx+random(7)-3, gy+random(7)-3, vgtStraightShot);
+            if glass <> nil then 
+                with glass^ do
+                    begin
+                    Frame:= 2;
+                    Tint:= $41B83ED0 - i * $10081000;
+                    Angle:= random * 360;
+                    dx:= 0.0000001;
+                    dy:= 0;
+                    if random(2) = 0 then dx := -dx;
+                    FrameTicks:= 750;
+                    State:= ord(sprEgg)
+                    end;
             end;
         for i:= 0 to 24 do
         begin
@@ -1102,9 +1115,9 @@
 procedure doStepDEagleShot(Gear: PGear);
 begin
     PlaySound(sndGun);
-    // add 2 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths
-    Gear^.X := Gear^.X + Gear^.dX * 2;
-    Gear^.Y := Gear^.Y + Gear^.dY * 2;
+    // add 3 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just plain old weird angles
+    Gear^.X := Gear^.X + Gear^.dX * 3;
+    Gear^.Y := Gear^.Y + Gear^.dY * 3;
     Gear^.doStep := @doStepBulletWork
 end;
 
@@ -1138,9 +1151,9 @@
         Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _0_5;
         Gear^.dY := -AngleCos(HHGear^.Angle) * _0_5;
         PlaySound(sndGun);
-        // add an initial step to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths
-        Gear^.X := Gear^.X + Gear^.dX;  
-        Gear^.Y := Gear^.Y + Gear^.dY;
+        // add 3 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just weird angles
+        Gear^.X := Gear^.X + Gear^.dX * 3;  
+        Gear^.Y := Gear^.Y + Gear^.dY * 3;
         Gear^.doStep := @doStepBulletWork;
     end
     else
@@ -2800,7 +2813,11 @@
     if (GameTicks mod 2 = 0) and hasWishes then
         begin
         sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1);
-        if sparkles <> nil then sparkles^.Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF;
+        if sparkles <> nil then 
+            begin
+            sparkles^.Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF;
+            sparkles^.Angle:= random * 360;
+            end
         end;
 
     i := 2;
@@ -2845,6 +2862,21 @@
     if Gear^.Health < Gear^.Damage then
     begin
         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
+        for i:= 0 to 31 do
+            begin
+            sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
+            if sparkles <> nil then
+                with sparkles^ do
+                    begin
+                    Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF;
+                    Angle:= random * 360;
+                    dx:= 0.001 * (random(200));
+                    dy:= 0.001 * (random(200));
+                    if random(2) = 0 then dx := -dx;
+                    if random(2) = 0 then dy := -dy;
+                    FrameTicks:= random(400) + 250
+                    end;
+            end;
         AfterAttack;
         DeleteGear(Gear);
         DeleteGear(HHGear);
@@ -2861,11 +2893,11 @@
     AllInactive := false;
     dec(Gear^.Timer);
     if Gear^.Timer = 0 then
-    begin
+        begin
         Gear^.Pos := 1;
         PlaySound(sndKamikaze, Gear^.Hedgehog^.Team^.voicepack);
         Gear^.doStep := @doStepKamikazeWork
-    end
+        end
 end;
 
 procedure doStepKamikaze(Gear: PGear);
@@ -4145,7 +4177,11 @@
 
         // Until loops are reliably broken
         if iscake then iterator^.PortalCounter:= 33
-        else inc(iterator^.PortalCounter);
+        else
+            begin
+            inc(iterator^.PortalCounter);
+            iterator^.State:= iterator^.State and not gstHHHJump
+            end;
 
         if not isbullet and (iterator^.Kind <> gtFlake) then
             FollowGear := iterator;
@@ -5070,7 +5106,7 @@
         begin
         if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible = 0) then
             begin
-	        AfterAttack;
+            AfterAttack;
             if Gear = CurAmmoGear then CurAmmoGear := nil;
             HideHog(HH)
             end
@@ -5087,7 +5123,20 @@
         end
     end;
 
-if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then inc(Gear^.Power);
+if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then 
+    begin
+    inc(Gear^.Power);
+    if (Gear^.Power = 172) and (Gear^.Hedgehog^.Gear <> nil) then
+        begin
+        with Gear^.Hedgehog^.Gear^ do
+            begin
+	    State:= State or gstAnimation;
+	    Tag:= 2;
+	    Timer:= 0;
+	    Pos:= 0
+            end
+        end
+    end;
 if (Gear^.Pos = 3) and (GameTicks and $1F = 0) and (Gear^.Power > 0) then dec(Gear^.Power);
 if (Gear^.Pos = 1) and (Gear^.Power = 255) and ((GameTicks mod 2000) = 1000) then Gear^.Pos:= 2;
 if (Gear^.Pos = 3) and (Gear^.Power = 0) then