# HG changeset patch # User sheepluva # Date 1269658535 0 # Node ID 97c8406acc856f56511a0d031e746d29237f4904 # Parent ff59e61346f52270ea0022911057dab4aae6c323 making collision/impact sounds a gear property + adding random melon+hellish sound, feel free to hate me :D diff -r ff59e61346f5 -r 97c8406acc85 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Sat Mar 27 00:48:59 2010 +0000 +++ b/hedgewars/GSHandlers.inc Sat Mar 27 02:55:35 2010 +0000 @@ -234,7 +234,12 @@ (not isFalling) then Gear^.State:= Gear^.State and not gstMoving else - Gear^.State:= Gear^.State or gstMoving + Gear^.State:= Gear^.State or gstMoving; + +if ((Gear^.Damage <> 0) or ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving))) then + if ((Gear^.dX.QWordValue > _0_1.QWordValue) + or (Gear^.dY.QWordValue > _0_1.QWordValue)) then + PlaySound(Gear^.ImpactSound); end; //////////////////////////////////////////////////////////////////////////////// @@ -320,11 +325,6 @@ if (Gear^.State and gstCollision) = 0 then AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtEvilTrace, 0, _0, _0, 0); end; - -if (Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving) then - if (hwAbs(Gear^.dX) > _0_1) or - (hwAbs(Gear^.dY) > _0_1) then - PlaySound(sndGrenadeImpact) end; //////////////////////////////////////////////////////////////////////////////// procedure doStepMolotov(Gear: PGear); @@ -456,7 +456,7 @@ begin Gear^.Active:= false; exit - end else if Gear^.dY < - _0_03 then PlaySound(sndGraveImpact) + end else if Gear^.dY < - _0_03 then PlaySound(Gear^.ImpactSound) end; Gear^.Y:= Gear^.Y + Gear^.dY; @@ -1351,7 +1351,7 @@ inc(Gear^.Damage, hwRound(Gear^.dY * -_50)) else if Gear^.dX.isNegative and (Gear^.dX < -_0_03) and TestCollisionXwithGear(Gear, -1) then inc(Gear^.Damage, hwRound(Gear^.dX * -_50)); - if Gear^.Damage <> 0 then PlaySound(sndGrenadeImpact); + doStepFallingGear(Gear); CalcRotationDirAngle(Gear); CheckGearDrowning(Gear) @@ -1470,10 +1470,7 @@ Gear^.dY:= - Gear^.dY * Gear^.Elasticity; if Gear^.dY > - _0_001 then Gear^.dY:= _0 else if Gear^.dY < - _0_03 then - if Gear^.Kind = gtExplosives then - PlaySound(sndGrenadeImpact) - else - PlaySound(sndGraveImpact); + PlaySound(Gear^.ImpactSound); end; //if Gear^.dY > - _0_001 then Gear^.dY:= _0 CheckGearDrowning(Gear); diff -r ff59e61346f5 -r 97c8406acc85 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Sat Mar 27 00:48:59 2010 +0000 +++ b/hedgewars/uConsts.pas Sat Mar 27 02:55:35 2010 +0000 @@ -113,7 +113,8 @@ sndHomerun, sndMolotov, sndCover, sndUhOh, sndOops, sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease, sndSwitchHog, sndVictory, sndSniperReload, sndSteps, sndLowGravity, - sndDroplet1, sndDroplet2, sndDroplet3); + sndHellishImpact, + sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3); TAmmoType = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, @@ -817,6 +818,8 @@ (FileName: 'sniperreload.ogg'; Path: ptSounds),// sndSniperReload (FileName: 'steps.ogg'; Path: ptSounds),// sndSteps (FileName: 'lowgravity.ogg'; Path: ptSounds),// sndLowGravity + (FileName: 'hellishimpact.ogg'; Path: ptSounds), // sndHellishImpact + (FileName: 'melonimpact.ogg'; Path: ptSounds), // sndMelonImpact (FileName: 'Droplet1.ogg'; Path: ptSounds),// sndDroplet1 (FileName: 'Droplet2.ogg'; Path: ptSounds),// sndDroplet2 (FileName: 'Droplet3.ogg'; Path: ptSounds) // sndDroplet3 diff -r ff59e61346f5 -r 97c8406acc85 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Sat Mar 27 00:48:59 2010 +0000 +++ b/hedgewars/uGears.pas Sat Mar 27 02:55:35 2010 +0000 @@ -57,6 +57,7 @@ IntersectGear: PGear; FlightTime: Longword; uid: Longword; + ImpactSound: TSound; SoundChannel: LongInt end; @@ -246,6 +247,7 @@ gear^.FlightTime:= 0; gear^.uid:= Counter; gear^.SoundChannel:= -1; +gear^.ImpactSound:= sndNone; if CurrentTeam <> nil then begin @@ -256,6 +258,7 @@ case Kind of gtAmmo_Bomb, gtClusterBomb: begin + gear^.ImpactSound:= sndGrenadeImpact; gear^.AdvBounce:= 1; gear^.Radius:= 4; gear^.Elasticity:= _0_6; @@ -264,6 +267,7 @@ if gear^.Timer = 0 then gear^.Timer:= 3000 end; gtWatermelon: begin + gear^.ImpactSound:= sndMelonImpact; gear^.AdvBounce:= 1; gear^.Radius:= 4; gear^.Elasticity:= _0_8; @@ -287,6 +291,7 @@ gear^.Z:= 2002; end; gtGrave: begin + gear^.ImpactSound:= sndGraveImpact; gear^.Radius:= 10; gear^.Elasticity:= _0_6; end; @@ -329,10 +334,12 @@ gear^.Timer:= cMinesTime*1; end; gtCase: begin + gear^.ImpactSound:= sndGraveImpact; gear^.Radius:= 16; gear^.Elasticity:= _0_3 end; gtExplosives: begin + gear^.ImpactSound:= sndGrenadeImpact; gear^.Radius:= 16; gear^.Elasticity:= _0_4; gear^.Friction:= _0_995; @@ -404,6 +411,7 @@ if not dX.isNegative then gear^.Angle:= 1 else gear^.Angle:= 3 end; gtHellishBomb: begin + gear^.ImpactSound:= sndHellishImpact; gear^.AdvBounce:= 1; gear^.Radius:= 4; gear^.Elasticity:= _0_5; @@ -416,6 +424,7 @@ gear^.Radius:= 4 end; gtBall: begin + gear^.ImpactSound:= sndGrenadeImpact; gear^.AdvBounce:= 1; gear^.Radius:= 5; gear^.Tag:= random(8); diff -r ff59e61346f5 -r 97c8406acc85 share/hedgewars/Data/Sounds/hellishimpact.ogg Binary file share/hedgewars/Data/Sounds/hellishimpact.ogg has changed diff -r ff59e61346f5 -r 97c8406acc85 share/hedgewars/Data/Sounds/melonimpact.ogg Binary file share/hedgewars/Data/Sounds/melonimpact.ogg has changed