Revert 3ec95dc2b249 - causes hogs to be trapped in the teleport animation. bad breakage
--- a/hedgewars/HHHandlers.inc Sat Sep 17 10:22:35 2011 -0400
+++ b/hedgewars/HHHandlers.inc Sat Sep 17 13:40:54 2011 -0400
@@ -1016,7 +1016,7 @@
////////////////////////////////////////////////////////////////////////////////
procedure doStepHedgehogFree(Gear: PGear);
-var prevState: Longword;
+var prevState, i: Longword;
begin
prevState:= Gear^.State;
@@ -1038,7 +1038,7 @@
PrvInactive:= false;
AllInactive:= false;
- if (Gear^.State and gstHHGone) = 0 then
+ if not Gear^.Hedgehog^.Team^.hasGone then
begin
Gear^.Hedgehog^.Effects[hePoisoned] := false;
if Gear^.Hedgehog^.Effects[heResurrectable] then begin
@@ -1052,8 +1052,21 @@
end
else
begin
+ Gear^.State:= Gear^.State or gstHHGone;
Gear^.doStep:= @doStepHedgehogGone;
+ with Gear^.Hedgehog^.Team^ do
+ for i:= 0 to cMaxHHIndex do
+ if Hedgehogs[i].GearHidden <> nil then
+ begin
+ RestoreHog(@Hedgehogs[i]);
+ if Hedgehogs[i].Gear <> nil then
+ begin
+ Hedgehogs[i].Gear^.State:= Gear^.State or gstHHGone;
+ Hedgehogs[i].Gear^.doStep:= @doStepHedgehogGone
+ end
+ end;
+
// Gone message
AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
end
@@ -1094,9 +1107,7 @@
else
begin
with Gear^.Hedgehog^ do
- if Team^.hasGone then
- TeamGoneEffect(Team^)
- else
- doStepHedgehogDriven(Gear)
+ if Team^.hasGone then TeamGoneEffect(Team^);
+ doStepHedgehogDriven(Gear)
end;
end;
--- a/hedgewars/uTeams.pas Sat Sep 17 10:22:35 2011 -0400
+++ b/hedgewars/uTeams.pas Sat Sep 17 13:40:54 2011 -0400
@@ -427,17 +427,11 @@
with Team do
for i:= 0 to cMaxHHIndex do
with Hedgehogs[i] do
- begin
- if Hedgehogs[i].GearHidden <> nil then
- RestoreHog(@Hedgehogs[i]);
-
if Gear <> nil then
begin
Gear^.Invulnerable:= false;
- Gear^.Damage:= Gear^.Health;
- Gear^.State:= Gear^.State or gstHHGone
+ Gear^.Damage:= Gear^.Health
end
- end
end;
procedure chAddHH(var id: shortstring);