* removed old hellishimpact.ogg
authorsheepluva
Sun, 28 Mar 2010 16:35:44 +0000
changeset 3136 326a8cb7d9b7
parent 3135 a7d0e22eaf28
child 3137 d8b968a543df
* removed old hellishimpact.ogg * changed random impactsounds of HHgrenade to more general implementation
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
share/hedgewars/Data/Sounds/hellishimpact.ogg
--- a/hedgewars/GSHandlers.inc	Sun Mar 28 12:02:51 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Mar 28 16:35:44 2010 +0000
@@ -236,9 +236,10 @@
 else
     Gear^.State:= Gear^.State or      gstMoving;
 
-if ((Gear^.Damage <> 0) or ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving))) and
-   ((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)) then
-   PlaySound(Gear^.ImpactSound);
+if (Gear^.nImpactSounds > 0) then
+    if ((Gear^.Damage <> 0) or ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving))) and
+       ((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)) then
+        PlaySound(TSound(ord(Gear^.ImpactSound) + GetRandom(Gear^.nImpactSounds)));
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -318,19 +319,11 @@
 
 if Gear^.Kind = gtHellishBomb then
     begin
-    if (Gear^.Timer > 3000) and ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving)) and
-       ((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)) then
-        case random(4) of
-            0: Gear^.ImpactSound:= sndHellishImpact1;
-            1: Gear^.ImpactSound:= sndHellishImpact2;
-            2: Gear^.ImpactSound:= sndHellishImpact3;
-            3: Gear^.ImpactSound:= sndHellishImpact4
-        end;
 
     if Gear^.Timer = 3000 then
         begin
+        Gear^.nImpactSounds:= 0;
         PlaySound(sndHellish);
-        Gear^.ImpactSound:= sndNone
         end;
 
     if (GameTicks and $3F) = 0 then
--- a/hedgewars/uGears.pas	Sun Mar 28 12:02:51 2010 +0000
+++ b/hedgewars/uGears.pas	Sun Mar 28 16:35:44 2010 +0000
@@ -57,7 +57,8 @@
             IntersectGear: PGear;
             FlightTime: Longword;
             uid: Longword;
-            ImpactSound: TSound;
+            ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
+            nImpactSounds: ShortInt; // count of ImpactSounds
             SoundChannel: LongInt
         end;
 
@@ -248,6 +249,7 @@
 gear^.uid:= Counter;
 gear^.SoundChannel:= -1;
 gear^.ImpactSound:= sndNone;
+gear^.nImpactSounds:= 0;
 
 if CurrentTeam <> nil then
     begin
@@ -259,6 +261,7 @@
    gtAmmo_Bomb,
  gtClusterBomb: begin
                 gear^.ImpactSound:= sndGrenadeImpact;
+                gear^.nImpactSounds:= 1;
                 gear^.AdvBounce:= 1;
                 gear^.Radius:= 4;
                 gear^.Elasticity:= _0_6;
@@ -268,6 +271,7 @@
                 end;
   gtWatermelon: begin
                 gear^.ImpactSound:= sndMelonImpact;
+                gear^.nImpactSounds:= 1;
                 gear^.AdvBounce:= 1;
                 gear^.Radius:= 4;
                 gear^.Elasticity:= _0_8;
@@ -292,6 +296,7 @@
                 end;
        gtGrave: begin
                 gear^.ImpactSound:= sndGraveImpact;
+                gear^.nImpactSounds:= 1;
                 gear^.Radius:= 10;
                 gear^.Elasticity:= _0_6;
                 end;
@@ -335,11 +340,13 @@
                 end;
         gtCase: begin
                 gear^.ImpactSound:= sndGraveImpact;
+                gear^.nImpactSounds:= 1;
                 gear^.Radius:= 16;
                 gear^.Elasticity:= _0_3
                 end;
   gtExplosives: begin
                 gear^.ImpactSound:= sndGrenadeImpact;
+                gear^.nImpactSounds:= 1;
                 gear^.Radius:= 16;
                 gear^.Elasticity:= _0_4;
                 gear^.Friction:= _0_995;
@@ -411,12 +418,8 @@
                 if not dX.isNegative then gear^.Angle:= 1 else gear^.Angle:= 3
                 end;
  gtHellishBomb: begin
-                case random(4) of
-                    0: gear^.ImpactSound:= sndHellishImpact1;
-                    1: gear^.ImpactSound:= sndHellishImpact2;
-                    2: gear^.ImpactSound:= sndHellishImpact3;
-                    3: gear^.ImpactSound:= sndHellishImpact4
-                end;
+                gear^.ImpactSound:= sndHellishImpact1;
+                gear^.nImpactSounds:= 4;
                 gear^.AdvBounce:= 1;
                 gear^.Radius:= 4;
                 gear^.Elasticity:= _0_5;
@@ -430,6 +433,7 @@
                 end;
         gtBall: begin
                 gear^.ImpactSound:= sndGrenadeImpact;
+                gear^.nImpactSounds:= 1;
                 gear^.AdvBounce:= 1;
                 gear^.Radius:= 5;
                 gear^.Tag:= random(8);
Binary file share/hedgewars/Data/Sounds/hellishimpact.ogg has changed