Engine:
authorsmxx
Sun, 14 Mar 2010 20:48:13 +0000
changeset 2995 b90745d87332
parent 2994 7ae3067546f2
child 2996 dfc7507a21a0
Engine: * Small tweaks to Birdy code * Added (commented) Birdy spawn code
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
--- a/hedgewars/GSHandlers.inc	Sun Mar 14 20:46:29 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Mar 14 20:48:13 2010 +0000
@@ -2718,7 +2718,7 @@
     fuel: LongInt;
     move: hwFloat;
 begin
-HHGear:=PHedgehog(Gear^.Hedgehog)^.Gear;
+HHGear:= CurrentHedgehog^.Gear;
 
 move:= _0_1;
 fuel:= 50;
@@ -2790,21 +2790,22 @@
 procedure doStepBirdyDescend(Gear: PGear);
 var HHGear: PGear;
 begin
-HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
 AllInactive:= false;
 if Gear^.Timer > 0 then
     dec(Gear^.Timer, 1)
 else if CurrentHedgehog = nil then
     begin
     Gear^.doStep:= @doStepBirdyVanish;
+    exit
     end;
+HHGear:= CurrentHedgehog^.Gear;
 HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Precise or gm_Left or gm_Right);
 if abs(hwRound(HHGear^.Y - Gear^.Y)) > 32 then
     begin
-    if Gear^.Pos = 0 then
+    if Gear^.Timer = 0 then
         Gear^.Y:= Gear^.Y + _0_1
     end
-else
+else if Gear^.Timer = 0 then
     begin
     Gear^.doStep:= @doStepBirdyFly;
     HHGear^.dY:= -_0_2
@@ -2816,7 +2817,14 @@
 var HHGear: PGear;
 begin
 Gear^.doStep:= @doStepBirdyDescend;
-HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+if CurrentHedgehog = nil then
+    begin
+    DeleteGear(Gear);
+    exit
+    end;
+
+HHGear:= CurrentHedgehog^.Gear;
+
 if HHGear^.dX.isNegative then
     Gear^.Tag:= -1
 else
--- a/hedgewars/HHHandlers.inc	Sun Mar 14 20:46:29 2010 +0000
+++ b/hedgewars/HHHandlers.inc	Sun Mar 14 20:48:13 2010 +0000
@@ -192,6 +192,7 @@
                         amDrill: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtDrill, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
                       amBallgun: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
                     amJetpack: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtJetpack, 0, _0, _0, 0);
+                    //amBirdy: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y) - 120, gtBirdy, 0, _0, _0, 0);
                       amLowGravity: begin
                                     PlaySound(sndLowGravity);
                                     cGravity:= cMaxWindSpeed / 2