Add ammotype amDuck for rubber duck
authorWuzzy <almikes@aol.com>
Sat, 08 Apr 2017 21:43:48 +0200
changeset 12198 71c47122fbc0
parent 12197 de9144250c37
child 12199 ac9cf0cf40ee
Add ammotype amDuck for rubber duck Still needs some tweaking (eject position, ammo menu slot)
QTfrontend/weapons.h
hedgewars/uAIAmmoTests.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsList.pas
hedgewars/uGearsRender.pas
hedgewars/uTypes.pas
hedgewars/uVariables.pas
share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png
share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw.png
share/hedgewars/Data/Locale/en.txt
--- a/QTfrontend/weapons.h	Sat Apr 08 18:36:12 2017 +0200
+++ b/QTfrontend/weapons.h	Sat Apr 08 21:43:48 2017 +0200
@@ -16,10 +16,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#define AMMOLINE_EMPTY_QT       "000000900000000000000000000000000000000000000000000000000"
-#define AMMOLINE_EMPTY_PROB     "000000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_EMPTY_DELAY    "000000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_EMPTY_CRATE    "131111031211111112311411111111111111121111111111111111111"
+#define AMMOLINE_EMPTY_QT       "0000009000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_EMPTY_PROB     "0000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_EMPTY_DELAY    "0000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_EMPTY_CRATE    "1311110312111111123114111111111111111211111111111111111111"
 
 /*
  AmmoType lookup table (use monospace font / cursor movements)
@@ -81,63 +81,60 @@
  amKnife-------------------------------------------------------------------------------|
  amRubber-------------------------------------------------------------------------------|
  amAirMine-------------------------------------------------------------------------------|
+ amDuck-----------------------------------------------------------------------------------|
 */
-#define AMMOLINE_DEFAULT_QT     "939192942219912103223511100120000000021110010101111100010"
-#define AMMOLINE_DEFAULT_PROB   "040504054160065554655446477657666666615551010111541111111"
-#define AMMOLINE_DEFAULT_DELAY  "000000000000020550000004000700400000000022000000060002000"
-#define AMMOLINE_DEFAULT_CRATE  "131111031211111112311411111111111111121111111111111111111"
+#define AMMOLINE_DEFAULT_QT     "9391929422199121032235111001200000000211100101011111000102"
+#define AMMOLINE_DEFAULT_PROB   "0405040541600655546554464776576666666155510101115411111114"
+#define AMMOLINE_DEFAULT_DELAY  "0000000000000205500000040007004000000000220000000600020000"
+#define AMMOLINE_DEFAULT_CRATE  "1311110312111111123114111111111111111211111111111111111111"
 
-#define AMMOLINE_CRAZY_QT       "999999999999999999299999999999999929999999999999999299919"
-#define AMMOLINE_CRAZY_PROB     "111111011111111111111111111111111111111111111111111111111"
-#define AMMOLINE_CRAZY_DELAY    "000000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CRAZY_CRATE    "131111031211111112311411111111111111121111111111111111111"
+#define AMMOLINE_CRAZY_QT       "9999999999999999992999999999999999299999999999999992999199"
+#define AMMOLINE_CRAZY_PROB     "1111110111111111111111111111111111111111111111111111111111"
+#define AMMOLINE_CRAZY_DELAY    "0000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_CRAZY_CRATE    "1311110312111111123114111111111111111211111111111111111111"
 
-#define AMMOLINE_PROMODE_QT     "909000900000000000000900000000000000000000000000000000000"
-#define AMMOLINE_PROMODE_PROB   "000000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_PROMODE_DELAY  "000000000000020550000004000700400000000020000000000002000"
-#define AMMOLINE_PROMODE_CRATE  "111111011111111111111111111111111111111111111111111111111"
+#define AMMOLINE_PROMODE_QT     "9090009000000000000009000000000000000000000000000000000000"
+#define AMMOLINE_PROMODE_PROB   "0000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_PROMODE_DELAY  "0000000000000205500000040007004000000000200000000000020000"
+#define AMMOLINE_PROMODE_CRATE  "1111110111111111111111111111111111111111111111111111111111"
 
-#define AMMOLINE_SHOPPA_QT      "000000990000000000000000000000000000000000000000000000000"
-#define AMMOLINE_SHOPPA_PROB    "444441004424440221011212122242200000000200040001001100101"
-#define AMMOLINE_SHOPPA_DELAY   "000000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_SHOPPA_CRATE   "111111011111111111111111111111111111111111111111111111111"
+#define AMMOLINE_SHOPPA_QT      "0000009900000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPA_PROB    "4444410044244402210112121222422000000002000400010011001011"
+#define AMMOLINE_SHOPPA_DELAY   "0000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPA_CRATE   "1111110111111111111111111111111111111111111111111111111111"
 
-#define AMMOLINE_CLEAN_QT       "101000900001000001100000000000000000000000000000100000000"
-#define AMMOLINE_CLEAN_PROB     "040504054160065554655446477657666666615551010111541112111"
-#define AMMOLINE_CLEAN_DELAY    "000000000000000000000000000000000000000000000000000002000"
-#define AMMOLINE_CLEAN_CRATE    "131111031211111112311411111111111111121111111111111111111"
+#define AMMOLINE_CLEAN_QT       "1010009000010000011000000000000000000000000000001000000000"
+#define AMMOLINE_CLEAN_PROB     "0405040541600655546554464776576666666155510101115411121114"
+#define AMMOLINE_CLEAN_DELAY    "0000000000000000000000000000000000000000000000000000020000"
+#define AMMOLINE_CLEAN_CRATE    "1311110312111111123114111111111111111211111111111111111111"
 
-#define AMMOLINE_MINES_QT       "000000990009000000030000000000000000000000000000000000000"
-#define AMMOLINE_MINES_PROB     "000000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_MINES_DELAY    "000000000000020550000004000700400000000020000000060002000"
-#define AMMOLINE_MINES_CRATE    "111111011111111111111111111111111111111111111111111111111"
+#define AMMOLINE_MINES_QT       "0000009900090000000300000000000000000000000000000000000000"
+#define AMMOLINE_MINES_PROB     "0000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_MINES_DELAY    "0000000000000205500000040007004000000000200000000600020000"
+#define AMMOLINE_MINES_CRATE    "1111110111111111111111111111111111111111111111111111111111"
 
-#define AMMOLINE_PORTALS_QT     "900000900200000000210000000000000011000009000000000000000"
-#define AMMOLINE_PORTALS_PROB   "040504054160065554655446477657666666615551010111541112111"
-#define AMMOLINE_PORTALS_DELAY  "000000000000020550000004000700400000000020000000060002000"
-#define AMMOLINE_PORTALS_CRATE  "131111031211111112311411111111111111121111111111111111111"
+#define AMMOLINE_PORTALS_QT     "9000009002000000002100000000000000110000090000000000000000"
+#define AMMOLINE_PORTALS_PROB   "0405040541600655546554464776576666666155510101115411121112"
+#define AMMOLINE_PORTALS_DELAY  "0000000000000205500000040007004000000000200000000600020000"
+#define AMMOLINE_PORTALS_CRATE  "1311110312111111123114111111111111111211111111111111111111"
 
-#define AMMOLINE_ONEEVERY_QT    "111111911111111111111111111111111111111111111111111111111"
-#define AMMOLINE_ONEEVERY_PROB  "111111011111111111111111111111111111111111111111111111111"
-#define AMMOLINE_ONEEVERY_DELAY "000000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_ONEEVERY_CRATE "111111011111111111111111111111111111111111111111111111111"
+#define AMMOLINE_ONEEVERY_QT    "1111119111111111111111111111111111111111111111111111111111"
+#define AMMOLINE_ONEEVERY_PROB  "1111110111111111111111111111111111111111111111111111111111"
+#define AMMOLINE_ONEEVERY_DELAY "0000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_ONEEVERY_CRATE "1111110111111111111111111111111111111111111111111111111111"
 
-#define AMMOLINE_HIGHLANDER_QT    "111111911111111111110191111111111001011111011110110011010"
-#define AMMOLINE_HIGHLANDER_PROB  "000000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_HIGHLANDER_DELAY "000000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_HIGHLANDER_CRATE "000000000000000000000000000000000000000000000000000000000"
-
-#define AMMOLINE_CONSTRUCTION_QT    "110001900000001001000000000000000000000000000000000000000"
-#define AMMOLINE_CONSTRUCTION_PROB  "111111011111111111111111111111111111111111111111111111110"
-#define AMMOLINE_CONSTRUCTION_DELAY "000000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CONSTRUCTION_CRATE "111111011111111111111111111111111111111111111111111111111"
+#define AMMOLINE_HIGHLANDER_QT    "1111119111111111111101911111111110010111110111101100110101"
+#define AMMOLINE_HIGHLANDER_PROB  "0000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_HIGHLANDER_DELAY "0000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_HIGHLANDER_CRATE "0000000000000000000000000000000000000000000000000000000000"
 
-#define AMMOLINE_SHOPPAPRO_QT      "000000990000000000000000000000000000000000000000000000000"
-#define AMMOLINE_SHOPPAPRO_PROB    "444440004404440000000000000040000000000000000000000000000"
-#define AMMOLINE_SHOPPAPRO_DELAY   "000000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_SHOPPAPRO_CRATE   "111111011111111111111111111111111111111111111111111112111"
+#define AMMOLINE_CONSTRUCTION_QT    "1100019000000010010000000000000000000000000000000000000000"
+#define AMMOLINE_CONSTRUCTION_PROB  "1111110111111111111111111111111111111111111111111111111100"
+#define AMMOLINE_CONSTRUCTION_DELAY "0000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_CONSTRUCTION_CRATE "1111110111111111111111111111111111111111111111111111111111"
 
+#define AMMOLINE_SHOPPAPRO_QT      "0000009900000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPAPRO_PROB    "4444400044044400000000000000400000000000000000000000000000"
+#define AMMOLINE_SHOPPAPRO_DELAY   "0000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPAPRO_CRATE   "1111110111111111111111111111111111111111111111111111121111"
 
-//When adding new weapons also insert one element in cDefaultAmmos list (hwconsts.cpp.in)
-
-
--- a/hedgewars/uAIAmmoTests.pas	Sat Apr 08 18:36:12 2017 +0200
+++ b/hedgewars/uAIAmmoTests.pas	Sat Apr 08 21:43:48 2017 +0200
@@ -124,7 +124,8 @@
             (proc: nil;              flags: 0), // amIceGun
             (proc: nil;              flags: 0), // amKnife
             (proc: nil;              flags: 0), // amRubber
-            (proc: nil;              flags: 0)  // amAirMine
+            (proc: nil;              flags: 0), // amAirMine
+            (proc: nil;              flags: 0)  // amDuck
             );
 
 implementation
--- a/hedgewars/uGearsHedgehog.pas	Sat Apr 08 18:36:12 2017 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Sat Apr 08 21:43:48 2017 +0200
@@ -325,6 +325,13 @@
                                  newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0);
                                  end;
                      amDynamite: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
+                         amDuck: begin
+                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtDuck, 0, _0, _0, 0);
+                                 if not ((not dX.isNegative) xor ((State and gstHHHJump) <> 0)) then
+                                     newGear^.Tag:= -1
+                                 else
+                                     newGear^.Tag:= 1;
+                                 end;
                     amFirePunch: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtFirePunch, 0, xx, _0, 0);
                          amWhip: begin
                                  newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
--- a/hedgewars/uGearsList.pas	Sat Apr 08 18:36:12 2017 +0200
+++ b/hedgewars/uGearsList.pas	Sat Apr 08 21:43:48 2017 +0200
@@ -105,7 +105,7 @@
 (*        gtAddAmmo *) , amNothing
 (*  gtGenericFaller *) , amNothing
 (*          gtKnife *) , amKnife
-(*           gtDuck *) , amNothing // TODO: Add ammo type
+(*           gtDuck *) , amDuck
     );
 
 
--- a/hedgewars/uGearsRender.pas	Sat Apr 08 18:36:12 2017 +0200
+++ b/hedgewars/uGearsRender.pas	Sat Apr 08 21:43:48 2017 +0200
@@ -729,6 +729,7 @@
                 amSkip: DrawSpriteRotated(sprHandSkip, hx, hy, sign, aangle);
                 amClusterBomb: DrawSpriteRotated(sprHandCluster, hx, hy, sign, aangle);
                 amDynamite: DrawSpriteRotated(sprHandDynamite, hx, hy, sign, aangle);
+                amDuck: DrawSpriteRotatedF(sprHandDuck, hx, hy, 0, sign, aangle);
                 amHellishBomb: DrawSpriteRotated(sprHandHellish, hx, hy, sign, aangle);
                 amGasBomb: DrawSpriteRotated(sprHandCheese, hx, hy, sign, aangle);
                 amMine: DrawSpriteRotated(sprHandMine, hx, hy, sign, aangle);
--- a/hedgewars/uTypes.pas	Sat Apr 08 18:36:12 2017 +0200
+++ b/hedgewars/uTypes.pas	Sat Apr 08 21:43:48 2017 +0200
@@ -90,7 +90,7 @@
             sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis,
             sprSlider, sprBotlevels, sprHandKnife, sprKnife, sprStar, sprIceTexture, sprIceGun,
             sprFrozenHog, sprAmRubber, sprBoing, sprCustom1, sprCustom2, sprAirMine, sprHandAirMine,
-            sprFlakeL, sprSDFlakeL, sprCloudL, sprSDCloudL, sprDuck
+            sprFlakeL, sprSDFlakeL, sprCloudL, sprSDCloudL, sprDuck, sprHandDuck
             );
 
     // Gears that interact with other Gears and/or Land
@@ -161,7 +161,7 @@
             amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42
             amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48
             amResurrector, amDrillStrike, amSnowball, amTardis, {amStructure,} amLandGun, // 53
-            amIceGun, amKnife, amRubber, amAirMine); // 57
+            amIceGun, amKnife, amRubber, amAirMine, amDuck); // 58
 
     // Different kind of crates that e.g. hedgehogs can pick up
     TCrateType = (HealthCrate, AmmoCrate, UtilityCrate);
--- a/hedgewars/uVariables.pas	Sat Apr 08 18:36:12 2017 +0200
+++ b/hedgewars/uVariables.pas	Sat Apr 08 21:43:48 2017 +0200
@@ -748,7 +748,9 @@
             (FileName:     'SDCloudsL'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
             Width: 256; Height:128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprSDCloudL
             (FileName:     'Duck'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprDuck
+            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprDuck
+            (FileName:    'amDuck'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprHandDuck
             );
 
 const
@@ -2382,7 +2384,35 @@
             PosCount: 1;
             PosSprite: sprWater;
             ejectX: 0;
-            ejectY: 0)
+            ejectY: 0),
+// Rubber duck
+            (NameId: sidDuck;
+            NameTex: nil;
+            Probability: 100;
+            NumberInCase: 1;
+            Ammo: (Propz: ammoprop_NoCrosshair or
+                          ammoprop_AttackInMove or
+                          ammoprop_DontHold or
+                          ammoprop_AltUse;
+                Count: 2;
+                NumPerTurn: 0;
+                Timer: 9000;
+                Pos: 0;
+                AmmoType: amDuck;
+                AttackVoice: sndLaugh;
+                Bounciness: 1000);
+            Slot: 8; // FIXME: Use slot 0. for some reason, hwengine does not like it
+                     // when we put it into slot 0.
+                     // Probably related to amNothing being in slot 0, too?
+            TimeAfterTurn: 3000;
+            minAngle: 0;
+            maxAngle: 0;
+            isDamaging: true;
+            SkipTurns: 0;
+            PosCount: 1;
+            PosSprite: sprWater;
+            ejectX: 15;
+            ejectY: -7)
         );
 
 var
Binary file share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png has changed
Binary file share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw.png has changed
--- a/share/hedgewars/Data/Locale/en.txt	Sat Apr 08 18:36:12 2017 +0200
+++ b/share/hedgewars/Data/Locale/en.txt	Sat Apr 08 21:43:48 2017 +0200
@@ -60,6 +60,7 @@
 00:56=Cleaver
 00:57=Rubber
 00:58=Air Mine
+00:59=Rubber Duck
 
 01:00=Loading …
 01:01=Round draw
@@ -823,6 +824,7 @@
 03:56=Please use or misuse
 03:57=Utility
 03:58=Floating proximity bomb
+03:59=Swimming bomb
 
 ; Weapon Descriptions (use | as line breaks)
 04:00=Attack your enemies using a simple grenade.|It will explode once its timer reaches zero.|1-5: Set grenade's timer|Precise + 1-5: Set bounce strength|Attack: Hold to throw with more power
@@ -884,6 +886,7 @@
 04:56=You can throw two cleavers at your enemy,|block passages and tunnels and even use them for climbing!|Be careful! Playing with knifes is dangerous.|Attack: Hold to shoot with more power (twice)
 04:57=Build a VERY elastic rubber band, from which|hedgehogs and other things bounce off|without taking fall damage.|Left/Right: Change rubber band orientation|Cursor: Place rubber band in a valid position
 04:58=This proximity bomb will float freely in the air and follow|hedgehogs careless enouogh to come too close to it.|Its explosion is weaker than that of the land mine, however.|Attack: Hold to shoot with more power
+04:59=Send those dirty hogs swimming! This cute little squeaky|rubber duck is able to swim on water and will go with the|wind once swimming. It explodes when it hits land, so|make sure to drop it from a cliff or another safe spot.|Attack: Drop the rubber duck straight down
 
 ; Game goal strings
 05:00=Game Modes