Add taunt sndFlyAway when hog flies off the map
authorWuzzy <Wuzzy2@mail.ru>
Tue, 14 May 2019 16:01:55 +0200
changeset 14961 8b848c2939da
parent 14960 7b597da60fda
child 14962 c645327d0a81
Add taunt sndFlyAway when hog flies off the map
ChangeLog.txt
hedgewars/uGearsHedgehog.pas
hedgewars/uSound.pas
hedgewars/uTeams.pas
hedgewars/uTypes.pas
share/hedgewars/Data/Maps/ClimbHome/map.lua
--- a/ChangeLog.txt	Tue May 14 15:52:53 2019 +0200
+++ b/ChangeLog.txt	Tue May 14 16:01:55 2019 +0200
@@ -114,6 +114,7 @@
 Sounds and voicepacks:
  + sndYoohoo has been split to sndYoohoo and sndKiss
  + Voice files sndPoisonCough and sndPoisonMoan are now optional (fall back to Default voicepack)
+ + Add taunt: sndFlyAway / Flyaway.ogg: When hedgehog flies off the map
  + Tweak some taunts: sndFirstBlood, sndLeaveMeAlone, sndCutItOut
  * Fix English voicepack selection of team being overwritten when playing in non-English locale
 
--- a/hedgewars/uGearsHedgehog.pas	Tue May 14 15:52:53 2019 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Tue May 14 16:01:55 2019 +0200
@@ -1282,6 +1282,11 @@
     uStats.hedgehogFlight(Gear, Gear^.FlightTime);
     Gear^.FlightTime:= 0;
     end;
+if (WorldEdge = weNone) and (not Gear^.Hedgehog^.FlownOffMap) and (not isZero(Gear^.dX)) and (not isUnderwater) and ((Gear^.State and gstHHDriven) = 0) and (hwRound(Gear^.Y) < cWaterLine-300) and ((hwRound(Gear^.X) < leftX-2048) or (hwRound(Gear^.X) > rightX+2048)) then
+    begin
+    PlaySoundV(sndFlyAway, Gear^.Hedgehog^.Team^.voicepack);
+    Gear^.Hedgehog^.FlownOffMap:= true;
+    end;
 
 end;
 
--- a/hedgewars/uSound.pas	Tue May 14 15:52:53 2019 +0200
+++ b/hedgewars/uSound.pas	Tue May 14 16:01:55 2019 +0200
@@ -330,7 +330,8 @@
             (FileName:         'Leavemealone.ogg'; Path: ptVoices; AltPath: ptNone),// sndLeaveMeAlone
             (FileName:                 'Ouch.ogg'; Path: ptVoices; AltPath: ptNone),// sndOuch
             (FileName:                  'Hmm.ogg'; Path: ptVoices; AltPath: ptNone),// sndHmm
-            (FileName:                 'Kiss.ogg'; Path: ptSounds; AltPath: ptNone) // sndKiss
+            (FileName:                 'Kiss.ogg'; Path: ptSounds; AltPath: ptNone),// sndKiss
+            (FileName:              'Flyaway.ogg'; Path: ptVoices; AltPath: ptNone) // sndFlyAway
             );
 
 
--- a/hedgewars/uTeams.pas	Tue May 14 15:52:53 2019 +0200
+++ b/hedgewars/uTeams.pas	Tue May 14 16:01:55 2019 +0200
@@ -714,6 +714,7 @@
     if checkFails((Health > 0) and (Health <= cMaxHogHealth), 'Invalid hedgehog health (must be between 1 and '+IntToStr(cMaxHogHealth)+')', true) then exit;
     CurrentHedgehog^.Name:= id;
     CurrentHedgehog^.InitialHealth:= Health;
+    CurrentHedgehog^.RevengeHog:= nil;
     inc(HedgehogsNumber)
     end
 end;
@@ -749,6 +750,7 @@
     CurrentHedgehog^.Name:= id;
     CurrentHedgehog^.InitialHealth:= Gear^.Health;
     CurrentHedgehog^.RevengeHog:= nil;
+    CurrentHedgehog^.FlownOffMap:= false;
     CurrHedgehog:= HedgehogsNumber;
     inc(HedgehogsNumber)
     end
--- a/hedgewars/uTypes.pas	Tue May 14 15:52:53 2019 +0200
+++ b/hedgewars/uTypes.pas	Tue May 14 16:01:55 2019 +0200
@@ -156,7 +156,7 @@
             sndLandGun, sndCaseImpact, sndExtraDamage, sndFirePunchHit, sndGrenade, sndThisOneIsMine,
             sndWhatThe, sndSoLong, sndOhDear, sndGonnaGetYou, sndDrat, sndBugger, sndAmazing,
             sndBrilliant, sndExcellent, sndFire, sndWatchThis, sndRunAway, sndRevenge, sndCutItOut,
-            sndLeaveMeAlone, sndOuch, sndHmm, sndKiss);
+            sndLeaveMeAlone, sndOuch, sndHmm, sndKiss, sndFlyAway);
 
     // Available ammo types to be used by hedgehogs
     TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
@@ -422,6 +422,7 @@
             HealthBarHealth: LongInt;
             Effects: array[THogEffect] of LongInt;
             RevengeHog: PHedgehog;   // For which hog this hog wants revenge most. For sndRevenge taunt
+            FlownOffMap: boolean; // When hedgehog has flown far away off the map left or right
             end;
 
     TTeam = record
--- a/share/hedgewars/Data/Maps/ClimbHome/map.lua	Tue May 14 15:52:53 2019 +0200
+++ b/share/hedgewars/Data/Maps/ClimbHome/map.lua	Tue May 14 16:01:55 2019 +0200
@@ -32,7 +32,6 @@
 local addCake = true
 local takeASeat = false
 local Stars = {}
-local tauntNoo = false
 local jokeAwardNavy = nil
 local jokeAwardSpeed = nil
 local jokeAwardDamage = nil
@@ -189,7 +188,6 @@
     SetWaterLine(32768)
     YouWon = false
     YouLost = false
-    tauntNoo = false
     takeASeat = false
     recordBroken = false
     currTeam = GetHogTeamName(CurrentHedgehog)
@@ -503,17 +501,6 @@
                 takeASeat = true
             end
     
-            -- play taunts
-            if not YouWon and not YouLost then
-                local nooDistance = 500
-                if ((x < -nooDistance and vx < 0) or (x > LAND_WIDTH+nooDistance and vx > 0)) then
-                    if (tauntNoo == false and distanceFromWater > 80) then
-                        PlaySound(sndNooo, CurrentHedgehog)
-                        tauntNoo = true
-                    end
-                end
-            end
-
             if addCake and CakeTries < 10 and y < 32600 and y > 3000 and Cake == nil then 
                 -- doing this just after the start the first time to take advantage of randomness sources
                 -- Pick a clear y to start with