DEADSOFTWARE

fix small spider pain sound and sensitivity
authorbinarymaster <x86corez@gmail.com>
Wed, 1 Mar 2017 21:49:13 +0000 (00:49 +0300)
committerbinarymaster <x86corez@gmail.com>
Wed, 1 Mar 2017 21:49:13 +0000 (00:49 +0300)
src/game/g_monsters.pas

index 85563aa8ec40597b94a4d030022cedc89544d1b4..cde1aad4dff139c91b8ffdf65997fa9ce4ba1a3e 100644 (file)
@@ -64,6 +64,7 @@ type
     FPain: Integer;
     FSleep: Integer;
     FPainSound: Boolean;
+    FPainTicks: Integer;
     FWaitAttackAnim: Boolean;
     FChainFire: Boolean;
     tx, ty: Integer;
@@ -1268,6 +1269,7 @@ begin
     Exit;
 
   FPainSound := True;
+  FPainTicks := 20;
 
   case FMonsterType of
     MONSTER_IMP, MONSTER_ZOMBY, MONSTER_SERG,
@@ -1275,7 +1277,7 @@ begin
       g_Sound_PlayExAt('SOUND_MONSTER_PAIN', FObj.X, FObj.Y);
     MONSTER_SOUL, MONSTER_BARON, MONSTER_CACO,
     MONSTER_KNIGHT, MONSTER_DEMON, MONSTER_SPIDER,
-    MONSTER_CYBER:
+    MONSTER_BSP, MONSTER_CYBER:
       g_Sound_PlayExAt('SOUND_MONSTER_PAIN2', FObj.X, FObj.Y);
     MONSTER_VILE:
       g_Sound_PlayExAt('SOUND_MONSTER_VILE_PAIN', FObj.X, FObj.Y);
@@ -2015,7 +2017,10 @@ begin
     Exit;
   end;
 
-  FPainSound := False;
+  if FPainTicks > 0 then
+    Dec(FPainTicks)
+  else
+    FPainSound := False;
 
 // Äâèãàåìñÿ:
   st := g_Obj_Move(@FObj, fall, True, True);
@@ -2138,6 +2143,8 @@ begin
           FPain := MONSTERTABLE[FMonsterType].Pain;
           if gSoundEffectsDF then PainSound();
         end;
+        if (not gSoundEffectsDF) and (FPain >= MONSTERTABLE[FMonsterType].MinPain) then
+          PainSound();
 
       // Ñíèæàåì áîëü ñî âðåìåíåì:
         FPain := FPain - 5;
@@ -2948,7 +2955,10 @@ begin
     Exit;
   end;
 
-  FPainSound := False;
+  if FPainTicks > 0 then
+    Dec(FPainTicks)
+  else
+    FPainSound := False;
 
 // Äâèãàåìñÿ:
   st := g_Obj_Move(@FObj, fall, True, True);
@@ -3053,8 +3063,10 @@ begin
         if FPain >= MONSTERTABLE[FMonsterType].Pain then
         begin
           FPain := MONSTERTABLE[FMonsterType].Pain;
-          PainSound();
+          if gSoundEffectsDF then PainSound();
         end;
+        if (not gSoundEffectsDF) and (FPain >= MONSTERTABLE[FMonsterType].MinPain) then
+          PainSound();
 
       // Ñíèæàåì áîëü ñî âðåìåíåì:
         FPain := FPain - 5;