# HG changeset patch # User koda # Date 1247618159 0 # Node ID 0dc94341bf422bbea393dc66bbd6bfdd511a9842 # Parent 57e99c908e7c377b571e1d8a8f99acfbdfa1b024 sound for mortar diff -r 57e99c908e7c -r 0dc94341bf42 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Tue Jul 14 20:02:07 2009 +0000 +++ b/hedgewars/GSHandlers.inc Wed Jul 15 00:35:59 2009 +0000 @@ -1613,6 +1613,7 @@ if (Gear^.State and gstCollision) <> 0 then begin doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound); + soundFadeOut(sndMortar,10,nil); Gear^.dX.isNegative:= not dxn; Gear^.dY.isNegative:= not dyn; diff -r 57e99c908e7c -r 0dc94341bf42 hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Tue Jul 14 20:02:07 2009 +0000 +++ b/hedgewars/HHHandlers.inc Wed Jul 15 00:35:59 2009 +0000 @@ -174,7 +174,10 @@ amGirder: CurAmmoGear:= AddGear(0, 0, gtGirder, Ammo^[CurSlot, CurAmmo].Pos, _0, _0, 0); amTeleport: CurAmmoGear:= AddGear(0, 0, gtTeleport, 0, _0, _0, 0); amSwitch: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtSwitcher, 0, _0, _0, 0); - amMortar: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtMortar, 0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0); + amMortar: begin + playSound(sndMortar, false, nil); + FollowGear:= AddGear(hwRound(X), hwRound(Y), gtMortar, 0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0); + end; amRCPlane: begin CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtRCPlane, 0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0); PlaySound(sndRCPlane, true, nil) diff -r 57e99c908e7c -r 0dc94341bf42 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Tue Jul 14 20:02:07 2009 +0000 +++ b/hedgewars/uConsts.pas Wed Jul 15 00:35:59 2009 +0000 @@ -93,15 +93,15 @@ sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6, sndMelon, sndHellish, sndYoohoo, sndRCPlane, sndWhipCrack, sndRideOfTheValkyries, sndDenied, sndPlaced, sndBaseballBat, - sndVaporize, sndWarp, sndSuddenDeath); + sndVaporize, sndWarp, sndSuddenDeath, sndMortar); TAmmoType = (amGrenade, amClusterBomb, amBazooka, amUFO, amShotgun, amPickHammer, amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch, amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake, amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun, - amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, - amLaserSight, amVampiric, amSniperRifle, amJetpack); + amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, + amLaserSight, amVampiric, amSniperRifle, amJetpack); THWFont = (fnt16, fntBig, fntSmall); @@ -663,7 +663,8 @@ (FileName: 'baseballbat.ogg'; Path: ptSounds),// sndBaseballBat (FileName: 'steam.ogg'; Path: ptSounds),// sndVaporize (FileName: 'warp.ogg'; Path: ptSounds),// sndWarp - (FileName: 'suddendeath.ogg'; Path: ptSounds) // sndSuddenDeath + (FileName: 'suddendeath.ogg'; Path: ptSounds),// sndSuddenDeath + (FileName: 'mortar.ogg'; Path: ptSounds) // sndMortar ); Ammoz: array [TAmmoType] of record diff -r 57e99c908e7c -r 0dc94341bf42 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Tue Jul 14 20:02:07 2009 +0000 +++ b/hedgewars/uSound.pas Wed Jul 15 00:35:59 2009 +0000 @@ -55,6 +55,8 @@ procedure StopSound(snd: TSound); function ChangeVolume(voldelta: LongInt): LongInt; function AskForVoicepack(name: shortstring): Pointer; +function soundFadeOut(snd: TSound; qt: LongInt; voicepack: PVoicepack): LongInt; + {*remember: LongInt = 32bit; integer = 16bit; byte = 8bit*} function openal_init (memsize: LongInt) : boolean; cdecl; external OpenALBridge; @@ -65,7 +67,7 @@ function openal_setglobalvolume (percentage: byte) : boolean; cdecl; external OpenALBridge; function openal_fadeout (index: LongInt; quantity: integer) : boolean; cdecl; external OpenALBridge; function openal_fadein (index: LongInt; quantity: integer) : boolean; cdecl; external OpenALBridge; -function openal_fade (index: LongInt; quantity: integer; direction: byte) : boolean; cdecl; external OpenALBridge; +function openal_fade (index: LongInt; quantity: integer; direction: boolean) : boolean; cdecl; external OpenALBridge; function openal_playsound (index: LongInt) : boolean; cdecl; external OpenALBridge; function openal_pausesound (index: LongInt) : boolean; cdecl; external OpenALBridge; function openal_stopsound (index: LongInt) : boolean; cdecl; external OpenALBridge; @@ -150,21 +152,34 @@ end; end; +function soundFadeOut(snd: TSound; qt: LongInt; voicepack: PVoicepack): LongInt; +begin +if not isSoundEnabled then exit(0); +if (voicepack <> nil) and (voicepack^.chunks[snd] >= 0) then openal_fadeout(defVoicepack^.chunks[snd], qt) +else if (defVoicepack^.chunks[snd] >= 0) then openal_fadeout(defVoicepack^.chunks[snd], qt); +end; + procedure PlaySound(snd: TSound; infinite: boolean; voicepack: PVoicepack); begin if (not isSoundEnabled) or fastUntilLag then exit; -if (voicepack <> nil) and (voicepack^.chunks[snd] >= 0) then +if (voicepack <> nil) then begin +if voicepack^.chunks[snd] >= 0 then + begin if infinite then openal_toggleloop(voicepack^.chunks[snd]); openal_playsound(voicepack^.chunks[snd]); lastChan[snd]:=voicepack^.chunks[snd]; + end end else begin +if (defVoicepack^.chunks[snd] >= 0) then + begin if infinite then openal_toggleloop(defVoicepack^.chunks[snd]); openal_playsound(defVoicepack^.chunks[snd]); lastChan[snd]:=defVoicepack^.chunks[snd]; + end end end; diff -r 57e99c908e7c -r 0dc94341bf42 share/hedgewars/Data/Sounds/mortar.ogg Binary file share/hedgewars/Data/Sounds/mortar.ogg has changed