hedgewars/HHHandlers.inc
changeset 2603 abed6070a669
parent 2602 3deb9ff104da
child 2608 cebfea02f8b5
--- a/hedgewars/HHHandlers.inc	Thu Nov 05 20:47:42 2009 +0000
+++ b/hedgewars/HHHandlers.inc	Thu Nov 05 20:48:13 2009 +0000
@@ -136,8 +136,6 @@
         yy:= -AngleCos(Angle);
 
         if ((Gear^.State and gstHHHJump) <> 0) then xx:= - xx;
-        if Ammo^[CurSlot, CurAmmo].AttackVoice <> sndNone then
-           PlaySound(Ammo^[CurSlot, CurAmmo].AttackVoice, false, CurrentTeam^.voicepack);
              case Ammo^[CurSlot, CurAmmo].AmmoType of
                       amGrenade: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtAmmo_Bomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
                       amMolotov: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtMolotov,      0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
@@ -151,10 +149,16 @@
                    amPickHammer: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
                          amSkip: ParseCommand('/skip', true);
                          amRope: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtRope, 0, xx, yy, 0);
-                         amMine: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtMine, 0, SignAs(_0_02, dX), _0, 3000);
+                         amMine: begin
+                                 AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtMine, 0, SignAs(_0_02, dX), _0, 3000);
+                                 PlaySound(sndLaugh, false, CurrentTeam^.voicepack)
+                                 end;
                        amDEagle: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
                   amSniperRifle: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0);
-                     amDynamite: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
+                     amDynamite: begin
+                                 AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
+                                 PlaySound(sndLaugh, false, CurrentTeam^.voicepack)
+                                 end;
                     amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, xx, _0, 0);
                          amWhip: begin
                                  CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
@@ -180,7 +184,10 @@
                                  PlaySound(sndRCPlane, true, nil)
                                  end;
                        amKamikaze: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
-                         amCake: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 3, hwRound(Y), gtCake, 0, xx, _0, 0);
+                         amCake: begin
+                                 CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 3, hwRound(Y), gtCake, 0, xx, _0, 0);
+                                 PlaySound(sndLaugh, false, CurrentTeam^.voicepack)
+                                 end;
                     amSeduction: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius * 2), hwRound(Y + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0);
                    amWatermelon: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtWatermelon,  0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
                   amHellishBomb: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtHellishBomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
@@ -396,13 +403,8 @@
       end;
 
    PrevdX:= hwSign(Gear^.dX);
-    
-   if (Gear^.Message and gm_Left) <> 0 then
-      Gear^.dX:= -cLittle
-   else if (Gear^.Message and gm_Right) <> 0 then
-      Gear^.dX:=  cLittle
-   else
-      exit;
+   if (Gear^.Message and gm_Left  )<>0 then Gear^.dX:= -cLittle else
+   if (Gear^.Message and gm_Right )<>0 then Gear^.dX:=  cLittle else exit;
 
    StepTicks:= cHHStepTicks;
    if PrevdX <> hwSign(Gear^.dX) then
@@ -591,7 +593,6 @@
 
 if (TurnTimeLeft = 0) or (Gear^.Damage > 0) then
 	begin
-	StopSound(sndWalking);
 	TurnTimeLeft:= 0;
 	isCursorVisible:= false;
 	Gear^.State:= Gear^.State and not (gstHHDriven or gstAnimation or gstAttacking);
@@ -603,9 +604,7 @@
 
 if (Gear^.State and gstAnimation) <> 0 then
 	begin
-	StopSound(sndWalking);
 	Gear^.Message:= 0;
-	if (Gear^.Pos = Wavez[TWave(Gear^.Tag)].VoiceDelay) and (Gear^.Timer = 0) then PlaySound(Wavez[TWave(Gear^.Tag)].Voice, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
 	inc(Gear^.Timer);
 	if Gear^.Timer = Wavez[TWave(Gear^.Tag)].Interval then
 		begin
@@ -617,13 +616,6 @@
 	exit
 	end;
 
-	// HACK? "StepTicks < 100" - any better way to detect the jump delay?
-if not cArtillery and (StepTicks < 100) and ((Gear^.State and (gstMoving or gstDrowning)) = 0) and ((Gear^.Message and (gm_Left or gm_Right)) <> 0) then
-   LoopSound(sndWalking, nil)
-else
-   StopSound(sndWalking);
-
-	
 if ((Gear^.State and gstMoving) <> 0)
     or (StepTicks = cHHStepTicks)
 	or (CurAmmoGear <> nil) then // we are moving