Engine:
authorsmxx
Fri, 16 Apr 2010 17:17:43 +0000
changeset 3351 3fd3f116f2fc
parent 3350 5cd02aafc612
child 3352 ac5d14a35482
Engine: * Allow player to play piano tunes using slot keys (default: F1..F9) while it's dropping (no sounds defined yet)
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uConsts.pas
--- a/hedgewars/GSHandlers.inc	Fri Apr 16 16:04:41 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Fri Apr 16 17:17:43 2010 +0000
@@ -3054,7 +3054,26 @@
 begin
 AllInactive:= false;
 doStepFallingGear(Gear);
-if (Gear^.State and gstCollision) <> 0 then
+if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and ((CurrentHedgehog^.Gear^.Message and gm_Slot) <> 0) then
+    begin
+    case CurrentHedgehog^.Gear^.MsgParam of
+        0: PlaySound(sndPiano0);
+        1: PlaySound(sndPiano1);
+        2: PlaySound(sndPiano2);
+        3: PlaySound(sndPiano3);
+        4: PlaySound(sndPiano4);
+        5: PlaySound(sndPiano5);
+        6: PlaySound(sndPiano6);
+        7: PlaySound(sndPiano7);
+        else PlaySound(sndPiano8);
+        end;
+    CurrentHedgehog^.Gear^.MsgParam:= 0;
+    CurrentHedgehog^.Gear^.Message:= CurrentHedgehog^.Gear^.Message and not gm_Slot;
+    end;
+
+if (Gear^.State and gstDrowning) <> 0 then
+    ResumeMusic
+else if (Gear^.State and gstCollision) <> 0 then
     begin
     r0:= GetRandom(21);
     r1:= GetRandom(21);
--- a/hedgewars/HHHandlers.inc	Fri Apr 16 16:04:41 2010 +0000
+++ b/hedgewars/HHHandlers.inc	Fri Apr 16 17:17:43 2010 +0000
@@ -205,7 +205,10 @@
                       amExtraTime: TurnTimeLeft:= TurnTimeLeft + 30000;
                       amLaserSight: cLaserSighting:= true;
                       amVampiric: cVampiric:= true;
-                      amPiano: FollowGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0);
+                      amPiano: begin
+                               FollowGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0);
+                               PauseMusic
+                               end;
                   end;
 
         uStats.AmmoUsed(Ammo^[CurSlot, CurAmmo].AmmoType);
--- a/hedgewars/uConsts.pas	Fri Apr 16 16:04:41 2010 +0000
+++ b/hedgewars/uConsts.pas	Fri Apr 16 17:17:43 2010 +0000
@@ -112,7 +112,8 @@
             sndSwitchHog, sndVictory, sndSniperReload, sndSteps, sndLowGravity,
             sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4,
             sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket,
-            sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater);
+            sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater,
+            sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, sndPiano8);
 
     TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer,
             amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip,
@@ -848,7 +849,16 @@
             (FileName:           'PoisonMoan.ogg'; Path: ptVoices),// sndPoisonMoan
             (FileName:             'BirdyLay.ogg'; Path: ptSounds),// sndBirdyLay
             (FileName:              'Whistle.ogg'; Path: ptSounds),// sndWhistle
-            (FileName:             'beewater.ogg'; Path: ptSounds) // sndBeeWater
+            (FileName:             'beewater.ogg'; Path: ptSounds),// sndBeeWater
+            (FileName:                  'egg.ogg'; Path: ptSounds),// sndPiano0
+            (FileName:                  'egg.ogg'; Path: ptSounds),// sndPiano1
+            (FileName:                  'egg.ogg'; Path: ptSounds),// sndPiano2
+            (FileName:                  'egg.ogg'; Path: ptSounds),// sndPiano3
+            (FileName:                  'egg.ogg'; Path: ptSounds),// sndPiano4
+            (FileName:                  'egg.ogg'; Path: ptSounds),// sndPiano5
+            (FileName:                  'egg.ogg'; Path: ptSounds),// sndPiano6
+            (FileName:                  'egg.ogg'; Path: ptSounds),// sndPiano7
+            (FileName:                  'egg.ogg'; Path: ptSounds) // sndPiano8
             );
 
     Ammoz: array [TAmmoType] of record