# HG changeset patch # User nemo # Date 1280442708 14400 # Node ID 5fdf49ace96c2225f6e96866d65d8a06bd02e23e # Parent 0c34dbfdea7778ea521799b44965a81fa8db9728# Parent 45b416c5b9769c871f8db41b9af1cc8daa44fe59 I keep forgetting to merge. diff -r 0c34dbfdea77 -r 5fdf49ace96c hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Thu Jul 29 18:31:34 2010 -0400 +++ b/hedgewars/GSHandlers.inc Thu Jul 29 18:31:48 2010 -0400 @@ -186,12 +186,12 @@ if (Gear^.Invulnerable) then exit; - if _0_6 < Gear^.dY then - PlaySound(sndOw4, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) - else - PlaySound(sndOw1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); - - ApplyDamage(Gear, dmg); + //if _0_6 < Gear^.dY then + // PlaySound(sndOw4, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) + //else + // PlaySound(sndOw1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + + ApplyDamage(Gear, dmg, dsFall); end end; diff -r 0c34dbfdea77 -r 5fdf49ace96c hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Thu Jul 29 18:31:34 2010 -0400 +++ b/hedgewars/HHHandlers.inc Thu Jul 29 18:31:48 2010 -0400 @@ -17,6 +17,29 @@ *) //////////////////////////////////////////////////////////////////////////////// + +procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource); +begin +if (Source = dsFall) or (Source = dsExplosion) then + case random(3) of + 0: PlaySound(sndOoff1, Hedgehog^.Team^.voicepack); + 1: PlaySound(sndOoff2, Hedgehog^.Team^.voicepack); + 2: PlaySound(sndOoff3, Hedgehog^.Team^.voicepack); + end +else if (Source = dsPoison) then + case random(2) of + 0: PlaySound(sndPoisonCough, Hedgehog^.Team^.voicepack); + 1: PlaySound(sndPoisonMoan, Hedgehog^.Team^.voicepack); + end +else + case random(4) of + 0: PlaySound(sndOw1, Hedgehog^.Team^.voicepack); + 1: PlaySound(sndOw2, Hedgehog^.Team^.voicepack); + 2: PlaySound(sndOw3, Hedgehog^.Team^.voicepack); + 3: PlaySound(sndOw4, Hedgehog^.Team^.voicepack); + end +end; + procedure ChangeAmmo(Gear: PGear); var slot, i: Longword; begin diff -r 0c34dbfdea77 -r 5fdf49ace96c hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Thu Jul 29 18:31:34 2010 -0400 +++ b/hedgewars/uConsts.pas Thu Jul 29 18:31:48 2010 -0400 @@ -98,6 +98,8 @@ TGearsType = set of TGearType; + TDamageSource = (dsUnknown, dsFall, dsBullet, dsExplosion, dsShove, dsPoison); + TSound = (sndNone, sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash, sndShotgunReload, sndShotgunFire, sndGraveImpact, @@ -106,7 +108,7 @@ sndMissed, sndStupid, sndFirstBlood, sndBoring, sndByeBye, sndSameTeam, sndNutter, sndReinforce, sndTraitor, sndRegret, sndEnemyDown, sndCoward, sndHurry, sndWatchIt, sndKamikaze, - sndCake, sndOw1, sndOw4, sndFirePunch1, sndFirePunch2, + sndCake, sndOw1, sndOw2, sndOw3, sndOw4, sndFirePunch1, sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6, sndMelon, sndHellish, sndYoohoo, sndRCPlane, sndWhipCrack, sndRideOfTheValkyries, sndDenied, sndPlaced, sndBaseballBat, @@ -118,7 +120,7 @@ sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket, sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater, sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, sndPiano8, - sndSkip, sndSineGun); + sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3); TAmmoType = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, @@ -856,6 +858,8 @@ (FileName: 'Kamikaze.ogg'; Path: ptVoices),// sndKamikaze (FileName: 'cake2.ogg'; Path: ptSounds),// sndCake (FileName: 'Ow1.ogg'; Path: ptVoices),// sndOw1 + (FileName: 'Ow2.ogg'; Path: ptVoices),// sndOw2 + (FileName: 'Ow3.ogg'; Path: ptVoices),// sndOw3 (FileName: 'Ow4.ogg'; Path: ptVoices),// sndOw4 (FileName: 'Firepunch1.ogg'; Path: ptVoices),// sndFirepunch1 (FileName: 'Firepunch2.ogg'; Path: ptVoices),// sndFirepunch2 @@ -917,7 +921,10 @@ (FileName: '8C.ogg'; Path: ptSounds),// sndPiano7 (FileName: '9D.ogg'; Path: ptSounds),// sndPiano8 (FileName: 'skip.ogg'; Path: ptSounds),// sndSkip - (FileName: 'shotgunfire.ogg'; Path: ptSounds) // sndSineGun + (FileName: 'shotgunfire.ogg'; Path: ptSounds),// sndSineGun + (FileName: 'Ooff1.ogg'; Path: ptVoices),// sndOoff1 + (FileName: 'Ooff2.ogg'; Path: ptVoices),// sndOoff2 + (FileName: 'Ooff3.ogg'; Path: ptVoices) // sndOoff3 ); Ammoz: array [TAmmoType] of record diff -r 0c34dbfdea77 -r 5fdf49ace96c hedgewars/uGears.pas --- a/hedgewars/uGears.pas Thu Jul 29 18:31:34 2010 -0400 +++ b/hedgewars/uGears.pas Thu Jul 29 18:31:48 2010 -0400 @@ -83,7 +83,7 @@ function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; procedure ProcessGears; procedure EndTurnCleanup; -procedure ApplyDamage(Gear: PGear; Damage: Longword); +procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource); procedure SetAllToActive; procedure SetAllHHToActive; procedure DrawGears; @@ -635,22 +635,18 @@ team: PTeam; i: LongWord; flag: Boolean; + tmp: LongWord; begin - Gear:= GearsList; + Gear:= GearsList; - while Gear <> nil do - begin - if Gear^.Kind = gtHedgehog then - begin + while Gear <> nil do + begin + if Gear^.Kind = gtHedgehog then + begin + tmp:= 0; if PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] then - begin - inc(Gear^.Damage, min(ModifyDamage(5,Gear), max(0,Gear^.Health - 1 - Gear^.Damage))); - if getRandom(2) = 0 then - PlaySound(sndPoisonCough, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) - else - PlaySound(sndPoisonMoan, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); - end; - inc(Gear^.Damage, min(cHealthDecrease, max(0,Gear^.Health - 1 - Gear^.Damage))); + inc(tmp, min(ModifyDamage(5,Gear), max(0,Gear^.Health - 1 - Gear^.Damage))); + inc(tmp, min(cHealthDecrease, max(0,Gear^.Health - 1 - Gear^.Damage))); if PHedgehog(Gear^.Hedgehog)^.King then begin flag:= false; @@ -660,12 +656,13 @@ (not team^.Hedgehogs[i].King) and (team^.Hedgehogs[i].Gear^.Health > team^.Hedgehogs[i].Gear^.Damage) then flag:= true; - if not flag then inc(Gear^.Damage, min(5, max(0,Gear^.Health - 1 - Gear^.Damage))) + if not flag then inc(tmp, min(5, max(0,Gear^.Health - 1 - Gear^.Damage))) end; - end; + if tmp > 0 then ApplyDamage(Gear, tmp, dsPoison); + end; - Gear:= Gear^.NextGear - end; + Gear:= Gear^.NextGear + end; end; procedure ProcessGears; @@ -891,13 +888,14 @@ end end; -procedure ApplyDamage(Gear: PGear; Damage: Longword); +procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource); var s: shortstring; vampDmg, tmpDmg, i: Longword; vg: PVisualGear; begin if (Gear^.Kind = gtHedgehog) and (Damage>=1) then begin + HHHurt(Gear^.Hedgehog, Source); AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage)); if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then @@ -1226,7 +1224,7 @@ if (Mask and EXPLNoDamage) = 0 then begin if not Gear^.Invulnerable then - ApplyDamage(Gear, dmg) + ApplyDamage(Gear, dmg, dsExplosion) else Gear^.State:= Gear^.State or gstWinner; end; @@ -1285,7 +1283,7 @@ gtTarget, gtExplosives: begin if (not t^.Invulnerable) then - ApplyDamage(t, dmg) + ApplyDamage(t, dmg, dsBullet) else Gear^.State:= Gear^.State or gstWinner; @@ -1340,10 +1338,10 @@ gtExplosives: begin if (Ammo^.Kind = gtDrill) then begin Ammo^.Timer:= 0; exit; end; if (not Gear^.Invulnerable) then - ApplyDamage(Gear, tmpDmg) + ApplyDamage(Gear, tmpDmg, dsShove) else Gear^.State:= Gear^.State or gstWinner; - if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then ApplyDamage(Gear, tmpDmg * 100); // crank up damage for explosives + blowtorch + if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then ApplyDamage(Gear, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch DeleteCI(Gear); if (Gear^.Kind = gtHedgehog) and PHedgehog(Gear^.Hedgehog)^.King then