Rename amDuck and related symbols to amCreeper, gtCreeper, etc.
authorWuzzy <Wuzzy2@mail.ru>
Fri, 05 Oct 2018 17:27:12 +0200
changeset 13856 f01798038c2e
parent 13855 4e4111a75256
child 13857 e7c69e849005
Rename amDuck and related symbols to amCreeper, gtCreeper, etc. Compability for scripts is supported (amDuck=amCreeper, gtDuck=gtCreeper)
ChangeLog.txt
QTfrontend/weapons.h
hedgewars/uAIAmmoTests.pas
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsList.pas
hedgewars/uGearsRender.pas
hedgewars/uGearsUtils.pas
hedgewars/uScript.pas
hedgewars/uSound.pas
hedgewars/uTypes.pas
hedgewars/uVariables.pas
share/hedgewars/Data/Missions/Scenario/Big_Armory.lua
share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
--- a/ChangeLog.txt	Fri Oct 05 16:49:17 2018 +0200
+++ b/ChangeLog.txt	Fri Oct 05 17:27:12 2018 +0200
@@ -141,6 +141,7 @@
 
 Lua API:
  * Deprecation: Setting TurnTimeLeft/ReadyTimeLeft directly is deprecated and will become useless in future. Use the setter functions below
+ * Deprecation: Symbols amDuck/gtDuck are deprecated, will be removed later. For now, they alias to amCreeper/gtCreeper
  + New call: SetTurnTimeLeft(newTurnTimeLeft): Set remaining turn time
  + New call: SetReadyTimeLeft(newReadyTimeLeft): Set remaining ready time
  + New call: Retreat(time [, respectGetAwayTimeFactor): Force current turn into retreating mode
--- a/QTfrontend/weapons.h	Fri Oct 05 16:49:17 2018 +0200
+++ b/QTfrontend/weapons.h	Fri Oct 05 17:27:12 2018 +0200
@@ -81,7 +81,7 @@
  amKnife-------------------------------------------------------------------------------|
  amRubber-------------------------------------------------------------------------------|
  amAirMine-------------------------------------------------------------------------------|
- amDuck-----------------------------------------------------------------------------------|
+ amCreeper--------------------------------------------------------------------------------|
  amMinigun---------------------------------------------------------------------------------|
 */
 #define AMMOLINE_DEFAULT_QT     "93919294221991210322351110012000000002111001010111110001000"
--- a/hedgewars/uAIAmmoTests.pas	Fri Oct 05 16:49:17 2018 +0200
+++ b/hedgewars/uAIAmmoTests.pas	Fri Oct 05 17:27:12 2018 +0200
@@ -125,7 +125,7 @@
             (proc: nil;              flags: 0), // amKnife
             (proc: nil;              flags: 0), // amRubber
             (proc: nil;              flags: 0), // amAirMine
-            (proc: nil;              flags: 0), // amDuck
+            (proc: nil;              flags: 0), // amCreeper
             (proc: @TestShotgun;     flags: 0)  // amMinigun
             );
 
--- a/hedgewars/uGearsHandlersMess.pas	Fri Oct 05 16:49:17 2018 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Fri Oct 05 17:27:12 2018 +0200
@@ -4779,10 +4779,6 @@
             if not ((Gear^.dX*ox + Gear^.dY*oy).isNegative) then
                 continue;
 
-        if iterator^.Kind = gtDuck then
-            // Make duck go into “falling” mode again
-            iterator^.Pos:= 0;
-
         isbullet:= (iterator^.Kind in [gtShotgunShot, gtDEagleShot, gtSniperRifleShot, gtSineGunShot, gtMinigunBullet]);
 
         r:= int2hwFloat(iterator^.Radius);
@@ -6603,6 +6599,7 @@
     end
 end;
 
+// TODO: Finish creeper implementation
 procedure doStepCreeper(Gear: PGear);
 var i,t,targDist,tmpDist: LongWord;
     targ, tmpG: PGear;
--- a/hedgewars/uGearsHedgehog.pas	Fri Oct 05 16:49:17 2018 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Fri Oct 05 17:27:12 2018 +0200
@@ -393,14 +393,16 @@
                                  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
-                                 // Does duck spawn inside water?
+                      amCreeper: begin
+                                 // TODO: Implement proper creeper spawning code. This is still the old rubber duck code.
+
+                                 // Does it spawn inside water?
                                  if (LeftX > hwRound(Gear^.X) - Gear^.Karma) or (RightX < hwRound(Gear^.X) + Gear^.Karma) or (cWaterLine < hwRound(Gear^.Y) + Gear^.Karma) then
                                      PlaySound(sndDroplet2)
                                  else
-                                     // Duck spawned in air, normal drop sound
-                                     PlaySound(sndDuckDrop);
-                                 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDuck, 0, SignAs(_0_03, dX), _0, 0);
+                                     // spawned in air, normal drop sound
+                                     PlaySound(sndCreeperDrop);
+                                 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtCreeper, 0, SignAs(_0_03, dX), _0, 0);
                                  if not ((not dX.isNegative) xor ((State and gstHHHJump) <> 0)) then
                                      newGear^.Tag:= -1
                                  else
--- a/hedgewars/uGearsList.pas	Fri Oct 05 16:49:17 2018 +0200
+++ b/hedgewars/uGearsList.pas	Fri Oct 05 17:27:12 2018 +0200
@@ -105,7 +105,7 @@
 (*        gtAddAmmo *) , amNothing
 (*  gtGenericFaller *) , amNothing
 (*          gtKnife *) , amKnife
-(*           gtDuck *) , amDuck
+(*        gtCreeper *) , amCreeper
 (*        gtMinigun *) , amMinigun
 (*  gtMinigunBullet *) , amMinigun
     );
@@ -267,7 +267,7 @@
                     else Gear^.Boom := 3;
     gtPoisonCloud: Gear^.Boom := 20;
           gtKnife: Gear^.Boom := 40000; // arbitrary scaling factor since impact-based
-           gtDuck: Gear^.Boom := 100;
+        gtCreeper: Gear^.Boom := 100;
     gtMinigunBullet: Gear^.Boom := 2;
     end;
 
@@ -734,7 +734,8 @@
                 gear^.Radius:= 8;
                 gear^.Density:= _0;
                 end;
-        gtDuck: begin
+     gtCreeper: begin
+                // TODO: Finish creeper initialization implementation
                 gear^.Radius:= cHHRadius;
                 gear^.Elasticity:= _0_35;
                 gear^.Friction:= _0_93;
@@ -745,7 +746,7 @@
                 gear^.nImpactSounds:= 1;
                 gear^.Health:= 30;
                 gear^.Radius:= 8;
-                gear^.Angle:= 175; // Radius at which air bombs will start "seeking". $FFFFFFFF = unlimited. check is skipped.
+                gear^.Angle:= 175; // Radius at which it will start "seeking". $FFFFFFFF = unlimited. check is skipped.
                 gear^.Power:= cMaxWindSpeed.QWordValue div 2; // hwFloat converted. 1/2 g default. defines the "seek" speed when a gear is in range.
                 gear^.Pos:= cMaxWindSpeed.QWordValue * 3 div 2; // air friction. slows it down when not hitting stuff
                 if gear^.Timer = 0 then
--- a/hedgewars/uGearsRender.pas	Fri Oct 05 16:49:17 2018 +0200
+++ b/hedgewars/uGearsRender.pas	Fri Oct 05 17:27:12 2018 +0200
@@ -790,7 +790,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);
+                amCreeper: DrawSpriteRotatedF(sprHandCreeper, 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);
@@ -1622,9 +1622,9 @@
                                 end
                           end
                       end;
-            gtDuck: if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then
-					     DrawSpriteRotatedF(sprDuck, x, y, 1, hwRound(SignAs(_1,Gear^.Hedgehog^.Gear^.X-Gear^.X)), 0) 
-					else DrawSpriteRotatedF(sprDuck, x, y, 1, hwRound(SignAs(_1,Gear^.dX)), 0); 
+            gtCreeper: if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then
+					     DrawSpriteRotatedF(sprCreeper, x, y, 1, hwRound(SignAs(_1,Gear^.Hedgehog^.Gear^.X-Gear^.X)), 0)
+					else DrawSpriteRotatedF(sprCreeper, x, y, 1, hwRound(SignAs(_1,Gear^.dX)), 0);
 
             gtGenericFaller: begin
                              // DEBUG: draw gtGenericFaller
--- a/hedgewars/uGearsUtils.pas	Fri Oct 05 16:49:17 2018 +0200
+++ b/hedgewars/uGearsUtils.pas	Fri Oct 05 17:27:12 2018 +0200
@@ -1770,10 +1770,7 @@
             Scale:= imageScale;
             State:= ord(sprBoing)
             end;
-    if Gear^.Kind = gtDuck then
-        PlaySound(sndDuckDrop, true)
-    else
-        PlaySound(sndMelonImpact, true)
+    PlaySound(sndMelonImpact, true)
 end;
 
 function IsHogLocal(HH: PHedgehog): boolean;
--- a/hedgewars/uScript.pas	Fri Oct 05 16:49:17 2018 +0200
+++ b/hedgewars/uScript.pas	Fri Oct 05 17:27:12 2018 +0200
@@ -3970,6 +3970,12 @@
 // import some variables
 ScriptSetString(_S'LOCALE', cLocale);
 
+// Add aliases for amDuck and gtDuck because rubber duck was removed.
+// amDuck and gtDuck are deprecated and should be removed later.
+// TODO: Remove these aliases in a later version.
+ScriptSetInteger('amDuck', Ord(amCreeper));
+ScriptSetInteger('gtDuck', Ord(gtCreeper));
+
 // import game flags
 ScriptSetInteger('gfSwitchHog', gfSwitchHog);
 ScriptSetInteger('gfMultiWeapon', gfMultiWeapon);
--- a/hedgewars/uSound.pas	Fri Oct 05 16:49:17 2018 +0200
+++ b/hedgewars/uSound.pas	Fri Oct 05 17:27:12 2018 +0200
@@ -278,9 +278,10 @@
             (FileName:           'countdown2.ogg'; Path: ptSounds; AltPath: ptNone),// sndCountdown2
             (FileName:           'countdown3.ogg'; Path: ptSounds; AltPath: ptNone),// sndCountdown3
             (FileName:           'countdown4.ogg'; Path: ptSounds; AltPath: ptNone),// sndCountdown4
-            (FileName:      'rubberduck_drop.ogg'; Path: ptSounds; AltPath: ptNone),// sndDuckDrop
-            (FileName:     'rubberduck_water.ogg'; Path: ptSounds; AltPath: ptNone),// sndDuckWater
-            (FileName:       'rubberduck_die.ogg'; Path: ptSounds; AltPath: ptNone),// sndDuckDie
+            // TODO: Check which creeper (formerly rubberduck) sounds are needed, maybe rename them
+            (FileName:      'rubberduck_drop.ogg'; Path: ptSounds; AltPath: ptNone),// sndCreeperDrop
+            (FileName:     'rubberduck_water.ogg'; Path: ptSounds; AltPath: ptNone),// sndCreeperWater
+            (FileName:       'rubberduck_die.ogg'; Path: ptSounds; AltPath: ptNone),// sndCreeperDie
             (FileName:              'custom1.ogg'; Path: ptSounds; AltPath: ptNone),// sndCustom1
             (FileName:              'custom2.ogg'; Path: ptSounds; AltPath: ptNone),// sndCustom2
             (FileName:              'custom3.ogg'; Path: ptSounds; AltPath: ptNone),// sndCustom3
--- a/hedgewars/uTypes.pas	Fri Oct 05 16:49:17 2018 +0200
+++ b/hedgewars/uTypes.pas	Fri Oct 05 17:27:12 2018 +0200
@@ -91,7 +91,7 @@
             sprSlider, sprBotlevels, sprHandKnife, sprKnife, sprStar, sprIceTexture, sprIceGun,
             sprFrozenHog, sprAmRubber, sprBoing, sprCustom1, sprCustom2, sprCustom3, sprCustom4,
             sprCustom5, sprCustom6, sprCustom7, sprCustom8, sprFrozenAirMine, sprAirMine, sprHandAirMine,
-            sprFlakeL, sprSDFlakeL, sprCloudL, sprSDCloudL, sprDuck, sprHandDuck, sprMinigun
+            sprFlakeL, sprSDFlakeL, sprCloudL, sprSDCloudL, sprCreeper, sprHandCreeper, sprMinigun
             );
 
     // Gears that interact with other Gears and/or Land
@@ -109,7 +109,7 @@
             gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51
             gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 56
             gtNapalmBomb, gtSnowball, gtFlake, {gtStructure,} gtLandGun, gtTardis, // 61
-            gtIceGun, gtAddAmmo, gtGenericFaller, gtKnife, gtDuck, gtMinigun, gtMinigunBullet); // 68
+            gtIceGun, gtAddAmmo, gtGenericFaller, gtKnife, gtCreeper, gtMinigun, gtMinigunBullet); // 68
 
     // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
     TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
@@ -150,7 +150,7 @@
             sndIceBeam, sndHogFreeze, sndAirMineImpact, sndKnifeImpact, sndExtraTime, sndLaserSight,
             sndInvulnerable, sndJetpackLaunch, sndJetpackBoost, sndPortalShot, sndPortalSwitch,
             sndPortalOpen, sndBlowTorch, sndCountdown1, sndCountdown2, sndCountdown3, sndCountdown4,
-            sndDuckDrop, sndDuckWater, sndDuckDie, sndCustom1, sndCustom2, sndCustom3, sndCustom4,
+            sndCreeperDrop, sndCreeperWater, sndCreeperDie, sndCustom1, sndCustom2, sndCustom3, sndCustom4,
             sndCustom5, sndCustom6, sndCustom7, sndCustom8, sndMinigun);
 
     // Available ammo types to be used by hedgehogs
@@ -163,7 +163,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, amDuck, amMinigun); // 59
+            amIceGun, amKnife, amRubber, amAirMine, amCreeper, amMinigun); // 59
 
     // Different kind of crates that e.g. hedgehogs can pick up
     TCrateType = (HealthCrate, AmmoCrate, UtilityCrate);
@@ -482,7 +482,7 @@
             sidSineGun, sidFlamethrower,sidSMine, sidHammer, sidResurrector,
             sidDrillStrike, sidSnowball, sidNothing, sidTardis,
             {sidStructure,} sidLandGun, sidIceGun, sidKnife, sidRubber, sidAirMine,
-            sidDuck, sidMinigun);
+            sidCreeper, sidMinigun);
 
     TMsgStrId = (sidLoading, sidDraw, sidWinner, sidVolume, sidPaused,
             sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync,
--- a/hedgewars/uVariables.pas	Fri Oct 05 16:49:17 2018 +0200
+++ b/hedgewars/uVariables.pas	Fri Oct 05 17:27:12 2018 +0200
@@ -781,10 +781,12 @@
             Width: 256; Height:128; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: false; checkSum: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprCloudL
             (FileName:     'SDCloudsL'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
             Width: 256; Height:128; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: false; checkSum: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprSDCloudL
+            // TODO: Rename creeper image
             (FileName:     'Duck'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprDuck
+            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCreeper
+            // TODO: Rename creeper hand image
             (FileName:    'amDuck'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true), // sprHandDuck
+            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true), // sprHandCreeper
             (FileName: 'amMinigun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
             Width:  64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; critical: true; checkSum: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprMinigun
             );
@@ -2429,8 +2431,8 @@
             PosSprite: sprWater;
             ejectX: 0;
             ejectY: 0),
-// Rubber duck
-            (NameId: sidDuck;
+// Creeper
+            (NameId: sidCreeper;
             NameTex: nil;
             Probability: 100;
             NumberInCase: 1;
@@ -2442,7 +2444,7 @@
                 NumPerTurn: 0;
                 Timer: 15000;
                 Pos: 0;
-                AmmoType: amDuck;
+                AmmoType: amCreeper;
                 AttackVoice: sndNone;
                 Bounciness: defaultBounciness);
             Slot: 0;
--- a/share/hedgewars/Data/Missions/Scenario/Big_Armory.lua	Fri Oct 05 16:49:17 2018 +0200
+++ b/share/hedgewars/Data/Missions/Scenario/Big_Armory.lua	Fri Oct 05 17:27:12 2018 +0200
@@ -2,10 +2,10 @@
 HedgewarsScriptLoad("/Scripts/Locale.lua")
 
 local heroAmmo = {}
-for a=0, amDuck do
+for a=0, amCreeper do
 	if a == amExtraTime then
 		heroAmmo[a] = 2
-	elseif a ~= amNothing and a ~= amDuck then
+	elseif a ~= amNothing and a ~= amCreeper then
 		heroAmmo[a] = 100
 	end
 end
--- a/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Fri Oct 05 16:49:17 2018 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Fri Oct 05 17:27:12 2018 +0200
@@ -35,7 +35,7 @@
 	[amSeduction]=true, [amHammer]=true, [amMine]=true, [amDynamite]=true, [amCake]=true,
 	[amBallgun]=true, [amSMine]=true, [amRCPlane]=true, [amBirdy]=true, [amKnife]=true,
 	[amAirAttack]=true, [amMineStrike]=true, [amNapalm]=true, [amDrillStrike]=true, [amPiano]=true, [amAirMine] = true,
-	[amDuck]=true,
+	[amCreeper]=true,
 }
 
 local utilWeps =  {