--- a/hedgewars/GSHandlers.inc Mon Mar 28 19:31:47 2011 +0200
+++ b/hedgewars/GSHandlers.inc Mon Mar 28 21:44:39 2011 +0400
@@ -219,7 +219,10 @@
//else
// PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack);
- ApplyDamage(Gear, CurrentHedgehog, dmg, dsFall);
+ if Gear^.LastDamage <> nil then
+ ApplyDamage(Gear, Gear^.LastDamage, dmg, dsFall)
+ else
+ ApplyDamage(Gear, CurrentHedgehog, dmg, dsFall);
end
end;
--- a/hedgewars/uGears.pas Mon Mar 28 19:31:47 2011 +0200
+++ b/hedgewars/uGears.pas Mon Mar 28 21:44:39 2011 +0400
@@ -578,7 +578,10 @@
// should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog
// same stand for CheckHHDamage
- uStats.HedgehogDamaged(Gear, CurrentHedgehog)
+ if (Gear^.LastDamage <> nil) then
+ uStats.HedgehogDamaged(Gear, Gear^.LastDamage)
+ else
+ uStats.HedgehogDamaged(Gear, CurrentHedgehog)
end;
team:= Gear^.Hedgehog^.Team;
@@ -1019,6 +1022,8 @@
if (Gear^.Kind = gtHedgehog) then
begin
+ Gear^.LastDamage := AttackerHog;
+
Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
uStats.HedgehogDamaged(Gear, AttackerHog);
HHHurt(Gear^.Hedgehog, Source);
@@ -1053,6 +1058,7 @@
not CurrentHedgehog^.Gear^.Invulnerable then
begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
+ CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
end;
end;
--- a/hedgewars/uTeams.pas Mon Mar 28 19:31:47 2011 +0200
+++ b/hedgewars/uTeams.pas Mon Mar 28 21:44:39 2011 +0400
@@ -211,7 +211,8 @@
begin
Z:= cCurrHHZ;
State:= gstHHDriven;
- Active:= true
+ Active:= true;
+ LastDamage:= nil
end;
RemoveGearFromList(Gear);
InsertGearToList(Gear);
--- a/hedgewars/uTypes.pas Mon Mar 28 19:31:47 2011 +0200
+++ b/hedgewars/uTypes.pas Mon Mar 28 21:44:39 2011 +0400
@@ -235,7 +235,8 @@
ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
nImpactSounds: Word; // count of ImpactSounds
SoundChannel: LongInt;
- PortalCounter: LongWord // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion.
+ PortalCounter: LongWord; // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion.
+ LastDamage: PHedgehog;
end;
TPGearArray = Array of PGear;