diff -r 8789a8f6c016 -r efbc8f80acac hedgewars/uGears.pas --- a/hedgewars/uGears.pas Fri Jan 07 21:41:12 2011 +0300 +++ b/hedgewars/uGears.pas Fri Jan 07 23:08:34 2011 +0300 @@ -29,7 +29,7 @@ procedure ResurrectHedgehog(gear: PGear); procedure ProcessGears; procedure EndTurnCleanup; -procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource); +procedure ApplyDamage(Gear, Attacker: PGear; Damage: Longword; Source: TDamageSource); procedure SetAllToActive; procedure SetAllHHToActive; procedure DrawGears; @@ -50,8 +50,7 @@ uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture; -procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward; -procedure doMakeExplosion(X, Y, Radius: LongInt; Mask, Tint: LongWord); forward; +procedure doMakeExplosion(X, Y, Radius: LongInt; GearCaused: PGear; Mask: Longword; const Tint: LongWord = $FFFFFFFF); forward; procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; //procedure AmmoFlameWork(Ammo: PGear); forward; function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; forward; @@ -559,7 +558,7 @@ Gear^.Damage:= t; if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cWaterOpacity < $FF))) and (hwRound(Gear^.Y) < cWaterLine + 256) then spawnHealthTagForHH(Gear, t); - uStats.HedgehogDamaged(Gear) + uStats.HedgehogDamaged(Gear, CurrentHedgehog^.Gear) end; team:= Gear^.Hedgehog^.Team; @@ -616,7 +615,7 @@ (not Gear^.Invulnerable) then begin CheckNoDamage:= false; - uStats.HedgehogDamaged(Gear); + dmg:= Gear^.Damage; if Gear^.Health < dmg then begin @@ -986,13 +985,14 @@ RecountTeamHealth(TeamsArray[i]) end; -procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource); +procedure ApplyDamage(Gear, Attacker: PGear; Damage: Longword; Source: TDamageSource); var s: shortstring; vampDmg, tmpDmg, i: Longword; vg: PVisualGear; begin if (Gear^.Kind = gtHedgehog) and (Damage>=1) then begin + uStats.HedgehogDamaged(Gear, Attacker); HHHurt(Gear^.Hedgehog, Source); AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color); tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage)); @@ -1133,12 +1133,7 @@ end end; -procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); -begin -doMakeExplosion(X, Y, Radius, Mask, $FFFFFFFF); -end; - -procedure doMakeExplosion(X, Y, Radius: LongInt; Mask, Tint: LongWord); +procedure doMakeExplosion(X, Y, Radius: LongInt; GearCaused: PGear; Mask: Longword; const Tint: LongWord); var Gear: PGear; dmg, dmgRadius, dmgBase: LongInt; fX, fY: hwFloat; @@ -1192,7 +1187,7 @@ if (Mask and EXPLNoDamage) = 0 then begin if not Gear^.Invulnerable then - ApplyDamage(Gear, dmg, dsExplosion) + ApplyDamage(Gear, GearCaused, dmg, dsExplosion) else Gear^.State:= Gear^.State or gstWinner; end; @@ -1258,7 +1253,7 @@ gtTarget, gtExplosives: begin if (not t^.Invulnerable) then - ApplyDamage(t, dmg, dsBullet) + ApplyDamage(t, Gear, dmg, dsBullet) else Gear^.State:= Gear^.State or gstWinner; @@ -1305,13 +1300,13 @@ tmpDmg:= ModifyDamage(Damage, Gear); if (Gear^.State and gstNoDamage) = 0 then begin - + if (Ammo^.Kind = gtDEagleShot) or (Ammo^.Kind = gtSniperRifleShot) then begin VGear := AddVisualGear(hwround(Ammo^.X), hwround(Ammo^.Y), vgtBulletHit); if VGear <> nil then VGear^.Angle := DxDy2Angle(-Ammo^.dX, Ammo^.dY); end; - + if (Gear^.Kind = gtHedgehog) and (Ammo^.State and gsttmpFlag <> 0) and (Ammo^.Kind = gtShover) then Gear^.FlightTime:= 1; case Gear^.Kind of @@ -1323,10 +1318,10 @@ gtExplosives: begin if (Ammo^.Kind = gtDrill) then begin Ammo^.Timer:= 0; exit; end; if (not Gear^.Invulnerable) then - ApplyDamage(Gear, tmpDmg, dsShove) + ApplyDamage(Gear, Ammo, tmpDmg, dsShove) else Gear^.State:= Gear^.State or gstWinner; - if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then ApplyDamage(Gear, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch + if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then ApplyDamage(Gear, Ammo, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch DeleteCI(Gear); if (Gear^.Kind = gtHedgehog) and Gear^.Hedgehog^.King then @@ -1517,7 +1512,6 @@ gear^.dX := _0; gear^.dY := _0; gear^.State := gstWait; - uStats.HedgehogDamaged(gear); gear^.Damage := 0; gear^.Health := gear^.Hedgehog^.InitialHealth; gear^.Hedgehog^.Effects[hePoisoned] := false;