Allow control of grenade bounce. Not sure if this is a good idea, but has been requested a lot, so...
authornemo
Sun, 26 Jun 2011 13:38:47 -0400
changeset 5316 191cd6c06203
parent 5313 5e18eaef65d0
child 5319 51d8e4747876
Allow control of grenade bounce. Not sure if this is a good idea, but has been requested a lot, so...
hedgewars/HHHandlers.inc
hedgewars/uAmmos.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uTypes.pas
hedgewars/uVariables.pas
share/hedgewars/Data/Locale/en.txt
--- a/hedgewars/HHHandlers.inc	Sun Jun 26 02:47:36 2011 +0200
+++ b/hedgewars/HHHandlers.inc	Sun Jun 26 13:38:47 2011 -0400
@@ -125,11 +125,38 @@
 
 procedure HHSetTimer(Gear: PGear);
 var CurWeapon: PAmmo;
+    color: LongWord;
 begin
 Gear^.Message:= Gear^.Message and not gmTimer;
 CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
 with Gear^.Hedgehog^ do
-    if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then
+    if ((Gear^.Message and gmPrecise) <> 0) and ((CurWeapon^.Propz and ammoprop_SetBounce) <> 0) then
+        begin
+        color:= Gear^.Hedgehog^.Team^.Clan^.Color;
+        case Gear^.MsgParam of
+            1: begin
+               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce1]), color, capgrpAmmostate);
+               Gear^.Hedgehog^.Bounce:= _0_3
+               end;
+            2: begin
+               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce2]), color, capgrpAmmostate);
+               Gear^.Hedgehog^.Bounce:= _0_7
+               end;
+            3: begin
+               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce3]), color, capgrpAmmostate);
+               Gear^.Hedgehog^.Bounce:= _1
+               end;
+            4: begin
+               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce4]), color, capgrpAmmostate);
+               Gear^.Hedgehog^.Bounce:= _2
+               end;
+            5: begin
+               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce5]), color, capgrpAmmostate);
+               Gear^.Hedgehog^.Bounce:= _4
+               end
+            end
+        end
+    else if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then
         begin
         CurWeapon^.Timer:= 1000 * Gear^.MsgParam;
         with CurrentTeam^ do
@@ -140,7 +167,8 @@
 
 procedure Attack(Gear: PGear);
 var xx, yy, newDx, newDy, lx, ly: hwFloat;
-    tmpGear: PVisualGear;
+    speech: PVisualGear;
+    newGear:  PGear;
     CurWeapon: PAmmo;
     altUse: boolean;
 begin
@@ -204,81 +232,81 @@
             end;
 
              case CurAmmoType of
-                      amGrenade: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtGrenade,         0, newDx, newDy, CurWeapon^.Timer);
-                      amMolotov: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtMolotov,      0, newDx, newDy, 0);
-                  amClusterBomb: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtClusterBomb,  0, newDx, newDy, CurWeapon^.Timer);
-                      amGasBomb: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtGasBomb,      0, newDx, newDy, CurWeapon^.Timer);
-                      amBazooka: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtShell,        0, newDx, newDy, 0);
-                     amSnowball: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtSnowball,     0, newDx, newDy, 0);
-                          amBee: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtBee,          0, newDx, newDy, 0);
+                      amGrenade: newGear:= AddGear(hwRound(lx), hwRound(ly), gtGrenade,         0, newDx, newDy, CurWeapon^.Timer);
+                      amMolotov: newGear:= AddGear(hwRound(lx), hwRound(ly), gtMolotov,      0, newDx, newDy, 0);
+                  amClusterBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtClusterBomb,  0, newDx, newDy, CurWeapon^.Timer);
+                      amGasBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtGasBomb,      0, newDx, newDy, CurWeapon^.Timer);
+                      amBazooka: newGear:= AddGear(hwRound(lx), hwRound(ly), gtShell,        0, newDx, newDy, 0);
+                     amSnowball: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSnowball,     0, newDx, newDy, 0);
+                          amBee: newGear:= AddGear(hwRound(lx), hwRound(ly), gtBee,          0, newDx, newDy, 0);
                       amShotgun: begin
                                  PlaySound(sndShotgunReload);
-                                 CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtShotgunShot,  0, xx * _0_5, yy * _0_5, 0);
+                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtShotgunShot,  0, xx * _0_5, yy * _0_5, 0);
                                  end;
-                   amPickHammer: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
+                   amPickHammer: newGear:= AddGear(hwRound(lx), hwRound(ly) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
                          amSkip: ParseCommand('/skip', true);
-                         amRope: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0);
+                         amRope: newGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0);
                          amMine: if altUse then
-                                    AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, newDx, newDy, 3000)
+                                    newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, newDx, newDy, 3000)
                                  else
-                                    AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
-                        amSMine: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
-                       amDEagle: CurAmmoGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
-                      amSineGun: CurAmmoGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0);
+                                    newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
+                        amSMine: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
+                       amDEagle: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
+                      amSineGun: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0);
                     amPortalGun: begin
-                                 AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtPortal, 0, xx * _0_6, yy * _0_6, 
+                                 newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtPortal, 0, xx * _0_6, yy * _0_6, 
                                  // set selected color
                                  CurWeapon^.Pos);
                                  end;
                   amSniperRifle: begin
                                  PlaySound(sndSniperReload);
-                                 CurAmmoGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0);
+                                 newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0);
                                  end;
-                     amDynamite: AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
-                    amFirePunch: CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtFirePunch, 0, xx, _0, 0);
+                     amDynamite: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
+                    amFirePunch: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtFirePunch, 0, xx, _0, 0);
                          amWhip: begin
-                                 CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
+                                 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
                                  PlaySound(sndWhipCrack)
                                  end;
                        amHammer: begin
-                                 CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtHammer, 0, SignAs(_1, dX), - _0_8, 0);
+                                 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtHammer, 0, SignAs(_1, dX), - _0_8, 0);
                                  PlaySound(sndWhack)
                                  end;
                   amBaseballBat: begin
-                                 CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtShover, gsttmpFlag, xx * _0_5, yy * _0_5, 0);
+                                 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtShover, gsttmpFlag, xx * _0_5, yy * _0_5, 0);
                                  PlaySound(sndBaseballBat) // TODO: Only play if something is hit?
                                  end;
                     amParachute: begin
-                                 CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtParachute, 0, _0, _0, 0);
+                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtParachute, 0, _0, _0, 0);
                                  PlaySound(sndParachute)
                                  end;
                     // we save CurWeapon^.Pos (in this case: cursor direction) by using it as (otherwise irrelevant) X value of the new gear.
-                    amAirAttack: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 0, _0, _0, 0);
-                   amMineStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 1, _0, _0, 0);
-                    amBlowTorch: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtBlowTorch, 0, SignAs(_0_5, dX), _0, 0);
-                       amGirder: CurAmmoGear:= AddGear(0, 0, gtGirder, CurWeapon^.Pos, _0, _0, 0);
-                     amTeleport: CurAmmoGear:= AddGear(CurWeapon^.Pos, 0, gtTeleport, 0, _0, _0, 0);
-                       amSwitch: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtSwitcher, 0, _0, _0, 0);
+                    amAirAttack: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 0, _0, _0, 0);
+                   amMineStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 1, _0, _0, 0);
+                    amBlowTorch: newGear:= AddGear(hwRound(lx), hwRound(ly), gtBlowTorch, 0, SignAs(_0_5, dX), _0, 0);
+                       amGirder: newGear:= AddGear(0, 0, gtGirder, CurWeapon^.Pos, _0, _0, 0);
+                     amTeleport: newGear:= AddGear(CurWeapon^.Pos, 0, gtTeleport, 0, _0, _0, 0);
+                       amSwitch: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSwitcher, 0, _0, _0, 0);
                        amMortar: begin
                                  playSound(sndMortar);
-                                 FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtMortar,  0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0);
+                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtMortar,  0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0);
                                  end;
                       amRCPlane: begin
-                                 CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane,  0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0);
-                                 CurAmmoGear^.SoundChannel:= LoopSound(sndRCPlane, nil)
+                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane,  0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0);
+                                 newGear^.SoundChannel:= LoopSound(sndRCPlane, nil)
                                  end;
-                       amKamikaze: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
-                         amCake: CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0);
-                    amSeduction: CurAmmoGear:= AddGear(hwRound(lx + xx * cHHRadius * 2), hwRound(ly + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0);
-                   amWatermelon: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon,  0, newDx, newDy, CurWeapon^.Timer);
-                  amHellishBomb: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb,    0, newDx, newDy, 0);
-                       amNapalm: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 2, _0, _0, 0);
-                        amDrill: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, newDx, newDy, 0);
-                      amBallgun: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
-                    amJetpack: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0);
+                       amKamikaze: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
+                         amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0);
+                    amSeduction: newGear:= AddGear(hwRound(lx + xx * cHHRadius * 2), hwRound(ly + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0);
+                   amWatermelon: newGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon,  0, newDx, newDy, CurWeapon^.Timer);
+                  amHellishBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb,    0, newDx, newDy, 0);
+                       amNapalm: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 2, _0, _0, 0);
+                        amDrill: newGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, newDx, newDy, 0);
+                      amBallgun: newGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
+                    amJetpack: newGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0);
                     amBirdy: begin
                              PlaySound(sndWhistle);
-                             CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly) - 32, gtBirdy, 0, _0, _0, 0);
+                             newGear:= AddGear(hwRound(lx), hwRound(ly) - 32, gtBirdy, 0, _0, _0, 0);
                              end;
                       amLowGravity: begin
                                     PlaySound(sndLowGravity);
@@ -304,20 +332,44 @@
                                Unplaced:= true;
                                X:= _0;
                                Y:= _0;
-                               FollowGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0);
+                               newGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0);
                                PauseMusic
                                end;
-                      amFlamethrower: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower,  0, xx * _0_5, yy * _0_5, 0);
-                      amLandGun: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtLandGun,  0, xx * _0_5, yy * _0_5, 0);
+                      amFlamethrower: newGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower,  0, xx * _0_5, yy * _0_5, 0);
+                      amLandGun: newGear:= AddGear(hwRound(X), hwRound(Y), gtLandGun,  0, xx * _0_5, yy * _0_5, 0);
                     amResurrector: begin
-                        CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly),
+                        newGear:= AddGear(hwRound(lx), hwRound(ly),
                                 gtResurrector, 0, _0, _0, 0);
-                        CurAmmoGear^.SoundChannel := LoopSound(sndResurrector);
+                        newGear^.SoundChannel := LoopSound(sndResurrector);
                     end;
-                   amDrillStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 3, _0, _0, CurWeapon^.Timer);
+                   amDrillStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 3, _0, _0, CurWeapon^.Timer);
                    //amMelonStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 4, _0, _0, 0);
-                     amStructure: CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtStructure, gstWait, SignAs(_0_02, dX), _0, 3000);
-                        amTardis: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000);
+                     amStructure: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtStructure, gstWait, SignAs(_0_02, dX), _0, 3000);
+                        amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000);
+                  end;
+             case CurAmmoType of
+                      amGrenade, amMolotov, 
+                  amClusterBomb, amGasBomb, 
+                      amBazooka, amSnowball, 
+                          amBee, amSMine,
+                       amMortar, amWatermelon,
+                  amHellishBomb, amDrill,
+                        amPiano: FollowGear:= newGear;
+
+                      amShotgun, amPickHammer,
+                         amRope, amDEagle,
+                      amSineGun, amSniperRifle,
+                    amFirePunch, amWhip,
+                       amHammer, amBaseballBat,
+                    amParachute, amBlowTorch,
+                       amGirder, amTeleport,
+                       amSwitch, amRCPlane,
+                     amKamikaze, amCake,
+                    amSeduction, amBallgun,
+                      amJetpack, amBirdy,
+                 amFlamethrower, amLandGun,
+                  amResurrector, amStructure,
+                       amTardis: CurAmmoGear:= newGear;
                   end;
 
         // Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement
@@ -327,12 +379,12 @@
 
         if not (SpeechText = '') then
             begin
-            tmpGear:= AddVisualGear(0, 0, vgtSpeechBubble);
-            if tmpGear <> nil then
+            speech:= AddVisualGear(0, 0, vgtSpeechBubble);
+            if speech <> nil then
                begin
-               tmpGear^.Text:= SpeechText;
-               tmpGear^.Hedgehog:= Gear^.Hedgehog;
-               tmpGear^.FrameTicks:= SpeechType;
+               speech^.Text:= SpeechText;
+               speech^.Hedgehog:= Gear^.Hedgehog;
+               speech^.FrameTicks:= SpeechType;
                end;
             SpeechText:= ''
             end;
@@ -341,7 +393,6 @@
         if (CurAmmoGear <> nil)
            and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) = 0){check for dropping ammo from rope} then
            begin
-           CurAmmoGear^.AmmoType:= CurAmmoType;
            Message:= Message or gmAttack;
            CurAmmoGear^.Message:= Message
            end else begin
--- a/hedgewars/uAmmos.pas	Sun Jun 26 02:47:36 2011 +0200
+++ b/hedgewars/uAmmos.pas	Sun Jun 26 13:38:47 2011 -0400
@@ -191,6 +191,7 @@
 var ammos: TAmmoCounts;
     slot, ami: LongInt;
     hhammo: PHHAmmo;
+    CurWeapon: PAmmo;
 begin
 {$HINTS OFF}
 FillChar(ammos, sizeof(ammos), 0);
@@ -205,7 +206,17 @@
 ammos[ammo]:= cnt;
 if ammos[ammo] > AMMO_INFINITE then ammos[ammo]:= AMMO_INFINITE;
 
-FillAmmoStore(hhammo, ammos)
+FillAmmoStore(hhammo, ammos);
+CurWeapon:= GetAmmoEntry(Hedgehog);
+with Hedgehog do
+    begin
+    with CurWeapon^ do
+        if Count = 0 then
+            begin
+            PackAmmo(Ammo, Ammoz[AmmoType].Slot);
+            CurAmmoType:= amNothing
+            end
+    end
 end;
 
 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
--- a/hedgewars/uConsts.pas	Sun Jun 26 02:47:36 2011 +0200
+++ b/hedgewars/uConsts.pas	Sun Jun 26 13:38:47 2011 -0400
@@ -242,6 +242,7 @@
     ammoprop_NotBorder    = $00000800;
     ammoprop_Utility      = $00001000;
     ammoprop_Effect       = $00002000;
+    ammoprop_SetBounce    = $00004000;
     ammoprop_NoRoundEnd   = $10000000;
 
     AMMO_INFINITE = 100;
--- a/hedgewars/uGears.pas	Sun Jun 26 02:47:36 2011 +0200
+++ b/hedgewars/uGears.pas	Sun Jun 26 13:38:47 2011 -0400
@@ -222,12 +222,64 @@
 gear^.SoundChannel:= -1;
 gear^.ImpactSound:= sndNone;
 gear^.nImpactSounds:= 0;
+gear^.AmmoType:= amNothing;
 
 if CurrentHedgehog <> nil then
     begin
     gear^.Hedgehog:= CurrentHedgehog;
     gear^.IntersectGear:= CurrentHedgehog^.Gear
     end;
+// Define ammo association, if any.
+case Kind of
+        gtGrenade: gear^.AmmoType:= amGrenade;
+          gtShell: gear^.AmmoType:= amBazooka;
+            gtBee: gear^.AmmoType:= amBee;
+    gtShotgunShot: gear^.AmmoType:= amShotgun;
+     gtPickHammer: gear^.AmmoType:= amPickHammer;
+           gtRope: gear^.AmmoType:= amRope;
+     gtDEagleShot: gear^.AmmoType:= amDEagle;
+       gtDynamite: gear^.AmmoType:= amDynamite;
+    gtClusterBomb, 
+        gtCluster: gear^.AmmoType:= amClusterBomb;
+         gtShover: gear^.AmmoType:= amBaseballBat;  // Shover is only used for baseball bat right now
+      gtFirePunch: gear^.AmmoType:= amFirePunch;
+      gtParachute: gear^.AmmoType:= amParachute;
+        gtAirBomb: gear^.AmmoType:= amAirAttack;
+      gtBlowTorch: gear^.AmmoType:= amBlowTorch;
+         gtGirder: gear^.AmmoType:= amGirder;
+       gtTeleport: gear^.AmmoType:= amTeleport;
+       gtSwitcher: gear^.AmmoType:= amSwitch;
+         gtMortar: gear^.AmmoType:= amMortar;
+           gtWhip: gear^.AmmoType:= amWhip;
+       gtKamikaze: gear^.AmmoType:= amKamikaze;
+           gtCake: gear^.AmmoType:= amCake;
+      gtSeduction: gear^.AmmoType:= amSeduction;
+     gtWatermelon,
+     gtMelonPiece: gear^.AmmoType:= amWatermelon;
+    gtHellishBomb: gear^.AmmoType:= amHellishBomb;
+          gtDrill: gear^.AmmoType:= amDrill;
+        gtBallGun,
+           gtBall: gear^.AmmoType:= amBallgun;
+        gtRCPlane: gear^.AmmoType:= amRCPlane;
+gtSniperRifleShot: gear^.AmmoType:= amSniperRifle;
+        gtJetpack: gear^.AmmoType:= amJetpack;
+        gtMolotov: gear^.AmmoType:= amMolotov;
+          gtBirdy, 
+            gtEgg: gear^.AmmoType:= amBirdy;
+         gtPortal: gear^.AmmoType:= amPortalGun;
+          gtPiano: gear^.AmmoType:= amPiano;
+        gtGasBomb: gear^.AmmoType:= amGasBomb;
+    gtSineGunShot: gear^.AmmoType:= amSineGun;
+   gtFlamethrower: gear^.AmmoType:= amFlamethrower;
+          gtSMine: gear^.AmmoType:= amSMine;
+         gtHammer, 
+      gtHammerHit: gear^.AmmoType:= amHammer;
+    gtResurrector: gear^.AmmoType:= amResurrector;
+       gtSnowball: gear^.AmmoType:= amSnowball;
+      gtStructure: gear^.AmmoType:= amStructure;  // TODO - This will undoubtedly change once there is more than one structure
+        gtLandGun: gear^.AmmoType:= amLandGun;
+         gtTardis: gear^.AmmoType:= amTardis;
+end;
 
 case Kind of
      gtGrenade,
@@ -550,6 +602,18 @@
                 end;
     end;
 
+if ((Ammoz[gear^.AmmoType].Ammo.Propz and ammoprop_SetBounce) <> 0) and (CurrentHedgehog <> nil) then 
+    if CurrentHedgehog^.Bounce < _1 then 
+        begin
+        gear^.Elasticity:= gear^.Elasticity * CurrentHedgehog^.Bounce;
+        gear^.Friction:= gear^.Friction * CurrentHedgehog^.Bounce
+        end
+    else 
+        begin
+        gear^.Elasticity:= _1 - ((_1-gear^.Elasticity) / CurrentHedgehog^.Bounce);
+        gear^.Friction:= _1 - ((_1-gear^.Friction) / CurrentHedgehog^.Bounce);
+        end;
+
 InsertGearToList(gear);
 AddGear:= gear;
 
--- a/hedgewars/uTypes.pas	Sun Jun 26 02:47:36 2011 +0200
+++ b/hedgewars/uTypes.pas	Sun Jun 26 13:38:47 2011 -0400
@@ -333,6 +333,7 @@
             King: boolean;  // Flag for a bunch of hedgehog attributes
             Unplaced: boolean;  // Flag for hog placing mode
             Timer: Longword;
+            Bounce: hwFloat;
             Effects: Array[THogEffect] of boolean;
             end;
 
@@ -390,7 +391,8 @@
 
     TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused,
             sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync,
-            sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady);
+            sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady, 
+            sidBounce1, sidBounce2, sidBounce3, sidBounce4, sidBounce5, sidBounce);
 
     // Events that are important for the course of the game or at least interesting for other reasons
     TEventId = (eidDied, eidDrowned, eidRoundStart, eidRoundWin, eidRoundDraw,
--- a/hedgewars/uVariables.pas	Sun Jun 26 02:47:36 2011 +0200
+++ b/hedgewars/uVariables.pas	Sun Jun 26 13:38:47 2011 -0400
@@ -778,7 +778,7 @@
             NameTex: nil;
             Probability: 0;
             NumberInCase: 1;
-            Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
+            Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse or ammoprop_SetBounce;
                 Count: AMMO_INFINITE;
                 NumPerTurn: 0;
                 Timer: 3000;
@@ -801,7 +801,7 @@
             NameTex: nil;
             Probability: 100;
             NumberInCase: 3;
-            Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
+            Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse or ammoprop_SetBounce;
                 Count: 5;
                 NumPerTurn: 0;
                 Timer: 3000;
@@ -966,7 +966,7 @@
             NameTex: nil;
             Probability: 100;
             NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse;
+            Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse or ammoprop_SetBounce;
                 Count: 2;
                 NumPerTurn: 0;
                 Timer: 0;
@@ -1164,7 +1164,8 @@
                             ammoprop_NeedTarget or
                             ammoprop_AttackingPut or
                             ammoprop_DontHold or
-                            ammoprop_NotBorder;
+                            ammoprop_NotBorder or
+                            ammoprop_SetBounce;
                 Count: 1;
                 NumPerTurn: 0;
                 Timer: 0;
@@ -1849,7 +1850,7 @@
             NameTex: nil;
             Probability: 0;
             NumberInCase: 1;
-            Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
+            Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse or ammoprop_SetBounce;
                 Count: AMMO_INFINITE;
                 NumPerTurn: 0;
                 Timer: 3000;
--- a/share/hedgewars/Data/Locale/en.txt	Sun Jun 26 02:47:36 2011 +0200
+++ b/share/hedgewars/Data/Locale/en.txt	Sun Jun 26 13:38:47 2011 -0400
@@ -72,6 +72,12 @@
 01:12=Last round till Sudden Death!
 01:13=%1 rounds till Sudden Death!
 01:14=Get ready, %1!
+01:15=Slight
+01:16=Low
+01:17=Normal
+01:18=High
+01:19=Extreme
+01:20=%1 Bounce
 
 ; Event messages
 ; Hog (%1) died