Add Ouch taunt for particulary damaging hits (fall, bullet, shove, hammer)
authorWuzzy <Wuzzy2@mail.ru>
Wed, 31 Oct 2018 13:35:53 +0100
changeset 14046 44f20c9e6861
parent 14045 128fbd36eee4
child 14047 006f97a6f6a7
Add Ouch taunt for particulary damaging hits (fall, bullet, shove, hammer)
ChangeLog.txt
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uGearsUtils.pas
hedgewars/uSound.pas
hedgewars/uTypes.pas
hedgewars/uVariables.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/ChangeLog.txt	Wed Oct 31 13:08:56 2018 +0100
+++ b/ChangeLog.txt	Wed Oct 31 13:35:53 2018 +0100
@@ -7,7 +7,7 @@
  + Rework team rankings
  + Tied teams now rank equally
  + Help button in main menu
- + 17 new hedgehog taunts
+ + 18 new hedgehog taunts
  + Many new Lua API features
  * Functionality of controllers restored
  * Fix at least 2 crashes
@@ -55,7 +55,7 @@
  + Allow to change volume during pause
  + Add sounds: flamethrower, landspray, idle freezer, shorykuen hit
  + Add taunts: Amazing, Brilliant, Bugger, Cutitout, Drat, Excellent, Fire, Gonnagetyou, Grenade,
-               Leavemealone, Ohdear, Revenge, Runaway, Solong, Thisoneismine, Whatthe, Watchthis
+               Leavemealone, Ohdear, Ouch, Revenge, Runaway, Solong, Thisoneismine, Whatthe, Watchthis
  * Fix extreme amounts of droplets when shooting with minigun into ocean world edge
  * Fix some flakes disappearing in world wrap worlds while moving camera
  * Fix invisible projectile timer, attack bar, target on other side of wrap world edge
--- a/hedgewars/uConsts.pas	Wed Oct 31 13:08:56 2018 +0100
+++ b/hedgewars/uConsts.pas	Wed Oct 31 13:35:53 2018 +0100
@@ -191,6 +191,8 @@
     cMaxHogHealth = 268435455; // maximum hedgehog health
     // cMaxHogHealth was calculated by: High(LongInt) div (cMaxHHIndex+1);
 
+    ouchDmg = 55;        // least amount of damage a hog must take in one blow for sndOuch to play
+
     // Z levels
     cHHZ = 1000;
     cCurrHHZ = Succ(cHHZ);
--- a/hedgewars/uGears.pas	Wed Oct 31 13:08:56 2018 +0100
+++ b/hedgewars/uGears.pas	Wed Oct 31 13:35:53 2018 +0100
@@ -163,7 +163,7 @@
                 inc(Gear^.Damage, tmp);
                 if tmp > 0 then
                     // Make hedgehog moan on damage
-                    HHHurt(Gear^.Hedgehog, dsPoison);
+                    HHHurt(Gear^.Hedgehog, dsPoison, tmp);
                 end
             end;
 
@@ -509,7 +509,9 @@
     end;
 AddRandomness(CheckSum);
 TurnClockActive:= prevtime <> TurnTimeLeft;
-inc(GameTicks)
+inc(GameTicks);
+if (OuchTauntTimer > 0) then
+    dec(OuchTauntTimer);
 end;
 
 //Purpose, to reset all transient attributes toggled by a utility and clean up various gears and effects at end of turn
--- a/hedgewars/uGearsUtils.pas	Wed Oct 31 13:08:56 2018 +0100
+++ b/hedgewars/uGearsUtils.pas	Wed Oct 31 13:35:53 2018 +0100
@@ -31,7 +31,7 @@
 function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
-procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
+procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource; Damage: Longword);
 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: LongInt; showMessage: boolean; vgTint: Longword);
 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: LongInt; showMessage: boolean);
 function IncHogHealth(Hedgehog: PHedgehog; healthBoost: LongInt): LongInt;
@@ -280,7 +280,7 @@
         Gear^.LastDamage := AttackerHog;
 
         Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
-        HHHurt(Gear^.Hedgehog, Source);
+        HHHurt(Gear^.Hedgehog, Source, Damage);
         AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
         tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
         if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then
@@ -348,11 +348,17 @@
 end;
 
 // Play effects for hurt hedgehog
-procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
+procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource; Damage: Longword);
 begin
 if Hedgehog^.Effects[heFrozen] <> 0 then exit;
 
-if (Source = dsFall) or (Source = dsExplosion) then
+if (Damage >= ouchDmg) and (OuchTauntTimer = 0) and ((Source = dsFall) or (Source = dsBullet) or (Source = dsShove) or (Source = dsHammer)) then
+    begin
+    PlaySoundV(sndOuch, Hedgehog^.Team^.voicepack);
+    // Prevent sndOuch from being played too often in short time
+    OuchTauntTimer:= 1250;
+    end
+else if (Source = dsFall) or (Source = dsExplosion) then
     case random(3) of
         0: PlaySoundV(sndOoff1, Hedgehog^.Team^.voicepack);
         1: PlaySoundV(sndOoff2, Hedgehog^.Team^.voicepack);
--- a/hedgewars/uSound.pas	Wed Oct 31 13:08:56 2018 +0100
+++ b/hedgewars/uSound.pas	Wed Oct 31 13:35:53 2018 +0100
@@ -327,7 +327,8 @@
             (FileName:              'Runaway.ogg'; Path: ptVoices; AltPath: ptNone),// sndRunAway
             (FileName:              'Revenge.ogg'; Path: ptVoices; AltPath: ptNone),// sndRevenge
             (FileName:             'Cutitout.ogg'; Path: ptVoices; AltPath: ptNone),// sndCutItOut
-            (FileName:         'Leavemealone.ogg'; Path: ptVoices; AltPath: ptNone) // sndLeaveMeAlone
+            (FileName:         'Leavemealone.ogg'; Path: ptVoices; AltPath: ptNone),// sndLeaveMeAlone
+            (FileName:                 'Ouch.ogg'; Path: ptVoices; AltPath: ptNone) // sndOuch
             );
 
 
@@ -476,7 +477,7 @@
     // Fallback to sndFirePunch1 / sndOw1 / sndOoff1 if a “higher-numbered” sound is missing
     if (snd in [sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6]) then
         GetFallbackV := sndFirePunch1
-    else if (snd in [sndOw2, sndOw3, sndOw4]) then
+    else if (snd in [sndOw2, sndOw3, sndOw4, sndOuch]) then
         GetFallbackV := sndOw1
     else if (snd in [sndOoff2, sndOoff3]) then
         GetFallbackV := sndOoff1
--- a/hedgewars/uTypes.pas	Wed Oct 31 13:08:56 2018 +0100
+++ b/hedgewars/uTypes.pas	Wed Oct 31 13:35:53 2018 +0100
@@ -155,7 +155,7 @@
             sndLandGun, sndCaseImpact, sndExtraDamage, sndFirePunchHit, sndGrenade, sndThisOneIsMine,
             sndWhatThe, sndSoLong, sndOhDear, sndGonnaGetYou, sndDrat, sndBugger, sndAmazing,
             sndBrilliant, sndExcellent, sndFire, sndWatchThis, sndRunAway, sndRevenge, sndCutItOut,
-            sndLeaveMeAlone);
+            sndLeaveMeAlone, sndOuch);
 
     // Available ammo types to be used by hedgehogs
     TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
--- a/hedgewars/uVariables.pas	Wed Oct 31 13:08:56 2018 +0100
+++ b/hedgewars/uVariables.pas	Wed Oct 31 13:35:53 2018 +0100
@@ -89,6 +89,7 @@
     CheckSum        : LongWord;
     CampaignVariable: shortstring;
     GameTicks       : LongWord;
+    OuchTauntTimer  : LongWord; // Timer which blocks sndOuch from being played too often and fast
     GameState       : TGameState;
     GameType        : TGameType;
     InputMask       : LongWord;
@@ -2807,6 +2808,7 @@
     CursorMovementX     := 0;
     CursorMovementY     := 0;
     GameTicks           := 0;
+    OuchTauntTimer      := 0;
     CheckSum            := 0;
     cWaterLine          := LAND_HEIGHT;
     cGearScrEdgesDist   := 240;
--- a/share/hedgewars/Data/Sounds/voices/British/CMakeLists.txt	Wed Oct 31 13:08:56 2018 +0100
+++ b/share/hedgewars/Data/Sounds/voices/British/CMakeLists.txt	Wed Oct 31 13:35:53 2018 +0100
@@ -32,6 +32,7 @@
 Ohdear.ogg
 Ooff*.ogg
 Oops.ogg
+Ouch.ogg
 Ow*.ogg
 PoisonCough.ogg
 PoisonMoan.ogg
--- a/share/hedgewars/Data/Sounds/voices/Classic/CMakeLists.txt	Wed Oct 31 13:08:56 2018 +0100
+++ b/share/hedgewars/Data/Sounds/voices/Classic/CMakeLists.txt	Wed Oct 31 13:35:53 2018 +0100
@@ -32,6 +32,7 @@
 Ohdear.ogg
 Ooff*.ogg
 Oops.ogg
+Ouch.ogg
 Ow*.ogg
 PoisonCough.ogg
 PoisonMoan.ogg
--- a/share/hedgewars/Data/Sounds/voices/Default/CMakeLists.txt	Wed Oct 31 13:08:56 2018 +0100
+++ b/share/hedgewars/Data/Sounds/voices/Default/CMakeLists.txt	Wed Oct 31 13:35:53 2018 +0100
@@ -32,6 +32,7 @@
 Ohdear.ogg
 Ooff*.ogg
 Oops.ogg
+Ouch.ogg
 Ow*.ogg
 PoisonCough.ogg
 PoisonMoan.ogg
--- a/share/hedgewars/Data/Sounds/voices/Default_uk/CMakeLists.txt	Wed Oct 31 13:08:56 2018 +0100
+++ b/share/hedgewars/Data/Sounds/voices/Default_uk/CMakeLists.txt	Wed Oct 31 13:35:53 2018 +0100
@@ -32,6 +32,7 @@
 Ohdear.ogg
 Ooff*.ogg
 Oops.ogg
+Ouch.ogg
 Ow*.ogg
 PoisonCough.ogg
 PoisonMoan.ogg
--- a/share/hedgewars/Data/Sounds/voices/Mobster/CMakeLists.txt	Wed Oct 31 13:08:56 2018 +0100
+++ b/share/hedgewars/Data/Sounds/voices/Mobster/CMakeLists.txt	Wed Oct 31 13:35:53 2018 +0100
@@ -32,6 +32,7 @@
 Ohdear.ogg
 Ooff*.ogg
 Oops.ogg
+Ouch.ogg
 Ow*.ogg
 PoisonCough.ogg
 PoisonMoan.ogg
--- a/share/hedgewars/Data/Sounds/voices/Pirate/CMakeLists.txt	Wed Oct 31 13:08:56 2018 +0100
+++ b/share/hedgewars/Data/Sounds/voices/Pirate/CMakeLists.txt	Wed Oct 31 13:35:53 2018 +0100
@@ -32,6 +32,7 @@
 Ohdear.ogg
 Ooff*.ogg
 Oops.ogg
+Ouch.ogg
 Ow*.ogg
 PoisonCough.ogg
 PoisonMoan.ogg
--- a/share/hedgewars/Data/Sounds/voices/Robot/CMakeLists.txt	Wed Oct 31 13:08:56 2018 +0100
+++ b/share/hedgewars/Data/Sounds/voices/Robot/CMakeLists.txt	Wed Oct 31 13:35:53 2018 +0100
@@ -32,6 +32,7 @@
 Ohdear.ogg
 Ooff*.ogg
 Oops.ogg
+Ouch.ogg
 Ow*.ogg
 PoisonCough.ogg
 PoisonMoan.ogg
--- a/share/hedgewars/Data/Sounds/voices/Russian/CMakeLists.txt	Wed Oct 31 13:08:56 2018 +0100
+++ b/share/hedgewars/Data/Sounds/voices/Russian/CMakeLists.txt	Wed Oct 31 13:35:53 2018 +0100
@@ -32,6 +32,7 @@
 Ohdear.ogg
 Ooff*.ogg
 Oops.ogg
+Ouch.ogg
 Ow*.ogg
 PoisonCough.ogg
 PoisonMoan.ogg
--- a/share/hedgewars/Data/Sounds/voices/Singer/CMakeLists.txt	Wed Oct 31 13:08:56 2018 +0100
+++ b/share/hedgewars/Data/Sounds/voices/Singer/CMakeLists.txt	Wed Oct 31 13:35:53 2018 +0100
@@ -32,6 +32,7 @@
 Ohdear.ogg
 Ooff*.ogg
 Oops.ogg
+Ouch.ogg
 Ow*.ogg
 PoisonCough.ogg
 PoisonMoan.ogg
--- a/share/hedgewars/Data/Sounds/voices/Surfer/CMakeLists.txt	Wed Oct 31 13:08:56 2018 +0100
+++ b/share/hedgewars/Data/Sounds/voices/Surfer/CMakeLists.txt	Wed Oct 31 13:35:53 2018 +0100
@@ -32,6 +32,7 @@
 Ohdear.ogg
 Ooff*.ogg
 Oops.ogg
+Ouch.ogg
 Ow*.ogg
 PoisonCough.ogg
 PoisonMoan.ogg