Add Grenade taunt when grenade close to hog is about to blow up
authorWuzzy <Wuzzy2@mail.ru>
Sat, 27 Oct 2018 13:27:45 +0200
changeset 14011 3c40754f6cfe
parent 14010 fb9ed6adef05
child 14012 7b66a2e9b368
Add Grenade taunt when grenade close to hog is about to blow up
hedgewars/uGearsHandlersMess.pas
hedgewars/uSound.pas
hedgewars/uTypes.pas
share/hedgewars/Data/Sounds/voices/British/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Classic/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Default/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Default_uk/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Mobster/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Pirate/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Robot/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Russian/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Singer/CMakeLists.txt
share/hedgewars/Data/Sounds/voices/Surfer/CMakeLists.txt
--- a/hedgewars/uGearsHandlersMess.pas	Sat Oct 27 08:15:45 2018 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Oct 27 13:27:45 2018 +0200
@@ -32,7 +32,7 @@
 uses uTypes, uFloat;
 
 procedure doStepPerPixel(Gear: PGear; step: TGearStepProcedure; onlyCheckIfChanged: boolean);
-procedure makeHogsWorry(x, y: hwFloat; r: LongInt);
+procedure makeHogsWorry(x, y: hwFloat; r: LongInt; gearType: TGearType);
 procedure HideHog(HH: PHedgehog);
 procedure doStepDrowningGear(Gear: PGear);
 procedure doStepFallingGear(Gear: PGear);
@@ -201,10 +201,11 @@
         end;
 end;
 
-procedure makeHogsWorry(x, y: hwFloat; r: LongInt);
+procedure makeHogsWorry(x, y: hwFloat; r: LongInt; gearType: TGearType);
 var
     gi: PGear;
     d: LongInt;
+    grenadeTaunt: boolean;
 begin
     gi := GearsList;
     while gi <> nil do
@@ -225,10 +226,18 @@
                         gi^.State := gi^.State or gstLoser;
                         end;
 
-                    if d > r div 2 then
-                        PlaySoundV(sndNooo, gi^.Hedgehog^.Team^.voicepack)
+                    grenadeTaunt:= false;
+                    if (gearType = gtGrenade) then
+                        grenadeTaunt:= random(2) = 0;
+
+                    if grenadeTaunt then
+                        PlaySoundV(sndGrenade, gi^.Hedgehog^.Team^.voicepack)
                     else
-                        PlaySoundV(sndUhOh, gi^.Hedgehog^.Team^.voicepack);
+                        if d > r div 2 then
+                            PlaySoundV(sndNooo, gi^.Hedgehog^.Team^.voicepack)
+                        else
+                            PlaySoundV(sndUhOh, gi^.Hedgehog^.Team^.voicepack);
+
                     end;
                 end;
             end;
@@ -552,8 +561,8 @@
             gtGrenade,
             gtClusterBomb,
             gtWatermelon,
-            gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, Gear^.Boom);
-            gtGasBomb: makeHogsWorry(Gear^.X, Gear^.Y, 50);
+            gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, Gear^.Boom, Gear^.Kind);
+            gtGasBomb: makeHogsWorry(Gear^.X, Gear^.Y, 50, Gear^.Kind);
         end;
 
     if (Gear^.Kind = gtBall) and ((Gear^.State and gstTmpFlag) <> 0) then
@@ -2285,7 +2294,7 @@
     if Gear^.Timer mod 166 = 0 then
         inc(Gear^.Tag);
     if Gear^.Timer = 1000 then // might need better timing
-        makeHogsWorry(Gear^.X, Gear^.Y, 75);
+        makeHogsWorry(Gear^.X, Gear^.Y, 75, Gear^.Kind);
     if Gear^.Timer = 0 then
         begin
         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
--- a/hedgewars/uSound.pas	Sat Oct 27 08:15:45 2018 +0300
+++ b/hedgewars/uSound.pas	Sat Oct 27 13:27:45 2018 +0200
@@ -305,7 +305,8 @@
             (FileName:          'graveimpact.ogg'; Path: ptSounds; AltPath: ptNone),// sndCaseImpact
             // TODO: New Extra Damage sound
             (FileName:             'hell_ugh.ogg'; Path: ptSounds; AltPath: ptNone),// sndExtraDamage
-            (FileName:        'firepunch_hit.ogg'; Path: ptSounds; AltPath: ptNone) // sndFirePunchHit
+            (FileName:        'firepunch_hit.ogg'; Path: ptSounds; AltPath: ptNone),// sndFirePunchHit
+            (FileName:              'Grenade.ogg'; Path: ptVoices; AltPath: ptNone) // sndGrenade
             );
 
 
@@ -501,15 +502,21 @@
         if (voicepack^.chunks[snd] = nil) and (Soundz[snd].Path = ptVoices) and (Soundz[snd].FileName <> '') then
             begin
             s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
-            // Fallback to sndFirePunch1 / sndOw1 / sndOoff1 if a “higher-numbered” sound is missing
+            // Fallback sounds
             if (not pfsExists(s)) then
                 begin
+                // Fallback to sndFirePunch1 / sndOw1 / sndOoff1 if a “higher-numbered” sound is missing
                 if (snd in [sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6]) then
                     snd := sndFirePunch1
                 else if (snd in [sndOw2, sndOw3, sndOw4]) then
                     snd := sndOw1
                 else if (snd in [sndOoff2, sndOoff3]) then
-                    snd := sndOoff1;
+                    snd := sndOoff1
+                else if (snd = sndGrenade) then
+                    if random(2) = 0 then
+                        snd := sndNooo
+                    else
+                        snd := sndUhOh;
                 s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
                 end;
             WriteToConsole(msgLoading + s + ' ');
--- a/hedgewars/uTypes.pas	Sat Oct 27 08:15:45 2018 +0300
+++ b/hedgewars/uTypes.pas	Sat Oct 27 13:27:45 2018 +0200
@@ -152,7 +152,7 @@
             sndPortalOpen, sndBlowTorch, sndCountdown1, sndCountdown2, sndCountdown3, sndCountdown4,
             sndCreeperDrop, sndCreeperWater, sndCreeperDie, sndCustom1, sndCustom2, sndCustom3, sndCustom4,
             sndCustom5, sndCustom6, sndCustom7, sndCustom8, sndMinigun, sndFlamethrower, sndIceBeamIdle,
-            sndLandGun, sndCaseImpact, sndExtraDamage, sndFirePunchHit);
+            sndLandGun, sndCaseImpact, sndExtraDamage, sndFirePunchHit, sndGrenade);
 
     // Available ammo types to be used by hedgehogs
     TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
--- a/share/hedgewars/Data/Sounds/voices/British/CMakeLists.txt	Sat Oct 27 08:15:45 2018 +0300
+++ b/share/hedgewars/Data/Sounds/voices/British/CMakeLists.txt	Sat Oct 27 13:27:45 2018 +0200
@@ -7,6 +7,7 @@
 Firstblood.ogg
 Firepunch*.ogg
 Flawless.ogg
+Grenade.ogg
 Hello.ogg
 Hurry.ogg
 Illgetyou.ogg
--- a/share/hedgewars/Data/Sounds/voices/Classic/CMakeLists.txt	Sat Oct 27 08:15:45 2018 +0300
+++ b/share/hedgewars/Data/Sounds/voices/Classic/CMakeLists.txt	Sat Oct 27 13:27:45 2018 +0200
@@ -7,6 +7,7 @@
 Firstblood.ogg
 Firepunch*.ogg
 Flawless.ogg
+Grenade.ogg
 Hello.ogg
 Hurry.ogg
 Illgetyou.ogg
--- a/share/hedgewars/Data/Sounds/voices/Default/CMakeLists.txt	Sat Oct 27 08:15:45 2018 +0300
+++ b/share/hedgewars/Data/Sounds/voices/Default/CMakeLists.txt	Sat Oct 27 13:27:45 2018 +0200
@@ -7,6 +7,7 @@
 Firstblood.ogg
 Firepunch*.ogg
 Flawless.ogg
+Grenade.ogg
 Hello.ogg
 Hurry.ogg
 Illgetyou.ogg
--- a/share/hedgewars/Data/Sounds/voices/Default_uk/CMakeLists.txt	Sat Oct 27 08:15:45 2018 +0300
+++ b/share/hedgewars/Data/Sounds/voices/Default_uk/CMakeLists.txt	Sat Oct 27 13:27:45 2018 +0200
@@ -7,6 +7,7 @@
 Firstblood.ogg
 Firepunch*.ogg
 Flawless.ogg
+Grenade.ogg
 Hello.ogg
 Hurry.ogg
 Illgetyou.ogg
--- a/share/hedgewars/Data/Sounds/voices/Mobster/CMakeLists.txt	Sat Oct 27 08:15:45 2018 +0300
+++ b/share/hedgewars/Data/Sounds/voices/Mobster/CMakeLists.txt	Sat Oct 27 13:27:45 2018 +0200
@@ -7,6 +7,7 @@
 Firstblood.ogg
 Firepunch*.ogg
 Flawless.ogg
+Grenade.ogg
 Hello.ogg
 Hurry.ogg
 Illgetyou.ogg
--- a/share/hedgewars/Data/Sounds/voices/Pirate/CMakeLists.txt	Sat Oct 27 08:15:45 2018 +0300
+++ b/share/hedgewars/Data/Sounds/voices/Pirate/CMakeLists.txt	Sat Oct 27 13:27:45 2018 +0200
@@ -7,6 +7,7 @@
 Firstblood.ogg
 Firepunch*.ogg
 Flawless.ogg
+Grenade.ogg
 Hello.ogg
 Hurry.ogg
 Illgetyou.ogg
--- a/share/hedgewars/Data/Sounds/voices/Robot/CMakeLists.txt	Sat Oct 27 08:15:45 2018 +0300
+++ b/share/hedgewars/Data/Sounds/voices/Robot/CMakeLists.txt	Sat Oct 27 13:27:45 2018 +0200
@@ -7,6 +7,7 @@
 Firstblood.ogg
 Firepunch*.ogg
 Flawless.ogg
+Grenade.ogg
 Hello.ogg
 Hurry.ogg
 Illgetyou.ogg
--- a/share/hedgewars/Data/Sounds/voices/Russian/CMakeLists.txt	Sat Oct 27 08:15:45 2018 +0300
+++ b/share/hedgewars/Data/Sounds/voices/Russian/CMakeLists.txt	Sat Oct 27 13:27:45 2018 +0200
@@ -7,6 +7,7 @@
 Firstblood.ogg
 Firepunch*.ogg
 Flawless.ogg
+Grenade.ogg
 Hello.ogg
 Hurry.ogg
 Illgetyou.ogg
--- a/share/hedgewars/Data/Sounds/voices/Singer/CMakeLists.txt	Sat Oct 27 08:15:45 2018 +0300
+++ b/share/hedgewars/Data/Sounds/voices/Singer/CMakeLists.txt	Sat Oct 27 13:27:45 2018 +0200
@@ -7,6 +7,7 @@
 Firstblood.ogg
 Firepunch*.ogg
 Flawless.ogg
+Grenade.ogg
 Hello.ogg
 Hurry.ogg
 Illgetyou.ogg
--- a/share/hedgewars/Data/Sounds/voices/Surfer/CMakeLists.txt	Sat Oct 27 08:15:45 2018 +0300
+++ b/share/hedgewars/Data/Sounds/voices/Surfer/CMakeLists.txt	Sat Oct 27 13:27:45 2018 +0200
@@ -7,6 +7,7 @@
 Firstblood.ogg
 Firepunch*.ogg
 Flawless.ogg
+Grenade.ogg
 Hello.ogg
 Hurry.ogg
 Illgetyou.ogg