Birdy egg added
authormbait
Thu, 25 Mar 2010 23:03:21 +0000
changeset 3065 4afa5e3e27e4
parent 3064 7458ec3666c3
child 3066 5c0efa437728
Birdy egg added
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Thu Mar 25 23:02:55 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Thu Mar 25 23:03:21 2010 +0000
@@ -2774,7 +2774,15 @@
        Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall)
        end;
 
-if HHGear^.Message and (gm_Attack or gm_Up or gm_Precise or gm_Left or gm_Right) <> 0 then Gear^.State:= Gear^.State and not gsttmpFlag;
+if (HHGear^.Message and gm_Attack <> 0) then begin
+        HHGear^.Message := HHGear^.Message and not gm_Attack;
+		if Gear^.FlightTime > 0 then begin
+			AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtEgg, 0, Gear^.dX * _0_5, Gear^.dY, 0);
+			dec(Gear^.FlightTime)
+		end;
+end;
+
+if HHGear^.Message and (gm_Up or gm_Precise or gm_Left or gm_Right) <> 0 then Gear^.State:= Gear^.State and not gsttmpFlag;
 HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Precise or gm_Left or gm_Right);
 HHGear^.State:= HHGear^.State or gstMoving;
 
@@ -2881,3 +2889,19 @@
 for i:= 0 to 15 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart2);
 Gear^.doStep:= @doStepBigExplosionWork
 end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepEggWork(Gear: PGear);
+begin
+	AllInactive:= false;
+	Gear^.dX:= Gear^.dX + cWindSpeed;
+	doStepFallingGear(Gear);
+	if (Gear^.State and gstCollision) <> 0 then
+	begin
+		doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, EXPLAutoSound);
+		DeleteGear(Gear);
+		exit
+	end;
+	if (GameTicks and $3F) = 0 then
+		AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0)
+end;
--- a/hedgewars/HHHandlers.inc	Thu Mar 25 23:02:55 2010 +0000
+++ b/hedgewars/HHHandlers.inc	Thu Mar 25 23:03:21 2010 +0000
@@ -191,8 +191,8 @@
                        amNapalm: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 2, _0, _0, 0);
                         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);
+                    //amJetpack: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtJetpack, 0, _0, _0, 0);
+                    amJetpack: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y) - 120, gtBirdy, 0, _0, _0, 0);
                       amLowGravity: begin
                                     PlaySound(sndLowGravity);
                                     cGravity:= cMaxWindSpeed / 2
--- a/hedgewars/uConsts.pas	Thu Mar 25 23:02:55 2010 +0000
+++ b/hedgewars/uConsts.pas	Thu Mar 25 23:03:21 2010 +0000
@@ -88,7 +88,7 @@
             gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 37
             gtHellishBomb, gtEvilTrace, gtWaterUp, gtDrill, gtBallGun, gtBall,gtRCPlane,
             gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, 
-            gtBigExplosion);
+            gtBigExplosion, gtEgg);
 
     TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
             vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
@@ -1689,6 +1689,7 @@
                           ammoprop_NoCrosshair or
                           ammoprop_DontHold or
                           ammoprop_Utility or
+                          //ammoprop_Utility;
                           ammoprop_AltAttack;
                 Count: 1;
                 InitialCount: 1;
--- a/hedgewars/uGears.pas	Thu Mar 25 23:02:55 2010 +0000
+++ b/hedgewars/uGears.pas	Thu Mar 25 23:03:21 2010 +0000
@@ -183,7 +183,8 @@
             @doStepMolotov,
             @doStepCase,
             @doStepBirdy,
-            @doStepBigExplosion
+            @doStepBigExplosion,
+			@doStepEggWork
             );
 
 procedure InsertGearToList(Gear: PGear);
@@ -443,13 +444,22 @@
        gtBirdy: begin
                 gear^.Radius:= 16; // todo: check
                 gear^.Timer:= 500;
-                gear^.Health:= 2000;
+				gear^.Health := 2000;
+                gear^.FlightTime := 2;
                 end;
 gtBigExplosion: begin
                 gear^.X:= gear^.X;
                 gear^.Y:= gear^.Y;
                 gear^.Angle:= random(360);
                 end;
+		 gtEgg: begin 
+                gear^.AdvBounce:= true;
+                gear^.Radius:= 4;
+                gear^.Elasticity:= _0_6;
+                gear^.Friction:= _0_96;
+                gear^.RenderTimer:= true;
+                if gear^.Timer = 0 then gear^.Timer:= 3000
+                end;
      end;
 InsertGearToList(gear);
 AddGear:= gear;
@@ -1673,6 +1683,7 @@
                     DrawRotatedTextureF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -4 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle);
                     glColor4f(1, 1, 1, 1);
                     end;
+			   gtEgg: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
          end;
       if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(hwRound(Gear^.X) + 8 + WorldDx, hwRound(Gear^.Y) + 8 + WorldDy, Gear^.Tex);
       Gear:= Gear^.NextGear