merge
authorunc0rr
Sun, 27 Feb 2011 19:32:44 +0300
changeset 4961 9075d7effdf2
parent 4960 3b54b1c9b768 (current diff)
parent 4956 48e1f9a04c28 (diff)
child 4962 705c6186ad9d
child 4963 59c2489afcbd
merge
--- a/hedgewars/GSHandlers.inc	Sun Feb 27 19:32:14 2011 +0300
+++ b/hedgewars/GSHandlers.inc	Sun Feb 27 19:32:44 2011 +0300
@@ -2307,13 +2307,19 @@
             //4: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtWaterMelon, 0, cBombsSpeed *
             //                 Gear^.Tag, _0, 5000);
         end;
-        Gear^.dX := Gear^.dX + int2hwFloat(30 * Gear^.Tag)
+        Gear^.dX := Gear^.dX + int2hwFloat(30 * Gear^.Tag);
+        StopSound(Gear^.SoundChannel, 4000);
     end;
 
     if (GameTicks and $3F) = 0 then
         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
 
-    if (hwRound(Gear^.X) > (LAND_WIDTH+1024)) or (hwRound(Gear^.X) < -1024) then DeleteGear(Gear)
+    if (hwRound(Gear^.X) > (LAND_WIDTH+1024)) or (hwRound(Gear^.X) < -1024) then
+    begin
+        // avoid to play forever (is this necessary?)
+        StopSound(Gear^.SoundChannel);
+        DeleteGear(Gear)
+    end;
 end;
 
 procedure doStepAirAttack(Gear: PGear);
@@ -2344,6 +2350,8 @@
 
     Gear^.Health := 6;
     Gear^.doStep := @doStepAirAttackWork;
+    Gear^.SoundChannel := LoopSound(sndPlane, 4000);
+
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/hedgewars/SDLh.pas	Sun Feb 27 19:32:14 2011 +0300
+++ b/hedgewars/SDLh.pas	Sun Feb 27 19:32:44 2011 +0300
@@ -826,6 +826,9 @@
 function  Mix_ResumeMusic(music: PMixMusic): LongInt; cdecl; external SDL_MixerLibName;
 function  Mix_HaltChannel(channel: LongInt): LongInt; cdecl; external SDL_MixerLibName;
 
+function  Mix_FadeInChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; fadems: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName;
+function  Mix_FadeOutChannel(channel: LongInt; fadems: LongInt): LongInt; cdecl; external SDL_MixerLibName;
+
 (*  SDL_image  *)
 function  IMG_Init(flags: LongInt): LongInt; cdecl; external SDL_ImageLibName;
 procedure IMG_Quit; cdecl; external SDL_ImageLibName;
--- a/hedgewars/uSound.pas	Sun Feb 27 19:32:14 2011 +0300
+++ b/hedgewars/uSound.pas	Sun Feb 27 19:32:44 2011 +0300
@@ -35,7 +35,9 @@
 procedure PlaySound(snd: TSound; voicepack: PVoicepack);
 procedure PlaySound(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean);
 function  LoopSound(snd: TSound): LongInt;
+function  LoopSound(snd: TSound; fadems: LongInt): LongInt;
 function  LoopSound(snd: TSound; voicepack: PVoicepack): LongInt;
+function  LoopSound(snd: TSound; voicepack: PVoicepack; fadems: LongInt): LongInt;
 procedure PlayMusic;
 procedure PauseMusic;
 procedure ResumeMusic;
@@ -219,7 +221,17 @@
     LoopSound:= LoopSound(snd, nil)
 end;
 
+function LoopSound(snd: TSound; fadems: LongInt): LongInt;
+begin
+    LoopSound:= LoopSound(snd, nil, fadems)
+end;
+
 function LoopSound(snd: TSound; voicepack: PVoicepack): LongInt;
+begin
+    LoopSound:= LoopSound(snd, nil, 0)
+end;
+
+function LoopSound(snd: TSound; voicepack: PVoicepack; fadems: LongInt): LongInt;
 var s: shortstring;
 begin
     if (not isSoundEnabled) or fastUntilLag then
@@ -252,13 +264,17 @@
             TryDo(defVoicepack^.chunks[snd] <> nil, msgFailed, true);
             WriteLnToConsole(msgOK);
         end;
-        LoopSound:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], -1, -1);
+        if fadems > 0 then
+            LoopSound:= Mix_FadeInChannelTimed(-1, defVoicepack^.chunks[snd], -1, fadems, -1)
+        else
+            LoopSound:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], -1, -1);
     end;
 end;
 
 procedure StopSound(snd: TSound);
 begin
     if not isSoundEnabled then exit;
+
     if (lastChan[snd] <> -1) and (Mix_Playing(lastChan[snd]) <> 0) then
     begin
         Mix_HaltChannel(lastChan[snd]);
@@ -274,6 +290,14 @@
         Mix_HaltChannel(chn);
 end;
 
+procedure StopSound(chn, fadems: LongInt);
+begin
+    if not isSoundEnabled then exit;
+
+    if (chn <> -1) and (Mix_Playing(chn) <> 0) then
+        Mix_FadeOutChannel(chn, fadems);
+end;
+
 procedure PlayMusic;
 var s: shortstring;
 begin
--- a/hedgewars/uTypes.pas	Sun Feb 27 19:32:14 2011 +0300
+++ b/hedgewars/uTypes.pas	Sun Feb 27 19:32:44 2011 +0300
@@ -106,7 +106,7 @@
             sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater,
             sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, sndPiano8,
             sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack,
-            sndComeonthen, sndParachute, sndBump, sndResurrector);
+            sndComeonthen, sndParachute, sndBump, sndResurrector, sndPlane);
 
     TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
             amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13
--- a/hedgewars/uVariables.pas	Sun Feb 27 19:32:14 2011 +0300
+++ b/hedgewars/uVariables.pas	Sun Feb 27 19:32:44 2011 +0300
@@ -704,7 +704,8 @@
             (FileName:           'Comeonthen.ogg'; Path: ptVoices),// sndComeonthen
             (FileName:            'parachute.ogg'; Path: ptSounds),// sndParachute
             (FileName:                 'bump.ogg'; Path: ptSounds),// sndBump
-            (FileName: 'hogchant3.ogg'; Path: ptSounds) // sndResurrector
+            (FileName:            'hogchant3.ogg'; Path: ptSounds),// sndResurrector
+            (FileName:                'plane.ogg'; Path: ptSounds) // sndPlane
             );
 
     Ammoz: array [TAmmoType] of record
Binary file share/hedgewars/Data/Graphics/Hats/NinjaFull.png has changed
Binary file share/hedgewars/Data/Graphics/Hats/NinjaStraight.png has changed
Binary file share/hedgewars/Data/Graphics/Hats/NinjaTriangle.png has changed
Binary file share/hedgewars/Data/Graphics/Hats/NoHat.png has changed
Binary file share/hedgewars/Data/Graphics/Hats/darthvader.png has changed
Binary file share/hedgewars/Data/Graphics/Hats/mickey_ears.png has changed
Binary file share/hedgewars/Data/Graphics/Hats/stormtrooper.png has changed
Binary file share/hedgewars/Data/Sounds/plane.ogg has changed