--- a/hedgewars/GSHandlers.inc Mon Jan 19 13:02:33 2009 +0000
+++ b/hedgewars/GSHandlers.inc Mon Jan 19 15:25:22 2009 +0000
@@ -2013,7 +2013,19 @@
HHGear^.Message := HHGear^.Message and not gm_Attack;
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.dX * _0_5, Gear^.dY * _0_5, 0);
dec(Gear^.Health)
- end;
+ end;
+
+// Ride of the Valkyries
+// This does actually work, interestingly, if music is turned off
+// However, I'm not actually sure how this works with game state, and some
+// sort of flag specific to the purpose of avoiding duplicate playSounds might be better. Can't use lastChan reasonably, unfortunately
+if ((HHGear^.Message and gm_LJump) <> 0)
+ and ((Gear^.State and gsttmpFlag) = 0) then
+ begin
+ Gear^.State:= Gear^.State or gsttmpFlag;
+ PauseMusic;
+ playSound(sndRideOfTheValkyries, false, nil);
+ end;
// pickup bonuses
t:= CheckGearNear(Gear, gtCase, 36, 36);
@@ -2022,28 +2034,29 @@
CheckCollision(Gear);
-if ((Gear^.State and gstCollision) <> 0) then
+if ((Gear^.State and gstCollision) <> 0)
+ or CheckGearDrowning(Gear) then
begin
- HHGear^.Message:= 0;
- //HHGear^.State:= HHGear^.State and (not gstNotKickable);
- doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, EXPLAutoSound);
- for i:= 0 to 25 do
+ StopSound(sndRCPlane);
+ StopSound(sndRideOfTheValkyries);
+ ResumeMusic;
+
+ if ((Gear^.State and gstCollision) <> 0) then
begin
- dX:= AngleCos(i * 16) * _0_5 * (GetRandom + _1);
- dY:= AngleSin(i * 16) * _0_5 * (GetRandom + _1);
- AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0);
- AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, -dY, 0);
+ doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, EXPLAutoSound);
+ for i:= 0 to 25 do
+ begin
+ dX:= AngleCos(i * 16) * _0_5 * (GetRandom + _1);
+ dY:= AngleSin(i * 16) * _0_5 * (GetRandom + _1);
+ AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0);
+ AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, -dY, 0);
+ end;
+ DeleteGear(Gear)
end;
- DeleteGear(Gear);
+
AfterAttack;
TurnTimeLeft:= 14 * 125;
- ParseCommand('/taunt '#1, true)
- end;
-
-if CheckGearDrowning(Gear) then
- begin
- AfterAttack;
- TurnTimeLeft:= 14 * 125;
+ HHGear^.Message:= 0;
ParseCommand('/taunt '#1, true)
end
end;
@@ -2058,4 +2071,4 @@
Gear^.Tag:= hwSign(HHGear^.dX);
if HHGear^.dX.isNegative then Gear^.Angle:= 4096 - Gear^.Angle;
Gear^.doStep:= @doStepRCPlaneWork
-end;
\ No newline at end of file
+end;
--- a/hedgewars/HHHandlers.inc Mon Jan 19 13:02:33 2009 +0000
+++ b/hedgewars/HHHandlers.inc Mon Jan 19 15:25:22 2009 +0000
@@ -151,7 +151,10 @@
PlaySound(sndLaugh, false, CurrentTeam^.voicepack)
end;
amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, xx, _0, 0);
- amWhip: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
+ amWhip: begin
+ CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
+ PlaySound(sndWhipCrack, false, nil)
+ end;
amBaseballBat: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtShover, 0, xx * _0_5, yy * _0_5, 0);
amParachute: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtParachute, 0, _0, _0, 0);
amAirAttack: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 0, _0, _0, 0);
@@ -161,7 +164,10 @@
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);
- amRCPlane: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtRCPlane, 0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0);
+ amRCPlane: begin
+ CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtRCPlane, 0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0);
+ PlaySound(sndRCPlane, true, nil)
+ end;
amKamikaze: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
amCake: begin
CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 3, hwRound(Y), gtCake, 0, xx, _0, 0);
--- a/hedgewars/SDLh.pas Mon Jan 19 13:02:33 2009 +0000
+++ b/hedgewars/SDLh.pas Mon Jan 19 15:25:22 2009 +0000
@@ -367,6 +367,9 @@
function Mix_PlayChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName;
function Mix_PlayMusic(music: PMixMusic; loops: LongInt): LongInt; cdecl; external SDL_MixerLibName;
+function Mix_PausedMusic(music: PMixMusic): LongInt; cdecl; external SDL_MixerLibName;
+function Mix_PauseMusic(music: PMixMusic): LongInt; cdecl; external SDL_MixerLibName;
+function Mix_ResumeMusic(music: PMixMusic): LongInt; cdecl; external SDL_MixerLibName;
function Mix_HaltChannel(channel: LongInt): LongInt; cdecl; external SDL_MixerLibName;
(* SDL_image *)
--- a/hedgewars/uConsts.pas Mon Jan 19 13:02:33 2009 +0000
+++ b/hedgewars/uConsts.pas Mon Jan 19 15:25:22 2009 +0000
@@ -75,7 +75,8 @@
sndEnemyDown, sndCoward, sndHurry, sndWatchIt, sndKamikaze,
sndCake, sndOw1, sndOw4, sndFirePunch1, sndFirePunch2,
sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6,
- sndMelon, sndHellish, sndYoohoo);
+ sndMelon, sndHellish, sndYoohoo, sndRCPlane, sndWhipCrack,
+ sndRideOfTheValkyries);
TAmmoType = (amGrenade, amClusterBomb, amBazooka, amUFO, amShotgun, amPickHammer,
amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip,
@@ -473,55 +474,58 @@
);
Soundz: array[TSound] of record
- FileName: String[19];
+ FileName: String[25];
Path : TPathType;
end = (
- (FileName: 'grenadeimpact.ogg'; Path: ptSounds),// sndGrenadeImpact
- (FileName: 'explosion.ogg'; Path: ptSounds),// sndExplosion
- (FileName: 'throwpowerup.ogg'; Path: ptSounds),// sndThrowPowerUp
- (FileName: 'throwrelease.ogg'; Path: ptSounds),// sndThrowRelease
- (FileName: 'splash.ogg'; Path: ptSounds),// sndSplash
- (FileName: 'shotgunreload.ogg'; Path: ptSounds),// sndShotgunReload
- (FileName: 'shotgunfire.ogg'; Path: ptSounds),// sndShotgunFire
- (FileName: 'graveimpact.ogg'; Path: ptSounds),// sndGraveImpact
- (FileName: 'minetick.ogg'; Path: ptSounds),// sndMineTicks
- (FileName: 'pickhammer.ogg'; Path: ptSounds),// sndPickhammer
- (FileName: 'gun.ogg'; Path: ptSounds),// sndGun
- (FileName: 'ufo.ogg'; Path: ptSounds),// sndUFO
- (FileName: 'Jump1.ogg'; Path: ptVoices),// sndJump1
- (FileName: 'Jump2.ogg'; Path: ptVoices),// sndJump2
- (FileName: 'Jump3.ogg'; Path: ptVoices),// sndJump3
- (FileName: 'Yessir.ogg'; Path: ptVoices),// sndYesSir
- (FileName: 'Laugh.ogg'; Path: ptVoices),// sndLaugh
- (FileName: 'Illgetyou.ogg'; Path: ptVoices),// sndIllGetYou
- (FileName: 'Incoming.ogg'; Path: ptVoices),// sndIncoming
- (FileName: 'Missed.ogg'; Path: ptVoices),// sndMissed
- (FileName: 'Stupid.ogg'; Path: ptVoices),// sndStupid
- (FileName: 'Firstblood.ogg'; Path: ptVoices),// sndFirstBlood
- (FileName: 'Boring.ogg'; Path: ptVoices),// sndBoring
- (FileName: 'Byebye.ogg'; Path: ptVoices),// sndByeBye
- (FileName: 'Sameteam.ogg'; Path: ptVoices),// sndSameTeam
- (FileName: 'Nutter.ogg'; Path: ptVoices),// sndNutter
- (FileName:'Reinforcements.ogg'; Path: ptVoices),// sndReinforce
- (FileName: 'Traitor.ogg'; Path: ptVoices),// sndTraitor
- (FileName:'Youllregretthat.ogg';Path: ptVoices),// sndRegret
- (FileName: 'Enemydown.ogg'; Path: ptVoices),// sndEnemyDown
- (FileName: 'Coward.ogg'; Path: ptVoices),// sndCoward
- (FileName: 'Hurry.ogg'; Path: ptVoices),// sndHurry
- (FileName: 'Watchit.ogg'; Path: ptVoices),// sndWatchIt
- (FileName: 'Kamikaze.ogg'; Path: ptVoices),// sndKamikaze
- (FileName: 'cake2.ogg'; Path: ptSounds),// sndCake
- (FileName: 'Ow1.ogg'; Path: ptVoices),// sndOw1
- (FileName: 'Ow4.ogg'; Path: ptVoices),// sndOw4
- (FileName: 'Firepunch1.ogg'; Path: ptVoices),// sndFirepunch1
- (FileName: 'Firepunch2.ogg'; Path: ptVoices),// sndFirepunch2
- (FileName: 'Firepunch3.ogg'; Path: ptVoices),// sndFirepunch3
- (FileName: 'Firepunch4.ogg'; Path: ptVoices),// sndFirepunch4
- (FileName: 'Firepunch5.ogg'; Path: ptVoices),// sndFirepunch5
- (FileName: 'Firepunch6.ogg'; Path: ptVoices),// sndFirepunch6
- (FileName: 'Melon.ogg'; Path: ptSounds),// sndMelon
- (FileName: 'Hellish.ogg'; Path: ptSounds),// sndHellish
- (FileName: 'Yoohoo.ogg'; Path: ptSounds) // sndYoohoo
+ (FileName: 'grenadeimpact.ogg'; Path: ptSounds),// sndGrenadeImpact
+ (FileName: 'explosion.ogg'; Path: ptSounds),// sndExplosion
+ (FileName: 'throwpowerup.ogg'; Path: ptSounds),// sndThrowPowerUp
+ (FileName: 'throwrelease.ogg'; Path: ptSounds),// sndThrowRelease
+ (FileName: 'splash.ogg'; Path: ptSounds),// sndSplash
+ (FileName: 'shotgunreload.ogg'; Path: ptSounds),// sndShotgunReload
+ (FileName: 'shotgunfire.ogg'; Path: ptSounds),// sndShotgunFire
+ (FileName: 'graveimpact.ogg'; Path: ptSounds),// sndGraveImpact
+ (FileName: 'minetick.ogg'; Path: ptSounds),// sndMineTicks
+ (FileName: 'pickhammer.ogg'; Path: ptSounds),// sndPickhammer
+ (FileName: 'gun.ogg'; Path: ptSounds),// sndGun
+ (FileName: 'ufo.ogg'; Path: ptSounds),// sndUFO
+ (FileName: 'Jump1.ogg'; Path: ptVoices),// sndJump1
+ (FileName: 'Jump2.ogg'; Path: ptVoices),// sndJump2
+ (FileName: 'Jump3.ogg'; Path: ptVoices),// sndJump3
+ (FileName: 'Yessir.ogg'; Path: ptVoices),// sndYesSir
+ (FileName: 'Laugh.ogg'; Path: ptVoices),// sndLaugh
+ (FileName: 'Illgetyou.ogg'; Path: ptVoices),// sndIllGetYou
+ (FileName: 'Incoming.ogg'; Path: ptVoices),// sndIncoming
+ (FileName: 'Missed.ogg'; Path: ptVoices),// sndMissed
+ (FileName: 'Stupid.ogg'; Path: ptVoices),// sndStupid
+ (FileName: 'Firstblood.ogg'; Path: ptVoices),// sndFirstBlood
+ (FileName: 'Boring.ogg'; Path: ptVoices),// sndBoring
+ (FileName: 'Byebye.ogg'; Path: ptVoices),// sndByeBye
+ (FileName: 'Sameteam.ogg'; Path: ptVoices),// sndSameTeam
+ (FileName: 'Nutter.ogg'; Path: ptVoices),// sndNutter
+ (FileName: 'Reinforcements.ogg'; Path: ptVoices),// sndReinforce
+ (FileName: 'Traitor.ogg'; Path: ptVoices),// sndTraitor
+ (FileName: 'Youllregretthat.ogg';Path: ptVoices),// sndRegret
+ (FileName: 'Enemydown.ogg'; Path: ptVoices),// sndEnemyDown
+ (FileName: 'Coward.ogg'; Path: ptVoices),// sndCoward
+ (FileName: 'Hurry.ogg'; Path: ptVoices),// sndHurry
+ (FileName: 'Watchit.ogg'; Path: ptVoices),// sndWatchIt
+ (FileName: 'Kamikaze.ogg'; Path: ptVoices),// sndKamikaze
+ (FileName: 'cake2.ogg'; Path: ptSounds),// sndCake
+ (FileName: 'Ow1.ogg'; Path: ptVoices),// sndOw1
+ (FileName: 'Ow4.ogg'; Path: ptVoices),// sndOw4
+ (FileName: 'Firepunch1.ogg'; Path: ptVoices),// sndFirepunch1
+ (FileName: 'Firepunch2.ogg'; Path: ptVoices),// sndFirepunch2
+ (FileName: 'Firepunch3.ogg'; Path: ptVoices),// sndFirepunch3
+ (FileName: 'Firepunch4.ogg'; Path: ptVoices),// sndFirepunch4
+ (FileName: 'Firepunch5.ogg'; Path: ptVoices),// sndFirepunch5
+ (FileName: 'Firepunch6.ogg'; Path: ptVoices),// sndFirepunch6
+ (FileName: 'Melon.ogg'; Path: ptSounds),// sndMelon
+ (FileName: 'Hellish.ogg'; Path: ptSounds),// sndHellish
+ (FileName: 'Yoohoo.ogg'; Path: ptSounds),// sndYoohoo
+ (FileName: 'rcplane.ogg'; Path: ptSounds),// sndRCPlane
+ (FileName: 'whipcrack.ogg'; Path: ptSounds),// sndWhipCrack
+ (FileName:'ride_of_the_valkyries.ogg'; Path: ptSounds) // sndRideOfTheValkyries
);
Ammoz: array [TAmmoType] of record
--- a/hedgewars/uSound.pas Mon Jan 19 13:02:33 2009 +0000
+++ b/hedgewars/uSound.pas Mon Jan 19 15:25:22 2009 +0000
@@ -32,6 +32,8 @@
procedure SoundLoad;
procedure PlaySound(snd: TSound; infinite: boolean; voicepack: PVoicepack);
procedure PlayMusic;
+procedure PauseMusic;
+procedure ResumeMusic;
procedure StopSound(snd: TSound);
function ChangeVolume(voldelta: LongInt): LongInt;
@@ -43,11 +45,11 @@
uses uMisc, uConsole;
const chanTPU = 12;
-var Mus: PMixMusic = nil;
- Volume: LongInt;
+var Volume: LongInt;
lastChan: array [TSound] of LongInt;
voicepacks: array[0..cMaxTeams] of TVoicepack;
defVoicepack: PVoicepack;
+ Mus: PMixMusic = nil;
function AskForVoicepack(name: shortstring): Pointer;
var i: Longword;
@@ -152,7 +154,7 @@
begin
if (not isSoundEnabled)
or (MusicFN = '')
- or (not isMusicEnabled)then exit;
+ or (not isMusicEnabled) then exit;
s:= PathPrefix + '/Music/' + MusicFN;
WriteToConsole(msgLoading + s + ' ');
@@ -177,4 +179,18 @@
ChangeVolume:= Volume * 100 div MIX_MAX_VOLUME
end;
+procedure PauseMusic;
+begin
+if (MusicFN = '') or (not isMusicEnabled) then exit;
+
+Mix_PauseMusic(Mus);
+end;
+
+procedure ResumeMusic;
+begin
+if (MusicFN = '') or (not isMusicEnabled) then exit;
+
+Mix_ResumeMusic(Mus);
+end;
+
end.
Binary file share/hedgewars/Data/Sounds/rcplane.ogg has changed
Binary file share/hedgewars/Data/Sounds/ride_of_the_valkyries.ogg has changed
Binary file share/hedgewars/Data/Sounds/whipcrack.ogg has changed